mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-22 09:21:30 +01:00
New: An external module can add its own menu manager
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 3.1 compared to 3.0 *****
|
||||
|
||||
For developers:
|
||||
- New: External modules can add their menu manager
|
||||
|
||||
|
||||
***** ChangeLog for 3.0 compared to 2.9 *****
|
||||
|
||||
For users:
|
||||
|
||||
@@ -40,9 +40,9 @@ $langs->load("other");
|
||||
// Security check
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$dirtop = "../includes/menus/standard";
|
||||
$dirleft = "../includes/menus/standard";
|
||||
$dirsmartphone = "../includes/menus/smartphone";
|
||||
$dirtop = "/includes/menus/standard";
|
||||
$dirleft = "/includes/menus/standard";
|
||||
$dirsmartphone = "/includes/menus/smartphone";
|
||||
|
||||
|
||||
// Cette page peut etre longue. On augmente le delai autorise.
|
||||
@@ -78,13 +78,14 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["can
|
||||
// Initialize menu handlers
|
||||
foreach ($listofmenuhandler as $key => $val)
|
||||
{
|
||||
$dir = DOL_DOCUMENT_ROOT."/includes/menus/";
|
||||
|
||||
// Load sql init_menu_handler.sql file
|
||||
$dir = "/includes/menus/";
|
||||
$file='init_menu_'.$key.'.sql';
|
||||
if (file_exists($dir.$file))
|
||||
$fullpath=dol_buildpath($dir.$file);
|
||||
|
||||
if (file_exists($fullpath))
|
||||
{
|
||||
$result=run_sql($dir.$file,1,'',1,$key);
|
||||
$result=run_sql($fullpath,1,'',1,$key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ $langs->load("admin");
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$dirtop = "../../includes/menus/standard";
|
||||
$dirleft = "../../includes/menus/standard";
|
||||
$dirsmartphone = "../../includes/menus/smartphone";
|
||||
$dirtop = "/includes/menus/standard";
|
||||
$dirleft = "/includes/menus/standard";
|
||||
$dirsmartphone = "/includes/menus/smartphone";
|
||||
|
||||
$dirmenu = array($dirleft,$dirsmartphone);
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ $langs->load("admin");
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$dirtop = "../../includes/menus/standard";
|
||||
$dirleft = "../../includes/menus/standard";
|
||||
$dirsmartphone = "../../includes/menus/smartphone";
|
||||
$dirtop = "/includes/menus/standard";
|
||||
$dirleft = "/includes/menus/standard";
|
||||
$dirsmartphone = "/includes/menus/smartphone";
|
||||
|
||||
$dirmenu = array($dirleft,$dirsmartphone);
|
||||
|
||||
|
||||
@@ -134,12 +134,15 @@ class FormAdmin
|
||||
if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // For compatibility
|
||||
|
||||
$menuarray=array();
|
||||
$handle=opendir($dirmenu);
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir=$dirroot.$dirmenu;
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
{
|
||||
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
|
||||
$filelib=preg_replace('/\.php$/i','',$file);
|
||||
@@ -158,6 +161,7 @@ class FormAdmin
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
ksort($menuarray);
|
||||
|
||||
@@ -199,12 +203,15 @@ class FormAdmin
|
||||
|
||||
foreach($dirmenuarray as $dirmenu)
|
||||
{
|
||||
$handle=opendir($dirmenu);
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir=$dirroot.$dirmenu;
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
{
|
||||
$filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i','',$file);
|
||||
if (preg_match('/^default/i',$filelib)) continue;
|
||||
@@ -218,6 +225,7 @@ class FormAdmin
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksort($menuarray);
|
||||
|
||||
@@ -87,7 +87,7 @@ function dol_getprefix()
|
||||
function dol_include_once($relpath)
|
||||
{
|
||||
global $conf,$langs,$user,$mysoc; // Other global var must be retreived with $GLOBALS['var']
|
||||
return include_once(dol_buildpath($relpath));
|
||||
return @include_once(dol_buildpath($relpath));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -951,7 +951,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
||||
|
||||
if (! $conf->top_menu) $conf->top_menu ='eldy_backoffice.php';
|
||||
|
||||
|
||||
// For backward compatibility with old modules
|
||||
if (empty($conf->headerdone)) top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
@@ -1051,7 +1050,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
||||
if (GETPOST('menu')) $top_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
||||
|
||||
// Load the top menu manager
|
||||
$result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/standard/".$top_menu);
|
||||
$result=dol_include_once("/includes/menus/standard/".$top_menu);
|
||||
if (! $result) // If failed to include, we try with standard
|
||||
{
|
||||
$top_menu='eldy_backoffice.php';
|
||||
@@ -1243,7 +1242,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
|
||||
if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
||||
|
||||
// Load the left menu manager
|
||||
$result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/standard/".$left_menu);
|
||||
$result=dol_include_once("/includes/menus/standard/".$left_menu);
|
||||
if (! $result) // If menu manager removed or not found
|
||||
{
|
||||
$left_menu='eldy_backoffice.php';
|
||||
|
||||
Reference in New Issue
Block a user