Skip to content

Commit f699a20

Browse files
author
mcramer
committed
Implemented: Extend menus by putting *.menu.php inside the module/lib/menu.d/ folder
1 parent 656a1c3 commit f699a20

File tree

6 files changed

+43
-32
lines changed

6 files changed

+43
-32
lines changed
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
<?php
22

3-
$items[] = array( 'title' => 'Default Theme',
4-
'target' => 'content',
5-
'link' => 'admin/tpl_default.php',
6-
'html_id' => 'tpl_default');
3+
for($m = 0; $m < count($module['nav']); $m++) {
4+
if($module['nav'][$m]['title'] == 'Interface') {
5+
6+
$module['nav'][$m]['items'][] = array( 'title' => 'Default Theme',
7+
'target' => 'content',
8+
'link' => 'admin/tpl_default.php',
9+
'html_id' => 'tpl_default');
10+
break;
11+
}
12+
}
13+
714
?>

interface/web/admin/lib/module.conf.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,6 @@
8383
'link' => 'admin/system_config_edit.php?id=1',
8484
'html_id' => 'interface_config');
8585

86-
//**** Load the settings pages of all installed themes
87-
$menu_dir = ISPC_WEB_PATH.'/admin/lib/interface.d';
88-
89-
if (is_dir($menu_dir)) {
90-
if ($dh = opendir($menu_dir)) {
91-
//** Go through all files in the menu dir
92-
while (($file = readdir($dh)) !== false) {
93-
if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php') {
94-
include_once($menu_dir . '/' . $file);
95-
}
96-
}
97-
}
98-
}
99-
10086
$module['nav'][] = array( 'title' => 'Interface',
10187
'open' => "1",
10288
'items' => $items);

interface/web/capp.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,21 @@
5252
//* Load module configuration into the session.
5353
if(is_file($mod."/lib/module.conf.php")) {
5454
include_once($mod."/lib/module.conf.php");
55-
$_SESSION["s"]["module"] = $module;
55+
56+
$menu_dir = ISPC_WEB_PATH.'/' . $mod . '/lib/menu.d';
57+
58+
if (is_dir($menu_dir)) {
59+
if ($dh = opendir($menu_dir)) {
60+
//** Go through all files in the menu dir
61+
while (($file = readdir($dh)) !== false) {
62+
if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
63+
include_once($menu_dir . '/' . $file);
64+
}
65+
}
66+
}
67+
}
68+
69+
$_SESSION["s"]["module"] = $module;
5670
session_write_close();
5771
if($redirect == ''){
5872
echo "HEADER_REDIRECT:".$_SESSION["s"]["module"]["startpage"];

interface/web/login/index.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,18 @@ public function render() {
195195

196196
if(is_file($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php')) {
197197
include_once($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php');
198+
$menu_dir = ISPC_WEB_PATH.'/' . $_SESSION['s']['user']['startmodule'] . '/lib/menu.d';
199+
200+
if (is_dir($menu_dir)) {
201+
if ($dh = opendir($menu_dir)) {
202+
//** Go through all files in the menu dir
203+
while (($file = readdir($dh)) !== false) {
204+
if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
205+
include_once($menu_dir . '/' . $file);
206+
}
207+
}
208+
}
209+
}
198210
$_SESSION['s']['module'] = $module;
199211
}
200212

interface/web/themes/default/templates/sidenav.tpl.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
<tmpl_loop name="items">
1313
<li <tmpl_if name="html_id"> id='<tmpl_var name="html_id">' </tmpl_if>>
1414
<tmpl_if name="link">
15+
<tmpl_if name="target" op="==" value="_blank">
16+
<a href="<tmpl_var name='link'>" target="_blank">
17+
<tmpl_else>
1518
<a href="#" onclick="loadContent('<tmpl_var name='link'>')">
19+
</tmpl_if>
1620
</tmpl_if>
1721
<tmpl_var name="title">
1822
<tmpl_if name="link">

interface/web/tools/lib/module.conf.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@
4040

4141
unset($items);
4242

43-
//**** Load additional menu items
44-
$menu_dir = ISPC_WEB_PATH.'/tools/lib/menu.d';
45-
46-
if (is_dir($menu_dir)) {
47-
if ($dh = opendir($menu_dir)) {
48-
//** Go through all files in the menu dir
49-
while (($file = readdir($dh)) !== false) {
50-
if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
51-
include_once($menu_dir . '/' . $file);
52-
}
53-
}
54-
}
55-
}
43+
5644

5745
?>

0 commit comments

Comments
 (0)