Clean up some javascript defs in kronolith
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 30 Jul 2010 17:30:30 +0000 (11:30 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 30 Jul 2010 17:43:28 +0000 (11:43 -0600)
kronolith/js/calendar-panel.js
kronolith/js/edit.js
kronolith/js/goto.js
kronolith/js/views.js
kronolith/templates/common-header.inc
kronolith/templates/edit/edit.inc
kronolith/templates/javascript_defs.php

index 6ae93e6..5ff6fb3 100644 (file)
@@ -16,7 +16,7 @@ function sbarToggle()
 document.observe('dom:loaded', function() {
     $$('#pageControlsInner .checkbox').invoke('observe', 'click', function() {
         Views.invalidate();
-        ShowView(kronolithView, { date: kronolithDate.getFullYear() + (kronolithDate.getMonth() + 1).toPaddedString(2) + kronolithDate.getDate().toPaddedString(2), toggle_calendar: this.value }, false);
+        ShowView(KronolithView, { date: KronolithDate.getFullYear() + (KronolithDate.getMonth() + 1).toPaddedString(2) + KronolithDate.getDate().toPaddedString(2), toggle_calendar: this.value }, false);
     });
 
     $$('#pageControlsInner .calendar-info').invoke('observe', 'click', function() {
index b9e02f6..1d8f971 100644 (file)
@@ -520,6 +520,8 @@ var KronolithEdit =
         $('eventform').observe('click', this.clickHandler.bindAsEventListener(this));
         $('eventform').observe('change', this.changeHandler.bindAsEventListener(this));
         $('eventform').observe('keypress', this.keypressHandler.bindAsEventListener(this));
+
+        $('title').focus();
     }
 
 };
index 3684169..48b54cb 100644 (file)
@@ -50,7 +50,7 @@ var KronolithGoto =
     onDomLoad: function()
     {
         $('menu').down('A.kgotomenu').observe('click', function(e) {
-            Horde_Calendar.open(e.element(), Object.isUndefined(window.kronolithDate) ? new Date() : window.kronolithDate);
+            Horde_Calendar.open(e.element(), Object.isUndefined(window.KronolithDate) ? new Date() : window.KronolithDate);
         });
     }
 
index d55b3d3..90521aa 100644 (file)
@@ -90,8 +90,8 @@ function _ShowView()
 
     var viewVars = $('view_vars');
     if (viewVars) {
-        kronolithView = viewVars.readAttribute('view');
-        kronolithDate = new Date(viewVars.readAttribute('date'));
+        KronolithView = viewVars.readAttribute('view');
+        KronolithDate = new Date(viewVars.readAttribute('date'));
     }
 }
 
index f78aa19..c763729 100644 (file)
@@ -30,13 +30,7 @@ $bc = (isset($view) && is_object($view) && $prefs->getValue('show_panel'))
     ? 'rightPanel'
     : '';
 
-$currentDate = Kronolith::currentDate();
-
 ?>
-<script type="text/javascript">//<![CDATA[
-var kronolithView = '<?php if (isset($view) && is_object($view)) echo $view->getName() ?>';
-var kronolithDate = new Date(<?php printf('%d, %d, %d', $currentDate->year, $currentDate->month - 1, $currentDate->mday) ?>);
-//]]></script>
 <title><?php echo htmlspecialchars($page_title) ?></title>
 <link href="<?php echo Horde_Themes::img('favicon.ico', array('nohorde' => true)) ?>" rel="SHORTCUT ICON" />
 <?php Horde_Themes::includeStylesheetFiles() ?>
index cc47d43..ca88d16 100644 (file)
@@ -446,6 +446,3 @@ if ($event->alarm) {
  </tr>
 </table>
 </form>
-<script type="text/javascript">
-document.eventform.title.focus();
-</script>
index c6a6552..07ad9e6 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 $charset = $GLOBALS['registry']->getCharset();
+$currentDate = Kronolith::currentDate();
 
 /* Variables used in core javascript files. */
 $var = array(
@@ -23,6 +24,8 @@ $gettext = array(
 
 ?>
 <script type="text/javascript">//<![CDATA[
-var KronolithVar = <?php echo Horde_Serialize::serialize($var, Horde_Serialize::JSON, $charset) ?>;
+var KronolithDate = new Date(<?php printf('%d, %d, %d', $currentDate->year, $currentDate->month - 1, $currentDate->mday) ?>);
 var KronolithText = <?php echo Horde_Serialize::serialize($gettext, Horde_Serialize::JSON, $charset) ?>;
+var KronolithVar = <?php echo Horde_Serialize::serialize($var, Horde_Serialize::JSON, $charset) ?>;
+var KronolithView = '<?php if (isset($view) && is_object($view)) echo $view->getName() ?>';
 //]]></script>