diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index f616a42bc..6c8d989fa 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -56,12 +56,11 @@ Saving/TiddlySpot/Backups: Backups Saving/TiddlySpot/Description: These settings are only used when saving to http://tiddlyspot.com or a compatible remote server Saving/TiddlySpot/Filename: Upload Filename Saving/TiddlySpot/Heading: ~TiddlySpot -Saving/TiddlySpot/Hint: //The server URL defaults to `http://.tiddlyspot.com/store.cgi` and can be changed to use a custom server address// +Saving/TiddlySpot/Hint: //The server URL defaults to `http://.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://me.com/store.php`.// Saving/TiddlySpot/Password: Password Saving/TiddlySpot/ServerURL: Server URL Saving/TiddlySpot/UploadDir: Upload Directory Saving/TiddlySpot/UserName: Wiki Name -Saving/TiddlySpot/RelativeURL: relative to ''Server URL'' Settings/AutoSave/Caption: Autosave Settings/AutoSave/Disabled/Description: Do not save changes automatically Settings/AutoSave/Enabled/Description: Save changes automatically diff --git a/core/modules/macros/serverpath.js b/core/modules/macros/serverpath.js new file mode 100644 index 000000000..7fe47a2c1 --- /dev/null +++ b/core/modules/macros/serverpath.js @@ -0,0 +1,41 @@ +/*\ +title: $:/core/modules/macros/serverpath.js +type: application/javascript +module-type: macro + +Outputs a server-path based on parameters, +by default appends a relative path to an absolute one, +e.g. constructs path to TiddlySpot backup directory + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports.name = "serverpath"; + +exports.params = [ + {name: "source"}, + {name: "target"}, + {name: "mode"} +]; + +/* +Run the macro +*/ +exports.run = function(source, target, mode) { + var result = target; + mode = mode || ""; + switch (mode){ + case "": + case "append-relative": + target = ("." == target || "./" == target) ? "" : target; + result = source.substr(0,1+source.lastIndexOf('/')) + target; + break; + } + return result; +}; + +})(); diff --git a/core/ui/ControlPanel/Saving.tid b/core/ui/ControlPanel/Saving.tid index f1d31f18e..65b3b687e 100644 --- a/core/ui/ControlPanel/Saving.tid +++ b/core/ui/ControlPanel/Saving.tid @@ -10,10 +10,10 @@ http://$(userName)$.tiddlyspot.com/backup/ <$reveal type="nomatch" state="$:/UploadName" text=""> <$set name="userName" value={{$:/UploadName}}> <$reveal type="match" state="$:/UploadURL" text=""> ->><$macrocall $name="backupURL" $type="text/plain" $output="text/plain"/> +<> <$reveal type="nomatch" state="$:/UploadURL" text=""> -<> +<$macrocall $name=serverpath source={{$:/UploadURL}} target={{$:/UploadBackupDir}}>> @@ -33,5 +33,4 @@ http://$(userName)$.tiddlyspot.com/backup/ |<> |<$edit-text tiddler="$:/UploadDir" default="." tag="input"/> | |<> |<$edit-text tiddler="$:/UploadBackupDir" default="." tag="input"/> | -<> - +<> \ No newline at end of file