This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Question : How-to make the Calendar to adapt to each blog page instead of staying fixed on the Main_blogentry?#

--FrancoisParlant

OK, sorry for taking so long. I was initially going to say that it cannot be done, but then I realized that yes, it's quite doable. It basically just requires changing the "jspwiki.tld" file to have the following:

  <tag>
    <name>Calendar</name>
    <tagclass>com.ecyrd.jspwiki.tags.CalendarTag</tagclass>
    <bodycontent>empty</bodycontent>
    <attribute>
       <name>pageformat</name>
       <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
       <name>urlformat</name>
       <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
       <name>monthurlformat</name>
       <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>  

Note that for each attribute you will have to define the "rtexprvalue" to be "true". This has now been enabled for JSPWiki 2.1.60 onwards, so you don't have to change anything if you're tracking the CVS version.

It does add some performance penalty, though.

After the change, you can do it like this:

<% String pagename = ((com.ecyrd.jspwiki.WikiContext)pageContext.getAttribute("jspwiki.context",
         PageContext.REQUEST_SCOPE)).getPage().getName(); %>

<wiki:Calendar pageformat="<%="'"+pagename+"_blogentry_'ddMMyy'_1'"%>"
      urlformat="<%="'Wiki.jsp?page="+pagename+"&weblog.startDate='ddMMyy'&weblog.days=1'"%>"
      monthurlformat="<%="'Wiki.jsp?page="+pagename+"&weblog.startDate='ddMMyy'&weblog.days=%d'"%>" />

Yup. It's extraordinarily ugly, but it works. The problem is that for some really, really strange reason (at least with JakartaTomcat 4.1) it is impossible to specify a tag within the ' -signs. It all works fine if you skip the single quotes, but those are required for the SimpleDateFormat.

-- JanneJalkanen

Thank you for this nice bit of code which works really great (without any performance change, and I'm running a 233mhz) REALLY COOL.--FrancoisParlant


Question: Can I insert the Calendar Plugin inside an entry?#

Exemple:#

[{INSERT com.ecyrd.jspwiki.tags.CalendarTag WHERE pageformat="'Main_blogentry_'ddMMyy'_1'"; urlformat="'Wiki.jsp?page=Main&weblog.startDate='ddMMyy'&weblog.days=1'"}]

--FrancoisParlant

No, this is not possible, as the CalendarTag is a JSP Tag, not a plugin. It is meant for building your template, not for inserting on a page.

There is actually a (good) reason for it being a tag instead of a plugin, but I just can't remember it right now.

--JanneJalkanen

Apart from this (good) reason I would prefer a CalendarPlugin so the same JSPWiki instance could be used as a Wiki and as a Weblog. Now if they are integrated I should decide between show the calendar in whe Wiki pages (something weird) or miss the Calendar in the blogs.

--JoseMRus


CalendarTag Ideas

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
png
CalendarExample.png 2.9 kB 1 20-Apr-2004 18:09 MDeichsel
« This particular version was published on 17-Sep-2003 23:54 by JoseMRus.