Worked like a charm, thanks.
It was interesting to see the method for adding function calls into
the system too.
Cheers,
Gary
On 6 Aug, 15:42, Michael Scherer misc0...@googlemail.com wrote:
I wrote a function that can be used instead of
tiddler.tiddlerisActive().
Create a new tiddler named 'TicklerWillBeActiveWithin' with the two
tags 'systemConfig' and 'exludeSearch' (all without quotes, of
course). Copy all the text between the BEGIN and END lines into the
content field:
//BEGIN
merge(Tiddler.prototype,{
ticklerWillBeActiveWithin: function(numDays) {
// Ignore ticklers without date
if (!this.fields.mgtd_date)
return false;
var nowTime = new Date();
// Respect user settings (see ticker.isActive())
var defaultHourToActivate = 5; // fixme put elsewhere
var hourToActivate =
config.mGTD.getOptTxt('tickleractivatehour') ||
defaultHourToActivate;
if (nowTime.getHours() hourToActivate) {
// Too early in the morning, go back one day.
nowTime.setDate(nowTime.getDate() - 1);
}
// Start tomorrow
startTime = new Date(nowTime.getFullYear(),
nowTime.getMonth(),
nowTime.getDate() + 1);
// End in numDays days
endTime = new Date(nowTime.getFullYear(), nowTime.getMonth(),
nowTime.getDate() + 1 + numDays);
return (startTime.convertToMMDDHHMM() =
this.fields.mgtd_date
endTime.convertToMMDDHHMM() = this.fields.mgtd_date);
}
});
//END
Save your wiki and reload it. Now, you can use the function in your
mgtdList as follows: (Note the changed 'where' clause)
//BEGIN
mgtdList title:'Upcoming Ticklers'
startTag:Tickler
tags:'!Actioned'
view:Tickler
mode:global
newButtonTags:'Tickler Once'
where:'tiddler.ticklerWillBeActiveWithin(7)'
sort:'tickleDate'
ignoreRealm:
{{config.mGTD.getOptChk('AlertsIgnoreRealm')?'yes':''}}
//END
This will show all future ticklers for the next 7 days. Of course, by
replacing the '7' in the list's where clause with another number, you
can define any other period.
HTH,
Michael
--
You received this message because you are subscribed to the Google Groups GTD
TiddlyWiki group.
To post to this group, send email to gtd-tiddlyw...@googlegroups.com.
To unsubscribe from this group, send email to
gtd-tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/gtd-tiddlywiki?hl=en.