2
<img src="%ATTACHURL%/screenshot.gif" style="float:right"/>
8
PLEASE DO NOT EDIT THIS TOPIC
10
It is automatically generated from the subversion repository, and any changes
11
you make will simply be overwritten the next time a release is generated.
13
Instead, you could check your fix in, raise a bug in the Bugs web, or mail thge author.
18
---++ Summary of Contents
19
This module packages the [[http://dynarch.com/mishoo/calendar.epl][Mishoo JSCalendar]] Javascript in a form suitable for use with Foswiki.
21
---++ Detailed Documentation
23
Read [[%ATTACHURL%/doc/html/reference.html][the Mishoo documentation]] or
24
[[%ATTACHURL%][visit the demo page]] for detailed information on using the
27
This package also includes a small Perl module to make using the calendar
28
easier from Foswiki plugins. This module includes the functions:
31
---+++ Foswiki::Contrib::JSCalendarContrib::renderDateForEdit($name, $value, $format [, \%cssClass]) -> $html
33
This is the simplest way to use calendars from a plugin.
34
* =$name= is the name of the CGI parameter for the calendar
35
(it should be unique),
36
* =$value= is the current value of the parameter (may be undef)
37
* =$format= is the format to use (optional; the default is set
38
in =configure=). The HTML returned will display a date field
39
and a drop-down calendar.
40
* =\%options= is an optional hash containing base options for
44
use Foswiki::Contrib::JSCalendarContrib;
46
my $fromDate = Foswiki::Contrib::JSCalendarContrib::renderDateForEdit(
47
'from', '1 April 1999');
48
my $toDate = Foswiki::Contrib::JSCalendarContrib::renderDateForEdit(
53
---+++ Foswiki::Contrib::JSCalendarContrib::addHEAD($setup)
55
This function will automatically add the headers for the calendar to the page
56
being rendered. It's intended for use when you want more control over the
57
formatting of your calendars than =renderDateForEdit= affords. =$setup= is
59
the calendar setup module; it can either be omitted, in which case the method
60
described in the Mishoo documentation can be used to create calendars, or it
61
can be ='foswiki'=, in which case a Javascript helper function called
62
'showCalendar' is added that simplifies using calendars to set a value in a
63
text field. For example, say we wanted to display the date with the calendar
64
icon _before_ the text field, using the format =%Y %b %e=
66
# Add styles and javascript for the calendar
67
use Foswiki::Contrib::JSCalendarContrib;
70
sub commonTagsHandler {
72
# Enable 'showCalendar'
73
Foswiki::Contrib::JSCalendarContrib::addHEAD( 'foswiki' );
75
my $cal = CGI::image_button(
76
-name => 'img_datefield',
78
"return showCalendar('id_datefield','%Y %b %e')",
79
-src=> Foswiki::Func::getPubUrlPath() . '/' .
80
$Foswiki::cfg{SystemWebName} .
81
'/JSCalendarContrib/img.gif',
85
{ name => 'date', id => "id_datefield" });
89
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'.
91
All available date specifiers:
93
%a - abbreviated weekday name
94
%A - full weekday name
95
%b - abbreviated month name
98
%d - the day of the month ( 00 .. 31 )
99
%e - the day of the month ( 0 .. 31 )
100
%H - hour ( 00 .. 23 )
101
%I - hour ( 01 .. 12 )
102
%j - day of the year ( 000 .. 366 )
103
%k - hour ( 0 .. 23 )
104
%l - hour ( 1 .. 12 )
105
%m - month ( 01 .. 12 )
106
%M - minute ( 00 .. 59 )
107
%n - a newline character
110
%S - second ( 00 .. 59 )
111
%s - number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC)
113
%U, %W, %V - the week number
114
The week 01 is the week that has the Thursday in the current year,
115
which is equivalent to the week that contains the fourth day of January.
116
Weeks start on Monday.
117
%u - the day of the week ( 1 .. 7, 1 = MON )
118
%w - the day of the week ( 0 .. 6, 0 = SUN )
119
%y - year without the century ( 00 .. 99 )
120
%Y - year including the century ( ex. 1979 )
121
%% - a literal % character
124
=addHEAD= can be called from =commonTagsHandler= for adding the header to all pages, or from =beforeEditHandler= just for edit pages etc.
126
An alternative to =commonTagsHandler= is =postRenderingHandler= which is more efficient since it is called less often.
130
---+++ Using the Calendar in user forms
131
You can also use the calendar directly in your own hand-built forms, without
132
having to write any code. Just add this inline in the topic text:
134
%INCLUDE{"%SYSTEMWEB%/JSCalendarContribInline"}%
136
Then, to display a calendar icon next to a text input field:
138
<input type="text" id="cal_val_here" />
139
<input type="image" src="%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('cal_val_here','%e %B %Y')" />
141
If the contrib is installed, you will see such a field here:
142
%INCLUDE{"%SYSTEMWEB%/JSCalendarContribInline"}%
143
<input type="text" id="cal_val_here" />
144
<input type="image" src="%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('cal_val_here','%e %B %Y')" />
147
* Set SHORTDESCRIPTION = [[http://dynarch.com/mishoo/calendar.epl][Mishoo JSCalendar]], packaged for use by plugins, skins and add-ons.
150
---+++ Installation Instructions
151
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
153
Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".
155
If you have any problems, or if the extension isn't available in =configure=, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
157
* An administrator can customize the appearance of the calendar by setting the following in =<nop>LocalSite.cfg=
158
| *Setting* | *Default* |
159
| =$Foswiki::cfg{JSCalendarContrib}{style}= | ='blue'= |
160
| =$Foswiki::cfg{JSCalendarContrib}{lang}= | ='en'= |
161
| =$Foswiki::cfg{JSCalendarContrib}{format}= | ='%e %b %Y'= |
165
Another great Foswiki extension from the <a style="text-decoration:none" href="http://wikiring.com"><img src="%ATTACHURLPATH%/wikiringlogo20x20.png" alt="" /> *WikiRing* </a> - working together to improve your wiki experience!
167
| Author: | Foswiki:Main/CrawfordCurrie http://c-dot.co.uk |
168
| Copyright ©: | See [[%ATTACHURL%/doc/html/reference.html][the Mishoo documentation]] |
169
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
170
| Version: | 3417 (2009-04-12) |
171
| Change History: | |
172
| 16 Dec 2008 | Foswiki version |
173
| 10 Sep 2008 | Bugs:Item5991 Applied patch to fix rendering on IE7 .|
174
| 06 Sep 2007 | Bugs:Item4030 Added doc for using the calendar in user forms |
175
| 13603 | Bugs:Item2982 cleaned up the interface to the contrib, re-added a date rendering function with a more generic interface |
176
| 11594 | Allow format to be configured. |
177
| 11415 | Add a =renderFormFieldForEditHandler= so other plugins can forward to this handler to add the date field to the DataForms. (TWiki:Main.ThomasWeigert) |
178
| 10247 | Bugs:Item2054 put the calendar at z-index 2000, way above pattern skin divs. |
179
| 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. |
180
| 6626 | Bugs:Item468 updated docs for Dakar release |
181
| 5048 | Cairo readiness |
182
| 5039 | Split from !SharedCode |
183
| 27 Dec 2005 | updated to calendar version 1.0; set style for Safari to win2k-1|
184
| 14 Aug 2004 | Separated out from !SharedCode module |
185
| Dependencies: | None |
186
| Home: | http://foswiki.org/Extensions/%TOPIC% |
187
| Support: | http://foswiki.org/Support/%TOPIC% |
190
*Related Topics:* %USERSWEB%.SitePreferences
192
%META:FILEATTACHMENT{name="screenshot.gif" attr="h" comment="" version="1"}%
193
%META:FILEATTACHMENT{name="wikiringlogo20x20.png" attr="h" comment="" version="1"}%