Hi Arc,

The entire magic for getting the right tiddlers is in this line...

tids = store.getTaggedTiddlers(tagname);

This tells the function getTiddlersPerTagAsHtmlLis to fetch the desired 
list as those tagged with a certain tagname.
Here is where you hook your custom function that likewise returns tiddler 
objects and perhaps could be...

//a new function of the TiddlyWiki class, i.e. the 'store' object
TiddlyWiki.prototype.parseBracketedList = function (title, field){
    //1. get the tiddler for the given title
    //2. retrieve the field value using store.getValue(title, fieldname)
    //3. turn the string value into an array using 
String.readBracketedList()
    //4. get tiddlers for each array entry using store.fetchTiddler(title)
    //5. add the tiddler to the return array
    //6. return what before was a string containing tiddler references as a 
list of tiddler objects
}

Then you could have a global variable for the plugin, like...
config.macros.treeview2.field = 'children';

If that is defined, it indicates that the user wants to rather use this 
field to define the relationship rather than tags, so 
getTiddlersPerTagAsHtmlList will eventually need some inner conditional 
like...
var field = config.macros.treeview2.field;
var tids = field ? parseBracketedList(tagname, field) : 
store.getTaggedTiddlers(tagname);

There may be additional places where you would have to use the field values 
instead of the tagnames as you likely also want those field values to be 
(easily) editable (add new ones, delete old ones) and also the sequence of 
elements in the bracketed list... much like you wanting to sort the tags of 
a tiddler.

In other words, adding a subitem to a 'folder' no longer happens by giving 
the item the folder as a tag, but instead by adding it to the children field 
at the corresponding parent.

An alternative method for modeling the relationship would be to use a 
parentfield for each tiddler, instead of using a 
children field. From a sorting point of view, this seems to make things 
harder though. Additionally, if one wanted the same capabilities 
of polymorphism (the ability to have multiple parents) as a children field 
it should be a parent*s* field ...regardless of whether biology tells us 
that humanoids may only have exactly two parents, one male and the other 
female.

Cheers, Tobias.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to