Thanks for the script! It worked perfectly when called from a Tiddler, and 
worked for 7 days when called from a link (MainMenu). Can you modify the 
script so that when the "label" function is used, the "count:" and 
"offset:" parameters still work instead of hardcoding the label function 
with 7 days? I played around with it a bit, but my javascript prowess is 
borderline zero, and was unable to make the script do what I want.

Any ideas why when the plugin is called during startup from 
"DefaultTiddlers", it just shows the text of "DefaultTiddler" instead of 
running the script? Maybe the default tiddlers get loaded before the 
scripts get loaded into memory?

TIA

On Thursday, May 24, 2012 9:44:02 AM UTC-6, vaiek wrote:
>
> Below is a plugin that I think will do what you asked (don't forget to tag 
> the tiddler you paste it into as systemConfig).  You can put a call to the 
> macro in a tiddler opened by default (I put mine in my Home tiddler, which 
> is on my DefaultTiddler list...putting the macro call in the DefaultTiddler 
> itself does not work for me). Like so:
>  
> <<GetJournals offset:0 count:7>>
>  
> That will open up the next 7 days worth of journal entries, starting from 
> today (offset=0).
>  
> Alternatively, if you provide a "label" argument, it will create  a button 
> instead:
> <<GetJournals label:"Open Calendar">>
>  
> If you, for example, put this in your MainMenu tiddler, you will then have 
> a button in your menu which you can click to (re)open the next 7 days of 
> journal tiddlers.
>  
> -Eric (K., not S.)
>  
> /***
> !Code
> ***/
> {{{
> // create macro object
> var journalMacros = config.macros.GetJournals = {
>     handler: function 
> (place,macroName,params,wikifier,paramString,tiddler) {
>         var 
> paramHash=paramString.parseParams('offset',null,true,false,false); 
>         var offset=getParam(paramHash,'offset', 0); 
>         var count=getParam(paramHash,'count', 1); 
>         var label=getParam(paramHash,'label', undefined); 
>         if(label) {
>            var span = 
> createTiddlyElement(place,"span",null,this.className);
>            createTiddlyButton(span,label,null,this.onClick);
>         } else {
>            var limit = parseInt(count) + parseInt(offset);
>            while (offset < limit) {
>                story.displayTiddler("bottom", 
> journalMacros.getTitle(offset));
>                offset++;
>            }
>        }
>    },
>    getTitle: function(offset) {
>       offset = offset || 0;
>       var today= new Date();
>       var date = new Date(today.getTime() + (offset *  24 * 60 * 60 * 
> 1000));
>       var title = date.formatString("DD MMM, YYYY");
>       return title;
>    },
>    onClick: function(ev) {
>       var limit = 0;
>       while (limit < 7) {
>       story.displayTiddler("bottom", journalMacros.getTitle(limit));
>           limit++;
>       }
>    }
> }
> }}}
>
>
> On Thu, May 24, 2012 at 9:12 AM, airman99 wrote:
>
>> Thanks Eric! This plugin does exactly what I needed. 
>>
>> Not knowing much about javascript, here are two closely related 
>> questions: 
>>
>> 1. How would I go about creating a link ("[[Weekly_Agenda]]" for example) 
>> that would do the very same thing, (i.e. pull up a week's future agenda 
>> items starting today)? This way I could easily return to the "agenda" view 
>> without having to restart TW.
>>
>> 2. How would I make some fixed Tiddlers appear on the startup page in 
>> addition to the next week of journals?
>>
>> TIA
>>
>>
>> On Wednesday, May 23, 2012 10:53:00 PM UTC-6, airman99 wrote: 
>>>
>>> I am using TW as an appointment book, with one journal per day (e.g. 
>>> 2012-05-23). Upon startup, I would like TW to display the next 7 days of 
>>> journal entries. For example, if today is 2012-05-23, I want TW to display 
>>> the journals for 2012-05-23, 2012-05-24, 2012-05-25 ... 2012-05-29. I have 
>>> searched in this group for a while and have not seen this request 
>>> addressed. Have also looked through some of the major plugin sites with no 
>>> progress. Any ideas would be appreciated.
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "TiddlyWiki" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/tiddlywiki/-/mlrV15poxjgJ.
>> To post to this group, send email to tiddlywiki@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> tiddlywiki+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/tiddlywiki?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/tiddlywiki/-/ZEX3ZQ6Gf90J.
To post to this group, send email to tiddlywiki@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to