Certain events need to be bound _before_ jquery mobile initializes (mobileinit, page*, etc...)
otherwise, the event handlers won't run on first pageload. This means that we can't always use the global
common-header-mobile template for all apps.
});
});
- // Day View
+ // Bind click events
$('.kronolithDayHeader .kronolithPrevDay').bind('click', KronolithMobile.showPrevDay);
$('.kronolithDayHeader .kronolithNextDay').bind('click', KronolithMobile.showNextDay);
- $('#dayview').bind('pageshow', function(event, ui) {
- KronolithMobile.view = 'day';
- });
-
- // Event view
- $('#eventview').bind('pageshow', function(event, ui) {
- KronolithMobile.view = 'event';
- });
- // Set up the month view
$('#kronolithMinicalPrev').bind('click', KronolithMobile.showPrevMonth);
$('#kronolithMinicalNext').bind('click', KronolithMobile.showNextMonth);
- $('#monthview').bind('pageshow', function(event, ui) {
- KronolithMobile.view = 'month';
- // (re)build the minical only if we need to
- if (!$('.kronolithMinicalDate').data('date') ||
- ($('.kronolithMinicalDate').data('date').toString('M') != KronolithMobile.date.toString('M'))) {
- KronolithMobile.moveToMonth(KronolithMobile.date);
- }
- });
-
- // Set up overview
- $('#overview').bind('pageshow', function(event, ui) {
- KronolithMobile.view = 'overview';
- if (!KronolithMobile.haveOverview) {
- KronolithMobile.loadEvents(KronolithMobile.date, KronolithMobile.date.clone().addDays(7), 'overview');
- KronolithMobile.haveOverview = true;
- }
- });
+ $('body').bind('swipeleft', KronolithMobile.handleSwipe);
+ $('body').bind('swiperight', KronolithMobile.handleSwipe);
$('td').live('click', function(e) {
KronolithMobile.selectMonthDay($(this).data('date'));
});
-
- // Load today's events.
- // @TODO once https://github.com/jquery/jquery-mobile/issues/issue/508
- // is fixed, move this to #dayview's pageshow event, as well as
- // fix monthview initialization.
- KronolithMobile.date = new Date();
- $('.kronolithDayDate').html(KronolithMobile.date.toString('ddd') + ' ' + KronolithMobile.date.toString('d'));
- KronolithMobile.loadEvents(KronolithMobile.date, KronolithMobile.date, 'day');
-
- $('body').bind('swipeleft', KronolithMobile.handleSwipe);
- $('body').bind('swiperight', KronolithMobile.handleSwipe);
}
};
$(KronolithMobile.onDocumentReady);
$datejs = 'en-US.js';
}
-require $registry->get('templates', 'horde') . '/common-header-mobile.inc';
-
-Horde::addScriptFile('horde-jquery.js', 'horde');
-Horde::addScriptFile('mobile.js', 'horde');
-Horde::addScriptFile('date/' . $datejs, 'horde');
-Horde::addScriptFile('date/date.js', 'horde');
-Horde::addScriptFile('mobile.js', 'kronolith');
-require KRONOLITH_TEMPLATES . '/mobile/javascript_defs.php';
+require $registry->get('templates', 'kronolith') . '/common-header-mobile.inc';
echo $view->render('head');
echo $view->render('day');
--- /dev/null
+<?php
+
+header('Content-type: text/html; charset=UTF-8');
+header('Vary: Accept-Language');
+
+?>
+<!DOCTYPE html>
+<html>
+<head>
+ <title><?php echo htmlspecialchars(Horde_Util::nonInputVar('title')) ?></title>
+<?php
+
+/* CSS Files. */
+$horde_css = $GLOBALS['injector']->getInstance('Horde_Themes_Css');
+$horde_css->addStylesheet(
+ $GLOBALS['registry']->get('jsfs', 'horde') . '/jquery.mobile/jquery.mobile.min.css',
+ $GLOBALS['registry']->get('jsuri', 'horde') . '/jquery.mobile/jquery.mobile.min.css'
+);
+$horde_css->addThemeStylesheet('mobile.css');
+Horde::includeStylesheetFiles(array(
+ 'nobase' => true
+));
+
+/* JS Files. */
+$GLOBALS['injector']->getInstance('Horde_Script_Files')->prototypejs = false;
+Horde::addScriptFile('jquery.mobile/jquery.min.js', 'horde');
+Horde::addScriptFile('horde-jquery.js', 'horde');
+Horde::addScriptFile('mobile.js', 'horde');
+Horde::addScriptFile('date/' . $datejs, 'horde');
+Horde::addScriptFile('date/date.js', 'horde');
+Horde::addScriptFile('mobile.js', 'kronolith');
+require KRONOLITH_TEMPLATES . '/mobile/javascript_defs.php';
+
+/* Inline script. */
+Horde::addInlineScript(
+ '$(window.document).bind("mobileinit", function() {
+ $.mobile.page.prototype.options.backBtnText = "' . _("Back") .'";
+ $.mobile.loadingMessage = "' . _("loading") . '";
+
+ // Setup event bindings to populate views on pagebeforeshow
+ KronolithMobile.date = new Date();
+ $("#dayview").live("pagebeforeshow", function() {
+ KronolithMobile.view = "day";
+ $(".kronolithDayDate").html(KronolithMobile.date.toString("ddd") + " " + KronolithMobile.date.toString("d"));
+ KronolithMobile.loadEvents(KronolithMobile.date, KronolithMobile.date, "day");
+ });
+
+ $("#monthview").live("pagebeforeshow", function(event, ui) {
+ KronolithMobile.view = "month";
+ // (re)build the minical only if we need to
+ if (!$(".kronolithMinicalDate").data("date") ||
+ ($(".kronolithMinicalDate").data("date").toString("M") != KronolithMobile.date.toString("M"))) {
+ KronolithMobile.moveToMonth(KronolithMobile.date);
+ }
+ });
+
+ $("#eventview").live("pageshow", function(event, ui) {
+ KronolithMobile.view = "event";
+ });
+
+ // Set up overview
+ $("#overview").live("pageshow", function(event, ui) {
+ KronolithMobile.view = "overview";
+ if (!KronolithMobile.haveOverview) {
+ KronolithMobile.loadEvents(KronolithMobile.date, KronolithMobile.date.clone().addDays(7), "overview");
+ KronolithMobile.haveOverview = true;
+ }
+ });
+
+ });'
+);
+Horde::outputInlineScript();
+
+Horde::addScriptFile('jquery.mobile/jquery.mobile.min.js', 'horde');
+Horde::includeScriptFiles();