--- /dev/null
+/**
+ * mobile.js - Base mobile application logic.
+ *
+ * Copyright 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.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @category Horde
+ * @license http://www.fsf.org/copyleft/gpl.html GPL
+ * @package Ansel
+ */
+var AnselMobile = {
+
+ /**
+ * Build a gallery list
+ */
+ buildGalleryList: function(galleries)
+ {
+ var list = $('<ul>')
+ .addClass('anselGalleryList')
+ .attr({ 'data-role': 'listview' }), item;
+
+ $('#anselgallerylist ul').detach();
+ $.each(galleries, function(k, g) {
+ var item = $('<li>');
+ item.append($('<img>').attr({ src: g.ki }));
+ item.append($('<h3>').append($('<a>').attr({ href: '#' }).text(g.n)));
+ item.append($('<p>').text(g.d));
+ list.append(item);
+ });
+
+ $('#anselgallerylist').append(list);
+ },
+
+ /**
+ * Global click handler
+ *
+ */
+ clickHandler: function(e)
+ {
+
+ },
+
+ /**
+ * Global swipe handler
+ *
+ */
+ handleSwipe: function(map)
+ {
+
+ },
+
+ /**
+ * Initial document ready entry point
+ *
+ */
+ onDocumentReady: function()
+ {
+ // Set up HordeMobile.
+ HordeMobile.urls.ajax = Ansel.conf.URI_AJAX;
+
+ // Bind click and swipe events
+ $(document).click(AnselMobile.clickHandler);
+ $('body').bind('swipeleft', AnselMobile.handleSwipe);
+ $('body').bind('swiperight', AnselMobile.handleSwipe);
+
+ // Todo, eventually move to mobile callback so page reloads work etc...
+ AnselMobile.buildGalleryList(Ansel.conf.galleries);
+ }
+};
+$(AnselMobile.onDocumentReady);
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Defines the AJAX interface for Ansel.
+ *
+ * Copyright 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.
+ *
+ * @author Michael J Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_Ajax_Application extends Horde_Core_Ajax_Application
+{
+ /**
+ * Determines if notification information is sent in response.
+ *
+ * @var boolean
+ */
+ public $notify = true;
+
+
+
+}
$GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->setLogger($GLOBALS['injector']->getInstance('Horde_Log_Logger'));
/* Build initial Ansel javascript object. */
- Horde::addInlineJsVars(array('var Ansel' => array('ajax' => new stdClass, 'widgets' => new stdClass)));
+ if (!$GLOBALS['browser']->isMobile()) {
+ Horde::addInlineJsVars(array('var Ansel' => array('ajax' => new stdClass, 'widgets' => new stdClass)));
+ }
}
/**
//Horde::addScriptFile('mobile.js');
require ANSEL_TEMPLATES . '/mobile/javascript_defs.php';
+ Horde::addScriptFile('mobile.js');
/* Inline script. */
Horde::addInlineScript(
'$(window.document).bind("mobileinit", function() {
$.mobile.page.prototype.options.backBtnText = "' . _("Back") .'";
- $.mobile.loadingMessage = "' . _("loading") . '";'
+ $.mobile.loadingMessage = "' . _("loading") . '";
+ });'
);
}
</ul>
</div>
</div>
- <div data-role="content" class="ui-body">
- <ul data-role="listview">
- <li>
- <?php echo Horde::img('thumb-error.png')?>
- <h3><a href="#">Gallery One</a></h3>
- <p>Gallery Description</p>
- </li>
- <li>
- <?php echo Horde::img('thumb-error.png')?>
- <h3><a href="#">Gallery Two</a></h3>
- <p>Gallery Description</p>
- </li>
- <li>
- <?php echo Horde::img('thumb-error.png')?>
- <h3><a href="#">Gallery Three</a></h3>
- <p>Gallery Description</p>
- </li>
- </ul>
+ <div id="anselgallerylist" data-role="content" class="ui-body">
</div>
</div>
\ No newline at end of file
<?php
global $prefs, $registry;
-$kronolith_webroot = $registry->get('webroot');
+$ansel_webroot = $registry->get('webroot');
$horde_webroot = $registry->get('webroot', 'horde');
$has_tasks = $registry->hasInterface('tasks');