An ASPAjaxWikiBlog Thingy

March 15, 2006

Save Tiddler to TagMe

Filed under: Planned Features, Ideas

OK, saving a single tiddler to TagMe was relatively trivial. Hijacking the TiddlyWiki.prototype.saveTiddler() function and adding the following at the end.

var TiddlerObj = {subject:tiddler.title, body:tiddler.text, wikiword:tiddler.title, id:title, tags:tiddler.tags}
ajax.PostObject("tagme.asp", TiddlerObj, "POST", "action=save")

The action "save" is a new action in tagme.asp which basically inserts or updates depending on the existance of the tiddler. It also obtains the id from the wikiword in the parameter id.

ajax.PostObject is also a new function which simply serializes a simple object as a series of parameters basically resulting in the following post data:
subject=MyTiddler&body=Hello+World&wikiword=MyTiddler&id=MyOldTiddlerTitle&tags=Tag1,Tag+2

Actually in order to get the comma seperated tags we must pass the following as the tags attribute of TiddlerObj:

tags:tiddler.tags.join(’,').replace(/[\[\]]/, "") 

This ensures the TW-style tags (Tag1 [[Tag 2]]) get converted to our CSV Tags.

No comments so far, be the first »

TrackBack: http://ajaxwiki.blogsome.com/2006/03/15/save-tiddler-to-tagme/trackback/

RSS Comments Feed

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed.


Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com