Update menu loading.
authorJan Schneider <jan@horde.org>
Thu, 9 Dec 2010 11:11:52 +0000 (12:11 +0100)
committerJan Schneider <jan@horde.org>
Thu, 9 Dec 2010 11:11:52 +0000 (12:11 +0100)
vilma/domains/index.php
vilma/lib/Application.php
vilma/lib/Vilma.php
vilma/templates/common-header.inc
vilma/templates/domains/index.html
vilma/templates/users/index.html
vilma/templates/virtuals/index.html
vilma/users/index.php
vilma/virtuals/index.php

index 4810289..eea0680 100644 (file)
@@ -37,7 +37,7 @@ foreach ($domains as $id => $domain) {
 $template = $injector->createInstance('Horde_Template');
 $template->setOption('gettext', true);
 $template->set('domains', $domains, true);
-$template->set('menu', Vilma::getMenu('string'));
+$template->set('menu', Horde::menu());
 
 Horde::startBuffer();
 $notification->notify(array('listeners' => 'status'));
index cd137f8..732b6d3 100644 (file)
@@ -88,4 +88,21 @@ class Vilma_Application extends Horde_Registry_Application
 
         return $perms;
     }
+
+    /**
+     * Add additional items to the menu.
+     *
+     * @param Horde_Menu $menu  The menu object.
+     */
+    public function menu($menu)
+    {
+        $menu->add(Horde::url('domains/index.php'), _("_Domains"), 'domain.png');
+        if ($GLOBALS['vilma']->curdomain) {
+            $domain = $GLOBALS['session']->get('vilma', 'domain');
+            $menu->add(Horde::url('users/index.php')->add('domain_id', $domain['domain_id']), $domain['domain_name'], 'domain.png');
+            $menu->add(Horde::url('users/edit.php'), _("New _Address"), 'user.png');
+        } else {
+            $menu->add(Horde::url('domains/edit.php'), _("_New Domain"), 'domain.png');
+        }
+    }
 }
index f19bdb0..b9d137d 100644 (file)
@@ -130,31 +130,4 @@ class Vilma
                                                   $conf['mailboxes']['params']);
         return $driver;
     }
-
-    /**
-     * Build Vilma's list of menu items.
-     */
-    function getMenu($returnType = 'object')
-    {
-        $menu = new Horde_Menu();
-
-        $menu->add(Horde::url('domains/index.php'), _("_Domains"), 'domain.png');
-
-        if ($GLOBALS['vilma']->curdomain) {
-            $domain = $GLOBALS['session']->get('vilma', 'domain');
-            $url = Horde::url('users/index.php');
-            $tmp = Horde_Util::addParameter($url, 'domain_id', $domain['domain_id']);
-            $menu->add(Horde::url($tmp), _($domain['domain_name']), 'domain.png');
-            $menu->add(Horde::url('users/edit.php'), _("New _Address"), 'user.png');
-        } else {
-            $menu->add(Horde::url('domains/edit.php'), _("_New Domain"), 'domain.png');
-        }
-
-        if ($returnType == 'object') {
-            return $menu;
-        } else {
-            return $menu->render();
-        }
-    }
-
 }
index 9629907..1390c38 100644 (file)
@@ -21,6 +21,7 @@ Horde::outputMetaTags();
 Horde::includeScriptFiles();
 Horde::includeFavicon();
 Horde::includeStylesheetFiles();
+Horde::outputInlineScript();
 
 ?>
 <title><?php echo htmlspecialchars($page_title) ?></title>
index 6bef877..ae82802 100644 (file)
@@ -1,6 +1,4 @@
-<div id="menu">
- <tag:menu />
-</div>
+<tag:menu />
 
 <tag:notify />
 
index 68a2d93..391af24 100644 (file)
@@ -1,6 +1,4 @@
-<div id="menu">
- <tag:menu />
-</div>
+<tag:menu />
 
 <tag:notify />
 
index 88294f7..4ea71fa 100644 (file)
@@ -1,6 +1,4 @@
-<div id="menu">
- <tag:menu />
-</div>
+<tag:menu />
 
 <tag:notify />
 
index 4e1a5bc..e4d6f54 100644 (file)
@@ -126,7 +126,7 @@ $template = $injector->createInstance('Horde_Template');
 $template->setOption('gettext', true);
 $template->set('addresses', $addresses, true);
 $template->set('maxusers', $maxusers, true);
-$template->set('menu', Vilma::getMenu('string'));
+$template->set('menu', Horde::menu());
 $template->set('tabs', $tabs->render());
 
 Horde::startBuffer();
index fe34721..22cca99 100644 (file)
@@ -56,7 +56,7 @@ $images = array('delete' => Horde::img('delete.png', _("Delete User")),
                 'edit' => Horde::img('edit.png', _("Edit User")));
 $template->set('images', $images);
 
-$template->set('menu', Vilma::getMenu('string'));
+$template->set('menu', Horde::menu());
 
 Horde::startBuffer();
 $notification->notify(array('listeners' => 'status'));