At the minute I'm using the timeline macro in a tiddler to give me a
quick history of when things have been created but I'd also like
details of when they were modified and by which user, if that's
possible.
<script>
var out=[]; var who='';
var tids=store.getTiddlers('modifier');
for (i=0; i<tids.length; i++) { var t=tids[i];
if (who!=t.modifier) {
who=t.modifier;
out.push('by '+who+':');
}
out.push('*[['+t.title+']]');
}
return out.join('\n');
</script>
Regards Måns Mårtensson
On 6 Nov., 16:13, Gibson <kentucky.gib...@googlemail.com> wrote:
> At the minute I'm using the timeline macro in a tiddler to give me a
> quick history of when things have been created but I'd also like
> details of when they were modified and by which user, if that's
> possible.
My last submission ;-) Next....
-------------------------------------
<script>
var out=['| !Script by Shulman, Mårtensson & Gray |\>|']; var
who='';
var tids=store.getTiddlers('modifier');
for (i=0; i<tids.length; i++) { var t=tids[i];
if (who!=t.modifier) {
who=t.modifier;
out.push('| modified by """'+who+'""": |
\>|');
}
out.push('|[['+t.title+']]|'+t.modified.formatString
('YYYY.0MM.0DD-DDD 0hh:0mm:0ss')+" |"+'');
}
return out.join('\n');
</script>
---------------------------------------
Morris
On Nov 10, 8:01 pm, Måns <humam...@gmail.com> wrote:
On 10 Nov., 14:07, Morris Gray <msg...@symbex.net.au> wrote:
> My last submission ;-) Next....
One question though - Is it necessary to change it into a fET to make
use of TablesortingPlugin ( http://tw.lewcid.org/#TableSortingPlugin )
or is it possible to make the table sortable within the script?
With some help from ELS I have replaced all of my fET calls to inline
JS :)
I think you are missing the header (hdr)
i.e.
var hdr="|sortable|k\n| !Brand | !Name | !Wrapper | !Recommended By | !
Purchased ||h"
out.push(hdr);
A Working Example:
<script>
var out=[];
var fmt='| %0 | %1 | %2 | %3 | %4 | {{fine{[[%5|%5]]}}} |';
var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && !
Trash","created");
var hdr="|sortable|k\n| !Brand | !Name | !Wrapper | !Recommended By
| !Purchased ||h"
out.push(hdr);
if (!tids.length) out=["No Cigars found"];
for (var i=0; i<tids.length; i++) {
var val1=tids[i].title;
if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated")
continue;
if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
var val2=store.getTiddlerSlice(val1,'Brand')
var val3=store.getTiddlerSlice(val1,'Name')
var val4=store.getTiddlerSlice(val1,'Wrapper')
var val5=store.getTiddlerSlice(val1,'RecommendedBy')
var val6=store.getTiddlerSlice(val1,'Purchased')
out.push(fmt.format([val2,val3,val4,val5,val6,val1]));
}
return out.join('\n');
</script>
On Nov 10, 3:19 pm, Måns <humam...@gmail.com> wrote:
> On 10 Nov., 14:07, Morris Gray <msg...@symbex.net.au> wrote:
> > My last submission ;-) Next....
> One question though - Is it necessary to change it into a fET to make
> use of TablesortingPlugin (http://tw.lewcid.org/#TableSortingPlugin)
> or is it possible to make the table sortable within the script?
I understand that I should write sth like (I know this is wrong
- ....:
var out=[];
var fmt='| %0 | %1 | %2 | %3 |';
for (var i=0; i<tids.length; i++) {
var val1=tids[i].title; if (2!=t.modifier)
var val2=t.modifier;
var val3=t.modified.formatString ('YYYY.0MM.0DD-DDD 0hh:0mm:0ss')+"
|"+'');
var hdr="|sortable|k\n| !Tiddler | !Modifier | !Modified|h"
out.push(hdr);
I know next script isn't right - but it is nevertheless usefull even
if made wrong - :
(It sorts Modifier and TiddlerTitles in the same column)
I think: If I could separate tiddlertitle t.modifier and t.modified
(in three parts/columns instead of two )- Then I would have a correct
sortable table
<script>
var out= ['| Script by Shulman, Mårtensson & Gray|c'];
var hdr="|sortable|k\n| !Tiddler&Modifier | !Modified |h"
out.push(hdr);
var who='';
var tids=store.getTiddlers('modifier');
for (i=0; i<tids.length; i++) { var t=tids[i];
if (who!=t.modifier) {
who=t.modifier;
out.push('| modified by @@"""'+who+'""":@@ |
\>|');
}
out.push('|[['+t.title+']]|'+t.modified.formatString
('YYYY.0MM.0DD-DDD 0hh:0mm:0ss')+" |"+'');
}
return out.join('\n');
</script>
Can you help me out?
YS Måns Mårtensson
On 10 Nov., 22:44, Mike <eris...@gmail.com> wrote:
> With some help from ELS I have replaced all of my fET calls to inline
> JS :)
> I think you are missing the header (hdr)
> i.e.
> var hdr="|sortable|k\n| !Brand | !Name | !Wrapper | !Recommended By | !
> Purchased ||h"
> out.push(hdr);
> A Working Example:
> <script>
> var out=[];
> var fmt='| %0 | %1 | %2 | %3 | %4 | {{fine{[[%5|%5]]}}} |';
> var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && !
> Trash","created");
> var hdr="|sortable|k\n| !Brand | !Name | !Wrapper | !Recommended By
> | !Purchased ||h"
> out.push(hdr);
> if (!tids.length) out=["No Cigars found"];
> for (var i=0; i<tids.length; i++) {
> var val1=tids[i].title;
> if (store.getTiddlerSlice(val1,"PersonalRank") != "Not Rated")
> continue;
> if (store.getTiddlerSlice(val1,"Purchased") != "Yes") continue;
> var val2=store.getTiddlerSlice(val1,'Brand')
> var val3=store.getTiddlerSlice(val1,'Name')
> var val4=store.getTiddlerSlice(val1,'Wrapper')
> var val5=store.getTiddlerSlice(val1,'RecommendedBy')
> var val6=store.getTiddlerSlice(val1,'Purchased')
> out.push(fmt.format([val2,val3,val4,val5,val6,val1]));
> }
> return out.join('\n');
> </script>
> On Nov 10, 3:19 pm, Måns <humam...@gmail.com> wrote:
> > Very neat Morris
> > On 10 Nov., 14:07, Morris Gray <msg...@symbex.net.au> wrote:
> > > My last submission ;-) Next....
> > One question though - Is it necessary to change it into a fET to make
> > use of TablesortingPlugin (http://tw.lewcid.org/#TableSortingPlugin)
> > or is it possible to make the table sortable within the script?