Commit f699a20c authored by mcramer's avatar mcramer

Implemented: Extend menus by putting *.menu.php inside the module/lib/menu.d/ folder

parent 656a1c32
<?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;
}
}
?>
......@@ -83,20 +83,6 @@ $items[] = array( 'title' => 'Interface Config',
'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);
......
......@@ -52,7 +52,21 @@ if(!in_array($mod,$user_modules)) $app->error($app->lng(301));
//* 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"];
......
......@@ -195,6 +195,18 @@ class login_index {
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;
}
......
......@@ -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">
......
......@@ -40,18 +40,6 @@ $module['nav'][] = array( 'title' => 'Interface',
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment