diff --git a/core/images/timestamp-off.tid b/core/images/timestamp-off.tid new file mode 100644 index 000000000..62103ec27 --- /dev/null +++ b/core/images/timestamp-off.tid @@ -0,0 +1,12 @@ +title: $:/core/images/timestamp-off +tags: $:/tags/Image + + + + + + + + + + \ No newline at end of file diff --git a/core/images/timestamp-on.tid b/core/images/timestamp-on.tid new file mode 100644 index 000000000..450fb3636 --- /dev/null +++ b/core/images/timestamp-on.tid @@ -0,0 +1,12 @@ +title: $:/core/images/timestamp-on +tags: $:/tags/Image + + + + + + + + + + \ No newline at end of file diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 412e35f8f..3a8f21969 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -92,6 +92,12 @@ ShowSideBar/Caption: show sidebar ShowSideBar/Hint: Show sidebar TagManager/Caption: tag manager TagManager/Hint: Open tag manager +Timestamp/Caption: timestamps +Timestamp/Hint: Choose whether modifications update timestamps +Timestamp/On/Caption: timestamps are on +Timestamp/On/Hint: Update timestamps when tiddlers are modified +Timestamp/Off/Caption: timestamps are off +Timestamp/Off/Hint: Don't update timestamps when tiddlers are modified Theme/Caption: theme Theme/Hint: Choose the display theme Bold/Caption: bold diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 63e31303c..9eed1b5f1 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -24,7 +24,8 @@ Adds the following properties to the wiki object: var widget = require("$:/core/modules/widgets/widget.js"); -var USER_NAME_TITLE = "$:/status/UserName"; +var USER_NAME_TITLE = "$:/status/UserName", + TIMESTAMP_DISABLE_TITLE = "$:/config/TimestampDisable"; /* Get the value of a text reference. Text references can have any of these forms: @@ -231,27 +232,35 @@ exports.importTiddler = function(tiddler) { Return a hashmap of the fields that should be set when a tiddler is created */ exports.getCreationFields = function() { - var fields = { - created: new Date() - }, - creator = this.getTiddlerText(USER_NAME_TITLE); - if(creator) { - fields.creator = creator; + if(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,"").toLowerCase() !== "yes") { + var fields = { + created: new Date() + }, + creator = this.getTiddlerText(USER_NAME_TITLE); + if(creator) { + fields.creator = creator; + } + return fields; + } else { + return {}; } - return fields; }; /* Return a hashmap of the fields that should be set when a tiddler is modified */ exports.getModificationFields = function() { - var fields = Object.create(null), - modifier = this.getTiddlerText(USER_NAME_TITLE); - fields.modified = new Date(); - if(modifier) { - fields.modifier = modifier; + if(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,"").toLowerCase() !== "yes") { + var fields = Object.create(null), + modifier = this.getTiddlerText(USER_NAME_TITLE); + fields.modified = new Date(); + if(modifier) { + fields.modifier = modifier; + } + return fields; + } else { + return {}; } - return fields; }; /* diff --git a/core/ui/PageControls/timestamp.tid b/core/ui/PageControls/timestamp.tid new file mode 100644 index 000000000..28cfbd74e --- /dev/null +++ b/core/ui/PageControls/timestamp.tid @@ -0,0 +1,27 @@ +title: $:/core/ui/Buttons/timestamp +tags: $:/tags/PageControls +caption: {{$:/core/images/timestamp-on}} {{$:/language/Buttons/Timestamp/Caption}} +description: {{$:/language/Buttons/Timestamp/Hint}} + +<$reveal type="nomatch" state="$:/config/TimestampDisable" text="yes"> +<$button tooltip={{$:/language/Buttons/Timestamp/On/Hint}} aria-label={{$:/language/Buttons/Timestamp/On/Caption}} class=<>> +<$action-setfield $tiddler="$:/config/TimestampDisable" $value="yes"/> +<$list filter="[prefix[yes]]"> +{{$:/core/images/timestamp-on}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/Timestamp/On/Caption}}/> + + + +<$reveal type="match" state="$:/config/TimestampDisable" text="yes"> +<$button tooltip={{$:/language/Buttons/Timestamp/Off/Hint}} aria-label={{$:/language/Buttons/Timestamp/Off/Caption}} class=<>> +<$action-setfield $tiddler="$:/config/TimestampDisable" $value="no"/> +<$list filter="[prefix[yes]]"> +{{$:/core/images/timestamp-off}} + +<$list filter="[prefix[yes]]"> +<$text text={{$:/language/Buttons/Timestamp/Off/Caption}}/> + + + \ No newline at end of file diff --git a/core/wiki/config/PageControlButtons.multids b/core/wiki/config/PageControlButtons.multids index 9086e8f18..7ad91db29 100644 --- a/core/wiki/config/PageControlButtons.multids +++ b/core/wiki/config/PageControlButtons.multids @@ -18,5 +18,6 @@ core/ui/Buttons/palette: hide core/ui/Buttons/permaview: hide core/ui/Buttons/print: hide core/ui/Buttons/storyview: hide +core/ui/Buttons/timestamp: hide core/ui/Buttons/theme: hide core/ui/Buttons/unfold-all: hide