Initial commit
authorChristophe Benz <cbenz@easter-eggs.com>
Wed, 14 Jan 2009 11:22:17 +0000 (12:22 +0100)
committerChristophe Benz <cbenz@easter-eggs.com>
Wed, 14 Jan 2009 11:22:17 +0000 (12:22 +0100)
28 files changed:
LICENSE [new file with mode: 0644]
README [new file with mode: 0644]
lib/widget/eeWidgetFormDateVlaDatePicker.class.php [new file with mode: 0644]
package.xml [new file with mode: 0644]
web/css/vlaCal-v2.1.css [new file with mode: 0644]
web/images/arrowleft.gif [new file with mode: 0644]
web/images/arrowleft_hover.gif [new file with mode: 0644]
web/images/arrowright.gif [new file with mode: 0644]
web/images/arrowright_hover.gif [new file with mode: 0644]
web/images/calendar.gif [new file with mode: 0644]
web/images/calendar_background.gif [new file with mode: 0644]
web/images/calendar_background.png [new file with mode: 0644]
web/images/day_hover.gif [new file with mode: 0644]
web/images/day_selected.gif [new file with mode: 0644]
web/images/day_selected_hover.gif [new file with mode: 0644]
web/images/month_current.gif [new file with mode: 0644]
web/images/month_current_hover.gif [new file with mode: 0644]
web/images/month_hover.gif [new file with mode: 0644]
web/images/month_selected.gif [new file with mode: 0644]
web/images/month_selected_current.gif [new file with mode: 0644]
web/images/month_selected_hover.gif [new file with mode: 0644]
web/images/month_selectedcurrent.gif [new file with mode: 0644]
web/images/month_selectedcurrent_hover.gif [new file with mode: 0644]
web/js/i18n/fr.js [new file with mode: 0644]
web/js/vlaCal-v2.1-clientside-v1.0.1-compressed.js [new file with mode: 0644]
web/js/vlaCal-v2.1-clientside-v1.0.1.js [new file with mode: 0644]
web/js/vlaCal-v2.1-compressed.js [new file with mode: 0644]
web/js/vlaCal-v2.1.js [new file with mode: 0644]

diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..dbf0b2e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2009 Christophe Benz, Easter-eggs http://www.easter-eggs.com
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..ba5f826
--- /dev/null
+++ b/README
@@ -0,0 +1,48 @@
+eeVlaDatePickerPlugin
+=====================
+
+Description
+-----------
+
+This plugins eases the use of the rich
+[Javascript Vista-Like Ajax (Vla) Date Picker widget](http://dev.base86.com/scripts/vista-like_ajax_calendar_version_2.html)
+in Symfony.
+
+This plugin uses the
+[clientside-only version of the widget](http://dev.base86.com/solo/46/client-side_only_extension_for_vlacalendar_v21.html).
+That means that the contents of the widget are handled by Javascript
+on the client and not by PHP or whatever.
+
+Installation
+------------
+
+    $ symfony plugin:install eeVlaDatePickerPlugin
+    $ symfony cache:clear
+
+Usage
+-----
+
+Example:
+
+    $this->widgetSchema['date'] = new eeWidgetFormDateVlaDatePicker();
+
+You can use a standard sfValidatorDate to specify the string format:
+
+    $this->validatorSchema['date']->setOption(
+        'date_format',
+        '@(?P<day>\d{1,2}).(?P<month>\d{1,2}).(?P<year>\d{4})@'
+    );
+
+i18n
+----
+
+Internalisation is possible but not supported by original widget (please tell me
+if I am wrong).
+
+French translation is already done, and you can use it as an example if you want
+to add another language.
+
+Contact
+-------
+
+If you have any questions feel free to contact me (see the Plugin Information tab).
diff --git a/lib/widget/eeWidgetFormDateVlaDatePicker.class.php b/lib/widget/eeWidgetFormDateVlaDatePicker.class.php
new file mode 100644 (file)
index 0000000..198e837
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+
+/*
+ * This file is part of the Vista-Like Date Picker plugin for Symfony.
+ * (c) Christophe Benz <cbenz@easter-eggs.com>
+ * 
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * eeWidgetFormDateVlaDatePicker represents a rich Javascript date widget 
+ *
+ * @author     Christophe Benz <cbenz@easter-eggs.com>
+ * @version    SVN: $Id: eeWidgetFormDateVlaDatePicker.class.php $
+ */
+class eeWidgetFormDateVlaDatePicker extends sfWidgetForm
+{
+  /**
+   * Configures the current widget.
+   *
+   * Available options:
+   *
+   *  * format:       The date format string (%month%/%day%/%year% by default)
+   *  * can_be_empty: Whether the widget accept an empty value (true by default)
+   *  * start_monday: Whether the week starts on monday (true by default)
+   *
+   * @param array $options     An array of options
+   * @param array $attributes  An array of default HTML attributes
+   *
+   * @see sfWidgetForm
+   */
+  protected function configure($options = array(), $attributes = array())
+  {
+    $this->addOption('format', '%month%/%day%/%year%');
+    $this->addOption('can_be_empty', true);
+    $this->addOption('start_monday', true);
+  }
+
+  /**
+   * @param  string $name        The element name
+   * @param  string $value       The date displayed in this widget
+   * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
+   * @param  array  $errors      An array of errors for the field
+   *
+   * @return string An HTML tag string
+   *
+   * @see sfWidgetForm
+   */
+  public function render($name, $value = null, $attributes = array(), $errors = array())
+  {
+    $input = new sfWidgetFormInput(array(), array('autocomplete' => 'off'));
+
+    $html = $input->render($name, $value);
+
+    $id = $input->generateId($name);
+    $monday_option = $this->getOption('start_monday');
+    $html .= <<<EOHTML
+<script type="text/javascript">
+new vlaDatePicker('$id', {prefillDate: false, startMonday: $monday_option});
+</script>
+EOHTML;
+
+    return $html;
+  }
+
+  /*
+   *
+   * Gets the stylesheet paths associated with the widget.
+   *
+   * @return array An array of stylesheet paths
+   */
+  public function getStylesheets()
+  {
+      return array('/eeVlaDatePickerPlugin/css/vlaCal-v2.1.css' => 'screen');
+  }
+
+  /**
+   * Gets the JavaScript paths associated with the widget.
+   *
+   * @return array An array of JavaScript paths
+   */
+  public function getJavaScripts()
+  {
+    $js = array(
+      '/eeVlaDatePickerPlugin/js/vlaCal-v2.1-compressed.js',
+      '/eeVlaDatePickerPlugin/js/vlaCal-v2.1-clientside-v1.0.1-compressed.js'
+    );
+
+    $culture = sfContext::getInstance()->getUser()->getCulture();
+    if(isset($culture)) {
+      $i18n_js = 'eeVlaDatePickerPlugin/js/i18n/' . $culture . '.js';
+      if(file_exists($i18n_js)) {
+        $js[] = '/' . $i18n_js;
+      }
+    }
+
+    return $js;
+  }
+
+}
diff --git a/package.xml b/package.xml
new file mode 100644 (file)
index 0000000..70bbbbf
--- /dev/null
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.4.6" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
+ <name>eeVlaDatePickerPlugin</name>
+ <channel>pear.symfony-project.com</channel>
+ <summary>Vista-like Ajax Date Picker widget</summary>
+ <description>This plugin adds VLA Date Picker support to Symfony.</description>
+ <lead>
+  <name>Christophe Benz</name>
+  <user>cbenz</user>
+  <email>cbenz@easter-eggs.com</email>
+  <active>yes</active>
+ </lead>
+ <date>2009-01-13</date>
+ <time>18:11:00</time>
+ <version>
+  <release>0.1.3</release>
+  <api>0.1.3</api>
+ </version>
+ <stability>
+  <release>beta</release>
+  <api>beta</api>
+ </stability>
+ <license uri="http://www.symfony-project.org/license">MIT license</license>
+ <notes>-</notes>
+ <contents>
+  <dir name="/">
+   <file role="data" name="README" />
+   <file role="data" name="LICENSE" />
+   <dir name="lib">
+    <dir name="widget">
+     <file role="data" name="eeWidgetFormDateVlaDatePicker.class.php" />
+    </dir>
+   </dir>
+   <dir name="web">
+    <dir name="js">
+     <file role="data" name="vlaCal-v2.1-clientside-v1.0.1-compressed.js" />
+     <file role="data" name="vlaCal-v2.1-clientside-v1.0.1.js" />
+     <file role="data" name="vlaCal-v2.1-compressed.js" />
+     <file role="data" name="vlaCal-v2.1.js" />
+     <dir name="i18n">
+      <file role="data" name="fr.js" />
+     </dir>
+    </dir>
+    <dir name="css">
+     <file role="data" name="vlaCal-v2.1.css" />
+    </dir>
+    <dir name="images">
+     <file role="data" name="arrowleft.gif" />
+     <file role="data" name="arrowleft_hover.gif" />
+     <file role="data" name="arrowright.gif" />
+     <file role="data" name="arrowright_hover.gif" />
+     <file role="data" name="calendar_background.gif" />
+     <file role="data" name="calendar_background.png" />
+     <file role="data" name="calendar.gif" />
+     <file role="data" name="day_hover.gif" />
+     <file role="data" name="day_selected.gif" />
+     <file role="data" name="day_selected_hover.gif" />
+     <file role="data" name="month_current.gif" />
+     <file role="data" name="month_current_hover.gif" />
+     <file role="data" name="month_hover.gif" />
+     <file role="data" name="month_selected_current.gif" />
+     <file role="data" name="month_selectedcurrent.gif" />
+     <file role="data" name="month_selectedcurrent_hover.gif" />
+     <file role="data" name="month_selected.gif" />
+     <file role="data" name="month_selected_hover.gif" />
+    </dir>
+   </dir>
+  </dir>
+ </contents>
+ <dependencies>
+  <required>
+   <php>
+    <min>5.1.0</min>
+   </php>
+   <pearinstaller>
+    <min>1.4.1</min>
+   </pearinstaller>
+   <package>
+    <name>symfony</name>
+    <channel>pear.symfony-project.com</channel>
+    <min>1.1.0</min>
+    <max>1.3.0</max>
+    <exclude>1.3.0</exclude>
+   </package>
+  </required>
+ </dependencies>
+ <phprelease />
+ <changelog>
+  <release>
+   <version>
+    <release>0.1.1</release>
+    <api>0.1.1</api>
+   </version>
+   <stability>
+    <release>beta</release>
+    <api>beta</api>
+   </stability>
+   <date>2009-01-12</date>
+   <license uri="http://www.symfony-project.org/license">MIT license</license>
+   <notes>
+Initial release.
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>0.1.1</release>
+    <api>0.1.1</api>
+   </version>
+   <stability>
+    <release>beta</release>
+    <api>beta</api>
+   </stability>
+   <date>2009-01-12</date>
+   <license uri="http://www.symfony-project.org/license">MIT license</license>
+   <notes>
+minor typo fixes
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>0.1.2</release>
+    <api>0.1.2</api>
+   </version>
+   <stability>
+    <release>beta</release>
+    <api>beta</api>
+   </stability>
+   <date>2009-01-13</date>
+   <license uri="http://www.symfony-project.org/license">MIT license</license>
+   <notes>
+Improves README usage info.
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>0.1.3</release>
+    <api>0.1.3</api>
+   </version>
+   <stability>
+    <release>beta</release>
+    <api>beta</api>
+   </stability>
+   <date>2009-01-13</date>
+   <license uri="http://www.symfony-project.org/license">MIT license</license>
+   <notes>
+Change some path.
+   </notes>
+  </release>
+ </changelog>
+</package>
diff --git a/web/css/vlaCal-v2.1.css b/web/css/vlaCal-v2.1.css
new file mode 100644 (file)
index 0000000..412ce0d
--- /dev/null
@@ -0,0 +1,182 @@
+/***************/\r
+/* vlaCalendar */\r
+/***************/\r
+\r
+/* Picker */\r
+\r
+.vlaCalendarPicker {\r
+       position: absolute;\r
+       z-index: 999;\r
+       \r
+       margin-top: -5px;\r
+       margin-left: -2px;\r
+       \r
+       display: none;\r
+}\r
+\r
+.vlaCalendarPicker .pickerBackground {\r
+       background: transparent url('/eeVlaDatePickerPlugin/images/calendar_background.png') no-repeat top center;\r
+       padding: 16px;\r
+       height: 130px;\r
+       width: 166px;\r
+       overflow: hidden;\r
+}\r
+\r
+/* Background for IE6 - code does not validate as it is a hack */\r
+*html .vlaCalendarPicker .pickerBackground {\r
+       background-image: url('/eeVlaDatePickerPlugin/images/calendar_background.gif');\r
+}\r
+\r
+/* Main calendar */\r
+\r
+.vlaCalendar, .vlaCalendar table {\r
+       font-family: calibri, arial !important;\r
+       color: black;\r
+       font-size: 12px !important;\r
+}\r
+\r
+.vlaCalendar {\r
+       display: block;\r
+       width: 164px;\r
+}\r
+.vlaCalendar .container, .vlaCalendar .container div {\r
+       width: 164px;\r
+       height: 130px;\r
+       text-align: left;\r
+       position: absolute;\r
+       overflow: hidden;\r
+}\r
+\r
+.vlaCalendar span.indication {\r
+       display: block;\r
+       text-align: center;\r
+}\r
+\r
+.vlaCalendar table {\r
+       margin-top: 8px;\r
+       text-align: right;\r
+       border-collapse: collapse;\r
+       background-color: white; /* <- IE ugly text in transition fix  */\r
+}\r
+\r
+.vlaCalendar .picker td {\r
+       cursor: pointer;\r
+}\r
+\r
+/* Label & arrows */\r
+\r
+.vlaCalendar .label:hover {\r
+       color: #0066cc;\r
+       cursor: pointer;\r
+}\r
+.vlaCalendar .noHover:hover {\r
+       color: black;\r
+       cursor: default;\r
+}\r
+\r
+.vlaCalendar .arrowLeft, .vlaCalendar .arrowRight {\r
+       background: transparent url('/eeVlaDatePickerPlugin/images/arrowleft.gif') no-repeat center;\r
+       height: 12px;\r
+       width: 10px;\r
+       cursor: pointer;\r
+}\r
+.vlaCalendar .arrowLeft {\r
+       margin-left: 5px;\r
+       float: left;\r
+}\r
+.vlaCalendar .arrowLeft:hover {\r
+       background-image: url('/eeVlaDatePickerPlugin/images/arrowleft_hover.gif');\r
+}\r
+.vlaCalendar .arrowRight {\r
+       margin-right: 5px;\r
+       float: right;\r
+       background-image: url('/eeVlaDatePickerPlugin/images/arrowright.gif');\r
+}\r
+.vlaCalendar .arrowRight:hover {\r
+       background-image: url('/eeVlaDatePickerPlugin/images/arrowright_hover.gif');\r
+}\r
+\r
+/* Month */\r
+\r
+.vlaCalendar .month th {\r
+       text-align: center;\r
+       font-weight: normal;\r
+       width: 24px;\r
+       padding-bottom: 1px;\r
+       border-bottom: 1px solid #f5f5f5;\r
+}\r
+\r
+.vlaCalendar .month td {\r
+       padding-right: 3px;\r
+       height: 15px;\r
+}\r
+\r
+.vlaCalendar .month tr.firstRow td {\r
+       padding-top: 2px;\r
+}\r
+\r
+.vlaCalendar .month td:hover {\r
+       background: url('/eeVlaDatePickerPlugin/images/day_hover.gif') bottom no-repeat;\r
+       color: #0066cc;\r
+}\r
+\r
+.vlaCalendar .month td.selected {\r
+       background: url('/eeVlaDatePickerPlugin/images/day_selected.gif') bottom no-repeat;\r
+       color: #0066cc;\r
+}\r
+.vlaCalendar .month td.selected:hover {\r
+       background-image: url('/eeVlaDatePickerPlugin/images/day_selected_hover.gif');\r
+}\r
+\r
+.vlaCalendar .month td.outsideDay {\r
+       color: #a8a8a8;\r
+}\r
+.vlaCalendar .month td.outsideDay:hover {\r
+       color: #b1c5fc;\r
+}\r
+\r
+/* Year & decade */\r
+\r
+.vlaCalendar .year {\r
+       margin-left: 2px;\r
+}\r
+\r
+.vlaCalendar .year td {\r
+       width: 40px;\r
+       height: 35px;\r
+       text-align: center;\r
+       cursor: pointer;\r
+}\r
+.vlaCalendar .year td:hover {\r
+       background: url('/eeVlaDatePickerPlugin/images/month_hover.gif') center no-repeat;\r
+       color: #0066cc;\r
+}\r
+\r
+.vlaCalendar .year td.selected {\r
+       background: url('/eeVlaDatePickerPlugin/images/month_selected.gif') center no-repeat;\r
+}\r
+.vlaCalendar .year td.selected:hover {\r
+       background-image: url('/eeVlaDatePickerPlugin/images/month_selected_hover.gif');\r
+}\r
+\r
+.vlaCalendar .year td.current {\r
+       background: url('/eeVlaDatePickerPlugin/images/month_current.gif') center no-repeat;\r
+       color: #0066cc;\r
+}\r
+.vlaCalendar .year td.current:hover {\r
+       background-image: url('/eeVlaDatePickerPlugin/images/month_current_hover.gif');\r
+}\r
+\r
+.vlaCalendar .year td.selectedcurrent {\r
+       background: url('/eeVlaDatePickerPlugin/images/month_selectedcurrent.gif') center no-repeat;\r
+}\r
+.vlaCalendar .year td.selectedcurrent:hover {\r
+       background-image: url('/eeVlaDatePickerPlugin/images/month_selectedcurrent_hover.gif');\r
+}\r
+\r
+.vlaCalendar .year td.outsideYear {\r
+       color: #a8a8a8;\r
+}\r
+.vlaCalendar .year td.outsideYear:hover {\r
+       color: #b1c5fc;\r
+}\r
diff --git a/web/images/arrowleft.gif b/web/images/arrowleft.gif
new file mode 100644 (file)
index 0000000..2655c12
Binary files /dev/null and b/web/images/arrowleft.gif differ
diff --git a/web/images/arrowleft_hover.gif b/web/images/arrowleft_hover.gif
new file mode 100644 (file)
index 0000000..730920d
Binary files /dev/null and b/web/images/arrowleft_hover.gif differ
diff --git a/web/images/arrowright.gif b/web/images/arrowright.gif
new file mode 100644 (file)
index 0000000..7c4dd7f
Binary files /dev/null and b/web/images/arrowright.gif differ
diff --git a/web/images/arrowright_hover.gif b/web/images/arrowright_hover.gif
new file mode 100644 (file)
index 0000000..67e910a
Binary files /dev/null and b/web/images/arrowright_hover.gif differ
diff --git a/web/images/calendar.gif b/web/images/calendar.gif
new file mode 100644 (file)
index 0000000..5125b62
Binary files /dev/null and b/web/images/calendar.gif differ
diff --git a/web/images/calendar_background.gif b/web/images/calendar_background.gif
new file mode 100644 (file)
index 0000000..fa86c2c
Binary files /dev/null and b/web/images/calendar_background.gif differ
diff --git a/web/images/calendar_background.png b/web/images/calendar_background.png
new file mode 100644 (file)
index 0000000..f1b7543
Binary files /dev/null and b/web/images/calendar_background.png differ
diff --git a/web/images/day_hover.gif b/web/images/day_hover.gif
new file mode 100644 (file)
index 0000000..4ebc7aa
Binary files /dev/null and b/web/images/day_hover.gif differ
diff --git a/web/images/day_selected.gif b/web/images/day_selected.gif
new file mode 100644 (file)
index 0000000..fc7675f
Binary files /dev/null and b/web/images/day_selected.gif differ
diff --git a/web/images/day_selected_hover.gif b/web/images/day_selected_hover.gif
new file mode 100644 (file)
index 0000000..2d53e34
Binary files /dev/null and b/web/images/day_selected_hover.gif differ
diff --git a/web/images/month_current.gif b/web/images/month_current.gif
new file mode 100644 (file)
index 0000000..052d544
Binary files /dev/null and b/web/images/month_current.gif differ
diff --git a/web/images/month_current_hover.gif b/web/images/month_current_hover.gif
new file mode 100644 (file)
index 0000000..df1cd9b
Binary files /dev/null and b/web/images/month_current_hover.gif differ
diff --git a/web/images/month_hover.gif b/web/images/month_hover.gif
new file mode 100644 (file)
index 0000000..77c18f4
Binary files /dev/null and b/web/images/month_hover.gif differ
diff --git a/web/images/month_selected.gif b/web/images/month_selected.gif
new file mode 100644 (file)
index 0000000..580ea91
Binary files /dev/null and b/web/images/month_selected.gif differ
diff --git a/web/images/month_selected_current.gif b/web/images/month_selected_current.gif
new file mode 100644 (file)
index 0000000..580ea91
Binary files /dev/null and b/web/images/month_selected_current.gif differ
diff --git a/web/images/month_selected_hover.gif b/web/images/month_selected_hover.gif
new file mode 100644 (file)
index 0000000..2b6cb89
Binary files /dev/null and b/web/images/month_selected_hover.gif differ
diff --git a/web/images/month_selectedcurrent.gif b/web/images/month_selectedcurrent.gif
new file mode 100644 (file)
index 0000000..e586bd2
Binary files /dev/null and b/web/images/month_selectedcurrent.gif differ
diff --git a/web/images/month_selectedcurrent_hover.gif b/web/images/month_selectedcurrent_hover.gif
new file mode 100644 (file)
index 0000000..bd1cc84
Binary files /dev/null and b/web/images/month_selectedcurrent_hover.gif differ
diff --git a/web/js/i18n/fr.js b/web/js/i18n/fr.js
new file mode 100644 (file)
index 0000000..af900bf
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+ * French translation of vlaCalendar v2.1 clientside v1.0.1\r
+ *\r
+ * http://dev.base86.com/solo/46/client-side_only_extension_for_vlacalendar_v21.html\r
+ *\r
+ * @author Christophe Benz <cbenz@easter-eggs.com>\r
+ */\r
+\r
+\r
+vlaCalendar.implement({\r
+       'weekDayLabels': ['Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam', 'Dim'],\r
+       'monthLabels': ['Janvier', 'F&eacute;vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao&ucirc;t', 'Septembre', 'Octobre', 'Novembre', 'D&eacute;cembre'],\r
+       'monthSmallLabels': ['Jan', 'F&eacute;v', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Ao&ucirc;', 'Sep', 'Oct', 'Nov', 'D&eacute;c']\r
+    });\r
diff --git a/web/js/vlaCal-v2.1-clientside-v1.0.1-compressed.js b/web/js/vlaCal-v2.1-clientside-v1.0.1-compressed.js
new file mode 100644 (file)
index 0000000..265dc0b
--- /dev/null
@@ -0,0 +1,9 @@
+Date.implement({getWeek:function(){var oneJan=new Date(this.getFullYear(),0,1);return Math.ceil((((this-oneJan)/86400000)+oneJan.getDay())/7);},getTs:function(){return parseInt((this.getTime()/1000));},getMonthNo:function(){return(this.getMonth()+1);}});vlaCalendar.implement({'weekDayLabels':['Mo','Tu','We','Th','Fr','Sa','Su'],'monthLabels':['January','February','March','April','May','June','July','August','September','October','November','December'],'monthSmallLabels':['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],u:function(_url,_pars,_onComplete,_id){if(!this.loading&&!this.transitioning){this.loading=true;var _class=this;var element=$(_id?_id:this.tempLoader);_pars+='&defaultView='+_url;_pars+='&picker='+(this.picker?1:0)+'&startMonday='+(this.startMonday?1:0)+'&style='+this.style;if(this.picker&&this.getInputDate())_pars+='&pickedDate='+this.getInputDate();element.set('html',this.getHTML(_pars));_onComplete();this.loading=false;}},getHTML:function(args){var pars={};vars=args.split('&').each(function(e){param=e.split('=');if(!pars[param[0]])pars[param[0]]=param[1];});pars.startMonday=pars.startMonday.toInt();pars.picker=pars.picker.toInt();if(pars.gotoPickedDate)pars.gotoPickedDate=pars.gotoPickedDate.toInt();var pickedDate=null;if($defined(pars.pickedDate)){if(pars.pickedDate=='t'){pickedDate=this.mkdate();this.setDate(pickedDate);}else{match=pars.pickedDate.split('/');if(match!=null){if(match.length>0){pickedDate=this.mkdate(match[2],match[1]-1,match[0]);if(pickedDate.getMonthNo()!=match[1]){pickedDate=this.mkdate(match[2],match[1]-1,this.daysInMonth(match[2],match[1]-1));this.setDate(pickedDate);}}}}}\r
+if(pickedDate==null)pickedDate=this.mkdate();if($defined(pars.ts)){var date=new Date();date.setTime(parseInt(pars.ts)*1000);ts=date.getTs();}else{ts=this.mktime(pickedDate.getFullYear(),pickedDate.getMonth(),1);}pars.ts=ts;pars['pickedDate']=pickedDate;if(pars.defaultView=='decade')var picker=this.getDecadeHTML(pars);else if(pars.defaultView=='year')var picker=this.getYearHTML(pars);else var picker=this.getMonthHTML(pars);if(!$defined(this.createContainer)){this.createContainer=false;div='<div class="vlaCalendar'+($defined(args.style)?' '+args.style:'')+'">';div+='<span class="indication"><div class="arrowRight"></div><div class="arrowLeft"></div>';div+='<span class="label" date="';div+="{'day': '"+pickedDate.getDate()+"', 'month': '"+pickedDate.getMonthNo()+"'";div+=", 'year': '"+pickedDate.getFullYear()+'\'}">&nbsp;';div+='</span>';div+='</span>';div+='<div class="container">';div+='<div class="loaderB"></div>';div+='<div class="loaderA">'+picker+'</div>';div+='</div>';div+='</div>';return div;}else return picker;},getMonthHTML:function(args){var ts=this.ts2date(args.ts);var ts_year=ts.getFullYear();var ts_month=ts.getMonth();var ts_month_name=this.monthLabels[ts_month];var ts_nrodays=this.daysInMonth(ts.getFullYear(),ts.getMonth());var pr_date=this.mkdate(ts_year,ts_month-1,1);var nx_date=this.mkdate(ts_year,ts_month+1,1);var wdays_counter=ts.getDay()-(args.startMonday?1:0);if(wdays_counter==-1)wdays_counter=6;ts=ts.getTs();var t='<table class="month'+(args.picker?' picker':'')+'" cellpadding="0" summary="{';t+="'ts': '"+ts+"', 'pr_ts': '"+pr_date.getTs()+"', 'nx_ts': '"+nx_date.getTs()+"', 'label': '"+ts_month_name+", "+ts_year+"'";t+=", 'current': 'month', 'parent': 'year'";t+='}">';t+='<tr>';if(args.startMonday){var last_day=6;}else{t+='<th>'+this.weekDayLabels[6]+'</th>';var last_day=5;}\r
+for(i=0;i<=last_day;i++){t+='<th>'+this.weekDayLabels[i]+'</th>';}t+='</tr>';t+='<tr class="firstRow">';var row=0;for(i=0;i<wdays_counter;i++){last_day=this.daysInMonth(pr_date.getFullYear(),pr_date.getMonth());var day=last_day-(wdays_counter-i)+1;i_date=this.mkdate(ts_year,ts_month-1,day,ts_year);t+='<td class="outsideDay" date="'+"{";t+="'day': '"+day+"', 'month': '"+i_date.getMonthNo()+"', 'year': '"+i_date.getFullYear()+"'}";t+='">'+day+'</td>';}\r
+var pd_ts=args.pickedDate.getTs();for(i=1;i<=ts_nrodays;i++){i_date=this.mkdate(ts_year,ts_month,i);i_ts=i_date.getTs();t+='<td'+(i_ts==pd_ts?' class="selected"':'');t+=' '+"date=\"{'day': '"+i+"', 'month': '"+i_date.getMonthNo()+"', 'year': '"+ts_year+"'}\">";t+=i;t+='</td>';if(wdays_counter==6){week_num=i_date.getWeek()+1;t+="</tr><tr>";wdays_counter=-1;row++;}\r
+wdays_counter++;}var a=1;if(wdays_counter!==0){for(i=wdays_counter;i<7;i++){i_date=this.mkdate(ts_year,ts_month+1,a);i_ts=i_date.getTs();t+='<td class="outsideDay" date="'+"{'day': '"+a+"', 'month': '"+i_date.getMonthNo()+"', 'year': '"+i_date.getFullYear()+"'}"+'">'+a+'</td>';a++;}\r
+row++;}if(row==4||row==5){if(wdays_counter!==0){t+="</tr><tr>";}for(i=0;i<(row==5?7:14);i++){i_date=this.mkdate(ts_year,ts_month+1,a);t+='<td class="outsideDay" date="'+"{'day': '"+a+"', 'month': '"+i_date.getMonthNo()+"', 'year': '"+i_date.getFullYear()+"'}"+'">'+a+'</td>';a++;if(i==6){t+="</tr><tr>";}}}\r
+t+='</tr>';t+='</table>';return t;},getYearHTML:function(args){var ts=this.ts2date(args.ts);if(args.parent=='month')var m_ts=this.mktime(ts.getFullYear(),ts.getMonth(),1);else var m_ts='';var pickedDate=args.pickedDate;var ts_year=ts.getFullYear();var pr_ts=this.mktime(ts_year-1,0,1);var nx_ts=this.mktime(ts_year+1,0,1);ts=ts.getTs();var t='<table class="year" cellpadding="0" summary="';t+="{'ts': '"+ts+"', 'pr_ts': '"+pr_ts+"', 'nx_ts': '"+nx_ts+"', 'label': '";t+=ts_year+"', 'current': 'year', 'parent': 'decade'";t+='}">';var m=0;for(i=0;i<3;i++){t+="<tr>";for(y=0;y<4;y++){i_date=this.mkdate(ts_year,m,1);i_ts=i_date.getTs();var current=(pickedDate.getMonthNo()==i_date.getMonthNo()&&pickedDate.getFullYear()==i_date.getFullYear());t+='<td ts="'+i_ts+'" class="'+(m_ts==i_ts?'selected':'')+(current?'current':'')+'">'+this.monthSmallLabels[i_date.getMonth()]+'</td>';m++;}\r
+t+="</tr>";}t+='</table>';return t;},getDecadeHTML:function(args){var ts=this.ts2date(args.ts);var ts_year=parseInt(ts.getFullYear());var decade=[ts_year-5,ts_year+5];var y_ts=this.mktime(ts.getFullYear(),0,1);var m_ts=args.m_ts;var pr_ts=this.mktime(ts_year-12,0,1);var nx_ts=this.mktime(ts_year+12,0,1);var t='<table class="year" cellpadding="0" summary="{';t+="'ts': '"+ts.getTs()+"', 'pr_ts': '"+pr_ts+"', 'nx_ts': '"+nx_ts+"', 'label': '";t+=(decade[0])+' - '+(decade[1]+1)+"', 'current': 'decade'";t+='}">';var year=decade[0];for(i=0;i<3;i++){t+="<tr>";for(y=0;y<4;y++){i_ts=this.mktime(year,0,1);i_date=this.mkdate(year,0,1);t+='<td ts="'+i_ts+'" m_ts="'+m_ts+'" class="'+(args.parent&&y_ts==i_ts?'selected':'')+(args.pickedDate.getFullYear()==i_date.getFullYear()?'current':'')+'">'+year+'</td>';year++;}\r
+t+="</tr>";}t+='</table>';return t;},setDate:function(jsdate){this.pick({day:jsdate.getDate(),month:jsdate.getMonthNo(),year:jsdate.getFullYear()});},daysInMonth:function(iYear,iMonth){return 32-new Date(iYear,iMonth,32).getDate();},mkdate:function(year,month,day){var date=new Date();if($defined(year))date.setYear(year);if($defined(month))date.setMonth(month);if($defined(day))date.setDate(day);date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0);return date;},ts2date:function(ts){var date=new Date();date.setTime(parseInt(ts)*1000);return date;},mktime:function(year,month,day){var date=this.mkdate(year,month,day);return date.getTs();}});
\ No newline at end of file
diff --git a/web/js/vlaCal-v2.1-clientside-v1.0.1.js b/web/js/vlaCal-v2.1-clientside-v1.0.1.js
new file mode 100644 (file)
index 0000000..1236aa1
--- /dev/null
@@ -0,0 +1,297 @@
+  /****************************************************************************/\r
+ /*   vlaCalendar Clientside v1.0.1 extension for vlaCalendar version 2.1    */\r
+/****************************************************************************/\r
+\r
+Date.implement({\r
+       getWeek: function() {\r
+               var oneJan = new Date(this.getFullYear(), 0, 1);\r
+               return Math.ceil((((this - oneJan) / 86400000) + oneJan.getDay()) / 7);\r
+       },\r
+       \r
+       getTs: function() {\r
+               return parseInt((this.getTime() / 1000));\r
+       },\r
+       \r
+       getMonthNo: function() {\r
+               return (this.getMonth() + 1);\r
+       }\r
+});\r
+\r
+vlaCalendar.implement({\r
+       //New vars\r
+       'weekDayLabels': ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],\r
+       'monthLabels': ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\r
+       'monthSmallLabels': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\r
+       \r
+       //Replaced functions\r
+       u: function(_url, _pars, _onComplete, _id) {\r
+               if(!this.loading && !this.transitioning) {\r
+                       this.loading = true;\r
+                       var _class = this;\r
+                       var element = $(_id ? _id : this.tempLoader);\r
+                       _pars += '&defaultView='+  _url;\r
+                       _pars += '&picker='+ (this.picker ? 1 : 0) +'&startMonday='+ (this.startMonday ? 1 : 0) +'&style='+ this.style;\r
+                       if(this.picker && this.getInputDate()) _pars += '&pickedDate='+ this.getInputDate();\r
+                       element.set('html', this.getHTML(_pars));\r
+                       _onComplete();\r
+                       this.loading = false;\r
+               }\r
+       },\r
+       \r
+       //New functions\r
+       getHTML: function(args) {\r
+               var pars = {};\r
+               vars = args.split('&').each(function (e) {\r
+                       param = e.split('=');\r
+                       if(!pars[param[0]]) pars[param[0]] = param[1];\r
+               });\r
+               \r
+               pars.startMonday = pars.startMonday.toInt();\r
+               pars.picker = pars.picker.toInt();\r
+               if(pars.gotoPickedDate) pars.gotoPickedDate = pars.gotoPickedDate.toInt();\r
+               \r
+               var pickedDate = null;\r
+               if($defined(pars.pickedDate)) {\r
+                       if(pars.pickedDate == 't') {\r
+                               pickedDate = this.mkdate();                                     \r
+                               this.setDate(pickedDate);\r
+                       } else {\r
+                               match = pars.pickedDate.split('/');\r
+                               \r
+                               if(match != null) {\r
+                                       if(match.length > 0) {\r
+                                               pickedDate = this.mkdate(match[2], match[1] - 1, match[0]);\r
+                                               if(pickedDate.getMonthNo() != match[1]) {\r
+                                                       pickedDate = this.mkdate(match[2], match[1] - 1, this.daysInMonth(match[2], match[1] - 1));\r
+                                                       this.setDate(pickedDate);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+               if(pickedDate == null) pickedDate = this.mkdate();\r
+                       \r
+               if($defined(pars.ts)) {\r
+                       var date = new Date();\r
+                       date.setTime(parseInt(pars.ts) * 1000);\r
+                       ts = date.getTs();\r
+               } else {\r
+                       ts = this.mktime(pickedDate.getFullYear(), pickedDate.getMonth(), 1);\r
+               }\r
+               \r
+               pars.ts = ts;\r
+               pars['pickedDate'] = pickedDate;\r
+               \r
+               if(pars.defaultView == 'decade') var picker = this.getDecadeHTML(pars);\r
+               else if(pars.defaultView == 'year') var picker = this.getYearHTML(pars);\r
+               else var picker = this.getMonthHTML(pars);\r
+               \r
+               if(!$defined(this.createContainer)) {\r
+                       this.createContainer = false;\r
+                       div  = '<div class="vlaCalendar'+ ($defined(args.style) ? ' '+ args.style : '') +'">';\r
+                               div += '<span class="indication"><div class="arrowRight"></div><div class="arrowLeft"></div>';\r
+                                       div += '<span class="label" date="';\r
+                                               div += "{'day': '"+ pickedDate.getDate() +"', 'month': '"+ pickedDate.getMonthNo() +"'";\r
+                                               div += ", 'year': '"+ pickedDate.getFullYear() +'\'}">&nbsp;';\r
+                                       div += '</span>';\r
+                               div += '</span>';\r
+                               div += '<div class="container">';\r
+                                       div += '<div class="loaderB"></div>';\r
+                                       div += '<div class="loaderA">'+ picker +'</div>';\r
+                               div += '</div>';\r
+                       div += '</div>';\r
+                       return div;\r
+               } else return picker;\r
+       },\r
+\r
+       getMonthHTML: function(args) {\r
+               var ts = this.ts2date(args.ts);\r
+               var ts_year = ts.getFullYear();\r
+               var ts_month = ts.getMonth();\r
+               var ts_month_name = this.monthLabels[ts_month];\r
+               var ts_nrodays = this.daysInMonth(ts.getFullYear(), ts.getMonth());\r
+               \r
+               var pr_date = this.mkdate(ts_year, ts_month-1, 1);\r
+               var nx_date = this.mkdate(ts_year, ts_month+1, 1);\r
+               \r
+               var wdays_counter = ts.getDay() - (args.startMonday ? 1 : 0);\r
+               if(wdays_counter == -1) wdays_counter = 6;\r
+               \r
+               ts = ts.getTs();\r
+               var t = '<table class="month'+ (args.picker ? ' picker' : '') +'" cellpadding="0" summary="{';\r
+                       t += "'ts': '"+ ts +"', 'pr_ts': '"+ pr_date.getTs() +"', 'nx_ts': '"+ nx_date.getTs() +"', 'label': '"+ ts_month_name +", "+ ts_year +"'";\r
+                       t += ", 'current': 'month', 'parent': 'year'";\r
+               t += '}">';\r
+               t += '<tr>';\r
+               \r
+               if(args.startMonday) {\r
+                       var last_day = 6;\r
+               } else {\r
+                       t += '<th>'+ this.weekDayLabels[6] +'</th>';\r
+                       var last_day = 5;\r
+               }\r
+               for(i = 0; i <= last_day; i++) {\r
+                       t += '<th>'+ this.weekDayLabels[i] +'</th>';\r
+               }\r
+               t += '</tr>';\r
+               t += '<tr class="firstRow">';\r
+               \r
+               var row = 0;\r
+               \r
+               //Add days for the beginning non-month days\r
+               for(i = 0; i < wdays_counter; i++) {\r
+                       last_day = this.daysInMonth(pr_date.getFullYear(), pr_date.getMonth());\r
+                       var day = last_day - (wdays_counter-i) + 1;\r
+                       i_date = this.mkdate(ts_year, ts_month-1, day, ts_year);\r
+                       t += '<td class="outsideDay" date="'+"{";\r
+                       t += "'day': '"+ day +"', 'month': '"+ i_date.getMonthNo() +"', 'year': '"+ i_date.getFullYear() +"'}";\r
+                       t += '">'+ day +'</td>';\r
+               }\r
+               \r
+               //Add month days\r
+               var pd_ts = args.pickedDate.getTs();\r
+               for(i = 1; i <= ts_nrodays; i++) {\r
+                       i_date = this.mkdate(ts_year, ts_month, i); \r
+                       i_ts = i_date.getTs();\r
+                       t += '<td'+ (i_ts == pd_ts ? ' class="selected"' : '');\r
+                       t += ' '+"date=\"{'day': '"+ i +"', 'month': '"+ i_date.getMonthNo() +"', 'year': '"+ ts_year +"'}\">";\r
+                       t += i; \r
+                       t += '</td>';\r
+                       \r
+                       if(wdays_counter == 6) {\r
+                               // && (i - 1) != ts_nrodays) {\r
+                               week_num = i_date.getWeek() + 1;\r
+                               t += "</tr><tr>";\r
+                               wdays_counter = -1;\r
+                               row++;\r
+                       }\r
+                       wdays_counter++;\r
+               }\r
+               \r
+               //Add outside days\r
+               var a = 1;\r
+               if(wdays_counter !== 0) {\r
+                       for(i = wdays_counter; i < 7; i++) {\r
+                               i_date = this.mkdate(ts_year, ts_month + 1, a); \r
+                               i_ts = i_date.getTs();\r
+                               t += '<td class="outsideDay" date="'+"{'day': '"+ a +"', 'month': '"+ i_date.getMonthNo() +"', 'year': '"+ i_date.getFullYear() +"'}"+'">'+ a +'</td>';\r
+                               a++;\r
+                       }\r
+                       row++;\r
+               }\r
+               \r
+               //Always have 6 rows\r
+               if(row == 4 || row == 5) {\r
+                       if(wdays_counter !== 0) { t += "</tr><tr>"; }\r
+                       for(i = 0; i < (row == 5 ? 7 : 14); i++) {\r
+                               i_date = this.mkdate(ts_year, ts_month + 1, a); \r
+                               t += '<td class="outsideDay" date="'+"{'day': '"+ a +"', 'month': '"+ i_date.getMonthNo() +"', 'year': '"+ i_date.getFullYear() +"'}"+'">'+ a +'</td>';\r
+                               a++;\r
+                               if(i == 6) { t += "</tr><tr>"; }\r
+                       }\r
+               }       \r
+               \r
+               t += '</tr>';\r
+               t += '</table>';\r
+               return t;\r
+       },\r
+\r
+       getYearHTML: function(args) {\r
+               var ts = this.ts2date(args.ts);\r
+               if(args.parent == 'month') var m_ts = this.mktime(ts.getFullYear(), ts.getMonth(), 1); //Selected month timestamp\r
+               else var m_ts = '';\r
+               \r
+               var pickedDate = args.pickedDate;\r
+               \r
+               var ts_year     = ts.getFullYear();\r
+               var pr_ts = this.mktime(ts_year-1, 0, 1);\r
+               var nx_ts = this.mktime(ts_year+1, 0, 1);\r
+               \r
+               ts = ts.getTs();\r
+               var t = '<table class="year" cellpadding="0" summary="';\r
+               t += "{'ts': '"+ ts +"', 'pr_ts': '"+ pr_ts +"', 'nx_ts': '"+ nx_ts +"', 'label': '";\r
+                       t += ts_year +"', 'current': 'year', 'parent': 'decade'";\r
+               t += '}">';\r
+               \r
+               //Add years\r
+               var m = 0;\r
+               for(i = 0; i < 3; i++) {\r
+                       t += "<tr>";\r
+                       for(y = 0; y < 4; y++) {\r
+                               i_date = this.mkdate(ts_year, m, 1);\r
+                               i_ts = i_date.getTs();\r
+                               var current = (pickedDate.getMonthNo() == i_date.getMonthNo() && pickedDate.getFullYear() == i_date.getFullYear());\r
+                               t += '<td ts="'+ i_ts +'" class="'+ (m_ts == i_ts ? 'selected' : '') + (current ? 'current' : '') +'">'+ this.monthSmallLabels[i_date.getMonth()] +'</td>';\r
+                               m++;\r
+                       }\r
+                       t += "</tr>";\r
+               }\r
+               t += '</table>';\r
+               return t;\r
+       },\r
+\r
+       getDecadeHTML: function(args) {\r
+               var ts = this.ts2date(args.ts);\r
+               var ts_year     = parseInt(ts.getFullYear());\r
+               var decade = [ts_year-5, ts_year+5];\r
+               \r
+               var y_ts = this.mktime(ts.getFullYear(), 0, 1); \r
+               var m_ts = args.m_ts;\r
+               \r
+               var pr_ts = this.mktime(ts_year - 12, 0, 1);\r
+               var nx_ts = this.mktime(ts_year + 12, 0, 1);\r
+               \r
+               var t = '<table class="year" cellpadding="0" summary="{';\r
+               t += "'ts': '"+ ts.getTs() +"', 'pr_ts': '"+ pr_ts +"', 'nx_ts': '"+ nx_ts +"', 'label': '";\r
+               t += (decade[0]) +' - '+ (decade[1]+1) +"', 'current': 'decade'"; \r
+               t += '}">';\r
+               \r
+               //Add decades\r
+               var year = decade[0];\r
+               for(i = 0; i < 3; i++) {\r
+                       t += "<tr>";\r
+                       for(y = 0; y < 4; y++) {\r
+                               i_ts = this.mktime(year, 0, 1);\r
+                               i_date = this.mkdate(year, 0, 1);\r
+                               t += '<td ts="'+ i_ts +'" m_ts="'+ m_ts +'" class="'+ (args.parent && y_ts == i_ts ? 'selected' : '') + (args.pickedDate.getFullYear() == i_date.getFullYear() ? 'current' : '') +'">'+ year +'</td>';\r
+                               year++;\r
+                       }\r
+                       t += "</tr>";\r
+               }\r
+               t += '</table>';\r
+               \r
+               return t;\r
+       },\r
+       \r
+       setDate: function(jsdate) {\r
+               this.pick({day: jsdate.getDate(), month: jsdate.getMonthNo(), year: jsdate.getFullYear()});\r
+       },\r
+       \r
+       daysInMonth: function(iYear, iMonth) {\r
+               return 32 - new Date(iYear, iMonth, 32).getDate();\r
+       },\r
+\r
+       mkdate: function(year, month, day) {\r
+               var date = new Date();\r
+               if($defined(year)) date.setYear(year);\r
+               if($defined(month)) date.setMonth(month);\r
+               if($defined(day)) date.setDate(day);\r
+               \r
+               date.setHours(0);\r
+               date.setMinutes(0);\r
+               date.setSeconds(0);\r
+               date.setMilliseconds(0);\r
+               return date;\r
+       },\r
+\r
+       ts2date: function(ts) {\r
+               var date = new Date();\r
+               date.setTime(parseInt(ts) * 1000);\r
+               return date;\r
+       },\r
+\r
+       mktime: function(year, month, day) {\r
+               var date = this.mkdate(year, month, day);\r
+               return date.getTs();\r
+       }\r
+});
\ No newline at end of file
diff --git a/web/js/vlaCal-v2.1-compressed.js b/web/js/vlaCal-v2.1-compressed.js
new file mode 100644 (file)
index 0000000..a0b4d4c
--- /dev/null
@@ -0,0 +1,16 @@
+var vlaCalendar=new Class({'slideDuration':500,'fadeDuration':500,'transition':Fx.Transitions.Quart.easeOut,'startMonday':false,'filePath':'inc/','defaultView':'month','style':'',initialize:function(_container,_options){if(_options)$extend(this,_options);this.loading=false;this.container=_container=$(_container);var _class=this;var pars='defaultView='+this.defaultView;if(this.picker){if($type(this.prefillDate)=='object'&&this.getInputDate(this.prefillDate))pars+='&pickedDate='+this.getInputDate(this.prefillDate);if(this.linkWithInput)pars+='&gotoPickedDate=1';}\r
+this.u('base',pars,function(){_class.mainLoader=_container.getElement('div[class=loaderA]');_class.tempLoader=_container.getElement('div[class=loaderB]');_class.label=_container.getElement('span[class=label]');_class.arrowLeft=_container.getElement('div[class=arrowLeft]');_class.arrowRight=_container.getElement('div[class=arrowRight]');_class.initializeCalendarFunctions();if(_class.picker){if($type(_class.prefillDate)=='object'&&_class.getInputDate(_class.prefillDate))_class.pick(_class.prefillDate);else if(_class.prefillDate==true)_class.pick(JSON.decode(_class.label.getProperty('date')));}},_container);},initializeCalendarFunctions:function(){this.resetArrows();var vars=JSON.decode(this.mainLoader.getElement('table').getProperty('summary'));var _class=this;this.label.removeClass('noHover').set('html',vars.label).onclick=vars.parent?function(){_class.u(vars.parent,'ts='+vars.ts+'&parent='+vars.current,function(){_class.fade()})}:null;if(vars.hide_left_arrow)this.hideLeftArrow();else if(vars.hide_right_arrow)this.hideRightArrow();this.arrowLeft.onclick=function(){_class.u(vars.current,'ts='+vars.pr_ts,function(){_class.slideLeft()})}\r
+this.arrowRight.onclick=function(){_class.u(vars.current,'ts='+vars.nx_ts,function(){_class.slideRight()})}\r
+var clickables=this.mainLoader.getElements('td');switch(vars.current){case'month':if(this.picker){clickables.each(function(_clickable){_clickable.onclick=function(){_class.pick(JSON.decode(_clickable.getProperty('date')));_class.mainLoader.getElements('td').each(function(_clickable){_clickable.removeClass('selected')});this.addClass('selected');}});}\r
+break;case'year':clickables.each(function(_clickable){_clickable.onclick=function(){_class.u('month','ts='+_clickable.getProperty('ts'),function(){_class.fade()})}});break;case'decade':this.label.addClass('noHover');clickables.each(function(_clickable){_clickable.onclick=function(){_class.u('year','ts='+_clickable.getProperty('ts')+'&m_ts='+_clickable.getProperty('m_ts'),function(){_class.fade()})}});break;}},u:function(_url,_pars,_onComplete,_id){if(!this.loading&&!this.transitioning){var _class=this;this.loading=true;var element=$(_id?_id:this.tempLoader);_pars+='&picker='+(this.picker?1:0)+'&startMonday='+(this.startMonday?1:0)+'&style='+this.style;if(this.picker&&this.getInputDate())_pars+='&pickedDate='+this.getInputDate();new Request({method:'post',url:this.filePath+_url+'.php',onComplete:function(data){element.set('html',data);_onComplete();_class.loading=false;}}).send(_pars);}},slideLeft:function(){var _class=this;this.transitioning=true;this.tempLoader.setStyle('opacity',1).set('tween',{duration:this.slideDuration,transition:this.transition}).tween('margin-left',[-164,0]);this.mainLoader.setStyle('opacity',1).set('tween',{duration:this.slideDuration,transition:this.transition,onComplete:function(){_class.transitioning=false}}).tween('margin-left',[0,164]);this.switchLoaders();},slideRight:function(){var _class=this;this.transitioning=true;this.mainLoader.setStyle('opacity',1).set('tween',{duration:this.slideDuration,transition:this.transition}).tween('margin-left',[0,-164]);this.tempLoader.setStyle('opacity',1).set('tween',{duration:this.slideDuration,transition:this.transition,onComplete:function(){_class.transitioning=false}}).tween('margin-left',[164,0]);this.switchLoaders();},fade:function(overRuleTrans){var _class=this;this.transitioning=overRuleTrans?false:true;this.tempLoader.setStyles({'opacity':0,'margin-left':0});this.mainLoader.set('tween',{duration:this.fadeDuration,transition:this.transition}).fade('out');this.tempLoader.set('tween',{duration:this.fadeDuration,transition:this.transition,onComplete:function(){_class.tempLoader.setStyles({'opacity':1,'margin-left':-999});_class.transitioning=false;}}).fade('in');this.switchLoaders();},switchLoaders:function(){this.mainLoader=this.mainLoader.className=='loaderA'?this.container.getElement('div[class=loaderB]'):this.container.getElement('div[class=loaderA]');this.tempLoader=this.tempLoader.className=='loaderA'?this.container.getElement('div[class=loaderB]'):this.container.getElement('div[class=loaderA]');this.initializeCalendarFunctions();},resetArrows:function(){this.arrowLeft.setStyle('visibility','visible');this.arrowRight.setStyle('visibility','visible');},hideLeftArrow:function(){this.arrowLeft.setStyle('visibility','hidden');},hideRightArrow:function(){this.arrowRight.setStyle('visibility','hidden');}});var vlaDatePicker=new Class({Extends:vlaCalendar,'separateInput':false,'prefillDate':true,'linkWithInput':true,'leadingZero':true,'twoDigitYear':false,'separator':'/','format':'d/m/y','openWith':null,'alignX':'right','alignY':'inputTop','offset':{'x':0,'y':0},'style':'','ieTransitionColor':'#ffffff','toggleDuration':350,initialize:function(_element,_options){if(_options)$extend(this,_options);this.element=$(_element);if(!this.element)throw'No (existing) element to create a datepicker for specified: new vlaDatePicker(ELEMENT, [options])';if(this.separateInput){this.element.day=this.element.getElement('input[name='+this.separateInput.day+']');this.element.month=this.element.getElement('input[name='+this.separateInput.month+']');this.element.year=this.element.getElement('input[name='+this.separateInput.year+']');}\r
+this.picker=new Element('div',{'class':'vlaCalendarPicker'+(this.style!=''?' '+this.style:'')}).injectTop($(document.body));this.pickerContent=new Element('div',{'class':'pickerBackground'}).injectTop(this.picker);this.parent(this.pickerContent);var _class=this;(this.openWith?$(this.openWith):this.element).addEvent('focus',function(){_class.show();}).addEvent('click',function(){_class.openWith?_class.toggle():_class.show()}).addEvent('change',function(){_class.hide();});document.addEvent('mousedown',function(e){if(_class.outsideHide&&_class.outsideClick(e,_class.picker))_class.hide()});if(this.linkWithInput){if(this.separateInput){this.element.day.addEvent('keyup',function(){_class.linkedUpdate()});this.element.month.addEvent('keyup',function(){_class.linkedUpdate()});this.element.year.addEvent('keyup',function(){_class.linkedUpdate()});}else{this.element.addEvent('keyup',function(){_class.linkedUpdate()});}}\r
+this.visible=false;this.outsideHide=false;},position:function(){var top,left;switch(this.alignX){case'left':left=this.element.getLeft();break;case'center':var pickerMiddle=this.pickerContent.getStyle('width').toInt()/2;if(pickerMiddle==0)pickerMiddle=83;left=this.element.getLeft()+(this.element.getSize().x/2)-pickerMiddle-\r
+((parseInt(this.pickerContent.getStyle('padding-left'))+parseInt(this.pickerContent.getStyle('padding-right')))/2);break;case'right':default:left=this.element.getLeft()+this.element.getSize().x;break;}\r
+switch(this.alignY){case'bottom':top=this.getPos(this.element).y+this.element.getSize().y;break;case'top':top=this.getPos(this.element).y-parseInt(this.pickerContent.getStyle('height'))-\r
+(parseInt(this.pickerContent.getStyle('padding-top'))+parseInt(this.pickerContent.getStyle('padding-bottom')));break;case'inputTop':default:top=this.getPos(this.element).y;}\r
+if(this.isNumber(this.offset.x))left+=this.offset.x;if(this.isNumber(this.offset.y))top+=this.offset.y;this.picker.setStyles({'top':top,'left':left});},show:function(){this.position();if(!this.visible){this.visible=true;var _class=this;this.picker.setStyles({'opacity':0,'display':'inline'});if(Browser.Engine.trident5)this.picker.setStyle('background-color',this.ieTransitionColor);this.picker.set('tween',{onComplete:function(){if(Browser.Engine.trident5)_class.picker.setStyle('background-color','transparent');_class.outsideHide=true;},duration:this.toggleDuration}).fade('in');}},hide:function(){if(this.visible){this.visible=false;var _class=this;if(Browser.Engine.trident5)this.picker.setStyle('background-color',this.ieTransitionColor);this.picker.set('tween',{onComplete:function(){_class.picker.setStyle('display','none');_class.outsideHide=false;},duration:this.toggleDuration}).fade('out');}},toggle:function(){if(this.visible)this.hide();else this.show();},pick:function(_date){if(this.leadingZero){if(_date.day<10)_date.day='0'+_date.day;if(_date.month<10)_date.month='0'+_date.month;}\r
+if(this.twoDigitYear)_date.year=_date.year.toString().substring(2,4);if(this.separateInput){if(this.element.day)this.element.day.set('value',_date.day);if(this.element.month)this.element.month.set('value',_date.month);if(this.element.year)this.element.year.set('value',_date.year);this.hide();}else{switch(this.format){case"m/d/y":this.element.set('value',_date.month+this.separator+_date.day+this.separator+_date.year);break;case"y/m/d":this.element.set('value',_date.year+this.separator+_date.month+this.separator+_date.day);break;case"y/d/m":this.element.set('value',_date.year+this.separator+_date.day+this.separator+_date.month);break;case"d/m/y":default:this.element.set('value',_date.day+this.separator+_date.month+this.separator+_date.year);}\r
+this.hide();}},getInputDate:function(_date){var day,month,year;if(_date){day=_date.day;month=_date.month;year=_date.year;}else if(this.separateInput){day=this.element.day.get('value').toInt();month=this.element.month.get('value').toInt();year=this.element.year.get('value').toInt();}else{var date=this.element.get('value').split(this.separator);if(date.length!=3)return null;switch(this.format){case"m/d/y":day=date[1];month=date[0];year=date[2];break;case"y/m/d":day=date[2];month=date[1];year=date[0];break;case"y/d/m":day=date[1];month=date[2];year=date[0];break;case"d/m/y":default:day=date[0];month=date[1];year=date[2];}}\r
+if(!this.isNumber(day)||!this.isNumber(month)||!this.isNumber(year)||day==0||month==0||year=='0'||(this.twoDigitYear&&year>99)||(!this.twoDigitYear&&year<1979)||(!this.twoDigitYear&&year>2030)||month>12||day>31)return null;if(this.twoDigitYear&&this.isNumber(year)&&year<100){year=year.toInt();if(year<10)year='200'+year;else if(year<70)year='20'+year;else if(year>69)year='19'+year;else year=new Date().getFullYear();}\r
+return day+'/'+month+'/'+year;},linkedUpdate:function(){var _class=this;var date=this.getInputDate();if(date&&this.pickedDate!=date){this.u('month','gotoPickedDate=1',function(){_class.fade(true)});this.pickedDate=date;}},outsideClick:function(_event,_element){var mousePos=this.getMousePos(_event);var elementData=_element.getCoordinates();return(mousePos.x>elementData.left&&mousePos.x<(elementData.left+elementData.width))&&(mousePos.y>elementData.top&&mousePos.y<(elementData.top+elementData.height))?false:true;},getMousePos:function(_event){if(document.all){return{'x':window.event.clientX+window.getScrollLeft(),'y':window.event.clientY+window.getScrollTop()};}else{return{'x':_event.page['x'],'y':_event.page['y']};}},isNumber:function(_number){if(_number=='')return false;return(_number>=0)||(_number<0)?true:false;},getPos:function(_element){var x,y=0;if(_element.offsetParent){do{x+=_element.offsetLeft;y+=_element.offsetTop;}while(_element=_element.offsetParent);}else if(_element.x){x+=_element.x;y+=_element.y;}\r
+return{'x':x,'y':y};}});
\ No newline at end of file
diff --git a/web/js/vlaCal-v2.1.js b/web/js/vlaCal-v2.1.js
new file mode 100644 (file)
index 0000000..d83e853
--- /dev/null
@@ -0,0 +1,391 @@
+  /*********************************************************/\r
+ /*   vlaCalendar version 2.1 for mootools release 1.2    */\r
+/*********************************************************/\r
+\r
+var vlaCalendar = new Class({\r
+       'slideDuration': 500,\r
+       'fadeDuration': 500,\r
+       'transition': Fx.Transitions.Quart.easeOut,\r
+       'startMonday': false,\r
+       'filePath': 'inc/',\r
+       'defaultView': 'month',\r
+       'style': '',\r
+       \r
+       initialize: function(_container, _options) {\r
+               //Add the provided options to this object by extending\r
+               if(_options) $extend(this, _options);\r
+               \r
+               this.loading = false;\r
+               this.container = _container = $(_container);\r
+               var _class = this;\r
+               \r
+               //Insert the base into the container and initialize elements\r
+               var  pars = 'defaultView='+ this.defaultView;\r
+               if(this.picker) {\r
+                       if($type(this.prefillDate) == 'object' && this.getInputDate(this.prefillDate)) pars += '&pickedDate='+ this.getInputDate(this.prefillDate);\r
+                       if(this.linkWithInput) pars += '&gotoPickedDate=1';\r
+               }\r
+               this.u('base', pars, function() { \r
+                       _class.mainLoader = _container.getElement('div[class=loaderA]');\r
+                       _class.tempLoader = _container.getElement('div[class=loaderB]');\r
+                       _class.label      = _container.getElement('span[class=label]');\r
+                       _class.arrowLeft  = _container.getElement('div[class=arrowLeft]');\r
+                       _class.arrowRight = _container.getElement('div[class=arrowRight]');                             \r
+                       _class.initializeCalendarFunctions();\r
+                       \r
+                       //Prefill/load picker date elements\r
+                       if(_class.picker) {\r
+                               if($type(_class.prefillDate) == 'object' && _class.getInputDate(_class.prefillDate)) _class.pick(_class.prefillDate);\r
+                               else if(_class.prefillDate == true) _class.pick(JSON.decode(_class.label.getProperty('date')));\r
+                       }\r
+               }, _container);\r
+       },\r
+       \r
+       initializeCalendarFunctions: function() {\r
+               this.resetArrows();\r
+               \r
+               //Retrieve data (label, timestamp etc) which are stored as a Json string in the table attribute summary\r
+               var vars = JSON.decode(this.mainLoader.getElement('table').getProperty('summary'));\r
+               var _class = this; \r
+               \r
+               //Change the label\r
+               this.label.removeClass('noHover').set('html', vars.label)\r
+                       .onclick = vars.parent ? function() { _class.u(vars.parent, 'ts=' + vars.ts + '&parent=' + vars.current, function() { _class.fade() }) } : null;\r
+                       \r
+               //Hide arrows if necessary and add arrow click events\r
+               if(vars.hide_left_arrow) this.hideLeftArrow();\r
+               else if(vars.hide_right_arrow) this.hideRightArrow();\r
+               \r
+               this.arrowLeft.onclick  = function() { _class.u(vars.current, 'ts=' + vars.pr_ts, function() { _class.slideLeft() }) }\r
+               this.arrowRight.onclick = function() { _class.u(vars.current, 'ts=' + vars.nx_ts, function() { _class.slideRight() }) }         \r
+               \r
+               //Add cell click events\r
+               var clickables = this.mainLoader.getElements('td');\r
+               switch(vars.current) {\r
+                       case 'month':\r
+                               if(this.picker) {\r
+                                       clickables.each(function(_clickable) {\r
+                                               _clickable.onclick = function() { \r
+                                                       _class.pick(JSON.decode(_clickable.getProperty('date')));\r
+                                                       _class.mainLoader.getElements('td').each(function(_clickable) { _clickable.removeClass('selected') });\r
+                                                       this.addClass('selected'); \r
+                                               }\r
+                                       });\r
+                               }\r
+                               break;\r
+                       case 'year':\r
+                               clickables.each(function(_clickable) {\r
+                                       _clickable.onclick = function() { _class.u('month', 'ts=' + _clickable.getProperty('ts'), function() { _class.fade() }) }\r
+                               });\r
+                               break;\r
+                       case 'decade':\r
+                               this.label.addClass('noHover');\r
+                               clickables.each(function(_clickable) {\r
+                                       _clickable.onclick = function() { _class.u('year', 'ts=' + _clickable.getProperty('ts') + '&m_ts=' + _clickable.getProperty('m_ts'), function() { _class.fade() }) }\r
+                               });\r
+                               break;\r
+               }\r
+       },\r
+       \r
+       //Ajax updater function which handles all requests\r
+       u: function(_url, _pars, _onComplete, _id) {\r
+               if(!this.loading && !this.transitioning) {\r
+                       var _class = this;\r
+                       this.loading = true;\r
+                       var element = $(_id ? _id : this.tempLoader);\r
+                       _pars += '&picker=' + (this.picker ? 1 : 0) + '&startMonday=' + (this.startMonday ? 1 : 0) + '&style=' +  this.style;\r
+                       if(this.picker && this.getInputDate()) _pars += '&pickedDate='+ this.getInputDate();\r
+                       new Request({ method: 'post',\r
+                                                 url: this.filePath + _url + '.php',\r
+                                                 onComplete: function(data) { element.set('html', data); _onComplete(); _class.loading = false; }\r
+                                               }).send(_pars);\r
+               }\r
+       },\r
+       \r
+       slideLeft: function() {\r
+               var _class = this;\r
+               this.transitioning = true;      \r
+               this.tempLoader.setStyle('opacity', 1).set('tween', { duration: this.slideDuration, transition: this.transition }).tween('margin-left', [-164, 0]);\r
+               this.mainLoader.setStyle('opacity', 1).set('tween', { duration: this.slideDuration, transition: this.transition, onComplete: function() { _class.transitioning = false } })\r
+                       .tween('margin-left', [0, 164]);\r
+               this.switchLoaders();\r
+       },\r
+       \r
+       slideRight: function() {\r
+               var _class = this;\r
+               this.transitioning = true;\r
+               this.mainLoader.setStyle('opacity', 1).set('tween', { duration: this.slideDuration, transition: this.transition }).tween('margin-left', [0, -164]);\r
+               this.tempLoader.setStyle('opacity', 1).set('tween', { duration: this.slideDuration, transition: this.transition, onComplete: function() { _class.transitioning = false } })\r
+                       .tween('margin-left', [164, 0]);\r
+               this.switchLoaders();\r
+       },\r
+       \r
+       fade: function(overRuleTrans) {\r
+               var _class = this;\r
+               this.transitioning = overRuleTrans ? false : true;\r
+               this.tempLoader.setStyles({'opacity': 0, 'margin-left': 0});\r
+               this.mainLoader.set('tween', { duration: this.fadeDuration, transition: this.transition}).fade('out');\r
+               this.tempLoader.set('tween', { duration: this.fadeDuration, transition: this.transition, \r
+                       onComplete: function() { \r
+                                       _class.tempLoader.setStyles({'opacity': 1, 'margin-left': -999});\r
+                                       _class.transitioning = false;\r
+                               } \r
+                       }).fade('in');\r
+               this.switchLoaders();\r
+       },\r
+       \r
+       switchLoaders: function() {\r
+               this.mainLoader = this.mainLoader.className == 'loaderA' ? this.container.getElement('div[class=loaderB]') : this.container.getElement('div[class=loaderA]');\r
+               this.tempLoader = this.tempLoader.className == 'loaderA' ? this.container.getElement('div[class=loaderB]') : this.container.getElement('div[class=loaderA]');\r
+               this.initializeCalendarFunctions();\r
+       },\r
+       \r
+       resetArrows: function() {\r
+               this.arrowLeft.setStyle('visibility', 'visible');\r
+               this.arrowRight.setStyle('visibility', 'visible');\r
+       },\r
+       \r
+       hideLeftArrow: function() {\r
+               this.arrowLeft.setStyle('visibility', 'hidden');\r
+       },\r
+       \r
+       hideRightArrow: function() {\r
+               this.arrowRight.setStyle('visibility', 'hidden');\r
+       } \r
+});\r
+\r
+var vlaDatePicker = new Class({\r
+       Extends: vlaCalendar,\r
+       \r
+       'separateInput': false,\r
+       'prefillDate': true,\r
+       'linkWithInput': true,\r
+       'leadingZero': true,\r
+       'twoDigitYear': false,\r
+       'separator': '/',\r
+       'format': 'd/m/y',\r
+       'openWith': null,\r
+       'alignX': 'right',\r
+       'alignY': 'inputTop',\r
+       'offset': { 'x': 0, 'y': 0 },\r
+       'style': '',\r
+       'ieTransitionColor' : '#ffffff',\r
+       'toggleDuration': 350,\r
+       \r
+       initialize: function(_element, _options) {\r
+               //Add the provided options to this object by extending\r
+               if(_options) $extend(this, _options);\r
+               \r
+               this.element = $(_element);\r
+               if(!this.element) throw 'No (existing) element to create a datepicker for specified: new vlaDatePicker(ELEMENT, [options])';\r
+               \r
+               //Check if the user wants multiple input\r
+               if(this.separateInput) {\r
+                       this.element.day   = this.element.getElement('input[name='+ this.separateInput.day +']');\r
+                       this.element.month = this.element.getElement('input[name='+ this.separateInput.month +']');\r
+                       this.element.year  = this.element.getElement('input[name='+ this.separateInput.year +']');\r
+               }\r
+               \r
+               //Create the picker and calendar and inject in in the body\r
+               this.picker = new Element('div', { 'class': 'vlaCalendarPicker' + (this.style != '' ? ' ' + this.style : '') }).injectTop($(document.body));\r
+               this.pickerContent = new Element('div', { 'class': 'pickerBackground' }).injectTop(this.picker);\r
+               this.parent(this.pickerContent);\r
+               \r
+               //Add events for showing and hiding the picker\r
+               var _class = this;\r
+               (this.openWith ? $(this.openWith) : this.element)\r
+                       .addEvent('focus',  function() { _class.show(); })\r
+                       .addEvent('click',  function() { _class.openWith ? _class.toggle() : _class.show() })\r
+                       .addEvent('change', function() { _class.hide(); });\r
+               \r
+               //If the datepicker is visible an outside click makes it hide\r
+               document.addEvent('mousedown', function(e) { if(_class.outsideHide && _class.outsideClick(e, _class.picker)) _class.hide() });\r
+               \r
+               //linkWithInput\r
+               if(this.linkWithInput) {\r
+                       if(this.separateInput) {\r
+                               this.element.day.addEvent('keyup',  function() { _class.linkedUpdate() });\r
+                               this.element.month.addEvent('keyup',  function() { _class.linkedUpdate() });\r
+                               this.element.year.addEvent('keyup',  function() { _class.linkedUpdate() });\r
+                       } else {\r
+                               this.element.addEvent('keyup',  function() { _class.linkedUpdate() });\r
+                       }\r
+               }\r
+               \r
+               this.visible = false;\r
+               this.outsideHide = false;\r
+       },\r
+       \r
+       //Position the picker\r
+       position: function() {\r
+               var top, left;\r
+               \r
+               switch(this.alignX) {\r
+                       case 'left':\r
+                               left = this.element.getLeft();\r
+                               break;\r
+                       case 'center':\r
+                               var pickerMiddle = this.pickerContent.getStyle('width').toInt() / 2;\r
+                               if(pickerMiddle == 0) pickerMiddle = 83;\r
+                               left = this.element.getLeft() + (this.element.getSize().x / 2) - pickerMiddle -\r
+                                               ((parseInt(this.pickerContent.getStyle('padding-left')) + parseInt(this.pickerContent.getStyle('padding-right'))) / 2);\r
+                               break;\r
+                       case 'right': default:\r
+                               left = this.element.getLeft() + this.element.getSize().x;\r
+                               break;\r
+               }\r
+               \r
+               switch(this.alignY) {\r
+                       case 'bottom':\r
+                               top = this.getPos(this.element).y + this.element.getSize().y;\r
+                               break;\r
+                       case 'top': \r
+                               top = this.getPos(this.element).y - parseInt(this.pickerContent.getStyle('height')) - \r
+                                       (parseInt(this.pickerContent.getStyle('padding-top')) + parseInt(this.pickerContent.getStyle('padding-bottom')));\r
+                               break;\r
+                       case 'inputTop': default:\r
+                               top = this.getPos(this.element).y;\r
+               }\r
+               \r
+               if(this.isNumber(this.offset.x)) left += this.offset.x;\r
+               if(this.isNumber(this.offset.y)) top += this.offset.y;\r
+               \r
+               this.picker.setStyles({ 'top': top, 'left': left });\r
+       },\r
+       \r
+       show: function() {\r
+               this.position();\r
+               if(!this.visible) {\r
+                       this.visible = true;\r
+                       var _class = this;\r
+                       this.picker.setStyles({ 'opacity': 0, 'display': 'inline' });\r
+                       if(Browser.Engine.trident5) this.picker.setStyle('background-color', this.ieTransitionColor); //Ugly transition fix for IE7\r
+                       this.picker.set('tween', { onComplete: function() { \r
+                                       if(Browser.Engine.trident5) _class.picker.setStyle('background-color', 'transparent');\r
+                                       _class.outsideHide = true; \r
+                               }, duration: this.toggleDuration }).fade('in');\r
+               }\r
+       },\r
+       \r
+       hide: function() {\r
+               if(this.visible) {\r
+                       this.visible = false;\r
+                       var _class = this;\r
+                       if(Browser.Engine.trident5) this.picker.setStyle('background-color', this.ieTransitionColor); //Ugly transition fix for IE7\r
+                       this.picker.set('tween', { onComplete: function() { _class.picker.setStyle('display', 'none'); _class.outsideHide = false; }, duration: this.toggleDuration }).fade('out');\r
+               }\r
+       },\r
+       \r
+       toggle: function() {\r
+               if(this.visible) this.hide();\r
+               else this.show();\r
+       },\r
+       \r
+       pick: function(_date) {\r
+               if(this.leadingZero) {\r
+                       if(_date.day < 10)   _date.day = '0' + _date.day;\r
+                       if(_date.month < 10) _date.month = '0' + _date.month;\r
+               }\r
+               if(this.twoDigitYear) _date.year = _date.year.toString().substring(2, 4);\r
+               \r
+               if(this.separateInput) {\r
+                       if(this.element.day)   this.element.day.set('value', _date.day);\r
+                       if(this.element.month) this.element.month.set('value', _date.month);\r
+                       if(this.element.year)  this.element.year.set('value', _date.year);\r
+                       this.hide();\r
+               } else {\r
+                       switch(this.format) {\r
+                               case "m/d/y": this.element.set('value', _date.month + this.separator + _date.day + this.separator + _date.year); break;\r
+                               case "y/m/d": this.element.set('value', _date.year + this.separator + _date.month + this.separator + _date.day); break;\r
+                               case "y/d/m": this.element.set('value', _date.year + this.separator +  _date.day + this.separator + _date.month); break;\r
+                               case "d/m/y": default: this.element.set('value', _date.day + this.separator + _date.month + this.separator + _date.year);\r
+                       }\r
+                       this.hide();\r
+               }\r
+       },\r
+       \r
+       getInputDate: function(_date) {\r
+               var day, month, year;\r
+               \r
+               if(_date) {\r
+                       day = _date.day;\r
+                       month = _date.month;\r
+                       year = _date.year;\r
+               } else if(this.separateInput) {\r
+                       day = this.element.day.get('value').toInt();\r
+                       month = this.element.month.get('value').toInt();\r
+                       year = this.element.year.get('value').toInt();\r
+               } else {\r
+                       var date = this.element.get('value').split(this.separator);\r
+                       if(date.length != 3) return null;\r
+                       switch(this.format) {\r
+                               case "m/d/y": day = date[1]; month = date[0]; year = date[2]; break;\r
+                               case "y/m/d": day = date[2]; month = date[1]; year = date[0]; break;\r
+                               case "y/d/m": day = date[1]; month = date[2]; year = date[0]; break;\r
+                               case "d/m/y": default: day = date[0]; month = date[1]; year = date[2];\r
+                       }\r
+               }\r
+               \r
+               if( !this.isNumber(day) || !this.isNumber(month) || !this.isNumber(year) ||     day == 0 || month == 0 || year == '0' ||\r
+                   (this.twoDigitYear && year > 99) || (!this.twoDigitYear && year < 1979) || (!this.twoDigitYear && year > 2030) || month > 12 || day > 31 ) return null;\r
+               \r
+               if(this.twoDigitYear && this.isNumber(year) && year < 100) {\r
+                       year = year.toInt();\r
+                       if(year < 10) year = '200'+  year;\r
+                       else if(year < 70) year = '20'+  year;\r
+                       else if(year > 69) year = '19'+  year;\r
+                       else year = new Date().getFullYear();\r
+               }\r
+               \r
+               return day +'/'+ month +'/'+ year;\r
+       },\r
+       \r
+       //This function is being called on keyup event if linkWithInput is set to true and when a date is picked\r
+       //If the full date is inserted the picker will change itself to that specific date (month view)\r
+       linkedUpdate: function() {\r
+               var _class = this;\r
+               var date = this.getInputDate();\r
+               if(date && this.pickedDate != date) {\r
+                       this.u('month', 'gotoPickedDate=1', function() { _class.fade(true) });\r
+                       this.pickedDate = date;\r
+               }\r
+       },\r
+       \r
+       outsideClick: function(_event, _element) {\r
+               var mousePos = this.getMousePos(_event);\r
+               var elementData = _element.getCoordinates();\r
+               return (mousePos.x > elementData.left && mousePos.x < (elementData.left + elementData.width)) &&\r
+                          (mousePos.y > elementData.top  && mousePos.y < (elementData.top + elementData.height)) ? false : true;\r
+       },\r
+       \r
+       getMousePos: function(_event) {\r
+               if(document.all) {\r
+                       return { 'x': window.event.clientX + window.getScrollLeft(),\r
+                                        'y': window.event.clientY + window.getScrollTop() };\r
+               } else {\r
+                       return { 'x': _event.page['x'],\r
+                                        'y': _event.page['y'] };\r
+               }\r
+       },\r
+       \r
+       isNumber: function(_number) {\r
+               if(_number == '') return false;\r
+               return (_number >= 0) || (_number < 0) ? true : false;\r
+       },\r
+       \r
+       //Retrieving positition funtions (like getCoordinates, getTop etc) don't seem to return correct values in some situations in mootools 1.2; \r
+       //Opera returns wrong values, IE returns too small values. This function returns the correct coordinates.\r
+       getPos: function(_element) { \r
+               var x, y = 0;\r
+               if(_element.offsetParent) {\r
+                       do {\r
+                               x += _element.offsetLeft;\r
+                               y += _element.offsetTop;\r
+                       } while(_element = _element.offsetParent);\r
+               } else if(_element.x) {\r
+                       x += _element.x;\r
+                       y += _element.y;\r
+               }\r
+               return { 'x': x, 'y': y };\r
+       }\r
+});
\ No newline at end of file