I would like to be able create a sort of treeview diagram like the
RelatedTiddlersPlugin does it
(http://www.tiddlytools.com/#RelatedTiddlersPlugin), but based on
costum fields instead of internal links.
I cannot, however, get RelatedTiddlersPlugin to do it or find a plugin
that does it for me.
I have therefore tried to create my own solution
cf. http://dl.dropbox.com/u/615478/empty.html
But it is not going very well.
I would therefore very much appreciate a little help or directions to
a plugin that can create a treeview diagram based on costum fields (I
search much of this forum for one cf.
http://tinyurl.com/qahkgm)
I found AdvancedFilterTiddlersPlugin [2] which has a filter for
fields. But I didn't test it until now.
If I use the macro
<<list filter [field[Milkyway]]>>
I get:
* Alpha Centauri
* The Solar System
But if I use
<<list filter [field[Alpha Centauri]]>>
I get Error: too much recursion
Earth and Atlantis work again. May be it doesn't want the spaces
inside the field value.
Because fields are not that easy to examine/changing like tags I
stopped. But may be this is a direction to look at.
regards Mario
[1] http://twt-treeview.tiddlyspot.com/
[2] http://www.jonrobson.me.uk/development/AdvancedFilterTiddlersPlugin/index.html
PS: Only for my interest: Why are you using the invisible fields?
On Jan 2, 5:33 pm, Jakob Graulund Jørgensen <jakobgraul...@gmail.com>
wrote:
> Hi
>
> I would like to be able create a sort of treeview diagram like the
> RelatedTiddlersPlugin does it
> (http://www.tiddlytools.com/#RelatedTiddlersPlugin), but based on
> costum fields instead of internal links.
>
> I cannot, however, get RelatedTiddlersPlugin to do it or find a plugin
> that does it for me.
>
> I have therefore tried to create my own solution
>
> cf.http://dl.dropbox.com/u/615478/empty.html
> <<list filter [field[Alpha Centauri]]>>
> I get Error: too much recursion
>
> Earth and Atlantis work again. May be it doesn't want the spaces
> inside the field value.
Does <<list filter "[field[Alpha Centauri]]">> work?
regards Måns Mårtensson
RelatedTiddlersPlugin documentation describes how to use your own
'callback function' to create a tree display using data from any
tiddler field you want. In order to define and invoke your callback,
you need to embed a small bit of script into a tiddler, using
http://www.TiddlyTools.com/#InlineJavascriptPlugin
(which adds support for <script>...</script> handling embedded in TW
syntax)
First, you have to define a function that, given a tiddler object,
returns an array of tiddler titles that are 'related' to it. For your
purposes, it appears that you are using two custom fields, "field" and
"field2", each containing the name of a single 'related' tiddler (or
possibly a blank/undefined value?). Thus, your callback function
should simply construct and return an array of the two values in those
fields.
Then, to generate the output, you invoke the 'getTree(...)' function
provided by RelatedTiddlersPlugin. This function takes three
arguments: the title of a tiddler to start from (the 'root' of the
tree), a space-separated list of tiddler to exclude from the tree (can
be blank, i.e, ""), and a reference to the custom callback function
that you've defined.
The getTree() function returns a text string, containing fully-
formatted wiki-syntax output for displaying the tree... which can be
rendered simply by returning it as the result of the inline script
itself.
Here's the basic script (untested):
<script>
window.myCallback=function(tiddler) {
var list=[];
if (tiddler.fields.field) list.push(tiddler.fields.field)
if (tiddler.fields.field2) list.push(tiddler.fields.field2)
return list;
}
var start="SomeTiddler";
var exclude="NotThisOne [[or this one with spaces]]";
var callback=window.myCallback;
return config.macros.relatedTiddlers.getTree(start,exclude,callback);
</script>
enjoy,
-e
cf. http://dl.dropbox.com/u/615478/empty2.html
thx to Måns I got the AdvancedFilterTiddlersPlugin to work but I don't
really understand how it can be used to save time creating a tree-
structur, you have to input almost just as much code as when you just
type in the tree manually.
I got Eric's RelatedTiddlersPlugin to almost create the tree that I
want, but there are a few important problems with this solution that I
cant quite work out cf http://dl.dropbox.com/u/615478/empty2.html#[[Test%202]]
regards
jgj
On Jan 2, 11:48 pm, Måns <humam...@gmail.com> wrote:
> Does <<list filter "[field[Alpha Centauri]]">> work?
Yes it does :)
And Eric did the whole trick.
regards.
cmari
That is a pretty neat solution.
I am using custom fields because I was hoping to implement the answer
to this thread in a larger TW where I am already using tags pretty
extensively, but if this is the only thing that can be made to work, I
guess I will empty out the other tags.
I am using firefox myself (must of the time) but it would be nice if
the solution would also work in IE, do you have any idea why it
doesn't? And what one might do to change that?
On Jan 4, 2:36 am, Jakob Graulund Jørgensen <jakobgraul...@gmail.com>
wrote:
AdvancedTiddlerFiltersPlugin resolves (finally!) an annoyance with not
being able to filter items by creator et al, but I would *like* to be
able to stick it in the stylesheet view template and have it pull in
the information from the title of the tiddler.
<<list filter [modifier[ExplicitTitleOfTiddler]]>> works, but what I
would *like* to do it is put in something like
<div macro="showWhen tiddler.tags.contains('author')">
<div class="authorList" macro="list.filter.modifier.thisTiddler"></
div>
</div>
but my knowledge of getting macros to work inside stylesheets has
never quite passed the "Wave a dead chicken over it" degree of
competence.
This looks feasible though - is the syntax to shift from macro to
stylesheet syntax simple enough to translate this?
Thanks - Jonnan
If it doesn't work as written - try the tiddler macro instead:
<div macro="tiddler TiddlerName"></div>
and put your advanced filter in TiddlerName...
regards Måns Mårtensson
On Jan 6, 7:05 pm, Jonnan <jonnan.w...@gmail.com> wrote:
> Quick Question ===snip
> <div macro="showWhen tiddler.tags.contains('author')">
> <div class="authorList" macro="list.filter.modifier.thisTiddler"></
> div>
> </div>
<div macro="showWhen tiddler.tags.contains('author')">
<div class="authorList" macro="list filter {{'[modifier
['+this.tiddler.modifier+']]'}}"></div>
</div>
This is my interpretation :)
regards Mario
['+this.tiddler... belongs to the line above.
regards Mario
And 'til I do, another bit of voodoo code for me to wave like a dead
chicken - <G>! I likes me dead chickens to wave!
Thanks again
As for the tree being "upside down", shouldn't your root rather be
something like "the universe"? Shouldn't your relations or "pointers"
therefore better be the other way around?
So instead of....
child->"parent"
where parent is the field-value at your child tiddler, you' rather
have:
parent->"[[child1]] [[child2]] [[child3]]"
where parent is the tiddler and that which is related through the
field-value would be the child-tiddlers. As in the example above,
wouldn't it make more sense if you'd only have one field containing
all those "related" tiddlers as a "bracketed list" ...similar to how
tags are managed?
At least, that way earth would point to two child elements... northern
and southern hemisphere + you'd have your tree the right way around.
As for numbering the tree, I fear, that isn't quite what
RelatedTiddlersPlugin was designed for, since the order by which it
builds the tree is somewhat arbitrary ...depending on the order of how
you gather "related tiddlers" and how the tree is recusively being
built.
Tobias.
I know the way I have done it may seem a little counter-intuitiv. The
reason I cant do it the other way around is that in the larger TW
where I am trying to implement the solution I only "know" each
tiddler's parent tiddler(s) and I can't think of an easy way to
reverse this (ei I don't what to sort through all tiddlers to make
sure I've caught all of a tiddler's childeren)
Allthough you could probably do what you are suggesting using the code
below. The lack of numbering is however kind of a dealbreaker because
I need the trees created to be very precise as to what tiddler is own
by what.
----
/%
!out
$1
!end
%/<<tiddler ShowList##out with: {{
var out=[];
var target="$1";
var tids=store.getTiddlers();
for (var i=0;i<tids.length;i++) {
var a=tids[i].fields.field;
var b=tids[i].fields.field2;
if (a&& a.contains(target))
out.push("#[["+tids[i].title+"]]");
if (b && b.contains(target))
out.push("#[["+tids[i].title+"]]");
}
out.join("\n");}}>>
---
I hope this made sense. As I am writing this it is kind of late in
Denmark.
regards