--- /dev/null
+/**
+ * jQuery Mobile UI application logic.
+ *
+ * Copyright 2005-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ */
+
+/* ImpMobile object. */
+var ImpMobile = {
+
+ /**
+ * Perform an Ajax action
+ *
+ * @param string action The AJAX request
+ * @param object params The parameter hash
+ * @param function callback The callback function
+ */
+ doAction: function(action, params, callback)
+ {
+ $.post(IMP.conf.URI_AJAX + action, params, callback, 'json');
+ },
+
+ /**
+ * Switches to the mailbox view and loads a mailbox.
+ *
+ * @param string mailbox A mailbox name.
+ * @param string label A mailbox label.
+ */
+ toMailbox: function(mailbox, label)
+ {
+ $('#imp-mailbox-header').text(label);
+ $.mobile.changePage('#mailbox', 'slide', false, true);
+ },
+
+ /**
+ * Catch-all event handler for the click event.
+ *
+ * @param object e An event object.
+ */
+ clickHandler: function(e)
+ {
+ var elt = $(e.target),
+ orig = $(e.target),
+ id;
+
+ while (elt) {
+ id = elt.attr('id');
+
+ switch (id) {
+ }
+
+ if (elt.hasClass('imp-folder')) {
+ var link = elt.find('a[mailbox]');
+ ImpMobile.toMailbox(link.attr('mailbox'), link.text());
+ break;
+ }
+
+ elt = elt.parent();
+ }
+ },
+
+ /**
+ * Event handlder for the document-ready event, responsible for the inital
+ * setup.
+ */
+ onDocumentReady: function()
+ {
+ // Global ajax options.
+ $.ajaxSetup({
+ dataFilter: function(data, type)
+ {
+ // Remove json security token
+ filter = /^\/\*-secure-([\s\S]*)\*\/s*$/;
+ return data.replace(filter, "$1");
+ }
+ });
+
+ $(document).click(ImpMobile.clickHandler);
+ }
+
+};
+
+// JQuery Mobile setup
+$(ImpMobile.onDocumentReady);
$title = _("Mobile Mail");
require $registry->get('templates', 'horde') . '/common-header-mobile.inc';
+include IMP_TEMPLATES . '/mobile/javascript_defs.php';
echo $view->render('head.html.php');
if (!empty($conf['user']['allow_folders'])) {
echo $view->render('folders.html.php');
<link type="text/css" rel="stylesheet" href="<?php echo $GLOBALS['registry']->get('themesuri', 'imp') ?>/mobile.css" />
+ <script type="text/javascript" src="<?php echo $GLOBALS['registry']->get('jsuri') ?>/mobile.js"></script>
</head>
<body>
--- /dev/null
+<?php
+/**
+ * IMP Mobile base JS file.
+ *
+ * Copyright 2005-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ */
+
+$code = $flags = array();
+
+/* Generate flag array. */
+foreach ($GLOBALS['injector']->getInstance('IMP_Imap_Flags')->getList(array('fgcolor' => true)) as $val) {
+ $flags[$val['flag']] = array_filter(array(
+ 'b' => isset($val['b']) ? $val['b'] : null,
+ 'c' => $val['c'],
+ 'f' => $val['f'],
+ 'l' => $val['l'],
+ 'n' => isset($val['n']) ? $val['n'] : null,
+ // Indicate if this is a user *P*ref flag
+ 'p' => intval($val['t'] == 'imapp'),
+ // Indicate if this is a flag that can be *S*earched for
+ 's' => intval(in_array($val['t'], array('imapp', 'imapu')))
+ ));
+}
+
+/* Variables used in core javascript files. */
+$code['conf'] = array_filter(array(
+ // URL variables
+ 'URI_AJAX' => Horde::getServiceLink('ajax', 'imp')->url,
+ 'URI_COMPOSE' => strval(Horde::url('compose-dimp.php')->setRaw(true)->add('ajaxui', 1)),
+ 'URI_DIMP' => strval(Horde::url('index-dimp.php')),
+ 'URI_MESSAGE' => strval(Horde::url('message-dimp.php')->setRaw(true)->add('ajaxui', 1)),
+ 'URI_PREFS_IMP' => strval(Horde::getServiceLink('prefs', 'imp')->setRaw(true)->add('ajaxui', 1)),
+ 'URI_SEARCH' => strval(Horde::url('search.php')),
+ 'URI_VIEW' => strval(Horde::url('view.php')),
+
+ 'IDX_SEP' => IMP_Dimp::IDX_SEP,
+ 'SESSION_ID' => defined('SID') ? SID : '',
+
+ // Other variables
+ 'flags' => $flags,
+ /* Needed to maintain flag ordering. */
+ 'flags_o' => array_keys($flags),
+ 'refresh_time' => intval($GLOBALS['prefs']->getValue('refresh_time')),
+));
+
+/* Gettext strings used in core javascript files. */
+$code['text'] = array(
+);
+
+Horde::addInlineJsVars(array(
+ 'var IMP' => $code
+), array('top' => true));
<?php if (!$this->allowFolders): ?>
<a rel="external" href="<?php echo $this->portal ?>"><?php echo _("Portal")?></a>
<?php endif ?>
- <h1><?php echo _("Inbox") ?></h1>
+ <h1 id="imp-mailbox-header"></h1>
<?php if ($this->logout): ?>
<a href="<?php echo $this->logout ?>" rel="external" data-theme="e" data-icon="delete" class="ui-btn-right"><?php echo _("Log out") ?></a>
<?php endif ?>