From f699a20c363fa6eea44287bec0f0584e7e6f9ade Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Fri, 28 Sep 2012 04:52:13 -0400
Subject: [PATCH] Implemented: Extend menus by putting *.menu.php inside the module/lib/menu.d/ folder
---
interface/web/tools/lib/module.conf.php | 12 ------
interface/web/admin/lib/interface.d/tpl_default.menu.php | 15 +++++--
interface/web/capp.php | 16 +++++++
interface/web/themes/default/templates/sidenav.tpl.htm | 4 ++
interface/web/login/index.php | 12 ++++++
interface/web/admin/lib/module.conf.php | 14 -------
6 files changed, 42 insertions(+), 31 deletions(-)
diff --git a/interface/web/admin/lib/interface.d/tpl_default.menu.php b/interface/web/admin/lib/interface.d/tpl_default.menu.php
index 5c30072..e2e7745 100644
--- a/interface/web/admin/lib/interface.d/tpl_default.menu.php
+++ b/interface/web/admin/lib/interface.d/tpl_default.menu.php
@@ -1,7 +1,14 @@
<?php
-$items[] = array( 'title' => 'Default Theme',
- 'target' => 'content',
- 'link' => 'admin/tpl_default.php',
- 'html_id' => 'tpl_default');
+for($m = 0; $m < count($module['nav']); $m++) {
+ if($module['nav'][$m]['title'] == 'Interface') {
+
+ $module['nav'][$m]['items'][] = array( 'title' => 'Default Theme',
+ 'target' => 'content',
+ 'link' => 'admin/tpl_default.php',
+ 'html_id' => 'tpl_default');
+ break;
+ }
+}
+
?>
diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php
index 489daac..92e1979 100644
--- a/interface/web/admin/lib/module.conf.php
+++ b/interface/web/admin/lib/module.conf.php
@@ -83,20 +83,6 @@
'link' => 'admin/system_config_edit.php?id=1',
'html_id' => 'interface_config');
-//**** Load the settings pages of all installed themes
-$menu_dir = ISPC_WEB_PATH.'/admin/lib/interface.d';
-
-if (is_dir($menu_dir)) {
- if ($dh = opendir($menu_dir)) {
- //** Go through all files in the menu dir
- while (($file = readdir($dh)) !== false) {
- if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php') {
- include_once($menu_dir . '/' . $file);
- }
- }
- }
-}
-
$module['nav'][] = array( 'title' => 'Interface',
'open' => "1",
'items' => $items);
diff --git a/interface/web/capp.php b/interface/web/capp.php
index 4512391..7917aa0 100644
--- a/interface/web/capp.php
+++ b/interface/web/capp.php
@@ -52,7 +52,21 @@
//* Load module configuration into the session.
if(is_file($mod."/lib/module.conf.php")) {
include_once($mod."/lib/module.conf.php");
- $_SESSION["s"]["module"] = $module;
+
+ $menu_dir = ISPC_WEB_PATH.'/' . $mod . '/lib/menu.d';
+
+ if (is_dir($menu_dir)) {
+ if ($dh = opendir($menu_dir)) {
+ //** Go through all files in the menu dir
+ while (($file = readdir($dh)) !== false) {
+ if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
+ include_once($menu_dir . '/' . $file);
+ }
+ }
+ }
+ }
+
+ $_SESSION["s"]["module"] = $module;
session_write_close();
if($redirect == ''){
echo "HEADER_REDIRECT:".$_SESSION["s"]["module"]["startpage"];
diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index a99a775..a158422 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -195,6 +195,18 @@
if(is_file($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php')) {
include_once($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php');
+ $menu_dir = ISPC_WEB_PATH.'/' . $_SESSION['s']['user']['startmodule'] . '/lib/menu.d';
+
+ if (is_dir($menu_dir)) {
+ if ($dh = opendir($menu_dir)) {
+ //** Go through all files in the menu dir
+ while (($file = readdir($dh)) !== false) {
+ if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
+ include_once($menu_dir . '/' . $file);
+ }
+ }
+ }
+ }
$_SESSION['s']['module'] = $module;
}
diff --git a/interface/web/themes/default/templates/sidenav.tpl.htm b/interface/web/themes/default/templates/sidenav.tpl.htm
index 8ec46aa..b42ea66 100644
--- a/interface/web/themes/default/templates/sidenav.tpl.htm
+++ b/interface/web/themes/default/templates/sidenav.tpl.htm
@@ -12,7 +12,11 @@
<tmpl_loop name="items">
<li <tmpl_if name="html_id"> id='<tmpl_var name="html_id">' </tmpl_if>>
<tmpl_if name="link">
+ <tmpl_if name="target" op="==" value="_blank">
+ <a href="<tmpl_var name='link'>" target="_blank">
+ <tmpl_else>
<a href="#" onclick="loadContent('<tmpl_var name='link'>')">
+ </tmpl_if>
</tmpl_if>
<tmpl_var name="title">
<tmpl_if name="link">
diff --git a/interface/web/tools/lib/module.conf.php b/interface/web/tools/lib/module.conf.php
index 10855fe..c6b6aae 100644
--- a/interface/web/tools/lib/module.conf.php
+++ b/interface/web/tools/lib/module.conf.php
@@ -40,18 +40,6 @@
unset($items);
-//**** Load additional menu items
-$menu_dir = ISPC_WEB_PATH.'/tools/lib/menu.d';
-if (is_dir($menu_dir)) {
- if ($dh = opendir($menu_dir)) {
- //** Go through all files in the menu dir
- while (($file = readdir($dh)) !== false) {
- if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
- include_once($menu_dir . '/' . $file);
- }
- }
- }
-}
?>
\ No newline at end of file
--
Gitblit v1.9.1