Well, supposedly it couldn't be done. But I had a lot of fun
programming a bit and tweaking things here and there. If you want to
try this one, make a backup of your data first.
Step one: Add the necessary plugin.
Import ListBoxPlugin from tiddlytools.com. Save and reload mGTD.
Step two: Add the necessary code.
Edit the plugin MgtdList. Replace the original code, below...
// -------- Original code --------
merge(Tiddler.prototype,{
// doesn't belong here..
ticklerIsActive: function() {
var defaultHourToActivate = 5; // fixme put elsewhere
var hourToActivate =
config.mGTD.getOptTxt('tickleractivatehour') ||
defaultHourToActivate;
var nowTime = new Date();
nowTime.setHours(nowTime.getHours() - hourToActivate); // i'm
confused because of UTC versus local. I think mgtd_date is UTC. But
has hh:mm:ss is 00:00:00 in local time
return (this.fields.mgtd_date &&
nowTime.convertToYYYYMMDDHHMM() >=
this.fields.mgtd_date );
}
});
// ---------------- Replace with the following -------------------
merge(Tiddler.prototype,{
// doesn't belong here..
ticklerIsActive: function() {
var defaultHourToActivate = 5; // fixme put elsewhere
if (this.fields.mgtd_date) {
var hourToActivate =
config.mGTD.getOptTxt('tickleractivatehour')
|| defaultHourToActivate;
var nowTime = new Date();
var ticklerTime = Date.convertFromYYYYMMDDHHMM
(this.fields.mgtd_date);
if (this.fields.ticklerhh) {
ticklerTime.setHours(this.fields.ticklerhh);
if (this.fields.tickleractivate) hourToActivate
= -
this.fields.tickleractivate;
else hourToActivate = 0;
if (this.fields.ticklermm)
ticklerTime.setMinutes
(this.fields.ticklermm);
}
nowTime.setHours(nowTime.getHours() - hourToActivate);
return (nowTime.convertToYYYYMMDDHHMM() >=
ticklerTime.convertToYYYYMMDDHHMM());
}
else return false;
}
});
// --------- End code ---------
Step three: Add the template change.
Edit TitleButtons and find the section !Tickler.
Right after the following code:
<span macro="addMonth"></span>
<span macro="addYear"></span>
</div>
Add (no line breaks):
<div class="floatleft"><span class="label">Activation time:</span><br/
><span macro="select tickleractivate rows:1 0 1 2 3 4 5 6 7 8 9 10 11
12 13 14 15 16 17 18 19 20 21 22 23"></span> hour(s) before <span
macro="select ticklerhh rows:1 00 01 02 03 04 05 06 07 08 09 10 11 12
13 14 15 16 17 18 19 20 21 22 23"></span> : <span macro="select
ticklermm rows:1 00 05 10 15 20 25 30 35 40 45 50 55"></span></span></
div>
Step four: Add code to show the activation time in lists.
Edit the plugin TiddlerViewMethods. Find:
'<<singleToggleTag tag:Starred title:[[%0]]>>'+
'<<dateChooser [[%0]]>>'+
And add this line below dateChooser (no line breaks):
(this.fields.ticklerhh ? (' //('+this.fields.ticklerhh+':'+
(this.fields.ticklermm ? this.fields.ticklermm : '00')+')//') : '')+
Step Five:
Cross your fingers, save and reload... voila!
You can now set both an time for ticklers and an activation time (say,
you want a tickler to pop up five hours before an appointment). The
only problem I've had so far is that lists don't refresh
automatically. For now I'll simply push F5 to refresh when returning
to my computer to see if any new ticklers pop up. I might work on some
automatic refresh if I have time later (and can figure it out... ;).
Let me know if/how it works for you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "GTD
TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/GTD-TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---