PmWiki cookbook : GuiEditDateButton release 1.01 - March 28, 2005

Add a graphical button to the guiedit toolbar to insert a date in the edit window
see http://www.pmwiki.org/wiki/Cookbook/GuiEditDateButton


Add this in your local/config.php file :

SDV($GUIButtons['date'], array(750, '', '', '',
 '<a href=\"javascript:insDate(before, after, dir);\">'.
 '<img src=\'$GUIButtonDirUrlFmt/date.gif\' title=\'Date\' style=\'border:0px;\' /></a>'));

where 
- before - text or pmwiki markup to insert before the selected date
- after - text or pmwiki markup to insert after the date
- dir - the directory where calendar.html is located

For example if you just want the date use :

SDV($GUIButtons['date'], array(750, '', '', '',
 '<a href=\"javascript:insDate(\'\', \' \\\n\', \'$GUIButtonDirUrlFmt\');\">'.
 '<img src=\'$GUIButtonDirUrlFmt/date.gif\' title=\'Date\' style=\'border:0px;\' /></a>'));

if you want the date in strong characters with a bullet list,
      insert *''' before the date and ''' followed by a new line after the date, use : 

   
... javascript:insDate(\'*\\\\\'\\\\\'\\\\\'\', \'\\\\\'\\\\\'\\\\\' \\\n\', \'$GUIButtonDirUrlFmt\') ...
 


Add this in your template file (default is pub/skins/pmwiki/pmwiki.tmpl but you can make a copy of the pmwiki skin avoiding it to be overwritten during the next pmwiki upgrade, see http://www.pmwiki.org/wiki/PmWiki/LayoutBasics) after the line <link rel='stylesheet'..../> to load the javascript jscal.js 
<script type="text/javascript" src="$SkinDirUrl/jscal.js"></script>

Copy date.gif and calendar.html in pub/guiedit/.

Copy jscal.js in pub/pmwiki/ 


Notes

- To choose another language see selectedLanguage in jscal.js
- To choose another date format see calDateFormat in jscal.js
- To modifify the behaviour of the markup insertion see insMarkupDate and insDate in jscal.js
- If you want to insert *''' before the date and ''' followed by a new line after the date, add 
  this in your config.php file :
 '<a href=\"SDV($GUIButtons['date'], array(750, '', '', '',
javascript:insDate(\'*\\\\\'\\\\\'\\\\\'\', \'\\\\\'\\\\\'\\\\\' \\\n\', \'$GUIButtonDirUrlFmt\');\">'.
 '<img src=\'$GUIButtonDirUrlFmt/date.gif\' title=\'Date\' style=\'border:0px;\' /></a>'));

Contributors
David Shadovitz and John Fojtek for jscal (http://sourceforge.net/projects/jscal/)
Pierre Noe. - PmWiki integration - March 05, 2005, at 05:38 PM

See also :
Another javascript popup calendar : http://www.dynarch.com/projects/calendar/ jscalendar release 2.9.6 GPL

