Mishoo JSCalendar: A pop-up calendar for use in TWiki forms and TWiki applications
<--
PLEASE DO NOT EDIT THIS TOPIC
It is automatically generated from the subversion repository, and any changes
you make will simply be overwritten the next time a release is generated.
Instead, you could check your fix in, raise a bug in the Bugs web, or mail thge author.
-->
Summary of Contents
This module packages the Mishoo JSCalendar Javascript in a form suitable for use with TWiki.
Detailed Documentation
Read the Mishoo documentation or
visit the demo page for detailed information on using the
calendar widget.
This package also includes a small Perl module to make using the calendar
easier from TWiki plugins. This module includes the functions:
TWiki::Contrib::JSCalendarContrib::renderDateForEdit($name, $value, $format [, \%cssClass]) -> $html
This is the simplest way to use calendars from a plugin.
-
$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.
Example:
use TWiki::Contrib::JSCalendarContrib;
...
my $fromDate = TWiki::Contrib::JSCalendarContrib::renderDateForEdit(
'from', '1 April 1999');
my $toDate = TWiki::Contrib::JSCalendarContrib::renderDateForEdit(
'to', undef, '%Y');
TWiki::Contrib::JSCalendarContrib::addHEAD($setup)
This function will automatically add the headers for the calendar to the page
being rendered. It's intended for use when you want more control over the
formatting of your calendars than 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" });
....
}
|