add links for next/prev day navigation (in addition to swipe).
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 13 Nov 2010 18:51:08 +0000 (13:51 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 13 Nov 2010 18:51:08 +0000 (13:51 -0500)
Really don't like the way the links look, but I've yet to find a way
for jqm to render them better.

kronolith/js/kronolithmobile.js
kronolith/mobile.php

index 9ee16fc..50d557b 100644 (file)
                    $("#eventcontent").text(data.response.event.t);
                },
                'json');
+    },
+
+    showNextDay: function()
+    {
+        KronolithMobile.currentDate.addDays(1);
+        KronolithMobile.doAction('listEvents',
+                                 {'start': KronolithMobile.currentDate.toString("yyyyMMdd"), 'end': KronolithMobile.currentDate.toString("yyyyMMdd"), 'cal': Kronolith.conf.default_calendar},
+                                 KronolithMobile.listEventsCallback
+        );
+    },
+
+    showPrevDay: function()
+    {
+        KronolithMobile.currentDate.addDays(-1);
+        KronolithMobile.doAction('listEvents',
+                                 {'start': KronolithMobile.currentDate.toString("yyyyMMdd"), 'end': KronolithMobile.currentDate.toString("yyyyMMdd"), 'cal': Kronolith.conf.default_calendar},
+                                 KronolithMobile.listEventsCallback
+        );
     }
 };
 
@@ -71,21 +89,10 @@ $(function() {
     // For now, start at today's day view
     KronolithMobile.currentDate = new Date();
 
-    $('body').bind('swipeleft', function(e) {
-        KronolithMobile.currentDate.addDays(1);
-        KronolithMobile.doAction('listEvents',
-                                 {'start': KronolithMobile.currentDate.toString("yyyyMMdd"), 'end': KronolithMobile.currentDate.toString("yyyyMMdd"), 'cal': Kronolith.conf.default_calendar},
-                                 KronolithMobile.listEventsCallback
-        );
-    });
-
-    $('body').bind('swiperight', function(e) {
-            KronolithMobile.currentDate.addDays(-1);
-            KronolithMobile.doAction('listEvents',
-                                     {'start': KronolithMobile.currentDate.toString("yyyyMMdd"), 'end': KronolithMobile.currentDate.toString("yyyyMMdd"), 'cal': Kronolith.conf.default_calendar},
-                                     KronolithMobile.listEventsCallback
-            );
-    });
+    $('body').bind('swipeleft', KronolithMobile.showNextDay);
+    $('body').bind('swiperight', KronolithMobile.showPrevDay);
+    $('#prevDay').bind('click', KronolithMobile.showPrevDay);
+    $('#nextDay').bind('click', KronolithMobile.showNextDay);
 
     // Load today
     KronolithMobile.doAction('listEvents',
index e798551..5dcfb6d 100644 (file)
@@ -38,7 +38,8 @@ require $registry->get('templates', 'horde') . '/common-header-mobile.inc';
    <h1>My Calendar:Day</h1>
    <a class="ui-btn-left" href="<?php echo Horde::getServiceLink('portal', 'horde')?>"><?php echo _("Home")?></a>
    <a rel="external" class="ui-btn-right" href="<?php echo Horde::getServiceLink('logout', 'horde')?>"><?php echo _("Logout")?></a>
-   <h4 id="todayheader"></h4>
+   <div class="ui-bar-b" style="width:100%;text-align:center;"><a href="#" data-icon="arrow-l" id="prevDay"><?php echo _("Previous")?></a><span id="todayheader"></span><a href="#" data-icon="arrow-r" id="nextDay"><?php echo _("Next")?></a></div>
+
   </div>
   <div data-role="content" class="ui-body" id="daycontent"></div>
   <div data-role="footer">