Add initial javascript_defs for mobile view
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 26 Dec 2010 04:48:52 +0000 (23:48 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 26 Dec 2010 05:41:21 +0000 (00:41 -0500)
ansel/templates/mobile/javascript_defs.php [new file with mode: 0644]

diff --git a/ansel/templates/mobile/javascript_defs.php b/ansel/templates/mobile/javascript_defs.php
new file mode 100644 (file)
index 0000000..196525b
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+global $prefs, $registry;
+
+$kronolith_webroot = $registry->get('webroot');
+$horde_webroot = $registry->get('webroot', 'horde');
+$has_tasks = $registry->hasInterface('tasks');
+
+/* Variables used in core javascript files. */
+$code['conf'] = array(
+    'URI_AJAX' => (string)Horde::getServiceLink('ajax', 'ansel'),
+    'SESSION_ID' => defined('SID') ? SID : '',
+    'images' => array(
+        'error' => (string)Horde_Themes::img('error-thumb.png'),
+    ),
+    'user' => $GLOBALS['registry']->convertUsername($GLOBALS['registry']->getAuth(), false),
+    'name' => $registry->get('name'),
+);
+
+// My Galleries
+$gallerylist = $GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries(array('all_levels' => false, 'attribtues' => $registry->getAuth()));
+$galleries = array();
+foreach ($gallerylist as $gallery) {
+    $galleries[$gallery->id] = $gallery->data;
+}
+$code['conf']['galleries'] = $galleries;
+
+/* Gettext strings used in core javascript files. */
+$code['text'] = array(
+    'ajax_error' => _("Error when communicating with the server."),
+);
+echo Horde::addInlineJsVars(array(
+    'var Ansel' => $code
+), array('top' => true));
\ No newline at end of file