Initial stab at a jquery-mobile enabled mobile portal page.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 5 Nov 2010 04:11:42 +0000 (00:11 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 5 Nov 2010 04:13:41 +0000 (00:13 -0400)
Also no longer restricts apps to those with a mobile view, as discussed in Boston.

horde/index.php
horde/services/portal/mobile.php
horde/templates/common-footer-mobile.inc [new file with mode: 0644]
horde/templates/common-header-mobile.inc [new file with mode: 0644]
horde/templates/portal/mobile.inc

index ad8d365..b498b45 100644 (file)
@@ -61,6 +61,8 @@ if ($main_page) {
             ($initial_app != 'horde') &&
             $registry->hasPermission($initial_app)) {
             $main_page = Horde::url($initial_app, true);
+        } else if ($browser->isMobile()) {
+            $main_page = Horde::url('services/portal/mobile.php', true);
         } else {
             /* Next, try the initial horde page if it is something other than
              * index.php or login.php, since that would lead to inifinite
@@ -70,9 +72,7 @@ if ($main_page) {
                 $main_page = Horde::url($registry->applications['horde']['initial_page'], true);
             } else {
                 /* Finally, fallback to the portal page. */
-                $main_page = $browser->isMobile()
-                    ? Horde::url('services/portal/mobile.php', true)
-                    : Horde::url('services/portal/', true);
+                $main_page = Horde::url('services/portal/', true);
             }
         }
     }
index 0b85f67..b407d25 100644 (file)
@@ -21,13 +21,13 @@ if (empty($fullname)) {
 
 $links = array();
 foreach ($registry->listApps() as $app) {
-    if ($registry->hasMobileView($app)) {
-        $links[htmlspecialchars($registry->get('name', $app))] = Horde::url('/', false, array('app' => $app));
+    if ($app != 'horde') {
+        $links[htmlspecialchars($registry->get('name', $app))] = Horde::url('', true, array('app' => $app));
     }
 }
 
 $title = _("Welcome");
 
-require HORDE_TEMPLATES . '/common-header.inc';
+require HORDE_TEMPLATES . '/common-header-mobile.inc';
 require HORDE_TEMPLATES . '/portal/mobile.inc';
-require HORDE_TEMPLATES . '/common-footer.inc';
+require HORDE_TEMPLATES . '/common-footer-mobile.inc';
diff --git a/horde/templates/common-footer-mobile.inc b/horde/templates/common-footer-mobile.inc
new file mode 100644 (file)
index 0000000..691287b
--- /dev/null
@@ -0,0 +1,2 @@
+</body>
+</html>
\ No newline at end of file
diff --git a/horde/templates/common-header-mobile.inc b/horde/templates/common-header-mobile.inc
new file mode 100644 (file)
index 0000000..c69f776
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+    <head>
+<?php
+$page_title = $GLOBALS['registry']->get('name');
+if (!empty($title)) {
+    $page_title .= ' :: ' . $title;
+}?>
+    <title><?php echo htmlspecialchars($title) ?></title>
+    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css" />
+    <script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
+    <script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"></script>
\ No newline at end of file
index ba61a09..20cf805 100644 (file)
@@ -1,7 +1,20 @@
-<p><?php echo sprintf(_("Welcome, %s"), $fullname) ?></p>
-
-<ul>
-<?php foreach ($links as $key => $val): ?>
- <li><a href="<?php echo $val ?>"><?php echo $key ?></a></li>
-<?php endforeach; ?>
-</ul>
+<div data-role="page">
+    <div data-role="header">
+     <?php echo sprintf(_("Welcome, %s"), $fullname) ?>
+    </div>
+    <div data-role="content" class="ui-body"">
+        <ul data-role="listview" data-theme="a">
+        <?php foreach ($links as $key => $val): ?>
+         <li class="extlink"><?php echo $val->link(array('rel' => 'external'))?><?php echo $key ?></a></li>
+        <?php endforeach; ?>
+        </ul>
+    </div>
+    <div data-role="footer"></div>
+</div>
+<script type="text/javascript">
+// workaround for listview items not being clickable for links with rel="external"
+$("li.extlink").click(function(){
+     window.location=$(this).find("a").attr("href");
+     return false;
+});
+</script>
\ No newline at end of file