CSS tweaks, move mobile javascript defs out of Kronolith.php:
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 19 Nov 2010 04:02:44 +0000 (23:02 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 19 Nov 2010 04:02:44 +0000 (23:02 -0500)
Use data-theme="b", remove data-role="content" from the month view
to get rid of the annoying page border/padding, add selected date text
to month view also,

kronolith/js/mobile.js
kronolith/mobile.php
kronolith/templates/mobile/day.html.php
kronolith/templates/mobile/event.html.php
kronolith/templates/mobile/head.html.php
kronolith/templates/mobile/javascript_defs.php
kronolith/templates/mobile/month.html.php
kronolith/themes/mobile.css

index 0c91b6b..98a634e 100644 (file)
                 }
                 // Select current date.
                 $('#kronolithMonth'+ $('kronolithMinicalDate').data('date')).addClass('kronolithSelected');
-
+                KronolithMobile.selectMonthDay($('#kronolithMinicalDate').data('date'));
                 break;
         }
     },
      */
     selectMonthDay: function(date)
     {
-        var ul = $('<ul>').attr({ 'data-role': 'listview '});
-        var d = Date.parse(date);
+        var ul = $('<ul>').attr({ 'data-role': 'listview '}),
+        d = KronolithMobile.parseDate(date), today = new Date(),
+        text;
         $('.kronolithDayDetail ul').detach();
+        if (today.dateString() == d.dateString()) {
+          text = Kronolith.text.today;
+        } else if (today.clone().addDays(-1).dateString() == d.dateString()) {
+          text = Kronolith.text.yesterday;
+        } else if (today.clone().addDays(1).dateString() == d.dateString()) {
+          text = Kronolith.text.tomorrow;
+        } else {
+          text = d.toString('ddd') + ' ' + d.toString('d')
+        }
+        $('.kronolithDayDetail h4').text(text);
         $('.kronolithSelected').removeClass('kronolithSelected');
         $('#kronolithMonth' + date).addClass('kronolithSelected');
         if ($('#kronolithMonth' + date).hasClass('kronolithContainsEvents')) {
         $('#kronolithMinicalDate')
             .data('date', date.toString('yyyyMMdd'))
             .html(date.toString('MMMM yyyy'));
+
         for (i = 0; i < 42; i++) {
             dateString = day.toString('yyyyMMdd');
 
                 KronolithMobile.buildCal($('.kronolithDayDate').data('date'));
                 KronolithMobile.insertEvents(d, 'month');
                 KronolithMobile.selectMonthDay($('.kronolithDayDate').data('date').dateString());
+                KronolithMobile.monthIsLoaded = true;
             }
         });
 
index 97390e9..4032579 100644 (file)
@@ -24,6 +24,7 @@ $view->portal = Horde::getServiceLink('portal', 'horde')->setRaw(false);
 $view->logout = Horde::getServiceLink('logout')->setRaw(false);
 
 require $registry->get('templates', 'horde') . '/common-header-mobile.inc';
+require KRONOLITH_TEMPLATES . '/mobile/javascript_defs.php';
 echo $view->render('head');
 echo $view->render('day');
 echo $view->render('event');
index fe1fc34..dd54eb1 100644 (file)
@@ -1,4 +1,4 @@
-<div data-role="page" id="dayview">
+<div data-role="page" data-theme="b" id="dayview">
   <div data-role="header">
     <h1><?php echo _("Day")?></h1>
     <a rel="external" href="<?php echo $this->portal ?>"><?php echo _("Portal")?></a>
@@ -15,7 +15,8 @@
     <div class="ui-bar-b kronolithDayHeader">
       <a href="#" class="kronolithPrevDay" data-icon="arrow-l" data-iconpos="notext"><?php echo _("Previous")?></a>
       <span class="kronolithDayDate"></span>
-      <a href="#" data-icon="arrow-r" data-iconpos="notext" class="kronolithNextDay"><?php echo _("Next")?></a></div>
+      <a href="#" data-icon="arrow-r" data-iconpos="notext" class="kronolithNextDay"><?php echo _("Next")?></a>
+    </div>
   </div>
   <div data-role="content" class="ui-body"></div>
 </div>
index ebb17dd..9993738 100644 (file)
@@ -1,4 +1,4 @@
-<div data-role="page" id="eventview">
+<div data-role="page" data-theme="b" id="eventview">
   <div data-role="header" data-theme="b"><h1><?php echo ("Event")?></h1></div>
   <div data-role="content" class="ui-body"></div>
 </div>
index b151e96..d20c4ee 100644 (file)
@@ -1,4 +1,3 @@
-  <?php Horde::addInlineScript(Kronolith::includeJSVars());?>
   <script type="text/javascript" src="<?php echo $this->registry->get('jsuri', 'horde')?>/horde-jquery.js"></script>
   <script type="text/javascript" src="<?php echo $this->registry->get('jsuri', 'horde') ?>/date/en-US.js"></script>
   <script type="text/javascript" src="<?php echo $this->registry->get('jsuri', 'horde') ?>/date/date.js"></script>
index 39ab6da..41e03b0 100644 (file)
@@ -4,7 +4,6 @@ global $prefs, $registry;
 $kronolith_webroot = $registry->get('webroot');
 $horde_webroot = $registry->get('webroot', 'horde');
 $has_tasks = $registry->hasInterface('tasks');
-$tagger = self::getTagger();
 
 /* Variables used in core javascript files. */
 $code['conf'] = array(
@@ -18,21 +17,20 @@ $code['conf'] = array(
         'exception' => (string)Horde_Themes::img('exception-fff.png'),
     ),
     'user' => $GLOBALS['registry']->convertUsername($GLOBALS['registry']->getAuth(), false),
-    'prefs_url' => (string)Horde::getServiceLink('prefs', 'kronolith')->setRaw(true)->add('ajaxui', 1),
+    //'prefs_url' => (string)Horde::getServiceLink('prefs', 'kronolith')->setRaw(true)->add('ajaxui', 1),
     'name' => $registry->get('name'),
     'has_tasks' => $has_tasks,
-    'login_view' => $prefs->getValue('defaultview') == 'workweek' ? 'week' : $prefs->getValue('defaultview'),
-    'default_calendar' => 'internal|' . self::getDefaultCalendar(Horde_Perms::EDIT),
+    'default_calendar' => 'internal|' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT),
     'week_start' => (int)$prefs->getValue('week_start_monday'),
     'max_events' => (int)$prefs->getValue('max_events'),
     'date_format' => str_replace(array('%e', '%d', '%a', '%A', '%m', '%h', '%b', '%B', '%y', '%Y'),
                                  array('d', 'dd', 'ddd', 'dddd', 'MM', 'MMM', 'MMM', 'MMMM', 'yy', 'yyyy'),
                                  Horde_Nls::getLangInfo(D_FMT)),
     'time_format' => $prefs->getValue('twentyFour') ? 'HH:mm' : 'hh:mm tt',
-    'status' => array('tentative' => self::STATUS_TENTATIVE,
-                      'confirmed' => self::STATUS_CONFIRMED,
-                      'cancelled' => self::STATUS_CANCELLED,
-                      'free' => self::STATUS_FREE),
+    'status' => array('tentative' => Kronolith::STATUS_TENTATIVE,
+                      'confirmed' => Kronolith::STATUS_CONFIRMED,
+                      'cancelled' => Kronolith::STATUS_CANCELLED,
+                      'free' => Kronolith::STATUS_FREE),
     'recur' => array(Horde_Date_Recurrence::RECUR_NONE => 'None',
                      Horde_Date_Recurrence::RECUR_DAILY => 'Daily',
                      Horde_Date_Recurrence::RECUR_WEEKLY => 'Weekly',
@@ -46,7 +44,7 @@ $code['conf'] = array(
                      'read' => Horde_Perms::READ,
                      'edit' => Horde_Perms::EDIT,
                      'delete' => Horde_Perms::DELETE,
-                     'delegate' => self::PERMS_DELEGATE),
+                     'delegate' => Kronolith::PERMS_DELEGATE),
     'snooze' => array('0' => _("select..."),
                       '5' => _("5 minutes"),
                       '15' => _("15 minutes"),
@@ -54,17 +52,9 @@ $code['conf'] = array(
                       '360' => _("6 hours"),
                       '1440' => _("1 day")),
 );
-if (!empty($GLOBALS['conf']['logo']['link'])) {
-    $code['conf']['URI_HOME'] = $GLOBALS['conf']['logo']['link'];
-}
-
 if ($has_tasks) {
     $code['conf']['tasks'] = $registry->tasks->ajaxDefaults();
 }
-
-$subscriptionCals = Horde::url($registry->get('webroot', 'horde') . ($GLOBALS['conf']['urls']['pretty'] == 'rewrite' ? '/rpc/kronolith/' : '/rpc.php/kronolith/'), true, -1);
-$subscriptionTasks = Horde::url($registry->get('webroot', 'horde') . ($GLOBALS['conf']['urls']['pretty'] == 'rewrite' ? '/rpc/nag/' : '/rpc.php/nag/'), true, -1);
-
 // Calendars
 foreach (array(true, false) as $my) {
     foreach ($GLOBALS['all_calendars'] as $id => $calendar) {
@@ -85,12 +75,10 @@ foreach (array(true, false) as $my) {
                 'bg' => $calendar->background(),
                 'show' => in_array($id, $GLOBALS['display_calendars']),
                 'edit' => $calendar->hasPermission(Horde_Perms::EDIT),
-                'sub' => $subscriptionCals . ($calendar->owner() ? $calendar->owner() : '-system-') . '/' . $id . '.ics',
                 'feed' => (string)Kronolith::feedUrl($id),
-                'embed' => self::embedCode($id),
-                'tg' => array_values($tagger->getTags($id, 'calendar')));
+                'embed' => Kronolith::embedCode($id));
             if ($owner) {
-                $code['conf']['calendars']['internal'][$id]['perms'] = self::permissionToJson($calendar->share()->getPermission());
+                $code['conf']['calendars']['internal'][$id]['perms'] = Kronolith::permissionToJson($calendar->share()->getPermission());
             }
         }
     }
@@ -113,13 +101,12 @@ foreach (array(true, false) as $my) {
                     . $tasklist->get('name'),
                 'desc' => $tasklist->get('desc'),
                 'owner' => $owner,
-                'fg' => self::foregroundColor($tasklist),
-                'bg' => self::backgroundColor($tasklist),
+                'fg' => Kronolith::foregroundColor($tasklist),
+                'bg' => Kronolith::backgroundColor($tasklist),
                 'show' => in_array('tasks/' . $id, $GLOBALS['display_external_calendars']),
-                'edit' => $tasklist->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT),
-                'sub' => $subscriptionTasks . ($tasklist->get('owner') ? $tasklist->get('owner') : '-system-') . '/' . $tasklist->getName() . '.ics');
+                'edit' => $tasklist->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT));
             if ($owner) {
-                $code['conf']['calendars']['tasklists']['tasks/' . $id]['perms'] = self::permissionToJson($tasklist->getPermission());
+                $code['conf']['calendars']['tasklists']['tasks/' . $id]['perms'] = Kronolith::permissionToJson($tasklist->getPermission());
             }
         }
     }
@@ -166,31 +153,18 @@ foreach ($GLOBALS['all_holidays'] as $id => $calendar) {
 /* Gettext strings used in core javascript files. */
 $code['text'] = array(
     'ajax_error' => _("Error when communicating with the server."),
-    'ajax_timeout' => _("There has been no contact with the server for several minutes. The server may be temporarily unavailable or network problems may be interrupting your session. You will not see any updates until the connection is restored."),
-    'ajax_recover' => _("The connection to the server has been restored."),
-    'alarm' => _("Alarm:"),
-    'snooze' => sprintf(_("You can snooze it for %s or %s dismiss %s it entirely"), '#{time}', '#{dismiss_start}', '#{dismiss_end}'),
-    'noalerts' => _("No Notifications"),
-    'alerts' => sprintf(_("%s notifications"), '#{count}'),
-    'hidelog' => _("Hide Notifications"),
-    'growlerinfo' => _("This is the notification backlog"),
-    'agenda' => _("Agenda"),
-    'searching' => sprintf(_("Events matching \"%s\""), '#{term}'),
+    //'alarm' => _("Alarm:"),
+    //'snooze' => sprintf(_("You can snooze it for %s or %s dismiss %s it entirely"), '#{time}', '#{dismiss_start}', '#{dismiss_end}'),
+    //'agenda' => _("Agenda"),
     'allday' => _("All day"),
-    'more' => _("more..."),
-    'prefs' => _("Preferences"),
-    'shared' => _("Shared"),
-    'no_url' => _("You must specify a URL."),
-    'no_calendar_title' => _("The calendar title must not be empty."),
-    'no_tasklist_title' => _("The task list title must not be empty."),
-    'delete_calendar' => _("Are you sure you want to delete this calendar and all the events in it?"),
-    'delete_tasklist' => _("Are you sure you want to delete this task list and all the tasks in it?"),
-    'wrong_auth' => _("The authentication information you specified wasn't accepted."),
-    'geocode_error' => _("Unable to locate requested address"),
-    'wrong_date_format' => sprintf(_("You used an unknown date format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'),
-    'wrong_time_format' => sprintf(_("You used an unknown time format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'),
-    'fix_form_values' => _("Please enter correct values in the form first."),
+    //'more' => _("more..."),
+    //'prefs' => _("Preferences"),
+    //'shared' => _("Shared"),
+    //'fix_form_values' => _("Please enter correct values in the form first."),
     'noevents' => _("No events to display"),
+    'yesterday' => _("Yesterday"),
+    'today' => _("Today"),
+    'tomorrow' => _("Tomorrow")
 );
 for ($i = 1; $i <= 12; ++$i) {
     $code['text']['month'][$i - 1] = Horde_Nls::getLangInfo(constant('MON_' . $i));
@@ -198,16 +172,15 @@ for ($i = 1; $i <= 12; ++$i) {
 for ($i = 1; $i <= 7; ++$i) {
     $code['text']['weekday'][$i] = Horde_Nls::getLangInfo(constant('DAY_' . $i));
 }
-foreach (array(Horde_Date_Recurrence::RECUR_DAILY,
-               Horde_Date_Recurrence::RECUR_WEEKLY,
-               Horde_Date_Recurrence::RECUR_MONTHLY_DATE,
-               Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY,
-               Horde_Date_Recurrence::RECUR_YEARLY_DATE,
-               Horde_Date_Recurrence::RECUR_YEARLY_DAY,
-               Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY) as $recurType) {
-    $code['text']['recur'][$recurType] = self::recurToString($recurType);
-}
-
+//foreach (array(Horde_Date_Recurrence::RECUR_DAILY,
+//               Horde_Date_Recurrence::RECUR_WEEKLY,
+//               Horde_Date_Recurrence::RECUR_MONTHLY_DATE,
+//               Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY,
+//               Horde_Date_Recurrence::RECUR_YEARLY_DATE,
+//               Horde_Date_Recurrence::RECUR_YEARLY_DAY,
+//               Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY) as $recurType) {
+//    $code['text']['recur'][$recurType] = Kronolith::recurToString($recurType);
+//}
 $code['text']['recur']['desc'] = array(
     Horde_Date_Recurrence::RECUR_WEEKLY => array(sprintf(_("Recurs weekly on every %s"), "#{weekday}"),
                                                  sprintf(_("Recurs every %s weeks on %s"), "#{interval}", "#{weekday}")),
@@ -218,9 +191,6 @@ $code['text']['recur']['desc'] = array(
 );
 $code['text']['recur']['exception'] = _("Exception");
 
-// Maps
-$code['conf']['maps'] = $GLOBALS['conf']['maps'];
-
-return Horde::addInlineJsVars(array(
+echo Horde::addInlineJsVars(array(
     'var Kronolith' => $code
-), array('ret_vars' => true));
\ No newline at end of file
+), array('top' => true));
\ No newline at end of file
index a322bf3..a4169ac 100644 (file)
@@ -1,5 +1,5 @@
 <!-- Month View -->
-<div data-role="page" id="monthview" class="monthview">
+<div data-role="page" data-theme="b" id="monthview" class="monthview">
   <div data-role="header">
     <h1><?php echo _("Month")?></h1>
     <a rel="external" href="<?php echo $this->portal ?>"><?php echo _("Portal")?></a>
@@ -19,7 +19,7 @@
      <a href="#" data-role="button" id="kronolithMinicalNext" data-icon="arrow-r" data-iconpos="notext" title="<?php echo _("Next month") ?>">&gt;</a>
     </div>
   </div>
-  <div data-role="content" class="bld" id="monthcontent">
+  <div id="monthcontent">
     <div id="kronolithMinical" class="kronolithMinical">
       <table>
         <thead>
@@ -32,6 +32,8 @@
         <tbody><tr><td></td></tr></tbody>
       </table>
     </div>
-    <div class="kronolithDayDetail ui-body"></div>
+    <div class="kronolithDayDetail">
+        <h4 class="ui-bar-b"></h4>
+    </div>
   </div>
 </div>
index c009fad..88afc5c 100644 (file)
   font-style: italic;
   color: gray;
 }
-
 .kronolithDayDetail {
-  border-top: 1px solid #999;
 }
+.kronolithDayDetail h4 {
+  text-align: center;
+  margin-bottom: 0;
+  margin-top: 0;
+}
+
 /* Mini calendar */
 .kronolithMinical {
-
+    background-color: #fff;
 }
 #kronolithMinical {
 }