Hi Måns,
1) As for saving changes on tiddlyspace, I believe you have to
properly initialize certain server fields like this...
replace:
t.fields,
with:
merge(t.fields, config.defaultCustomFields),
That will read the default fields required for tiddlyspace from the
config and merge it with any existing fields, thus allowing for the
tiddler to save correctly.
2) Would your prompts be for each tiddler or one for all tiddlers?
Depending on that you simply have to put a prompt inside or outside
the for loop and assign its return value to the corresponding
variable, e.g.
var tgs=prompt("Please enter any tags.", "").readBracketedList();
With readBracketedList you can specify any of...
tagA "tag B" [[tag cdef]]
...in the prompt and all will be added correctly. You might want to
merge any tags entered into the prompt with the existing ones,
therefore replace:
t.tags,
with...
merge(t.tags,tgs),
So here's the whole deal...
<script label="Replace Text Now!">
var t,i,
tids=store.getTaggedTiddlers('UPDATE'),
tpl=prompt('Enter template name...',''),
tgs=prompt('Enter tags...','');
tgs=tgs?tgs.readBracketedList():[];
tpl=store.getTiddlerText(tpl)||'',
if(!confirm("Really replace the contents of:\n"+
tids.map(function(t){return t.title;})))return;
for(i=0;i<tids.length;i++){
t=tids[i];
store.saveTiddler(
t.title,
t.title,
tpl,
config.options.txtUserName,
new Date(),
merge(t.tags,tgs),
merge(t.fields, config.defaultCustomFields),
t.created
);
};
</script>
Give it a try...
Cheers, Tobias.
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.