Ingo::addNewFolderJs();
$title = _("Blacklist Edit");
require INGO_TEMPLATES . '/common-header.inc';
-require INGO_TEMPLATES . '/menu.inc';
+Ingo::menu();
+Ingo::status();
require INGO_TEMPLATES . '/blacklist/blacklist.inc';
require $registry->get('templates', 'horde') . '/common-footer.inc';
Ingo::prepareMenu();
$title = _("Filter Rules");
require INGO_TEMPLATES . '/common-header.inc';
-require INGO_TEMPLATES . '/menu.inc';
+Ingo::menu();
+Ingo::status();
require INGO_TEMPLATES . '/filters/header.inc';
/* Common URLs. */
$title = _("Forwards Edit");
Ingo::prepareMenu();
require INGO_TEMPLATES . '/common-header.inc';
-require INGO_TEMPLATES . '/menu.inc';
+Ingo::menu();
+Ingo::status();
$form->renderActive(new Horde_Form_Renderer(array('encode_title' => false)), $vars, 'forward.php', 'post');
require $registry->get('templates', 'horde') . '/common-footer.inc';
const USER_HEADER = '++USER_HEADER++';
/**
- * getMenu() cache.
+ * prepareMenu() cache.
*
- * @var string
+ * @var Horde_Template
*/
- static private $_menuCache = null;
+ static private $_menuTemplate = null;
/**
* hasSharePermission() cache.
/**
* Build Ingo's list of menu items.
+ *
+ * @return Horde_Menu A Horde_Menu object.
*/
static public function getMenu()
{
*/
static public function prepareMenu()
{
- if (!self::$_menuCache) {
- self::$_menuCache = self::getMenu()->render();
+ if (isset(self::$_menuTemplate)) {
+ return;
+ }
+
+ $t = $GLOBALS['injector']->createInstance('Horde_Template');
+ $t->set('forminput', Horde_Util::formInput());
+
+ if (!empty($GLOBALS['ingo_shares']) &&
+ (count($GLOBALS['all_rulesets']) > 1)) {
+ $options = array();
+ foreach (array_keys($GLOBALS['all_rulesets']) as $id) {
+ $options[] = array(
+ 'name' => htmlspecialchars($GLOBALS['all_rulesets'][$id]->get('name')),
+ 'selected' => ($_SESSION['ingo']['current_share'] == $id),
+ 'val' => htmlspecialchars($id)
+ );
+ }
+ $t->set('options', $options);
}
- return self::$_menuCache;
+ $t->set('menu_string', self::getMenu()->render());
+
+ self::$_menuTemplate = $t;
+ }
+
+ /**
+ * Outputs IMP's menu to the current output stream.
+ */
+ static public function menu()
+ {
+ self::prepareMenu();
+ echo self::$_menuTemplate->fetch(INGO_TEMPLATES . '/menu/menu.html');
+ }
+
+ /**
+ * Outputs IMP's status/notification bar.
+ */
+ static public function status()
+ {
+ $GLOBALS['notification']->notify(array('listeners' => array('status', 'audio')));
}
/**
Ingo::prepareMenu();
Ingo::addNewFolderJs();
require INGO_TEMPLATES . '/common-header.inc';
-require INGO_TEMPLATES . '/menu.inc';
+Ingo::menu();
+Ingo::status();
require INGO_TEMPLATES . '/rule/header.inc';
/* Add new, blank condition. */
$title = _("Filter Script Display");
Ingo::prepareMenu();
require INGO_TEMPLATES . '/common-header.inc';
-require INGO_TEMPLATES . '/menu.inc';
+Ingo::menu();
+Ingo::status();
require INGO_TEMPLATES . '/script/header.inc';
if (!empty($script)) {
require INGO_TEMPLATES . '/script/activate.inc';
Ingo::prepareMenu();
Ingo::addNewFolderJs();
require INGO_TEMPLATES . '/common-header.inc';
-require INGO_TEMPLATES . '/menu.inc';
+Ingo::menu();
+Ingo::status();
$form->renderActive($renderer, $vars, 'spam.php', 'post');
require $registry->get('templates', 'horde') . '/common-footer.inc';
+++ /dev/null
-<form action="filters.php" method="post" name="rulesetsmenu">
-<?php echo Horde_Util::formInput() ?>
-<div id="menu">
-<?php if (!empty($ingo_shares) && count($all_rulesets) > 1): ?>
- <div style="float:right">
-<label for="ruleset" class="hidden"><?php echo _("Select ruleset to display:") ?></label>
-<select id="ruleset" name="ruleset" onchange="document.rulesetsmenu.submit(); return false;">
- <option value=""><?php echo _("Select ruleset to display:") ?></option>
-<?php foreach (array_keys($all_rulesets) as $id): ?>
- <option value="<?php echo htmlspecialchars($id) ?>"<?php echo ($_SESSION['ingo']['current_share'] == $id ? ' selected="selected"' : '') . '>' . htmlspecialchars($all_rulesets[$id]->get('name')) ?></option>
-<?php endforeach; ?>
-</select>
- </div>
-<?php endif; ?>
-
- <?php echo Ingo::prepareMenu() ?>
-</div>
-</form>
-
-<?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
--- /dev/null
+<form action="filters.php" method="post" name="rulesetsmenu">
+ <tag:forminput />
+ <div id="menu">
+<if:options>
+ <div style="float:right">
+ <label for="ruleset" class="hidden"><gettext>Select ruleset to display:</gettext></label>
+ <select id="ruleset" name="ruleset" onchange="document.rulesetsmenu.submit(); return false;">
+ <option value=""><gettext>Select ruleset to display:</gettext></option>
+<loop:options>
+ <option value="<tag:options.val />"<if:options.selected> selected="selected"</if:options.selected>><tag:options.name /></option>
+</loop:options>
+ </select>
+ </div>
+</if:options>
+ <tag:menu_string />
+ </div>
+</form>
$title = _("Vacation Edit");
Ingo::prepareMenu();
require INGO_TEMPLATES . '/common-header.inc';
-require INGO_TEMPLATES . '/menu.inc';
+Ingo::menu();
+Ingo::status();
$form->renderActive(new Horde_Form_Renderer(array('encode_title' => false)), $vars, 'vacation.php', 'post');
require $registry->get('templates', 'horde') . '/common-footer.inc';
$title = _("Whitelist Edit");
Ingo::prepareMenu();
require INGO_TEMPLATES . '/common-header.inc';
-require INGO_TEMPLATES . '/menu.inc';
+Ingo::menu();
+Ingo::status();
require INGO_TEMPLATES . '/whitelist/whitelist.inc';
require $registry->get('templates', 'horde') . '/common-footer.inc';