Mobile apps should implement an {app}_Application::mobileInitCallback() method that is
responsible for bringing in any additional javascript files and setting up event bindings
that must be done prior to jqm being initialized. At the minimum, this would include
a mobileinit handler to localize the Back and Loading text.
/* 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');
-/* Inline script. */
-Horde::addInlineScript(
- '$(window.document).bind("mobileinit", function() {
- $.mobile.page.prototype.options.backBtnText = "' . _("Back") .'";
- $.mobile.loadingMessage = "' . _("loading") . '";
- });'
-);
-Horde::outputInlineScript();
+$GLOBALS['registry']->callAppMethod($GLOBALS['registry']->getApp(), 'mobileInitCallback');
Horde::addScriptFile('jquery.mobile/jquery.mobile.min.js', 'horde');
Horde::includeScriptFiles();
$GLOBALS['injector']->getInstance('IMP_Imap_Tree')->init();
}
+ /**
+ * Callback, called from common-template-mobile.inc that sets up the jquery
+ * mobile init hanler.
+ */
+ public function mobileInitCallback()
+ {
+ Horde::addScriptFile('mobile.js');
+ require IMP_TEMPLATES . '/mobile/javascript_defs.php';
+
+ /* Inline script. */
+ Horde::addInlineScript(
+ '$(window.document).bind("mobileinit", function() {
+ $.mobile.page.prototype.options.backBtnText = "' . _("Back") .'";
+ $.mobile.loadingMessage = "' . _("loading") . '";
+ });'
+ );
+ }
}
require_once dirname(__FILE__) . '/lib/Application.php';
Horde_Registry::appInit('imp', array('impmode' => 'mobile'));
+$title = _("Mobile Mail");
+require $registry->get('templates', 'horde') . '/common-header-mobile.inc';
+
$view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/mobile'));
new Horde_View_Helper_Text($view);
$view->portal = Horde::getServiceLink('portal', 'horde')->setRaw(false);
$view->logout = Horde::getServiceLink('logout')->setRaw(false);
-$title = _("Mobile Mail");
-
-require $registry->get('templates', 'horde') . '/common-header-mobile.inc';
-
-Horde::addScriptFile('horde-jquery.js', 'horde');
-Horde::addScriptFile('mobile.js', 'horde');
-Horde::addScriptFile('mobile.js', 'imp');
-include IMP_TEMPLATES . '/mobile/javascript_defs.php';
echo $view->render('head.html.php');
if (!empty($conf['user']['allow_folders'])) {
}
}
+ /**
+ * Callback, called from common-template-mobile.inc that sets up the jquery
+ * mobile init hanler.
+ */
+ public function mobileInitCallback()
+ {
+ $datejs = str_replace('_', '-', $GLOBALS['language']) . '.js';
+ if (!file_exists($GLOBALS['registry']->get('jsfs', 'horde') . '/date/' . $datejs)) {
+ $datejs = 'en-US.js';
+ }
+
+ Horde::addScriptFile('date/' . $datejs, 'horde');
+ Horde::addScriptFile('date/date.js', 'horde');
+ Horde::addScriptFile('mobile.js');
+ 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;
+ }
+ });
+
+ });'
+ );
+ }
+
}
$view->portal = Horde::getServiceLink('portal', 'horde')->setRaw(false);
$view->logout = Horde::getServiceLink('logout')->setRaw(false);
-$datejs = str_replace('_', '-', $GLOBALS['language']) . '.js';
-if (!file_exists($GLOBALS['registry']->get('jsfs', 'horde') . '/date/' . $datejs)) {
- $datejs = 'en-US.js';
-}
-
-require $registry->get('templates', 'kronolith') . '/common-header-mobile.inc';
+require $registry->get('templates', 'horde') . '/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();