Mishoo JSCalendar, packaged for use by plugins, skins and add-ons.
$name is the name of the CGI parameter for the calendar (it should be unique),
$value is the current value of the parameter (may be undef)
$format is the format to use (optional; the default is set in configure). The HTML returned will display a date field and a drop-down calendar.
\%options is an optional hash containing base options for the textfield.
use TWiki::Contrib::JSCalendarContrib; ... my $fromDate = TWiki::Contrib::JSCalendarContrib::renderDateForEdit( 'from', '1 April 1999'); my $toDate = TWiki::Contrib::JSCalendarContrib::renderDateForEdit( 'to', undef, '%Y');
renderDateForEdit affords. $setup is
the name of
the calendar setup module; it can either be omitted, in which case the method
described in the Mishoo documentation can be used to create calendars, or it
can be 'twiki', in which case a Javascript helper function called
'showCalendar' is added that simplifies using calendars to set a value in a
text field. For example, say we wanted to display the date with the calendar
icon before the text field, using the format %Y %b %e
# Add styles and javascript for the calendar
use TWiki::Contrib::JSCalendarContrib;
...
sub commonTagsHandler {
....
# Enable 'showCalendar'
TWiki::Contrib::JSCalendarContrib::addHEAD( 'twiki' );
my $cal = CGI::image_button(
-name => 'img_datefield',
-onclick =>
"return showCalendar('id_datefield','%Y %b %e')",
-src=> TWiki::Func::getPubUrlPath() . '/' .
TWiki::Func::getTwikiWebname() .
'/JSCalendarContrib/img.gif',
-alt => 'Calendar',
-align => 'middle' )
. CGI::textfield(
{ name => 'date', id => "id_datefield" });
....
}
The first parameter to showCalendar is the id of the textfield, and the second parameter is the date format. Default format is '%e %B %Y'.
All available date specifiers:
%a - abbreviated weekday name %A - full weekday name %b - abbreviated month name %B - full month name %C - century number %d - the day of the month ( 00 .. 31 ) %e - the day of the month ( 0 .. 31 ) %H - hour ( 00 .. 23 ) %I - hour ( 01 .. 12 ) %j - day of the year ( 000 .. 366 ) %k - hour ( 0 .. 23 ) %l - hour ( 1 .. 12 ) %m - month ( 01 .. 12 ) %M - minute ( 00 .. 59 ) %n - a newline character %p - "PM" or "AM" %P - "pm" or "am" %S - second ( 00 .. 59 ) %s - number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC) %t - a tab character %U, %W, %V - the week number The week 01 is the week that has the Thursday in the current year, which is equivalent to the week that contains the fourth day of January. Weeks start on Monday. %u - the day of the week ( 1 .. 7, 1 = MON ) %w - the day of the week ( 0 .. 6, 0 = SUN ) %y - year without the century ( 00 .. 99 ) %Y - year including the century ( ex. 1979 ) %% - a literal % character
addHEAD can be called from commonTagsHandler for adding the header to all pages, or from beforeEditHandler just for edit pages etc.
%INCLUDE{"%TWIKIWEB%/JSCalendarContribInline"}%
Then, to display a calendar icon next to a text input field:
<input type="text" id="cal_val_here" />
<input type="image" src="%PUBURL%/%TWIKIWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('cal_val_here','%e %B %Y')" />
If the contrib is installed, you will see such a field here:
configure interface (Go to Plugins->Find More Extensions) .zip or .tgz archives
perl <module>_installer )
configure and enable the module, if it is a plugin.
,v files in your existing install (take care not to lock the files when you check in)
LocalSite.cfg | Setting | Default |
|---|---|
$TWiki::cfg{JSCalendarContrib}{style} | 'blue' |
$TWiki::cfg{JSCalendarContrib}{lang} | 'en' |
$TWiki::cfg{JSCalendarContrib}{format} | '%e %b %Y' |
WikiRing - working together to improve your wiki experience!
| Author: | TWiki:Trash/Trash/Main/CrawfordCurrie http://c-dot.co.uk |
| Version: | 17492 (30 Mar 2009) of the Mishoo calendar |
| Copyright ©: | See the Mishoo documentation |
| License: | GPL (GNU General Public License) |
| Dependencies: | None |
| Change History: | |
| 10 Sep 2008 | Bugs:Item5991 Applied patch to fix rendering on IE7 . |
| 06 Sep 2007 | Bugs:Item4030 Added doc for using the calendar in user forms |
| 13603 | Bugs:Item2982 cleaned up the interface to the contrib, re-added a date rendering function with a more generic interface |
| 11594 | Allow format to be configured. |
| 11415 | Add a renderFormFieldForEditHandler so other plugins can forward to this handler to add the date field to the TWikiForms. (TWiki:Trash/Main.ThomasWeigert) |
| 10247 | Bugs:Item2054 put the calendar at z-index 2000, way above pattern skin divs. |
| 6634 | Bugs:Item453 removed EditTablePlugins private copy of the Mishoo JS calendar, and made sure it works with JSCalendarContrib. Improved the documentation of the JSCalendar while I was there. |
| 6626 | Bugs:Item468 updated docs for Dakar release |
| 5048 | Cairo readiness |
| 5039 | Split from SharedCode |
| 27 Dec 2005 | updated to calendar version 1.0; set style for Safari to win2k-1 |
| 14 Aug 2004 | Separated out from SharedCode module |
| Home: | http://TWiki.org/cgi-bin/view/Plugins/JSCalendarContrib |
| Feedback: | http://TWiki.org/cgi-bin/view/Plugins/JSCalendarContribDev |
| Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/JSCalendarContribAppraisal |

| Copyright 2011 The Board of Trustees of the University of Illinois.webmaster@cs.uic.edu |
WISEST Helping Women Faculty Advance Funded by NSF | | |