reference.html 77KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738
  1. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!--
  4. Generated from ../reference.tex by tex2page, v 2004-09-11
  5. (running on MzScheme 209, unix),
  6. (c) Dorai Sitaram,
  7. http://www.ccs.neu.edu/~dorai/tex2page/tex2page-doc.html
  8. -->
  9. <head>
  10. <title>
  11. DHTML Calendar Widget
  12. </title>
  13. <link rel="stylesheet" type="text/css" href="reference.css" title=default>
  14. <link rel="stylesheet" type="text/css" href="reference-Z-S.css" title=default>
  15. <meta name=robots content="index,follow">
  16. </head>
  17. <body>
  18. <p>
  19. </p>
  20. <p>
  21. </p>
  22. <p>
  23. </p>
  24. <p>
  25. </p>
  26. <p>
  27. </p>
  28. <p>
  29. </p>
  30. <p>
  31. </p>
  32. <p>
  33. </p>
  34. <p>
  35. </p>
  36. <p>
  37. </p>
  38. <h1 class=title align=center><br><br>DHTML Calendar Widget</h1>
  39. <p></p>
  40. <div align=center>
  41. Mihai Bazon, <tt>&lt;mihai_bazon@yahoo.com&gt;</tt><br>
  42. &copy; Dynarch.com 2002-2005, <a href="http://www.dynarch.com/"><tt>www.dynarch.com</tt></a><p>March 7, 2005<br></p>
  43. <p></p>
  44. <p>
  45. <span class=small>calendar version: 1.0 ``It is happening again''</span>
  46. </p>
  47. </div>
  48. <p></p>
  49. <p>
  50. <span class=small><code class=verbatim>$Id: reference.tex,v 1.23 2005/03/05 11:37:14 mishoo Exp $</code></span>
  51. </p>
  52. <span class=small><blockquote>
  53. <div align=right><table><tr><td>
  54. </td></tr></table></div>
  55. </blockquote></span>
  56. <a name="node_sec_Temp_1"></a>
  57. <h1><a href="#node_toc_node_sec_Temp_1">Contents</a></h1>
  58. <p><a name="node_toc_start"></a></p>
  59. <p><b>
  60. &nbsp; &nbsp; <a name="node_toc_node_sec_1"></a><a href="#node_sec_1">1&nbsp;&nbsp;Overview</a></b><br>
  61. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_1.1"></a><a href="#node_sec_1.1">1.1&nbsp;&nbsp;How does this thing work?</a><br>
  62. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_1.2"></a><a href="#node_sec_1.2">1.2&nbsp;&nbsp;Project files</a><br>
  63. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_1.3"></a><a href="#node_sec_1.3">1.3&nbsp;&nbsp;License</a><br>
  64. </p>
  65. <p><b>
  66. &nbsp; &nbsp; <a name="node_toc_node_sec_2"></a><a href="#node_sec_2">2&nbsp;&nbsp;Quick startup</a></b><br>
  67. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_2.1"></a><a href="#node_sec_2.1">2.1&nbsp;&nbsp;Installing a popup calendar</a><br>
  68. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_2.2"></a><a href="#node_sec_2.2">2.2&nbsp;&nbsp;Installing a flat calendar</a><br>
  69. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_2.3"></a><a href="#node_sec_2.3">2.3&nbsp;&nbsp;<tt>Calendar.setup</tt> in detail</a><br>
  70. </p>
  71. <p><b>
  72. &nbsp; &nbsp; <a name="node_toc_node_sec_3"></a><a href="#node_sec_3">3&nbsp;&nbsp;Recipes</a></b><br>
  73. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_3.1"></a><a href="#node_sec_3.1">3.1&nbsp;&nbsp;Popup calendars</a><br>
  74. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_3.1.1"></a><a href="#node_sec_3.1.1">3.1.1&nbsp;&nbsp;Simple text field with calendar attached to a button</a><br>
  75. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_3.1.2"></a><a href="#node_sec_3.1.2">3.1.2&nbsp;&nbsp;Simple field with calendar attached to an image</a><br>
  76. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_3.1.3"></a><a href="#node_sec_3.1.3">3.1.3&nbsp;&nbsp;Hidden field, plain text triggers</a><br>
  77. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_3.1.4"></a><a href="#node_sec_3.1.4">3.1.4&nbsp;&nbsp;2 Linked fields, no trigger buttons</a><br>
  78. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_3.2"></a><a href="#node_sec_3.2">3.2&nbsp;&nbsp;Flat calendars</a><br>
  79. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_3.3"></a><a href="#node_sec_3.3">3.3&nbsp;&nbsp;Highlight special dates</a><br>
  80. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_3.4"></a><a href="#node_sec_3.4">3.4&nbsp;&nbsp;Select multiple dates</a><br>
  81. </p>
  82. <p><b>
  83. &nbsp; &nbsp; <a name="node_toc_node_sec_4"></a><a href="#node_sec_4">4&nbsp;&nbsp;The Calendar object overview</a></b><br>
  84. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_4.1"></a><a href="#node_sec_4.1">4.1&nbsp;&nbsp;Creating a calendar</a><br>
  85. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_4.2"></a><a href="#node_sec_4.2">4.2&nbsp;&nbsp;Order does matter ;-)</a><br>
  86. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_4.3"></a><a href="#node_sec_4.3">4.3&nbsp;&nbsp;Caching the object</a><br>
  87. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_4.4"></a><a href="#node_sec_4.4">4.4&nbsp;&nbsp;Callback functions</a><br>
  88. </p>
  89. <p><b>
  90. &nbsp; &nbsp; <a name="node_toc_node_sec_5"></a><a href="#node_sec_5">5&nbsp;&nbsp;The Calendar object API reference</a></b><br>
  91. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.1"></a><a href="#node_sec_5.1">5.1&nbsp;&nbsp;<tt>Calendar</tt> constructor</a><br>
  92. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.2"></a><a href="#node_sec_5.2">5.2&nbsp;&nbsp;Useful member variables (properties)</a><br>
  93. &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3"></a><a href="#node_sec_5.3">5.3&nbsp;&nbsp;Public methods</a><br>
  94. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.1"></a><a href="#node_sec_5.3.1">5.3.1&nbsp;&nbsp;<tt>Calendar.create</tt></a><br>
  95. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.2"></a><a href="#node_sec_5.3.2">5.3.2&nbsp;&nbsp;<tt>Calendar.callHandler</tt></a><br>
  96. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.3"></a><a href="#node_sec_5.3.3">5.3.3&nbsp;&nbsp;<tt>Calendar.callCloseHandler</tt></a><br>
  97. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.4"></a><a href="#node_sec_5.3.4">5.3.4&nbsp;&nbsp;<tt>Calendar.hide</tt></a><br>
  98. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.5"></a><a href="#node_sec_5.3.5">5.3.5&nbsp;&nbsp;<tt>Calendar.setDateFormat</tt></a><br>
  99. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.6"></a><a href="#node_sec_5.3.6">5.3.6&nbsp;&nbsp;<tt>Calendar.setTtDateFormat</tt></a><br>
  100. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.7"></a><a href="#node_sec_5.3.7">5.3.7&nbsp;&nbsp;<tt>Calendar.setDisabledHandler</tt></a><br>
  101. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.8"></a><a href="#node_sec_5.3.8">5.3.8&nbsp;&nbsp;<tt>Calendar.setDateStatusHandler</tt></a><br>
  102. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.9"></a><a href="#node_sec_5.3.9">5.3.9&nbsp;&nbsp;<tt>Calendar.show</tt></a><br>
  103. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.10"></a><a href="#node_sec_5.3.10">5.3.10&nbsp;&nbsp;<tt>Calendar.showAt</tt></a><br>
  104. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.11"></a><a href="#node_sec_5.3.11">5.3.11&nbsp;&nbsp;<tt>Calendar.showAtElement</tt></a><br>
  105. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.12"></a><a href="#node_sec_5.3.12">5.3.12&nbsp;&nbsp;<tt>Calendar.setDate</tt></a><br>
  106. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.13"></a><a href="#node_sec_5.3.13">5.3.13&nbsp;&nbsp;<tt>Calendar.setFirstDayOfWeek</tt></a><br>
  107. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.14"></a><a href="#node_sec_5.3.14">5.3.14&nbsp;&nbsp;<tt>Calendar.parseDate</tt></a><br>
  108. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a name="node_toc_node_sec_5.3.15"></a><a href="#node_sec_5.3.15">5.3.15&nbsp;&nbsp;<tt>Calendar.setRange</tt></a><br>
  109. </p>
  110. <p><b>
  111. &nbsp; &nbsp; <a name="node_toc_node_sec_6"></a><a href="#node_sec_6">6&nbsp;&nbsp;Side effects</a></b><br>
  112. </p>
  113. <p><b>
  114. &nbsp; &nbsp; <a name="node_toc_node_sec_7"></a><a href="#node_sec_7">7&nbsp;&nbsp;Credits</a></b><br>
  115. </p>
  116. <p>
  117. </p>
  118. <p>
  119. </p>
  120. <a name="node_sec_1"></a>
  121. <h1><a href="#node_toc_node_sec_1">1&nbsp;&nbsp;Overview</a></h1>
  122. <p>The DHTML Calendar widget<a name="call_footnote_Temp_2"></a><a href="#footnote_Temp_2"><sup><small>1</small></sup></a>
  123. is an (HTML) user interface element that gives end-users a friendly way to
  124. select date and time. It works in a web browser. The first versions only provided
  125. support for popup calendars, while starting with version 0.9 it also supports
  126. ``flat'' display. A ``flat'' calendar is a calendar that stays visible in the
  127. page all the time. In this mode it could be very useful for ``blog'' pages and
  128. other pages that require the calendar to be always present.</p>
  129. <p>
  130. The calendar is compatible with most popular browsers nowadays. While it's
  131. created using web standards and it should generally work with any compliant
  132. browser, the following browsers were found to work: Mozilla/Firefox (the
  133. development platform), Netscape&nbsp;6.0 or better, all other Gecko-based browsers,
  134. Internet Explorer&nbsp;5.0 or better <em>for Windows</em><a name="call_footnote_Temp_3"></a><a href="#footnote_Temp_3"><sup><small>2</small></sup></a>, Opera&nbsp;7<a name="call_footnote_Temp_4"></a><a href="#footnote_Temp_4"><sup><small>3</small></sup></a>, Konqueror 3.1.2 and Apple Safari for
  135. MacOSX.</p>
  136. <p>
  137. You can find the latest info and version at the calendar homepage:</p>
  138. <p>
  139. </p>
  140. <div align=center><table><tr><td>
  141. <a href="http://www.dynarch.com/projects/calendar/"><tt>www.dynarch.com/projects/calendar</tt></a>
  142. </td></tr></table></div>
  143. <p>
  144. </p>
  145. <a name="node_sec_1.1"></a>
  146. <h2><a href="#node_toc_node_sec_1.1">1.1&nbsp;&nbsp;How does this thing work?</a></h2>
  147. <p>DHTML is not ``another kind of HTML''. It's merely a naming convention. DHTML
  148. refers to the combination of HTML, CSS, JavaScript and DOM. DOM (Document
  149. Object Model) is a set of interfaces that glues the other three together. In
  150. other words, DOM allows dynamic modification of an HTML page through a program.
  151. JavaScript is our programming language, since that's what browsers like. CSS
  152. is a way to make it look good ;-). So all this soup is generically known as
  153. DHTML.</p>
  154. <p>
  155. Using DOM calls, the program dynamically creates a <tt>&lt;table&gt;</tt> element
  156. that contains a calendar for the given date and then inserts it in the document
  157. body. Then it shows this table at a specified position. Usually the position
  158. is related to some element in which the date needs to be displayed/entered,
  159. such as an input field.</p>
  160. <p>
  161. By assigning a certain CSS class to the table we can control the look of the
  162. calendar through an external CSS file; therefore, in order to change the
  163. colors, backgrounds, rollover effects and other stuff, you can only change a
  164. CSS file -- modification of the program itself is not necessary.</p>
  165. <p>
  166. </p>
  167. <a name="node_sec_1.2"></a>
  168. <h2><a href="#node_toc_node_sec_1.2">1.2&nbsp;&nbsp;Project files</a></h2>
  169. <p>Here's a description of the project files, excluding documentation and example
  170. files.</p>
  171. <p>
  172. </p>
  173. <ul><p>
  174. </p>
  175. <li><p>the main program file (<tt>calendar.js</tt>). This defines all the logic
  176. behind the calendar widget.</p>
  177. <p>
  178. </p>
  179. <li><p>the CSS files (<tt>calendar-*.css</tt>). Loading one of them is
  180. necessary in order to see the calendar as intended.</p>
  181. <p>
  182. </p>
  183. <li><p>the language definition files (<tt>lang/calendar-*.js</tt>). They are
  184. plain JavaScript files that contain all texts that are displayed by the
  185. calendar. Loading one of them is necessary.</p>
  186. <p>
  187. </p>
  188. <li><p>helper functions for quick setup of the calendar
  189. (<tt>calendar-setup.js</tt>). You can do fine without it, but starting with
  190. version 0.9.3 this is the recommended way to setup a calendar.</p>
  191. <p>
  192. </p>
  193. </ul><p></p>
  194. <p>
  195. </p>
  196. <a name="node_sec_1.3"></a>
  197. <h2><a href="#node_toc_node_sec_1.3">1.3&nbsp;&nbsp;License</a></h2>
  198. <p></p>
  199. <div align=center><table><tr><td>
  200. &copy; Dynarch.com 2002-2005,
  201. <a href="http://www.dynarch.com/"><tt>www.dynarch.com</tt></a>
  202. Author: Mihai Bazon
  203. </td></tr></table></div>
  204. <p>
  205. The calendar is released under the
  206. <a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a>.</p>
  207. <p>
  208. </p>
  209. <a name="node_sec_2"></a>
  210. <h1><a href="#node_toc_node_sec_2">2&nbsp;&nbsp;Quick startup</a></h1>
  211. <p></p>
  212. <p>
  213. Installing the calendar used to be quite a task until version 0.9.3. Starting
  214. with 0.9.3 I have included the file <tt>calendar-setup.js</tt> whose goal is to
  215. assist you to setup a popup or flat calendar in minutes. You are
  216. encouraged to modify this file and <em>not</em> calendar.js if you need
  217. extra customization, but you're on your own.</p>
  218. <p>
  219. First you have to include the needed scripts and style-sheet. Make sure you do
  220. this in your document's <tt>&lt;head&gt;</tt> section, also make sure you put the
  221. correct paths to the scripts.</p>
  222. <p>
  223. </p>
  224. <pre class=verbatim>&lt;style type=&quot;text/css&quot;&gt;@import url(calendar-win2k-1.css);&lt;/style&gt;
  225. &lt;script type=&quot;text/javascript&quot; src=&quot;calendar.js&quot;&gt;&lt;/script&gt;
  226. &lt;script type=&quot;text/javascript&quot; src=&quot;lang/calendar-en.js&quot;&gt;&lt;/script&gt;
  227. &lt;script type=&quot;text/javascript&quot; src=&quot;calendar-setup.js&quot;&gt;&lt;/script&gt;
  228. </pre><p></p>
  229. <p>
  230. </p>
  231. <a name="node_sec_2.1"></a>
  232. <h2><a href="#node_toc_node_sec_2.1">2.1&nbsp;&nbsp;Installing a popup calendar</a></h2>
  233. <p></p>
  234. <p>
  235. Now suppose you have the following HTML:</p>
  236. <p>
  237. </p>
  238. <pre class=verbatim>&lt;form ...&gt;
  239. &lt;input type=&quot;text&quot; id=&quot;data&quot; name=&quot;data&quot; /&gt;
  240. &lt;button id=&quot;trigger&quot;&gt;...&lt;/button&gt;
  241. &lt;/form&gt;
  242. </pre><p></p>
  243. <p>
  244. You want the button to popup a calendar widget when clicked? Just
  245. insert the following code immediately <em>after</em> the HTML form:</p>
  246. <p>
  247. </p>
  248. <pre class=verbatim>&lt;script type=&quot;text/javascript&quot;&gt;
  249. Calendar.setup(
  250. {
  251. inputField : &quot;data&quot;, // ID of the input field
  252. ifFormat : &quot;%m %d, %Y&quot;, // the date format
  253. button : &quot;trigger&quot; // ID of the button
  254. }
  255. );
  256. &lt;/script&gt;
  257. </pre><p></p>
  258. <p>
  259. The <tt>Calendar.setup</tt> function, defined in <tt>calendar-setup.js</tt>
  260. takes care of ``patching'' the button to display a calendar when clicked. The
  261. calendar is by default in single-click mode and linked with the given input
  262. field, so that when the end-user selects a date it will update the input field
  263. with the date in the given format and close the calendar. If you are a
  264. long-term user of the calendar you probably remember that for doing this you
  265. needed to write a couple functions and add an ``onclick'' handler for the
  266. button by hand.</p>
  267. <p>
  268. By looking at the example above we can see that the function
  269. <tt>Calendar.setup</tt> receives only one parameter: a JavaScript object.
  270. Further, that object can have lots of properties that tell to the setup
  271. function how would we like to have the calendar. For instance, if we would
  272. like a calendar that closes at double-click instead of single-click we would
  273. also include the following: <tt>singleClick:false</tt>.</p>
  274. <p>
  275. For a list of all supported parameters please see the section
  276. <a href="#node_sec_2.3">2.3</a>.</p>
  277. <p>
  278. </p>
  279. <a name="node_sec_2.2"></a>
  280. <h2><a href="#node_toc_node_sec_2.2">2.2&nbsp;&nbsp;Installing a flat calendar</a></h2>
  281. <p></p>
  282. <p>
  283. Here's how to configure a flat calendar, using the same <tt>Calendar.setup</tt>
  284. function. First, you should have an empty element with an ID. This element
  285. will act as a container for the calendar. It can be any block-level element,
  286. such as DIV, TABLE, etc. We will use a DIV in this example.</p>
  287. <p>
  288. </p>
  289. <pre class=verbatim>&lt;div id=&quot;calendar-container&quot;&gt;&lt;/div&gt;
  290. </pre><p></p>
  291. <p>
  292. Then there is the JavaScript code that sets up the calendar into the
  293. ``calendar-container'' DIV. The code can occur anywhere in HTML
  294. <em>after</em> the DIV element.</p>
  295. <p>
  296. </p>
  297. <pre class=verbatim>&lt;script type=&quot;text/javascript&quot;&gt;
  298. function dateChanged(calendar) {
  299. // Beware that this function is called even if the end-user only
  300. // changed the month/year. In order to determine if a date was
  301. // clicked you can use the dateClicked property of the calendar:
  302. if (calendar.dateClicked) {
  303. // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
  304. var y = calendar.date.getFullYear();
  305. var m = calendar.date.getMonth(); // integer, 0..11
  306. var d = calendar.date.getDate(); // integer, 1..31
  307. // redirect...
  308. window.location = &quot;/&quot; + y + &quot;/&quot; + m + &quot;/&quot; + d + &quot;/index.php&quot;;
  309. }
  310. };
  311. Calendar.setup(
  312. {
  313. flat : &quot;calendar-container&quot;, // ID of the parent element
  314. flatCallback : dateChanged // our callback function
  315. }
  316. );
  317. &lt;/script&gt;
  318. </pre><p></p>
  319. <p>
  320. </p>
  321. <a name="node_sec_2.3"></a>
  322. <h2><a href="#node_toc_node_sec_2.3">2.3&nbsp;&nbsp;<tt>Calendar.setup</tt> in detail</a></h2>
  323. <p></p>
  324. <p>
  325. Following there is the complete list of properties interpreted by
  326. Calendar.setup. All of them have default values, so you can pass only those
  327. which you would like to customize. Anyway, you <em>must</em> pass at least one
  328. of <tt>inputField</tt>, <tt>displayArea</tt> or <tt>button</tt>, for a popup
  329. calendar, or <tt>flat</tt> for a flat calendar. Otherwise you will get a
  330. warning message saying that there's nothing to setup.</p>
  331. <p>
  332. </p>
  333. <span class=small><table border=0><tr><td valign=top ><b>property</b> </td><td valign=top ><b>type</b> </td><td valign=top ><b>description</b> </td><td valign=top ><b>default</b>
  334. </td></tr>
  335. <tr><td valign=top ><tt>inputField</tt>
  336. </td><td valign=top >string </td><td valign=top >The ID of your input field.
  337. </td><td valign=top >null
  338. </td></tr>
  339. <tr><td valign=top ><tt>displayArea</tt>
  340. </td><td valign=top >string </td><td valign=top >This is the ID of a &lt;span&gt;, &lt;div&gt;, or any other element that you would like to use to display the current date. This is generally useful only if the input field is hidden, as an area to display the date.
  341. </td><td valign=top >null
  342. </td></tr>
  343. <tr><td valign=top ><tt>button</tt>
  344. </td><td valign=top >string </td><td valign=top >The ID of the calendar ``trigger''. This is an element (ordinarily a button or an image) that will dispatch a certain event (usually ``click'') to the function that creates and displays the calendar.
  345. </td><td valign=top >null
  346. </td></tr>
  347. <tr><td valign=top ><tt>eventName</tt>
  348. </td><td valign=top >string </td><td valign=top >The name of the event that will trigger the calendar. The name should be without the ``on'' prefix, such as ``click'' instead of ``onclick''. Virtually all users will want to let this have the default value (``click''). Anyway, it could be useful if, say, you want the calendar to appear when the input field is focused and have no trigger button (in this case use ``focus'' as the event name).
  349. </td><td valign=top >``click''
  350. </td></tr>
  351. <tr><td valign=top ><tt>ifFormat</tt>
  352. </td><td valign=top >string </td><td valign=top >The format string that will be used to enter the date in the input field. This format will be honored even if the input field is hidden.
  353. </td><td valign=top >``%Y/%m/%d''
  354. </td></tr>
  355. <tr><td valign=top ><tt>daFormat</tt>
  356. </td><td valign=top >string </td><td valign=top >Format of the date displayed in the displayArea (if specified).
  357. </td><td valign=top >``%Y/%m/%d''
  358. </td></tr>
  359. <tr><td valign=top ><tt>singleClick</tt>
  360. </td><td valign=top >boolean </td><td valign=top >Wether the calendar is in ``single-click mode'' or ``double-click mode''. If true (the default) the calendar will be created in single-click mode.
  361. </td><td valign=top >true
  362. </td></tr>
  363. <tr><td valign=top ><tt>disableFunc</tt>
  364. </td><td valign=top >function </td><td valign=top >A function that receives a JS Date object. It should return
  365. <tt>true</tt> if that date has to be disabled, <tt>false</tt> otherwise.
  366. <font color="red">DEPRECATED (see below).</font>
  367. </td><td valign=top >null
  368. </td></tr>
  369. <tr><td valign=top ><tt>dateStatusFunc</tt>
  370. </td><td valign=top >function </td><td valign=top >A function that receives a JS Date object and returns a boolean
  371. or a string. This function allows one to set a certain CSS class to some
  372. date, therefore making it look different. If it returns <tt>true</tt> then
  373. the date will be disabled. If it returns <tt>false</tt> nothing special
  374. happens with the given date. If it returns a string then that will be taken
  375. as a CSS class and appended to the date element. If this string is
  376. ``disabled'' then the date is also disabled (therefore is like returning
  377. <tt>true</tt>). For more information please also refer to section
  378. <a href="#node_sec_5.3.8">5.3.8</a>.
  379. </td><td valign=top >null
  380. </td></tr>
  381. <tr><td valign=top ><tt>firstDay</tt>
  382. </td><td valign=top >integer </td><td valign=top >Specifies which day is to be displayed as the first day of
  383. week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, ..., 6
  384. means Saturday. The end user can easily change this too, by clicking on the
  385. day name in the calendar header.
  386. </td><td valign=top >0
  387. </td></tr>
  388. <tr><td valign=top ><tt>weekNumbers</tt>
  389. </td><td valign=top >boolean </td><td valign=top >If ``true'' then the calendar will display week numbers.
  390. </td><td valign=top >true
  391. </td></tr>
  392. <tr><td valign=top ><tt>align</tt>
  393. </td><td valign=top >string </td><td valign=top >Alignment of the calendar, relative to the reference element. The
  394. reference element is dynamically chosen like this: if a displayArea is
  395. specified then it will be the reference element. Otherwise, the input field
  396. is the reference element. For the meaning of the alignment characters
  397. please section <a href="#node_sec_5.3.11">5.3.11</a>.
  398. </td><td valign=top >``Bl''
  399. </td></tr>
  400. <tr><td valign=top ><tt>range</tt>
  401. </td><td valign=top >array </td><td valign=top >An array having exactly 2 elements, integers. (!) The first [0] element is the minimum year that is available, and the second [1] element is the maximum year that the calendar will allow.
  402. </td><td valign=top >[1900, 2999]
  403. </td></tr>
  404. <tr><td valign=top ><tt>flat</tt>
  405. </td><td valign=top >string </td><td valign=top >If you want a flat calendar, pass the ID of the parent object in
  406. this property. If not, pass <tt>null</tt> here (or nothing at all as
  407. <tt>null</tt> is the default value).
  408. </td><td valign=top >null
  409. </td></tr>
  410. <tr><td valign=top ><tt>flatCallback</tt>
  411. </td><td valign=top >function </td><td valign=top >You should provide this function if the calendar is flat. It
  412. will be called when the date in the calendar is changed with a reference to
  413. the calendar object. See section <a href="#node_sec_2.2">2.2</a> for an example
  414. of how to setup a flat calendar.
  415. </td><td valign=top >null
  416. </td></tr>
  417. <tr><td valign=top ><tt>onSelect</tt>
  418. </td><td valign=top >function </td><td valign=top >If you provide a function handler here then you have to manage
  419. the ``click-on-date'' event by yourself. Look in the calendar-setup.js and
  420. take as an example the onSelect handler that you can see there.
  421. </td><td valign=top >null
  422. </td></tr>
  423. <tr><td valign=top ><tt>onClose</tt>
  424. </td><td valign=top >function </td><td valign=top >This handler will be called when the calendar needs to close.
  425. You don't need to provide one, but if you do it's your responsibility to
  426. hide/destroy the calendar. You're on your own. Check the calendar-setup.js
  427. file for an example.
  428. </td><td valign=top >null
  429. </td></tr>
  430. <tr><td valign=top ><tt>onUpdate</tt>
  431. </td><td valign=top >function </td><td valign=top >If you supply a function handler here, it will be called right
  432. after the target field is updated with a new date. You can use this to
  433. chain 2 calendars, for instance to setup a default date in the second just
  434. after a date was selected in the first.
  435. </td><td valign=top >null
  436. </td></tr>
  437. <tr><td valign=top ><tt>date</tt>
  438. </td><td valign=top >date </td><td valign=top >This allows you to setup an initial date where the calendar will be
  439. positioned to. If absent then the calendar will open to the today date.
  440. </td><td valign=top >null
  441. </td></tr>
  442. <tr><td valign=top ><tt>showsTime</tt>
  443. </td><td valign=top >boolean </td><td valign=top >If this is set to <tt>true</tt> then the calendar will also
  444. allow time selection.
  445. </td><td valign=top >false
  446. </td></tr>
  447. <tr><td valign=top ><tt>timeFormat</tt>
  448. </td><td valign=top >string </td><td valign=top >Set this to ``12'' or ``24'' to configure the way that the
  449. calendar will display time.
  450. </td><td valign=top >``24''
  451. </td></tr>
  452. <tr><td valign=top ><tt>electric</tt>
  453. </td><td valign=top >boolean </td><td valign=top >Set this to ``false'' if you want the calendar to update the
  454. field only when closed (by default it updates the field at each date change,
  455. even if the calendar is not closed) </td><td valign=top >true
  456. </td></tr>
  457. <tr><td valign=top ><tt>position</tt>
  458. </td><td valign=top >array </td><td valign=top >Specifies the [x, y] position, relative to page's top-left corner,
  459. where the calendar will be displayed. If not passed then the position will
  460. be computed based on the ``align'' parameter. Defaults to ``null'' (not
  461. used). </td><td valign=top >null
  462. </td></tr>
  463. <tr><td valign=top ><tt>cache</tt>
  464. </td><td valign=top >boolean </td><td valign=top >Set this to ``true'' if you want to cache the calendar object.
  465. This means that a single calendar object will be used for all fields that
  466. require a popup calendar </td><td valign=top >false
  467. </td></tr>
  468. <tr><td valign=top ><tt>showOthers</tt>
  469. </td><td valign=top >boolean </td><td valign=top >If set to ``true'' then days belonging to months overlapping
  470. with the currently displayed month will also be displayed in the calendar
  471. (but in a ``faded-out'' color) </td><td valign=top >false
  472. </td></tr></table>
  473. </span><p>
  474. </p>
  475. <a name="node_sec_3"></a>
  476. <h1><a href="#node_toc_node_sec_3">3&nbsp;&nbsp;Recipes</a></h1>
  477. <p>This section presents some common ways to setup a calendar using the
  478. <tt>Calendar.setup</tt> function detailed in the previous section.</p>
  479. <p>
  480. We don't discuss here about loading the JS or CSS code -- so make sure you
  481. add the proper &lt;script&gt; and &lt;style&gt; or &lt;link&gt; elements in your
  482. HTML code. Also, when we present input fields, please note that they should
  483. be embedded in some form in order for data to be actually sent to server; we
  484. don't discuss these things here because they are not related to our
  485. calendar.</p>
  486. <p>
  487. </p>
  488. <a name="node_sec_3.1"></a>
  489. <h2><a href="#node_toc_node_sec_3.1">3.1&nbsp;&nbsp;Popup calendars</a></h2>
  490. <p>These samples can be found in the file “<tt>simple-1.html</tt>” from the
  491. calendar package.</p>
  492. <p>
  493. </p>
  494. <a name="node_sec_3.1.1"></a>
  495. <h3><a href="#node_toc_node_sec_3.1.1">3.1.1&nbsp;&nbsp;Simple text field with calendar attached to a button</a></h3>
  496. <p></p>
  497. <p>
  498. This piece of code will create a calendar for a simple input field with a
  499. button that will open the calendar when clicked.</p>
  500. <p>
  501. </p>
  502. <pre class=verbatim>&lt;input type=&quot;text&quot; name=&quot;date&quot; id=&quot;f_date_b&quot;
  503. /&gt;&lt;button type=&quot;reset&quot; id=&quot;f_trigger_b&quot;
  504. &gt;...&lt;/button&gt;
  505. &lt;script type=&quot;text/javascript&quot;&gt;
  506. Calendar.setup({
  507. inputField : &quot;f_date_b&quot;, //*
  508. ifFormat : &quot;%m/%d/%Y %I:%M %p&quot;,
  509. showsTime : true,
  510. button : &quot;f_trigger_b&quot;, //*
  511. step : 1
  512. });
  513. &lt;/script&gt;
  514. </pre><p></p>
  515. <p>
  516. Note that this code does more actually; the only <em>required</em> fields are
  517. those marked with “//*” -- that is, the ID of the input field and the ID of
  518. the button need to be passed to <tt>Calendar.setup</tt> in order for the
  519. calendar to be properly assigned to this input field. As one can easily
  520. guess from the argument names, the other arguments configure a certain date
  521. format, instruct the calendar to also include a time selector and display
  522. every year in the drop-down boxes (the “step” parameter) -- instead of showing
  523. every other year as the default calendar does.</p>
  524. <p>
  525. </p>
  526. <a name="node_sec_3.1.2"></a>
  527. <h3><a href="#node_toc_node_sec_3.1.2">3.1.2&nbsp;&nbsp;Simple field with calendar attached to an image</a></h3>
  528. <p>Same as the above, but the element that triggers the calendar is this time
  529. an image, not a button.</p>
  530. <p>
  531. </p>
  532. <pre class=verbatim>&lt;input type=&quot;text&quot; name=&quot;date&quot; id=&quot;f_date_c&quot; readonly=&quot;1&quot; /&gt;
  533. &lt;img src=&quot;img.gif&quot; id=&quot;f_trigger_c&quot;
  534. style=&quot;cursor: pointer; border: 1px solid red;&quot;
  535. title=&quot;Date selector&quot;
  536. onmouseover=&quot;this.style.background='red';&quot;
  537. onmouseout=&quot;this.style.background=''&quot; /&gt;
  538. &lt;script type=&quot;text/javascript&quot;&gt;
  539. Calendar.setup({
  540. inputField : &quot;f_date_c&quot;,
  541. ifFormat : &quot;%B %e, %Y&quot;,
  542. button : &quot;f_trigger_c&quot;,
  543. align : &quot;Tl&quot;,
  544. singleClick : false
  545. });
  546. &lt;/script&gt;
  547. </pre><p></p>
  548. <p>
  549. Note that the same 2 parameters are required as in the previous case; the
  550. difference is that the 'button' parameter now gets the ID of the image
  551. instead of the ID of the button. But the event is the same: at 'onclick' on
  552. the element that is passed as 'button', the calendar will be shown.</p>
  553. <p>
  554. The above code additionally sets an alignment mode -- the parameters are
  555. described in <a href="#node_sec_5.3.11">5.3.11</a>.</p>
  556. <p>
  557. </p>
  558. <a name="node_sec_3.1.3"></a>
  559. <h3><a href="#node_toc_node_sec_3.1.3">3.1.3&nbsp;&nbsp;Hidden field, plain text triggers</a></h3>
  560. <p>Sometimes, to assure that the date is well formatted, you might want not to
  561. allow the end user to write a date manually. This can easily be achieved
  562. with an input field by setting its <tt>readonly</tt> attribute, which is
  563. defined by the HTML4 standard; however, here's an even nicer approach: our
  564. calendar widget allows you to use a hidden field as the way to pass data to
  565. server, and a “display area” to show the end user the selected date. The
  566. “display area” can be any HTML element, such as a DIV or a SPAN or
  567. whatever -- we will use a SPAN in our sample.</p>
  568. <p>
  569. </p>
  570. <pre class=verbatim>&lt;input type=&quot;hidden&quot; name=&quot;date&quot; id=&quot;f_date_d&quot; /&gt;
  571. &lt;p&gt;Your birthday:
  572. &lt;span style=&quot;background-color: #ff8; cursor: default;&quot;
  573. onmouseover=&quot;this.style.backgroundColor='#ff0';&quot;
  574. onmouseout=&quot;this.style.backgroundColor='#ff8';&quot;
  575. id=&quot;show_d&quot;
  576. &gt;Click to open date selector&lt;/span&gt;.&lt;/p&gt;
  577. &lt;script type=&quot;text/javascript&quot;&gt;
  578. Calendar.setup({
  579. inputField : &quot;f_date_d&quot;,
  580. ifFormat : &quot;%Y/%d/%m&quot;,
  581. displayArea : &quot;show_d&quot;,
  582. daFormat : &quot;%A, %B %d, %Y&quot;,
  583. });
  584. &lt;/script&gt;
  585. </pre><p></p>
  586. <p>
  587. The above code will configure a calendar attached to the hidden field and to
  588. the SPAN having the id=“show_d”. When the SPAN element is clicked, the
  589. calendar opens and allows the end user to chose a date. When the date is
  590. chosen, the input field will be updated with the value in the format
  591. “<tt>%Y/%d/%m</tt>”, and the SPAN element will display the date in a
  592. friendlier format (defined by “<tt>daFormat</tt>”).</p>
  593. <p>
  594. Beware that using this approach will make your page unfunctional in browsers
  595. that do not support JavaScript or our calendar.</p>
  596. <p>
  597. </p>
  598. <a name="node_sec_3.1.4"></a>
  599. <h3><a href="#node_toc_node_sec_3.1.4">3.1.4&nbsp;&nbsp;2 Linked fields, no trigger buttons</a></h3>
  600. <p>Supposing you want to create 2 fields that hold an interval of exactly one
  601. week. The first is the starting date, and the second is the ending date.
  602. You want the fields to be automatically updated when some date is clicked in
  603. one or the other, in order to keep exactly one week difference between them.</p>
  604. <p>
  605. </p>
  606. <pre class=verbatim>&lt;input type=&quot;text&quot; name=&quot;date&quot; id=&quot;f_date_a&quot; /&gt;
  607. &lt;input type=&quot;text&quot; name=&quot;date&quot; id=&quot;f_calcdate&quot; /&gt;
  608. &lt;script type=&quot;text/javascript&quot;&gt;
  609. function catcalc(cal) {
  610. var date = cal.date;
  611. var time = date.getTime()
  612. // use the _other_ field
  613. var field = document.getElementById(&quot;f_calcdate&quot;);
  614. if (field == cal.params.inputField) {
  615. field = document.getElementById(&quot;f_date_a&quot;);
  616. time -= Date.WEEK; // substract one week
  617. } else {
  618. time += Date.WEEK; // add one week
  619. }
  620. var date2 = new Date(time);
  621. field.value = date2.print(&quot;%Y-%m-%d %H:%M&quot;);
  622. }
  623. Calendar.setup({
  624. inputField : &quot;f_date_a&quot;,
  625. ifFormat : &quot;%Y-%m-%d %H:%M&quot;,
  626. showsTime : true,
  627. timeFormat : &quot;24&quot;,
  628. onUpdate : catcalc
  629. });
  630. Calendar.setup({
  631. inputField : &quot;f_calcdate&quot;,
  632. ifFormat : &quot;%Y-%m-%d %H:%M&quot;,
  633. showsTime : true,
  634. timeFormat : &quot;24&quot;,
  635. onUpdate : catcalc
  636. });
  637. &lt;/script&gt;
  638. </pre><p></p>
  639. <p>
  640. The above code will configure 2 input fields with calendars attached, as
  641. usual. The first thing to note is that there's no trigger button -- in such
  642. case, the calendar will popup when one clicks into the input field. Using
  643. the <tt>onUpdate</tt> parameter, we pass a reference to a function of ours
  644. that will get called after a date was selected. In that function we
  645. determine what field was updated and we compute the date in the other input
  646. field such that it keeps a one week difference between the two. Enjoy! :-)</p>
  647. <p>
  648. </p>
  649. <a name="node_sec_3.2"></a>
  650. <h2><a href="#node_toc_node_sec_3.2">3.2&nbsp;&nbsp;Flat calendars</a></h2>
  651. <p>This sample can be found in “<tt>simple-2.html</tt>”. It will configure a
  652. flat calendar that is always displayed in the page, in the DIV having the
  653. id=“calendar-container”. When a date is clicked our function hander gets
  654. called (<tt>dateChanged</tt>) and it will compute an URL to jump to based on
  655. the selected date, then use <tt>window.location</tt> to visit the new link.</p>
  656. <p>
  657. </p>
  658. <pre class=verbatim>&lt;div style=&quot;float: right; margin-left: 1em; margin-bottom: 1em;&quot;
  659. id=&quot;calendar-container&quot;&gt;&lt;/div&gt;
  660. &lt;script type=&quot;text/javascript&quot;&gt;
  661. function dateChanged(calendar) {
  662. // Beware that this function is called even if the end-user only
  663. // changed the month/year. In order to determine if a date was
  664. // clicked you can use the dateClicked property of the calendar:
  665. if (calendar.dateClicked) {
  666. // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
  667. var y = calendar.date.getFullYear();
  668. var m = calendar.date.getMonth(); // integer, 0..11
  669. var d = calendar.date.getDate(); // integer, 1..31
  670. // redirect...
  671. window.location = &quot;/&quot; + y + &quot;/&quot; + m + &quot;/&quot; + d + &quot;/index.php&quot;;
  672. }
  673. };
  674. Calendar.setup(
  675. {
  676. flat : &quot;calendar-container&quot;, // ID of the parent element
  677. flatCallback : dateChanged // our callback function
  678. }
  679. );
  680. &lt;/script&gt;
  681. </pre><p></p>
  682. <p>
  683. </p>
  684. <a name="node_sec_3.3"></a>
  685. <h2><a href="#node_toc_node_sec_3.3">3.3&nbsp;&nbsp;Highlight special dates</a></h2>
  686. <p>So you want to display certain dates in a different color, or with bold
  687. font, or whatever, right? Well, no problem -- our calendar can do this as
  688. well. It doesn't matter if it's a flat or popup calendar -- we'll use a flat
  689. one for this sample. The idea, however, is that you need to have the dates
  690. in an array or a JavaScript object -- whatever is suitable for your way of
  691. thinking -- and use it from a function that returns a value, telling the
  692. calendar what kind of date is the passed one.</p>
  693. <p>
  694. Too much talking, here's the code ;-)</p>
  695. <p>
  696. </p>
  697. <pre class=verbatim>&lt;!-- this goes into the &lt;head&gt; tag --&gt;
  698. &lt;style type=&quot;text/css&quot;&gt;
  699. .special { background-color: #000; color: #fff; }
  700. &lt;/style&gt;
  701. &lt;!-- and the rest inside the &lt;body&gt; --&gt;
  702. &lt;div style=&quot;float: right; margin-left: 1em; margin-bottom: 1em;&quot;
  703. id=&quot;calendar-container&quot;&gt;&lt;/div&gt;
  704. &lt;script type=&quot;text/javascript&quot;&gt;
  705. var SPECIAL_DAYS = {
  706. 0 : [ 13, 24 ], // special days in January
  707. 2 : [ 1, 6, 8, 12, 18 ], // special days in March
  708. 8 : [ 21, 11 ] // special days in September
  709. };
  710. function dateIsSpecial(year, month, day) {
  711. var m = SPECIAL_DAYS[month];
  712. if (!m) return false;
  713. for (var i in m) if (m[i] == day) return true;
  714. return false;
  715. };
  716. function dateChanged(calendar) {
  717. // Beware that this function is called even if the end-user only
  718. // changed the month/year. In order to determine if a date was
  719. // clicked you can use the dateClicked property of the calendar:
  720. if (calendar.dateClicked) {
  721. // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
  722. var y = calendar.date.getFullYear();
  723. var m = calendar.date.getMonth(); // integer, 0..11
  724. var d = calendar.date.getDate(); // integer, 1..31
  725. // redirect...
  726. window.location = &quot;/&quot; + y + &quot;/&quot; + m + &quot;/&quot; + d + &quot;/index.php&quot;;
  727. }
  728. };
  729. function ourDateStatusFunc(date, y, m, d) {
  730. if (dateIsSpecial(y, m, d))
  731. return &quot;special&quot;;
  732. else
  733. return false; // other dates are enabled
  734. // return true if you want to disable other dates
  735. };
  736. Calendar.setup(
  737. {
  738. flat : &quot;calendar-container&quot;, // ID of the parent element
  739. flatCallback : dateChanged, // our callback function
  740. dateStatusFunc : ourDateStatusFunc
  741. }
  742. );
  743. &lt;/script&gt;
  744. </pre><p></p>
  745. <p>
  746. So the above code creates a normal flat calendar, like in the previous
  747. sample. We hook into it with the function “<tt>ourDateStatusFunc</tt>”,
  748. which receives a date object as the first argument, and also the year,
  749. month, date as the next 3 arguments (normally, you can extract year, month,
  750. date from the first parameter too, but we pass them separately for
  751. convenience, as it's very likely that they are going to be used in this
  752. function).</p>
  753. <p>
  754. So, this function receives a date. It can return <tt>false</tt> if you want
  755. no special action to be taken on that date, <tt>true</tt> if that date
  756. should be disabled (unselectable), or a string if you want to assign a
  757. special CSS class to that date. We return “special” for the dates that we
  758. want to highlight -- and note that we defined a “special” look for them in
  759. the CSS section.</p>
  760. <p>
  761. I used a simple approach here to define what dates are special. There's a
  762. JavaScript object (the SPECIAL_DAYS global variable) which holds an array
  763. of dates for each month. Month numbers start at zero (January). Months
  764. that don't contain special dates can be absent from this object. Note that
  765. the way to implement this is completely separated from the calendar
  766. code -- therefore, feel free to use your imagination if you have better
  767. ideas. :-)</p>
  768. <p>
  769. </p>
  770. <a name="node_sec_3.4"></a>
  771. <h2><a href="#node_toc_node_sec_3.4">3.4&nbsp;&nbsp;Select multiple dates</a></h2>
  772. <p>Starting version 1.0, the calendar is able to handle multiple dates
  773. selection. You just need to pass the “<tt>multiple</tt>” parameter to
  774. <tt>Calendar.setup</tt> and add some special code that interprets the
  775. selection once the calendar is closed.</p>
  776. <p>
  777. </p>
  778. <pre class=verbatim>&lt;a id=&quot;trigger&quot; href=&quot;#&quot;&gt;[open calendar...]&lt;/a&gt;
  779. &lt;div id=&quot;output&quot;&gt;&lt;/div&gt;
  780. &lt;script type=&quot;text/javascript&quot;&gt;//&lt;![CDATA[
  781. // the default multiple dates selected,
  782. // first time the calendar is displayed
  783. var MA = [];
  784. function closed(cal) {
  785. // here we'll write the output; this is only for example. You
  786. // will normally fill an input field or something with the dates.
  787. var el = document.getElementById(&quot;output&quot;);
  788. // reset initial content.
  789. el.innerHTML = &quot;&quot;;
  790. // Reset the &quot;MA&quot;, in case one triggers the calendar again.
  791. // CAREFUL! You don't want to do &quot;MA = [];&quot;. We need to modify
  792. // the value of the current array, instead of creating a new one.
  793. // Calendar.setup is called only once! :-) So be careful.
  794. MA.length = 0;
  795. // walk the calendar's multiple dates selection hash
  796. for (var i in cal.multiple) {
  797. var d = cal.multiple[i];
  798. // sometimes the date is not actually selected,
  799. // so let's check
  800. if (d) {
  801. // OK, selected. Fill an input field or something.
  802. el.innerHTML += d.print(&quot;%A, %Y %B %d&quot;) + &quot;&lt;br /&gt;&quot;;
  803. // and push it in the &quot;MA&quot;, in case one triggers the calendar again.
  804. MA[MA.length] = d;
  805. }
  806. }
  807. cal.hide();
  808. return true;
  809. };
  810. Calendar.setup({
  811. align : &quot;BR&quot;,
  812. showOthers : true,
  813. multiple : MA, // pass the initial or computed array of multiple dates
  814. onClose : closed,
  815. button : &quot;trigger&quot;
  816. });
  817. //]]&gt;&lt;/script&gt;
  818. </pre><p></p>
  819. <p>
  820. The above code creates a popup calendar and passes to it an array of dates,
  821. which is initially empty, in the “multiple” argument. When the calendar is
  822. closed it will call our “<tt>closed</tt>” function handler; in this handler
  823. we determine what dates were actually selected, inspecting the
  824. “<tt>cal.multiple</tt>” property, we display them in a DIV element right
  825. next to the &lt;a&gt; element that opens the calendar, and we reinitialize the
  826. global array of selected dates (which will be used if the end user opens the
  827. calendar again). I guess the code speaks for itself, right? :-)</p>
  828. <p>
  829. </p>
  830. <a name="node_sec_4"></a>
  831. <h1><a href="#node_toc_node_sec_4">4&nbsp;&nbsp;The Calendar object overview</a></h1>
  832. <p></p>
  833. <p>
  834. Basically you should be able to setup the calendar with the function presented
  835. in the previous section. However, if for some reason <tt>Calendar.setup</tt>
  836. doesn't provide all the functionality that you need and you want to tweak into
  837. the process of creating and configuring the calendar ``by hand'', then this
  838. section is the way to go.</p>
  839. <p>
  840. The file <tt>calendar.js</tt> implements the functionality of the calendar.
  841. All (well, almost all) functions and variables are embedded in the JavaScript
  842. object ``Calendar''.</p>
  843. <p>
  844. You can instantiate a <tt>Calendar</tt> object by calling the constructor, like
  845. this: <tt>var cal = new Calendar(<tt>...</tt>)</tt>. We will discuss the parameters
  846. later. After creating the object, the variable <tt>cal</tt> will contain a
  847. reference to it. You can use this reference to access further options of the
  848. calendar, for instance:</p>
  849. <p>
  850. </p>
  851. <pre class=verbatim>cal.weekNumbers = false; // do not display week numbers
  852. cal.showsTime = true; // include a time selector
  853. cal.setDateFormat(&quot;%Y.%m.%d %H:%M&quot;); // set this format: 2003.12.31 23:59
  854. cal.setDisabledHandler(function(date, year, month, day) {
  855. // verify date and return true if it has to be disabled
  856. // ``date'' is a JS Date object, but if you only need the
  857. // year, month and/or day you can get them separately as
  858. // next 3 parameters, as you can see in the declaration
  859. if (year == 2004) {
  860. // disable all dates from 2004
  861. return true;
  862. }
  863. return false;
  864. });
  865. </pre><p></p>
  866. <p>
  867. etc. Prior to version
  868. 0.9.3 this was the only way to configure it. The <tt>Calendar.setup</tt>
  869. function, documented in section <a href="#node_sec_2">2</a>, basically does the same
  870. things (actually more) in order to setup the calendar, based on the parameters
  871. that you provided.</p>
  872. <p>
  873. </p>
  874. <a name="node_sec_4.1"></a>
  875. <h2><a href="#node_toc_node_sec_4.1">4.1&nbsp;&nbsp;Creating a calendar</a></h2>
  876. <p>The calendar is created by following some steps (even the function
  877. <tt>Calendar.setup</tt>, described in section <a href="#node_sec_2">2</a>, does the
  878. same). While you can skip optional (marked ``opt'') steps if you're happy with
  879. the defaults, please respect the order below.</p>
  880. <p>
  881. </p>
  882. <ol><p>
  883. </p>
  884. <li><p><em>Instantiate</em> a <tt>Calendar</tt> object. Details about this in
  885. section <a href="#node_sec_5.1">5.1</a>.</p>
  886. <p>
  887. </p>
  888. <li><p><b>opt</b>&nbsp;&nbsp; Set the <tt>weekNumbers</tt> property to <tt>false</tt> if you don't want
  889. the calendar to display week numbers.</p>
  890. <p>
  891. </p>
  892. <li><p><b>opt</b>&nbsp;&nbsp; Set the <tt>showsTime</tt> property to <tt>true</tt> if you
  893. want the calendar to also provide a time selector.</p>
  894. <p>
  895. </p>
  896. <li><p><b>opt</b>&nbsp;&nbsp; Set the <tt>time24</tt> property to <tt>false</tt> if you want
  897. the time selector to be in 12-hour format. Default is 24-hour format. This
  898. property only has effect if you also set <tt>showsTime</tt> to
  899. <tt>true</tt>.</p>
  900. <p>
  901. </p>
  902. <li><p><b>opt</b>&nbsp;&nbsp; Set the range of years available for selection (see section
  903. <a href="#node_sec_5.3.15">5.3.15</a>). The default range is [1970..2050].</p>
  904. <p>
  905. </p>
  906. <li><p><b>opt</b>&nbsp;&nbsp; Set the <tt>getDateStatus</tt> property. You should pass
  907. here a function that receives a JavaScript <tt>Date</tt> object and returns
  908. <tt>true</tt> if the given date should be disabled, false otherwise (details in
  909. section <a href="#node_sec_5.3.7">5.3.7</a>).</p>
  910. <p>
  911. </p>
  912. <li><p><b>opt</b>&nbsp;&nbsp; Set a date format. Your handler function, passed to the
  913. calendar constructor, will be called when a date is selected with a reference
  914. to the calendar and a date string in this format.</p>
  915. <p>
  916. </p>
  917. <li><p><em>Create</em> the HTML elements related to the calendar. This step
  918. practically puts the calendar in your HTML page. You simply call
  919. <tt>Calendar.create()</tt>. You can give an optional parameter if you wanna
  920. create a flat calendar (details in section <a href="#node_sec_5.3.1">5.3.1</a>).</p>
  921. <p>
  922. </p>
  923. <li><p><b>opt</b>&nbsp;&nbsp; Initialize the calendar to a certain date, for instance from
  924. the input field.</p>
  925. <p>
  926. </p>
  927. <li><p>Show the calendar (details in section <a href="#node_sec_5.3.9">5.3.9</a>).</p>
  928. <p>
  929. </p>
  930. </ol><p></p>
  931. <p>
  932. </p>
  933. <a name="node_sec_4.2"></a>
  934. <h2><a href="#node_toc_node_sec_4.2">4.2&nbsp;&nbsp;Order does matter ;-)</a></h2>
  935. <p>As you could see in the previous section, there are more steps to be followed
  936. in order to setup the calendar. This happens because there are two different
  937. things that need to be accomplished: first there is the JavaScript object, that
  938. is created with <tt>new Calendar(<tt>...</tt>)</tt>. Secondly there are the HTML
  939. elements that actually lets you see and manipulate the calendar.</p>
  940. <p>
  941. </p>
  942. <span class=small>[ Those that did UI<a name="call_footnote_Temp_5"></a><a href="#footnote_Temp_5"><sup><small>4</small></sup></a> programming, no matter in what
  943. language and on what platform, may be familiar with this concept. First there
  944. is the object in memory that lets you manipulate the UI element, and secondly
  945. there is the UI element (known as ``control'', ``window'', ``widget'', etc.),
  946. also in memory but you don't usually access it directly. ]
  947. </span><p>
  948. By instantiating the calendar we create the JavaScript object. It lets us
  949. configure some properties and it also knows how to create the UI element (the
  950. HTML elements actually) that will eventually be what the end-user sees on
  951. screen. Creation of the HTML element is accomplished by the function
  952. <tt>Calendar.create</tt>. It knows how to create popup or flat calendars.
  953. This function is described in section <a href="#node_sec_5.3.1">5.3.1</a>.</p>
  954. <p>
  955. Some properties need to be set prior to creating the HTML elements, because
  956. otherwise they wouldn't have any effect. Such a property is
  957. <tt>weekNumbers</tt> -- it has the default value ``true'', and if you don't
  958. want the calendar to display the week numbers you have to set it to false. If,
  959. however, you do that <em>after</em> calling <tt>Calendar.create</tt> the calendar
  960. would still display the week numbers, because the HTML elements are already
  961. created (including the <tt>&lt;td&gt;</tt>-s in the <tt>&lt;table&gt;</tt> element that
  962. should contain the week numbers). For this reason the order of the steps above
  963. is important.</p>
  964. <p>
  965. Another example is when you want to show the calendar. The ``create'' function
  966. does create the HTML elements, but they are initially hidden (have the style
  967. ``display: none'') unless the calendar is a flat calendar that should be always
  968. visible in the page. Obviously, the <tt>Calendar.show</tt> function should be
  969. called <em>after</em> calling <tt>Calendar.create</tt>.</p>
  970. <p>
  971. </p>
  972. <a name="node_sec_4.3"></a>
  973. <h2><a href="#node_toc_node_sec_4.3">4.3&nbsp;&nbsp;Caching the object</a></h2>
  974. <p>Suppose the end-user has popped up a calendar and selects a date. The calendar
  975. then closes. What really happens now?</p>
  976. <p>
  977. There are two approaches. The first (used in very old versions of the
  978. calendar) was to drop completely the Calendar object and when the end-user pops
  979. up the calendar again to create another one. This approach is bad for more
  980. reasons:</p>
  981. <p>
  982. </p>
  983. <ul><p>
  984. </p>
  985. <li><p>creating the JavaScript object and HTML elements is time-consuming</p>
  986. <p>
  987. </p>
  988. <li><p>we may loose some end-user preferences (i.e. he might prefer to have
  989. Monday for the first day of week and probably already clicked it the first time
  990. when the calendar was opened, but now he has to do it again)</p>
  991. <p>
  992. </p>
  993. </ul><p></p>
  994. <p>
  995. The second approach, implemented by the <tt>Calendar.setup</tt> function, is to
  996. cache the JavaScript object. It does this by checking the global variable
  997. <tt>window.calendar</tt> and if it is not null it assumes it is the created
  998. Calendar object. When the end-user closes the calendar, our code will only
  999. call ``<tt>hide</tt>'' on it, therefore keeping the JavaScript object and the
  1000. HTML elements in place.</p>
  1001. <p>
  1002. <font color="red">CAVEAT:</font> &nbsp;&nbsp;&nbsp;&nbsp;Since time selection support was introduced, this
  1003. ``object caching'' mechanism has the following drawback: if you once created
  1004. the calendar with the time selection support, then other items that may not
  1005. require this functionality will still get a calendar with the time selection
  1006. support enabled. And reciprocal. ;-) Hopefully this will be corrected in a
  1007. later version, but for now it doesn't seem such a big problem.</p>
  1008. <p>
  1009. </p>
  1010. <a name="node_sec_4.4"></a>
  1011. <h2><a href="#node_toc_node_sec_4.4">4.4&nbsp;&nbsp;Callback functions</a></h2>
  1012. <p>You might rightfully wonder how is the calendar related to the input field?
  1013. Who tells it that it has to update <em>that</em> input field when a date is
  1014. selected, or that it has to jump to <em>that</em> URL when a date is clicked in
  1015. flat mode?</p>
  1016. <p>
  1017. All this magic is done through callback functions. The calendar doesn't know
  1018. anything about the existence of an input field, nor does it know where to
  1019. redirect the browser when a date is clicked in flat mode. It just calls your
  1020. callback when a particular event is happening, and you're responsible to handle
  1021. it from there. For a general purpose library I think this is the best model of
  1022. making a truly reusable thing.</p>
  1023. <p>
  1024. The calendar supports the following user callbacks:</p>
  1025. <p>
  1026. </p>
  1027. <ul><p>
  1028. </p>
  1029. <li><p><b>onSelect</b>&nbsp;&nbsp; -- this gets called when the end-user changes the date in the
  1030. calendar. Documented in section <a href="#node_sec_5.1">5.1</a>.</p>
  1031. <p>
  1032. </p>
  1033. <li><p><b>onClose</b>&nbsp;&nbsp; -- this gets called when the calendar should close. It's
  1034. user's responsibility to close the calendar. Details in section
  1035. <a href="#node_sec_5.1">5.1</a>.</p>
  1036. <p>
  1037. </p>
  1038. <li><p><b>getDateStatus</b>&nbsp;&nbsp; -- this function gets called for any day in a month,
  1039. just before displaying the month. It is called with a JavaScript <tt>Date</tt>
  1040. object and should return <tt>true</tt> if that date should be disabled, false
  1041. if it's an ordinary date and no action should be taken, or it can return a
  1042. string in which case the returned value will be appended to the element's CSS
  1043. class (this way it provides a powerful way to make some dates ``special'',
  1044. i.e. highlight them differently). Details in section
  1045. <a href="#node_sec_5.3.8">5.3.8</a>.</p>
  1046. <p>
  1047. </p>
  1048. </ul><p></p>
  1049. <p>
  1050. </p>
  1051. <a name="node_sec_5"></a>
  1052. <h1><a href="#node_toc_node_sec_5">5&nbsp;&nbsp;The Calendar object API reference</a></h1>
  1053. <p></p>
  1054. <p>
  1055. </p>
  1056. <a name="node_sec_5.1"></a>
  1057. <h2><a href="#node_toc_node_sec_5.1">5.1&nbsp;&nbsp;<tt>Calendar</tt> constructor</a></h2>
  1058. <p></p>
  1059. <p>
  1060. Synopsis:</p>
  1061. <p>
  1062. </p>
  1063. <pre class=verbatim>var calendar = Calendar(firstDayOfWeek, date, onSelect, onClose);
  1064. </pre><p></p>
  1065. <p>
  1066. Parameters are as follows:</p>
  1067. <p>
  1068. </p>
  1069. <ul><p>
  1070. </p>
  1071. <li><p><b>firstDayOfWeek</b>&nbsp;&nbsp; -- specifies which day is to be displayed as the first
  1072. day of week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday,
  1073. ..., 6 means Saturday.</p>
  1074. <p>
  1075. </p>
  1076. <li><p><b>date</b>&nbsp;&nbsp; -- a JavaScript Date object or <tt>null</tt>. If <tt>null</tt>
  1077. is passed then the calendar will default to today date. Otherwise it will
  1078. initialize on the given date.</p>
  1079. <p>
  1080. </p>
  1081. <li><p><b>onSelect</b>&nbsp;&nbsp; -- your callback for the ``onChange'' event. See above.</p>
  1082. <p>
  1083. </p>
  1084. <li><p><b>onClose</b>&nbsp;&nbsp; -- your callback for the ``onClose'' event. See above.</p>
  1085. <p>
  1086. </p>
  1087. </ul><p></p>
  1088. <p>
  1089. </p>
  1090. <a name="node_sec_Temp_6"></a>
  1091. <h3><a href="#node_toc_node_sec_Temp_6">The <tt>onSelect</tt> event</a></h3>
  1092. <p></p>
  1093. <p>
  1094. Here is a typical implementation of this function:</p>
  1095. <p>
  1096. </p>
  1097. <pre class=verbatim>function onSelect(calendar, date) {
  1098. var input_field = document.getElementById(&quot;date&quot;);
  1099. input_field.value = date;
  1100. };
  1101. </pre><p></p>
  1102. <p>
  1103. <tt>date</tt> is in the format selected with <tt>calendar.setDateFormat</tt>
  1104. (see section <a href="#node_sec_5.3.5">5.3.5</a>). This code simply updates the
  1105. input field. If you want the calendar to be in single-click mode then you
  1106. should also close the calendar after you updated the input field, so we come to
  1107. the following version:</p>
  1108. <p>
  1109. </p>
  1110. <pre class=verbatim>function onSelect(calendar, date) {
  1111. var input_field = document.getElementById(&quot;date&quot;);
  1112. input_field.value = date;
  1113. if (calendar.dateClicked) {
  1114. calendar.callCloseHandler(); // this calls &quot;onClose&quot; (see above)
  1115. }
  1116. };
  1117. </pre><p></p>
  1118. <p>
  1119. Note that we checked the member variable <tt>dateClicked</tt> and
  1120. only hide the calendar if it's <tt>true</tt>. If this variable is <tt>false</tt> it
  1121. means that no date was actually selected, but the user only changed the
  1122. month/year using the navigation buttons or the menus. We don't want to hide
  1123. the calendar in that case.</p>
  1124. <p>
  1125. </p>
  1126. <a name="node_sec_Temp_7"></a>
  1127. <h3><a href="#node_toc_node_sec_Temp_7">The <tt>onClose</tt> event</a></h3>
  1128. <p></p>
  1129. <p>
  1130. This event is triggered when the calendar should close. It should hide or
  1131. destroy the calendar object -- the calendar itself just triggers the event, but
  1132. it won't close itself.</p>
  1133. <p>
  1134. A typical implementation of this function is the following:</p>
  1135. <p>
  1136. </p>
  1137. <pre class=verbatim>function onClose(calendar) {
  1138. calendar.hide();
  1139. // or calendar.destroy();
  1140. };
  1141. </pre><p></p>
  1142. <p>
  1143. </p>
  1144. <a name="node_sec_5.2"></a>
  1145. <h2><a href="#node_toc_node_sec_5.2">5.2&nbsp;&nbsp;Useful member variables (properties)</a></h2>
  1146. <p></p>
  1147. <p>
  1148. After creating the Calendar object you can access the following properties:</p>
  1149. <p>
  1150. </p>
  1151. <ul><p>
  1152. </p>
  1153. <li><p><tt>date</tt> -- is a JavaScript <tt>Date</tt> object. It will always
  1154. reflect the date shown in the calendar (yes, even if the calendar is hidden).</p>
  1155. <p>
  1156. </p>
  1157. <li><p><tt>isPopup</tt> -- if this is true then the current Calendar object is
  1158. a popup calendar. Otherwise (false) we have a flat calendar. This variable is
  1159. set from <tt>Calendar.create</tt> and has no meaning before this function was
  1160. called.</p>
  1161. <p>
  1162. </p>
  1163. <li><p><tt>dateClicked</tt> -- particularly useful in the <tt>onSelect</tt>
  1164. handler, this variable tells us if a date was really clicked. That's because
  1165. the <tt>onSelect</tt> handler is called even if the end-user only changed the
  1166. month/year but did not select a date. We don't want to close the calendar in
  1167. that case.</p>
  1168. <p>
  1169. </p>
  1170. <li><p><tt>weekNumbers</tt> -- if <tt>true</tt> (default) then the calendar
  1171. displays week numbers. If you don't want week numbers you have to set this
  1172. variable to <tt>false</tt> <em>before</em> calling <tt>Calendar.create</tt>.</p>
  1173. <p>
  1174. </p>
  1175. <li><p><tt>showsTime</tt> - if you set this to <tt>true</tt> (it is
  1176. <tt>false</tt> by default) then the calendar will also include a time selector.</p>
  1177. <p>
  1178. </p>
  1179. <li><p><tt>time24</tt> - if you set this to <tt>false</tt> then the time
  1180. selector will be in 12-hour format. It is in 24-hour format by default.</p>
  1181. <p>
  1182. </p>
  1183. <li><p><tt>firstDayOfWeek</tt> -- specifies the first day of week (0 to 6, pass
  1184. 0 for Sunday, 1 for Monday, ..., 6 for Saturday). This variable is set from
  1185. constructor, but you still have a chance to modify it <em>before</em> calling
  1186. <tt>Calendar.create</tt>.</p>
  1187. <p>
  1188. </p>
  1189. </ul><p></p>
  1190. <p>
  1191. There are lots of other member variables, but one should access them only
  1192. through member functions so I won't document them here.</p>
  1193. <p>
  1194. </p>
  1195. <a name="node_sec_5.3"></a>
  1196. <h2><a href="#node_toc_node_sec_5.3">5.3&nbsp;&nbsp;Public methods</a></h2>
  1197. <p></p>
  1198. <a name="node_sec_5.3.1"></a>
  1199. <h3><a href="#node_toc_node_sec_5.3.1">5.3.1&nbsp;&nbsp;<tt>Calendar.create</tt></a></h3>
  1200. <p></p>
  1201. <p>
  1202. This function creates the afferent HTML elements that are needed to display the
  1203. calendar. You should call it after setting the calendar properties. Synopsis:
  1204. </p>
  1205. <pre class=verbatim>calendar.create(); // creates a popup calendar
  1206. // -- or --
  1207. calendar.create(document.getElementById(parent_id)); // makes a flat calendar
  1208. </pre><p></p>
  1209. <p>
  1210. It can create a popup calendar or a flat calendar. If the ``parent'' argument
  1211. is present (it should be a <em>reference</em> -- not ID -- to an HTML element) then
  1212. a flat calendar is created and it is inserted in the given element.</p>
  1213. <p>
  1214. At any moment, given a reference to a calendar object, we can inspect if it's a
  1215. popup or a flat calendar by checking the boolean member variable
  1216. <tt>isPopup</tt>:</p>
  1217. <p>
  1218. </p>
  1219. <pre class=verbatim>if (calendar.isPopup) {
  1220. // this is a popup calendar
  1221. } else {
  1222. // this is a flat calendar
  1223. }
  1224. </pre><p></p>
  1225. <p>
  1226. </p>
  1227. <a name="node_sec_5.3.2"></a>
  1228. <h3><a href="#node_toc_node_sec_5.3.2">5.3.2&nbsp;&nbsp;<tt>Calendar.callHandler</tt></a></h3>
  1229. <p></p>
  1230. <p>
  1231. This function calls the first user callback (the
  1232. <tt>onSelect</tt> handler) with the required parameters.</p>
  1233. <p>
  1234. </p>
  1235. <a name="node_sec_5.3.3"></a>
  1236. <h3><a href="#node_toc_node_sec_5.3.3">5.3.3&nbsp;&nbsp;<tt>Calendar.callCloseHandler</tt></a></h3>
  1237. <p></p>
  1238. <p>
  1239. This function calls the second user callback (the
  1240. <tt>onClose</tt> handler). It's useful when you want to have a
  1241. ``single-click'' calendar -- just call this in your <tt>onSelect</tt> handler,
  1242. if a date was clicked.</p>
  1243. <p>
  1244. </p>
  1245. <a name="node_sec_5.3.4"></a>
  1246. <h3><a href="#node_toc_node_sec_5.3.4">5.3.4&nbsp;&nbsp;<tt>Calendar.hide</tt></a></h3>
  1247. <p></p>
  1248. <p>
  1249. Call this function to hide the calendar. The calendar object and HTML elements
  1250. will not be destroyed, thus you can later call one of the <tt>show</tt>
  1251. functions on the same element.</p>
  1252. <p>
  1253. </p>
  1254. <a name="node_sec_5.3.5"></a>
  1255. <h3><a href="#node_toc_node_sec_5.3.5">5.3.5&nbsp;&nbsp;<tt>Calendar.setDateFormat</tt></a></h3>
  1256. <p></p>
  1257. <p>
  1258. This function configures the format in which the calendar reports the date to
  1259. your ``onSelect'' handler. Call it like this:</p>
  1260. <p>
  1261. </p>
  1262. <pre class=verbatim>calendar.setDateFormat(&quot;%y/%m/%d&quot;);
  1263. </pre><p></p>
  1264. <p>
  1265. As you can see, it receives only one parameter, the required format. The magic
  1266. characters are the following:</p>
  1267. <p>
  1268. </p>
  1269. <table border=0><tr><td valign=top ></td></tr>
  1270. <tr><td valign=top ><tt>%a</tt> </td><td valign=top >abbreviated weekday name </td></tr>
  1271. <tr><td valign=top ><tt>%A</tt> </td><td valign=top >full weekday name </td></tr>
  1272. <tr><td valign=top ><tt>%b</tt> </td><td valign=top >abbreviated month name </td></tr>
  1273. <tr><td valign=top ><tt>%B</tt> </td><td valign=top >full month name </td></tr>
  1274. <tr><td valign=top ><tt>%C</tt> </td><td valign=top >century number </td></tr>
  1275. <tr><td valign=top ><tt>%d</tt> </td><td valign=top >the day of the month ( 00 .. 31 ) </td></tr>
  1276. <tr><td valign=top ><tt>%e</tt> </td><td valign=top >the day of the month ( 0 .. 31 ) </td></tr>
  1277. <tr><td valign=top ><tt>%H</tt> </td><td valign=top >hour ( 00 .. 23 ) </td></tr>
  1278. <tr><td valign=top ><tt>%I</tt> </td><td valign=top >hour ( 01 .. 12 ) </td></tr>
  1279. <tr><td valign=top ><tt>%j</tt> </td><td valign=top >day of the year ( 000 .. 366 ) </td></tr>
  1280. <tr><td valign=top ><tt>%k</tt> </td><td valign=top >hour ( 0 .. 23 ) </td></tr>
  1281. <tr><td valign=top ><tt>%l</tt> </td><td valign=top >hour ( 1 .. 12 ) </td></tr>
  1282. <tr><td valign=top ><tt>%m</tt> </td><td valign=top >month ( 01 .. 12 ) </td></tr>
  1283. <tr><td valign=top ><tt>%M</tt> </td><td valign=top >minute ( 00 .. 59 ) </td></tr>
  1284. <tr><td valign=top ><tt>%n</tt> </td><td valign=top >a newline character </td></tr>
  1285. <tr><td valign=top ><tt>%p</tt> </td><td valign=top >``PM'' or ``AM'' </td></tr>
  1286. <tr><td valign=top ><tt>%P</tt> </td><td valign=top >``pm'' or ``am'' </td></tr>
  1287. <tr><td valign=top ><tt>%S</tt> </td><td valign=top >second ( 00 .. 59 ) </td></tr>
  1288. <tr><td valign=top ><tt>%s</tt> </td><td valign=top >number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC) </td></tr>
  1289. <tr><td valign=top ><tt>%t</tt> </td><td valign=top >a tab character </td></tr>
  1290. <tr><td valign=top ><tt>%U, %W, %V</tt> </td><td valign=top >the week number</td></tr>
  1291. <tr><td valign=top ><tt>%u</tt> </td><td valign=top >the day of the week ( 1 .. 7, 1 = MON )</td></tr>
  1292. <tr><td valign=top ><tt>%w</tt> </td><td valign=top >the day of the week ( 0 .. 6, 0 = SUN )</td></tr>
  1293. <tr><td valign=top ><tt>%y</tt> </td><td valign=top >year without the century ( 00 .. 99 )</td></tr>
  1294. <tr><td valign=top ><tt>%Y</tt> </td><td valign=top >year including the century ( ex. 1979 )</td></tr>
  1295. <tr><td valign=top ><tt>%%</tt> </td><td valign=top >a literal <tt>%</tt> character
  1296. </td></tr></table><p>
  1297. There are more algorithms for computing the week number. All
  1298. three specifiers currently implement the same one, as defined by ISO 8601:
  1299. ``the week 01 is the week that has the Thursday in the current year, which is
  1300. equivalent to the week that contains the fourth day of January. Weeks start on
  1301. Monday.''</p>
  1302. <p>
  1303. </p>
  1304. <a name="node_sec_5.3.6"></a>
  1305. <h3><a href="#node_toc_node_sec_5.3.6">5.3.6&nbsp;&nbsp;<tt>Calendar.setTtDateFormat</tt></a></h3>
  1306. <p></p>
  1307. <p>
  1308. Has the same prototype as <tt>Calendar.setDateFormat</tt>, but refers to the
  1309. format of the date displayed in the ``status bar'' when the mouse is over some
  1310. date.</p>
  1311. <p>
  1312. </p>
  1313. <a name="node_sec_5.3.7"></a>
  1314. <h3><a href="#node_toc_node_sec_5.3.7">5.3.7&nbsp;&nbsp;<tt>Calendar.setDisabledHandler</tt></a></h3>
  1315. <p></p>
  1316. <p>
  1317. This function allows you to specify a callback function that checks if a
  1318. certain date must be disabled by the calendar. You are responsible to write
  1319. the callback function. Synopsis:</p>
  1320. <p>
  1321. </p>
  1322. <pre class=verbatim>function disallowDate(date) {
  1323. // date is a JS Date object
  1324. if ( date.getFullYear() == 2003 &amp;&amp;
  1325. date.getMonth() == 6 /* July, it's zero-based */ &amp;&amp;
  1326. date.getDate() == 5 ) {
  1327. return true; // disable July 5 2003
  1328. }
  1329. return false; // enable other dates
  1330. };
  1331. calendar.setDisabledHandler(disallowDate);
  1332. </pre><p></p>
  1333. <p>
  1334. If you change this function in ``real-time'', meaning, without creating a new
  1335. calendar, then you have to call <tt>calendar.refresh()</tt> to make it
  1336. redisplay the month and take into account the new disabledHandler.
  1337. <tt>Calendar.setup</tt> does this, so you have no such trouble with it.</p>
  1338. <p>
  1339. Note that <tt>disallowDate</tt> should be very fast, as it is called for each
  1340. date in the month. Thus, it gets called, say, 30 times before displaying the
  1341. calendar, and 30 times when the month is changed. Tests I've done so far show
  1342. that it's still good, but in the future I might switch it to a different design
  1343. (for instance, to call it once per month and to return an array of dates that
  1344. must be disabled).</p>
  1345. <p>
  1346. This function should be considered deprecated in the favor of
  1347. <tt>Calendar.setDateStatusHandler</tt>, described below.</p>
  1348. <p>
  1349. </p>
  1350. <a name="node_sec_5.3.8"></a>
  1351. <h3><a href="#node_toc_node_sec_5.3.8">5.3.8&nbsp;&nbsp;<tt>Calendar.setDateStatusHandler</tt></a></h3>
  1352. <p></p>
  1353. <p>
  1354. This function obsoletes <tt>Calendar.setDisabledHandler</tt>. You call it with
  1355. a function parameter, but this function can return a boolean
  1356. <em>or a string</em>. If the return value is a boolean (<tt>true</tt> or
  1357. <tt>false</tt>) then it behaves just like <tt>setDisabledHandler</tt>,
  1358. therefore disabling the date if the return value is <tt>true</tt>.</p>
  1359. <p>
  1360. If the returned value is a string then the given date will gain an additional
  1361. CSS class, namely the returned value. You can use this to highlight some dates
  1362. in some way. Note that you are responsible for defining the CSS class that you
  1363. return. If you return the string ``disabled'' then that date will be disabled,
  1364. just as if you returned <tt>true</tt>.</p>
  1365. <p>
  1366. Here is a simple scenario that shows what you can do with this function. The
  1367. following should be present in some of your styles, or in the document head in
  1368. a STYLE tag (but put it <em>after</em> the place where the calendar styles were
  1369. loaded):</p>
  1370. <p>
  1371. </p>
  1372. <pre class=verbatim>.special { background-color: #000; color: #fff; }
  1373. </pre><p></p>
  1374. <p>
  1375. And you would use the following code before calling <tt>Calendar.create()</tt>:</p>
  1376. <p>
  1377. </p>
  1378. <pre class=verbatim>// this table holds your special days, so that we can automatize
  1379. // things a bit:
  1380. var SPECIAL_DAYS = {
  1381. 0 : [ 13, 24 ], // special days in January
  1382. 2 : [ 1, 6, 8, 12, 18 ], // special days in March
  1383. 8 : [ 21, 11 ], // special days in September
  1384. 11 : [ 25, 28 ] // special days in December
  1385. };
  1386. // this function returns true if the passed date is special
  1387. function dateIsSpecial(year, month, day) {
  1388. var m = SPECIAL_DAYS[month];
  1389. if (!m) return false;
  1390. for (var i in m) if (m[i] == day) return true;
  1391. return false;
  1392. }
  1393. // this is the actual date status handler. Note that it receives the
  1394. // date object as well as separate values of year, month and date, for
  1395. // your confort.
  1396. function dateStatusHandler(date, y, m, d) {
  1397. if (dateIsSpecial(y, m, d)) return ``special'';
  1398. else return false;
  1399. // return true above if you want to disable other dates
  1400. }
  1401. // configure it to the calendar
  1402. calendar.setDateStatusHandler(dateStatusHandler);
  1403. </pre><p></p>
  1404. <p>
  1405. The above code adds the ``special'' class name to some dates that are defined
  1406. in the SPECIAL_DAYS table. Other dates will simply be displayed as default,
  1407. enabled.</p>
  1408. <p>
  1409. </p>
  1410. <a name="node_sec_5.3.9"></a>
  1411. <h3><a href="#node_toc_node_sec_5.3.9">5.3.9&nbsp;&nbsp;<tt>Calendar.show</tt></a></h3>
  1412. <p></p>
  1413. <p>
  1414. Call this function do show the calendar. It basically sets the CSS ``display''
  1415. property to ``block''. It doesn't modify the calendar position.</p>
  1416. <p>
  1417. This function only makes sense when the calendar is in popup mode.</p>
  1418. <p>
  1419. </p>
  1420. <a name="node_sec_5.3.10"></a>
  1421. <h3><a href="#node_toc_node_sec_5.3.10">5.3.10&nbsp;&nbsp;<tt>Calendar.showAt</tt></a></h3>
  1422. <p></p>
  1423. <p>
  1424. Call this to show the calendar at a certain (x, y) position. Prototype:</p>
  1425. <p>
  1426. </p>
  1427. <pre class=verbatim>calendar.showAt(x, y);
  1428. </pre><p></p>
  1429. <p>
  1430. The parameters are absolute coordinates relative to the top left
  1431. corner <em>of the page</em>, thus they are <em>page</em> coordinates not screen
  1432. coordinates.</p>
  1433. <p>
  1434. After setting the given coordinates it calls Calendar.show. This function only
  1435. makes sense when the calendar is in popup mode.</p>
  1436. <p>
  1437. </p>
  1438. <a name="node_sec_5.3.11"></a>
  1439. <h3><a href="#node_toc_node_sec_5.3.11">5.3.11&nbsp;&nbsp;<tt>Calendar.showAtElement</tt></a></h3>
  1440. <p></p>
  1441. <p>
  1442. This function is useful if you want to display the calendar near some element.
  1443. You call it like this:</p>
  1444. <p>
  1445. </p>
  1446. <pre class=verbatim>calendar.showAtElement(element, align);
  1447. </pre><p></p>
  1448. <p>
  1449. where element is a reference to your element (for instance it can be the input
  1450. field that displays the date) and align is an optional parameter, of type string,
  1451. containing one or two characters. For instance, if you pass <tt>&quot;Br&quot;</tt> as
  1452. align, the calendar will appear <em>below</em> the element and with its right
  1453. margin continuing the element's right margin.</p>
  1454. <p>
  1455. As stated above, align may contain one or two characters. The first character
  1456. dictates the vertical alignment, relative to the element, and the second
  1457. character dictates the horizontal alignment. If the second character is
  1458. missing it will be assumed <tt>&quot;l&quot;</tt> (the left margin of the calendar will
  1459. be at the same horizontal position as the left margin of the element).</p>
  1460. <p>
  1461. The characters given for the align parameters are case sensitive. This
  1462. function only makes sense when the calendar is in popup mode. After computing
  1463. the position it uses <tt>Calendar.showAt</tt> to display the calendar there.</p>
  1464. <p>
  1465. </p>
  1466. <a name="node_sec_Temp_8"></a>
  1467. <h4><a href="#node_toc_node_sec_Temp_8">Vertical alignment</a></h4>
  1468. <p>The first character in ``<tt>align</tt>'' can take one of the following values:</p>
  1469. <p>
  1470. </p>
  1471. <ul><p>
  1472. </p>
  1473. <li><p><tt>T</tt> -- completely above the reference element (bottom margin of
  1474. the calendar aligned to the top margin of the element).</p>
  1475. <p>
  1476. </p>
  1477. <li><p><tt>t</tt> -- above the element but may overlap it (bottom margin of the calendar aligned to
  1478. the bottom margin of the element).</p>
  1479. <p>
  1480. </p>
  1481. <li><p><tt>c</tt> -- the calendar displays vertically centered to the reference
  1482. element. It might overlap it (that depends on the horizontal alignment).</p>
  1483. <p>
  1484. </p>
  1485. <li><p><tt>b</tt> -- below the element but may overlap it (top margin of the calendar aligned to
  1486. the top margin of the element).</p>
  1487. <p>
  1488. </p>
  1489. <li><p><tt>B</tt> -- completely below the element (top margin of the calendar
  1490. aligned to the bottom margin of the element).</p>
  1491. <p>
  1492. </p>
  1493. </ul><p></p>
  1494. <p>
  1495. </p>
  1496. <a name="node_sec_Temp_9"></a>
  1497. <h4><a href="#node_toc_node_sec_Temp_9">Horizontal alignment</a></h4>
  1498. <p>The second character in ``<tt>align</tt>'' can take one of the following values:</p>
  1499. <p>
  1500. </p>
  1501. <ul><p>
  1502. </p>
  1503. <li><p><tt>L</tt> -- completely to the left of the reference element (right
  1504. margin of the calendar aligned to the left margin of the element).</p>
  1505. <p>
  1506. </p>
  1507. <li><p><tt>l</tt> -- to the left of the element but may overlap it (left margin
  1508. of the calendar aligned to the left margin of the element).</p>
  1509. <p>
  1510. </p>
  1511. <li><p><tt>c</tt> -- horizontally centered to the element. Might overlap it,
  1512. depending on the vertical alignment.</p>
  1513. <p>
  1514. </p>
  1515. <li><p><tt>r</tt> -- to the right of the element but may overlap it (right
  1516. margin of the calendar aligned to the right margin of the element).</p>
  1517. <p>
  1518. </p>
  1519. <li><p><tt>R</tt> -- completely to the right of the element (left margin of the
  1520. calendar aligned to the right margin of the element).</p>
  1521. <p>
  1522. </p>
  1523. </ul><p></p>
  1524. <p>
  1525. </p>
  1526. <a name="node_sec_Temp_10"></a>
  1527. <h4><a href="#node_toc_node_sec_Temp_10">Default values</a></h4>
  1528. <p>If the ``<tt>align</tt>'' parameter is missing the calendar will choose
  1529. ``<tt>Br</tt>''.</p>
  1530. <p>
  1531. </p>
  1532. <a name="node_sec_5.3.12"></a>
  1533. <h3><a href="#node_toc_node_sec_5.3.12">5.3.12&nbsp;&nbsp;<tt>Calendar.setDate</tt></a></h3>
  1534. <p></p>
  1535. <p>
  1536. Receives a JavaScript <tt>Date</tt> object. Sets the given date in the
  1537. calendar. If the calendar is visible the new date is displayed immediately.</p>
  1538. <p>
  1539. </p>
  1540. <pre class=verbatim>calendar.setDate(new Date()); // go today
  1541. </pre><p></p>
  1542. <p>
  1543. </p>
  1544. <a name="node_sec_5.3.13"></a>
  1545. <h3><a href="#node_toc_node_sec_5.3.13">5.3.13&nbsp;&nbsp;<tt>Calendar.setFirstDayOfWeek</tt></a></h3>
  1546. <p></p>
  1547. <p>
  1548. Changes the first day of week. The parameter has to be a numeric value ranging
  1549. from 0 to 6. Pass 0 for Sunday, 1 for Monday, ..., 6 for Saturday.</p>
  1550. <p>
  1551. </p>
  1552. <pre class=verbatim>calendar.setFirstDayOfWeek(5); // start weeks on Friday
  1553. </pre><p></p>
  1554. <p>
  1555. </p>
  1556. <a name="node_sec_5.3.14"></a>
  1557. <h3><a href="#node_toc_node_sec_5.3.14">5.3.14&nbsp;&nbsp;<tt>Calendar.parseDate</tt></a></h3>
  1558. <p></p>
  1559. <p>
  1560. Use this function to parse a date given as string and to move the calendar to
  1561. that date.</p>
  1562. <p>
  1563. The algorithm tries to parse the date according to the format that was
  1564. previously set with <tt>Calendar.setDateFormat</tt>; if that fails, it still
  1565. tries to get some valid date out of it (it doesn't read your thoughts, though).</p>
  1566. <p>
  1567. </p>
  1568. <pre class=verbatim>calendar.parseDate(&quot;2003/07/06&quot;);
  1569. </pre><p></p>
  1570. <p>
  1571. </p>
  1572. <a name="node_sec_5.3.15"></a>
  1573. <h3><a href="#node_toc_node_sec_5.3.15">5.3.15&nbsp;&nbsp;<tt>Calendar.setRange</tt></a></h3>
  1574. <p></p>
  1575. <p>
  1576. Sets the range of years that are allowed in the calendar. Synopsis:</p>
  1577. <p>
  1578. </p>
  1579. <pre class=verbatim>calendar.setRange(1970, 2050);
  1580. </pre><p></p>
  1581. <p>
  1582. </p>
  1583. <a name="node_sec_6"></a>
  1584. <h1><a href="#node_toc_node_sec_6">6&nbsp;&nbsp;Side effects</a></h1>
  1585. <p>The calendar code was intentionally embedded in an object to make it have as
  1586. less as possible side effects. However, there are some -- not harmful, after
  1587. all. Here is a list of side effects; you can count they already happened after
  1588. <tt>calendar.js</tt> was loaded.</p>
  1589. <p>
  1590. </p>
  1591. <ol><p>
  1592. </p>
  1593. <li><p>The global variable <tt>window.calendar</tt> will be set to null. This
  1594. variable is used by the calendar code, especially when doing drag &amp; drop for
  1595. moving the calendar. In the future I might get rid of it, but for now it
  1596. didn't harm anyone.</p>
  1597. <p>
  1598. </p>
  1599. <li><p>The JavaScript <tt>Date</tt> object is modified. We add some properties
  1600. and functions that are very useful to our calendar. It made more sense to add
  1601. them directly to the <tt>Date</tt> object than to the calendar itself.
  1602. Complete list:</p>
  1603. <p>
  1604. </p>
  1605. <ol><p>
  1606. </p>
  1607. <li><p><tt>Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);</tt>
  1608. </p>
  1609. <li><p><tt>Date.SECOND = 1000 /* milliseconds */;</tt>
  1610. </p>
  1611. <li><p><tt>Date.MINUTE = 60 * Date.SECOND;</tt>
  1612. </p>
  1613. <li><p><tt>Date.HOUR = 60 * Date.MINUTE;</tt>
  1614. </p>
  1615. <li><p><tt>Date.DAY = 24 * Date.HOUR;</tt>
  1616. </p>
  1617. <li><p><tt>Date.WEEK = 7 * Date.DAY;</tt></p>
  1618. <p>
  1619. </p>
  1620. <li><p><tt>Date.prototype.getMonthDays</tt>(month) -- returns the number of days
  1621. of the given month, or of the current date object if no month was given.</p>
  1622. <p>
  1623. </p>
  1624. <li><p><tt>Date.prototype.getWeekNumber</tt>() -- returns the week number of the
  1625. date in the current object.</p>
  1626. <p>
  1627. </p>
  1628. <li><p><tt>Date.prototype.equalsTo</tt>(other_date) -- compare the current date
  1629. object with <tt>other_date</tt> and returns <tt>true</tt> if the dates are
  1630. equal. <em>It ignores time</em>.</p>
  1631. <p>
  1632. </p>
  1633. <li><p><tt>Date.prototype.print</tt>(format) -- returns a string with the
  1634. current date object represented in the given format. It implements the format
  1635. specified in section <a href="#node_sec_5.3.5">5.3.5</a>.</p>
  1636. <p>
  1637. </p>
  1638. </ol><p></p>
  1639. <p>
  1640. </p>
  1641. </ol><p></p>
  1642. <p>
  1643. </p>
  1644. <a name="node_sec_7"></a>
  1645. <h1><a href="#node_toc_node_sec_7">7&nbsp;&nbsp;Credits</a></h1>
  1646. <p>The following people either sponsored, donated money to the project or bought
  1647. commercial licenses (listed in reverse chronological order). Your name could
  1648. be here too! If you wish to sponsor the project (for instance request a
  1649. feature and pay me for implementing it) or donate some money please
  1650. <em>please</em> contact me at <tt><a href="mailto:mihai\_bazon@yahoo.com">mihai_bazon@yahoo.com</a></tt>.</p>
  1651. <p>
  1652. </p>
  1653. <ul><p>
  1654. </p>
  1655. <li><p>Sunny Chowdhury (<a href="http://www.ex3.com">www.ex3.com</a>)</p>
  1656. <p>
  1657. </p>
  1658. <li><p>Ian Barrack (<a href="http://www.simban.com">www.simban.com</a>)</p>
  1659. <p>
  1660. </p>
  1661. <li><p>Himanshukumar Shah</p>
  1662. <p>
  1663. </p>
  1664. <li><p>Seyhan Ersoy (<a href="http://www.oocgi.com">www.oocgi.com</a>)</p>
  1665. <p>
  1666. </p>
  1667. <li><p>Jon Stokkeland (<a href="http://www.sauen.com">www.sauen.com</a>)</p>
  1668. <p>
  1669. </p>
  1670. </ul><p></p>
  1671. <p>
  1672. </p>
  1673. <div align=right><table><tr><td>
  1674. <b>Thank you!</b><br>
  1675. -- <tt>mihai_bazon@yahoo.com</tt>
  1676. </td></tr></table></div>
  1677. <p>
  1678. </p>
  1679. <div class=footnoterule><hr></div><p></p>
  1680. <div class=footnote><p><a name="footnote_Temp_2"></a><a href="#call_footnote_Temp_2"><sup><small>1</small></sup></a>
  1681. by the term ``widget'' I understand a single element of user interface.
  1682. But that's in Linux world. For those that did lots of Windows
  1683. programming the term ``control'' might be more familiar
  1684. </p>
  1685. <p><a name="footnote_Temp_3"></a><a href="#call_footnote_Temp_3"><sup><small>2</small></sup></a> people report that the calendar does
  1686. not work with IE5/Mac. However, this browser was discontinued and we
  1687. believe that supporting it doesn't worth the efforts, given the fact that
  1688. it has the worst, buggiest implementation for DOM I've ever seen.</p>
  1689. <p><a name="footnote_Temp_4"></a><a href="#call_footnote_Temp_4"><sup><small>3</small></sup></a> under Opera 7 the calendar still lacks some functionality, such as
  1690. keyboard navigation; also Opera doesn't seem to allow disabling text
  1691. selection when one drags the mouse on the page; despite all that, the
  1692. calendar is still highly functional under Opera 7 and looks as good as
  1693. in other supported browsers. </p>
  1694. <p><a name="footnote_Temp_5"></a><a href="#call_footnote_Temp_5"><sup><small>4</small></sup></a> user interface</p>
  1695. </div>
  1696. <div align=right class=colophon>
  1697. <i>Last modified: Saturday, March 5th, 2005<br>
  1698. HTML conversion by <a href="http://www.ccs.neu.edu/~dorai/tex2page/tex2page-doc.html">TeX2page 2004-09-11</a></i>
  1699. </div>
  1700. </body>
  1701. </html>