data/TWiki/JSCalendarContrib.txt
changeset 0 414e01d06fd5
child 1 e2915a7cbdfa
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/data/TWiki/JSCalendarContrib.txt	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,169 @@
     1.4 +---+!! %TOPIC%
     1.5 +<img src="%ATTACHURL%/screenshot.gif" style="float:right"/>
     1.6 +
     1.7 +%SHORTDESCRIPTION%
     1.8 +
     1.9 +<!--
    1.10 +
    1.11 +   PLEASE DO NOT EDIT THIS TOPIC
    1.12 +
    1.13 +   It is automatically generated from the subversion repository, and any changes
    1.14 +   you make will simply be overwritten the next time a release is generated.
    1.15 +
    1.16 +   Instead, you could check your fix in, raise a bug in the Bugs web, or mail thge author.
    1.17 +-->
    1.18 +
    1.19 +%TOC%
    1.20 +
    1.21 +---++ Summary of Contents
    1.22 +This module packages the [[http://dynarch.com/mishoo/calendar.epl][Mishoo JSCalendar]] Javascript in a form suitable for use with TWiki.
    1.23 +
    1.24 +---++ Detailed Documentation
    1.25 +
    1.26 +Read [[%ATTACHURL%/doc/html/reference.html][the Mishoo documentation]] or
    1.27 +[[%ATTACHURL%][visit the demo page]] for detailed information on using the
    1.28 +calendar widget.
    1.29 +
    1.30 +This package also includes a small Perl module to make using the calendar
    1.31 +easier from TWiki plugins. This module includes the functions:
    1.32 +
    1.33 +
    1.34 +---+++ TWiki::Contrib::JSCalendarContrib::renderDateForEdit($name, $value, $format [, \%cssClass]) -> $html
    1.35 +
    1.36 +This is the simplest way to use calendars from a plugin.
    1.37 +   * =$name= is the name of the CGI parameter for the calendar
    1.38 +     (it should be unique),
    1.39 +   * =$value= is the current value of the parameter (may be undef)
    1.40 +   * =$format= is the format to use (optional; the default is set
    1.41 +     in =configure=). The HTML returned will display a date field
    1.42 +     and a drop-down calendar.
    1.43 +   * =\%options= is an optional hash containing base options for
    1.44 +     the textfield.
    1.45 +Example:
    1.46 +<verbatim>
    1.47 +use TWiki::Contrib::JSCalendarContrib;
    1.48 +...
    1.49 +my $fromDate = TWiki::Contrib::JSCalendarContrib::renderDateForEdit(
    1.50 +   'from', '1 April 1999');
    1.51 +my $toDate = TWiki::Contrib::JSCalendarContrib::renderDateForEdit(
    1.52 +   'to', undef, '%Y');
    1.53 +</verbatim>
    1.54 +
    1.55 +
    1.56 +---+++ TWiki::Contrib::JSCalendarContrib::addHEAD($setup)
    1.57 +
    1.58 +This function will automatically add the headers for the calendar to the page
    1.59 +being rendered. It's intended for use when you want more control over the
    1.60 +formatting of your calendars than =renderDateForEdit= affords. =$setup= is
    1.61 +the name of
    1.62 +the calendar setup module; it can either be omitted, in which case the method
    1.63 +described in the Mishoo documentation can be used to create calendars, or it
    1.64 +can be ='twiki'=, in which case a Javascript helper function called
    1.65 +'showCalendar' is added that simplifies using calendars to set a value in a
    1.66 +text field. For example, say we wanted to display the date with the calendar
    1.67 +icon _before_ the text field, using the format =%Y %b %e=
    1.68 +<verbatim>
    1.69 +# Add styles and javascript for the calendar
    1.70 +use TWiki::Contrib::JSCalendarContrib;
    1.71 +...
    1.72 +
    1.73 +sub commonTagsHandler {
    1.74 +  ....
    1.75 +  # Enable 'showCalendar'
    1.76 +  TWiki::Contrib::JSCalendarContrib::addHEAD( 'twiki' );
    1.77 +
    1.78 +  my $cal = CGI::image_button(
    1.79 +      -name => 'img_datefield',
    1.80 +      -onclick =>
    1.81 +       "return showCalendar('id_datefield','%Y %b %e')",
    1.82 +      -src=> TWiki::Func::getPubUrlPath() . '/' .
    1.83 +             TWiki::Func::getTwikiWebname() .
    1.84 +             '/JSCalendarContrib/img.gif',
    1.85 +      -alt => 'Calendar',
    1.86 +      -align => 'middle' )
    1.87 +    . CGI::textfield(
    1.88 +      { name => 'date', id => "id_datefield" });
    1.89 +  ....
    1.90 +}
    1.91 +</verbatim>
    1.92 +The first parameter to =showCalendar= is the id of the textfield, and the second parameter is the . See the Mishoo documentation for details of the '$e %B %Y' parameter.
    1.93 +
    1.94 +=addHEAD= can be called from =commonTagsHandler= for adding the header to all pages, or from =beforeEditHandler= just for edit pages etc.
    1.95 +
    1.96 +
    1.97 +
    1.98 +---+++ Using the Calendar in user forms
    1.99 +You can also use the calendar directly in your own hand-built forms, without
   1.100 +having to write any code. Just add this inline in the topic text:
   1.101 +<verbatim>
   1.102 +%INCLUDE{"%SYSTEMWEB%/JSCalendarContribInline"}%
   1.103 +</verbatim>
   1.104 +Then, to display a calendar icon next to a text input field:
   1.105 +<verbatim>
   1.106 +<input type="text" id="cal_val_here" />
   1.107 +<input type="image" src="%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('cal_val_here','%e %B %Y')" />
   1.108 +</verbatim>
   1.109 +If the contrib is installed, you will see such a field here:
   1.110 +%INCLUDE{"%SYSTEMWEB%/JSCalendarContribInline"}%
   1.111 +<input type="text" id="cal_val_here" />
   1.112 +<input type="image" src="%PUBURL%/%SYSTEMWEB%/JSCalendarContrib/img.gif" onclick="javascript: return showCalendar('cal_val_here','%e %B %Y')" />
   1.113 +
   1.114 +<!--
   1.115 +   * Set SHORTDESCRIPTION = [[http://dynarch.com/mishoo/calendar.epl][Mishoo JSCalendar]], packaged for use by plugins, skins and add-ons.
   1.116 +-->
   1.117 +
   1.118 +---+++ Installation Instructions
   1.119 +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 where TWiki is running.
   1.120 +
   1.121 +Like many other TWiki extensions, this module is shipped with a fully
   1.122 +automatic installer script written using the Build<nop>Contrib.
   1.123 +   * If you have TWiki 4.2 or later, you can install from the =configure= interface (Go to Plugins->Find More Extensions)
   1.124 +      * See the [[http://twiki.org/cgi-bin/view/Plugins/BuildContribInstallationSupplement][installation supplement]] on TWiki.org for more information.
   1.125 +   * If you have any problems, then you can still install manually from the command-line:
   1.126 +      1 Download one of the =.zip= or =.tgz= archives
   1.127 +      1 Unpack the archive in the root directory of your TWiki installation.
   1.128 +      1 Run the installer script ( =perl &lt;module&gt;_installer= )
   1.129 +      1 Run =configure= and enable the module, if it is a plugin.
   1.130 +      1 Repeat for any missing dependencies.
   1.131 +   * If you are *still* having problems, then instead of running the installer script:
   1.132 +      1 Make sure that the file permissions allow the webserver user to access all files.
   1.133 +      1 Check in any installed files that have existing =,v= files in your existing install (take care *not* to lock the files when you check in)
   1.134 +      1 Manually edit !LocalSite.cfg to set any configuration variables.
   1.135 +
   1.136 +%IF{"defined 'SYSTEMWEB'" else="<div class='twikiAlert'>%X% WARNING: SYSTEMWEB is not defined in this TWiki. Please add these definitions to your %MAINWEB%.TWikiPreferences, if they are not already there:<br><pre>   * <nop>Set SYSTEMWEB = %<nop>TWIKIWEB%<br>   * <nop>Set USERSWEB = %<nop>MAINWEB%</pre></div>"}%
   1.137 +
   1.138 +	* An administrator can customize the appearance of the calendar by setting the following in =<nop>LocalSite.cfg=
   1.139 +     | *Setting* | *Default* |
   1.140 +     | =$TWiki::cfg{JSCalendarContrib}{style}= | ='blue'= |
   1.141 +     | =$TWiki::cfg{JSCalendarContrib}{lang}= | ='en'= |
   1.142 +     | =$TWiki::cfg{JSCalendarContrib}{format}= | ='%e %b %Y'= |
   1.143 +
   1.144 +---+++ Contrib Info
   1.145 +
   1.146 +Another great TWiki 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!
   1.147 +
   1.148 +|  Author: | TWiki:Main/CrawfordCurrie http://c-dot.co.uk |
   1.149 +|  Version: | 16236 (22 Jan 2008) of the Mishoo calendar |
   1.150 +|  Copyright &copy;: | See [[%ATTACHURL%/doc/html/reference.html][the Mishoo documentation]] |
   1.151 +|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
   1.152 +|  Dependencies: | None |
   1.153 +| Change History: | |
   1.154 +|  6 Sep 2007 | Bugs:Item4030 Added doc for using the calendar in user forms |
   1.155 +|  13603 | Bugs:Item2982 cleaned up the interface to the contrib, re-added a date rendering function with a more generic interface |
   1.156 +|  11594 | Allow format to be configured. |
   1.157 +|  11415 | Add a =renderFormFieldForEditHandler= so other plugins can forward to this handler to add the date field to the TWikiForms. (TWiki:Main.ThomasWeigert) |
   1.158 +|  10247 | Bugs:Item2054 put the calendar at z-index 2000, way above pattern skin divs. |
   1.159 +|  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. |
   1.160 +|  6626 | Bugs:Item468  updated docs for Dakar release |
   1.161 +|  5048 | Cairo readiness |
   1.162 +|  5039 | Split from SharedCode |
   1.163 +|  27 Dec 2005 | updated to calendar version 1.0; set style for Safari to win2k-1|
   1.164 +|  14 Aug 2004 | Separated out from SharedCode module |
   1.165 +|  Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% |
   1.166 +|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev |
   1.167 +|  Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal |
   1.168 +
   1.169 +__Related Topics:__ %SYSTEMWEB%.TWikiPreferences
   1.170 +
   1.171 +%META:FILEATTACHMENT{name="screenshot.gif" attr="h" comment="" version="1"}%
   1.172 +%META:FILEATTACHMENT{name="wikiringlogo20x20.png" attr="h" comment="" version="1"}%