--- /dev/null
+/**
+ * Base logic for all jQuery Mobile applications.
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @author Jan Schneider <jan@horde.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @package Horde
+ */
+ var HordeMobile = {
+
+ serverError: 0,
+
+ /**
+ * Common URLs.
+ *
+ * Required properties to be set from calling applications:
+ * - ajax: AJAX endpoint.
+ */
+ urls: {},
+
+ /**
+ * 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)
+ {
+ $.mobile.pageLoading();
+ var options = {
+ 'url': HordeMobile.urls.ajax + action,
+ 'data': params,
+ 'error': HordeMobile.errorCallback,
+ 'success': function(d, t, x) { HordeMobile.doActionComplete(d, callback); },
+ 'type': 'post'
+ };
+ $.ajax(options);
+ },
+
+ doActionComplete: function(d, callback)
+ {
+ var r = d.response;
+ if (r && $.isFunction(callback)) {
+ callback(r);
+ }
+
+ HordeMobile.server_error = 0;
+ HordeMobile.showNotifications(d.msgs || []);
+ HordeMobile.inAjaxCallback = false;
+ $.mobile.pageLoading(true);
+ },
+
+ showNotifications: function(m)
+ {
+ $.each(m, function(key, msg) {
+ if (msg.type == 'horde.ajaxtimeout') {
+ HordeMobile.logout(msg.message);
+ }
+ });
+ },
+
+ logout: function(url)
+ {
+ HordeMobile.is_logout = true;
+ window.location = (url || HordeMobile.urls.ajax + 'logOut');
+ },
+
+ errorCallback: function(x, t, e)
+ {
+
+ },
+
+ onDocumentReady: function()
+ {
+ // Global ajax options.
+ $.ajaxSetup({
+ dataFilter: function(data, type)
+ {
+ // Remove json security token
+ filter = /^\/\*-secure-([\s\S]*)\*\/s*$/;
+ return data.replace(filter, "$1");
+ }
+ });
+ }
+};
+$(HordeMobile.onDocumentReady);
<email>jan@horde.org</email>
<active>yes</active>
</lead>
- <date>2010-11-25</date>
- <time>15:30:20</time>
+ <date>2010-11-29</date>
+ <time>15:17:50</time>
<version>
<release>4.0.0</release>
<api>4.0.0</api>
<file name="login.js" role="horde" />
<file name="logintasks.js" role="horde" />
<file name="md5.js" role="horde" />
+ <file name="mobile.js" role="horde" />
<file name="popup.js" role="horde" />
<file name="prototype.js" role="horde" />
<file name="quickfinder.js" role="horde" />
<install as="js/login.js" name="js/login.js" />
<install as="js/logintasks.js" name="js/logintasks.js" />
<install as="js/md5.js" name="js/md5.js" />
+ <install as="js/mobile.js" name="js/mobile.js" />
<install as="js/popup.js" name="js/popup.js" />
<install as="js/prototype.js" name="js/prototype.js" />
<install as="js/quickfinder.js" name="js/quickfinder.js" />
<release>alpha</release>
<api>alpha</api>
</stability>
- <date>2010-11-25</date>
+ <date>2010-11-29</date>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
<notes>
* Initial package.xml.
* 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');
- },
-
// Convert object to an IMP UID Range string. See IMP::toRangeString()
// ob = (object) mailbox name as keys, values are array of uids.
toRangeString: function(ob)
$('#imp-mailbox-header').text(label);
$('#imp-mailbox-list').empty();
$.mobile.changePage('#mailbox', 'slide', false, true);
- $.mobile.pageLoading();
- ImpMobile.doAction(
+ HordeMobile.doAction(
'viewPort',
{
view: mailbox,
mailboxLoaded: function(r)
{
var list = $('#imp-mailbox-list');
- $.mobile.pageLoading(true);
- if (r.response && r.response.ViewPort) {
- $.each(r.response.ViewPort.data, function(key, data) {
+ if (r && r.ViewPort) {
+ $.each(r.ViewPort.data, function(key, data) {
list.append(
$('<li class="imp-message" data-imp-mailbox="' + data.view + '" data-imp-uid="' + data.imapuid + '">').append(
$('<h3>').append(
$('#imp-message-more').parent().show();
$('#imp-message-less').parent().hide();
$.mobile.changePage('#message', 'slide', false, true);
- $.mobile.pageLoading();
- ImpMobile.doAction(
+ HordeMobile.doAction(
'showMessage',
{
uid: ImpMobile.toRangeString(o),
*/
messageLoaded: function(r)
{
- $.mobile.pageLoading(true);
- if (r.response && r.response.message && !r.response.message.error) {
- var data = r.response.message,
+ if (r && r.message && !r.message.error) {
+ var data = r.message,
headers = $('#imp-message-headers tbody');
$('#imp-message-title').html(data.title);
$('#imp-message-subject').html(data.subject);
*/
onDocumentReady: function()
{
- // Global ajax options.
- $.ajaxSetup({
- dataFilter: function(data, type)
- {
- // Remove json security token
- filter = /^\/\*-secure-([\s\S]*)\*\/s*$/;
- return data.replace(filter, "$1");
- }
- });
+ // Set up HordeMobile.
+ HordeMobile.urls.ajax = IMP.conf.URI_AJAX;
IMP.iframeInject = function(id, data)
{
$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');
-
-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');
}
echo $view->render('mailbox.html.php');
echo $view->render('message.html.php');
+echo $view->render('notice.html.php');
require $registry->get('templates', 'horde') . '/common-footer-mobile.inc';
--- /dev/null
+<div id="notification" data-role="dialog">
+ <div data-role="header">
+ <h1><?php echo _("Notice")?></h1>
+ </div>
+ <div data-role="content" class="ui-body">
+ </div>
+</div>
\ No newline at end of file
*/
date: null,
- serverError: 0,
-
- /**
- * 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)
- {
- $.mobile.pageLoading();
- var options = {
- 'url': Kronolith.conf.URI_AJAX + action,
- 'data': params,
- 'error': KronolithMobile.errorCallback,
- 'success': function(d, t, x) { KronolithMobile.doActionComplete(d, callback); },
- 'type': 'post'
- };
- $.ajax(options);
- },
-
- doActionComplete: function(d, callback)
- {
- var r = d.response;
- if (r && $.isFunction(callback)) {
- callback(r);
- }
-
- KronolithMobile.server_error = 0;
- KronolithMobile.showNotifications(d.msgs || []);
- KronolithMobile.inAjaxCallback = false;
- $.mobile.pageLoading(true);
- },
-
- showNotifications: function(m)
- {
- $.each(m, function(key, msg) {
- if (msg.type == 'horde.ajaxtimeout') {
- KronolithMobile.logout(msg.message);
- }
- });
- },
-
- logout: function(url)
- {
- KronolithMobile.is_logout = true;
- window.location = (url || (Kronolith.conf.URI_AJAX + 'logOut'));
- },
-
- errorCallback: function(x, t, e)
- {
-
- },
-
/**
* Load all events between start and end time.
*
}
var start = startDay.dateString(), end = endDay.dateString();
- KronolithMobile.doAction('listEvents',
- {
- 'start': start,
- 'end': end,
- 'cal': cal.join('|'),
- 'view': view,
- 'sig': start + end + (Math.random() + '').slice(2)
- },
- KronolithMobile.loadEventsCallback
+ HordeMobile.doAction('listEvents',
+ {
+ 'start': start,
+ 'end': end,
+ 'cal': cal.join('|'),
+ 'view': view,
+ 'sig': start + end + (Math.random() + '').slice(2)
+ },
+ KronolithMobile.loadEventsCallback
);
});
},
*/
loadEvent: function(cal, id, d)
{
- KronolithMobile.doAction('getEvent',
- {'cal': cal, 'id': id, 'date': d.toString('yyyyMMdd')},
- KronolithMobile.loadEventCallback);
+ HordeMobile.doAction('getEvent',
+ {'cal': cal, 'id': id, 'date': d.toString('yyyyMMdd')},
+ KronolithMobile.loadEventCallback);
},
/**
onDocumentReady: function()
{
+ // Set up HordeMobile.
+ HordeMobile.urls.ajax = Kronolith.conf.URI_AJAX;
+
// Build list of calendars we want.
$.each(Kronolith.conf.calendars, function(key, value) {
$.each(value, function(cal, info) {
});
});
- // Global ajax options.
- $.ajaxSetup({
- dataFilter: function(data, type)
- {
- // Remove json security token
- filter = /^\/\*-secure-([\s\S]*)\*\/s*$/;
- return data.replace(filter, "$1");
- }
- });
-
// Day View
$('.kronolithDayHeader .kronolithPrevDay').bind('click', KronolithMobile.showPrevDay);
$('.kronolithDayHeader .kronolithNextDay').bind('click', KronolithMobile.showNextDay);
$('body').bind('swiperight', KronolithMobile.handleSwipe);
}
};
-$(KronolithMobile.onDocumentReady);
\ No newline at end of file
+$(KronolithMobile.onDocumentReady);
if (!file_exists($GLOBALS['registry']->get('jsfs', 'horde') . '/date/' . $datejs)) {
$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 $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');