mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-21 08:51:24 +01:00
New: An external module can add its own menu manager
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
English Dolibarr ChangeLog
|
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 *****
|
***** ChangeLog for 3.0 compared to 2.9 *****
|
||||||
|
|
||||||
For users:
|
For users:
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ $langs->load("other");
|
|||||||
// Security check
|
// Security check
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
$dirtop = "../includes/menus/standard";
|
$dirtop = "/includes/menus/standard";
|
||||||
$dirleft = "../includes/menus/standard";
|
$dirleft = "/includes/menus/standard";
|
||||||
$dirsmartphone = "../includes/menus/smartphone";
|
$dirsmartphone = "/includes/menus/smartphone";
|
||||||
|
|
||||||
|
|
||||||
// Cette page peut etre longue. On augmente le delai autorise.
|
// 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
|
// Initialize menu handlers
|
||||||
foreach ($listofmenuhandler as $key => $val)
|
foreach ($listofmenuhandler as $key => $val)
|
||||||
{
|
{
|
||||||
$dir = DOL_DOCUMENT_ROOT."/includes/menus/";
|
|
||||||
|
|
||||||
// Load sql init_menu_handler.sql file
|
// Load sql init_menu_handler.sql file
|
||||||
$file='init_menu_'.$key.'.sql';
|
$dir = "/includes/menus/";
|
||||||
if (file_exists($dir.$file))
|
$file='init_menu_'.$key.'.sql';
|
||||||
|
$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)
|
if (! $user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$dirtop = "../../includes/menus/standard";
|
$dirtop = "/includes/menus/standard";
|
||||||
$dirleft = "../../includes/menus/standard";
|
$dirleft = "/includes/menus/standard";
|
||||||
$dirsmartphone = "../../includes/menus/smartphone";
|
$dirsmartphone = "/includes/menus/smartphone";
|
||||||
|
|
||||||
$dirmenu = array($dirleft,$dirsmartphone);
|
$dirmenu = array($dirleft,$dirsmartphone);
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ elseif (isset($_GET["action"]) && $_GET["action"] == 'edit')
|
|||||||
$menu = new Menubase($db);
|
$menu = new Menubase($db);
|
||||||
$result=$menu->fetch($_GET['menuId']);
|
$result=$menu->fetch($_GET['menuId']);
|
||||||
//var_dump($menu);
|
//var_dump($menu);
|
||||||
|
|
||||||
// MenuId Parent
|
// MenuId Parent
|
||||||
print '<tr><td>'.$langs->trans('MenuIdParent').'</td>';
|
print '<tr><td>'.$langs->trans('MenuIdParent').'</td>';
|
||||||
//$menu_handler
|
//$menu_handler
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ $langs->load("admin");
|
|||||||
if (! $user->admin)
|
if (! $user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$dirtop = "../../includes/menus/standard";
|
$dirtop = "/includes/menus/standard";
|
||||||
$dirleft = "../../includes/menus/standard";
|
$dirleft = "/includes/menus/standard";
|
||||||
$dirsmartphone = "../../includes/menus/smartphone";
|
$dirsmartphone = "/includes/menus/smartphone";
|
||||||
|
|
||||||
$dirmenu = array($dirleft,$dirsmartphone);
|
$dirmenu = array($dirleft,$dirsmartphone);
|
||||||
|
|
||||||
|
|||||||
@@ -134,30 +134,34 @@ class FormAdmin
|
|||||||
if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // For compatibility
|
if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // For compatibility
|
||||||
|
|
||||||
$menuarray=array();
|
$menuarray=array();
|
||||||
$handle=opendir($dirmenu);
|
foreach ($conf->file->dol_document_root as $dirroot)
|
||||||
if (is_resource($handle))
|
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
$dir=$dirroot.$dirmenu;
|
||||||
|
$handle=opendir($dir);
|
||||||
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
|
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||||
$filelib=preg_replace('/\.php$/i','',$file);
|
{
|
||||||
$prefix='';
|
if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files
|
||||||
if (preg_match('/^eldy|^iphone/i',$file)) $prefix='0'; // 0=Recommanded, 1=Experimental, 2=Other
|
$filelib=preg_replace('/\.php$/i','',$file);
|
||||||
else $prefix='2';
|
$prefix='';
|
||||||
|
if (preg_match('/^eldy|^iphone/i',$file)) $prefix='0'; // 0=Recommanded, 1=Experimental, 2=Other
|
||||||
|
else $prefix='2';
|
||||||
|
|
||||||
if ($file == $selected)
|
if ($file == $selected)
|
||||||
{
|
{
|
||||||
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="selected">'.$filelib.'</option>';
|
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="selected">'.$filelib.'</option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
|
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
closedir($handle);
|
||||||
}
|
}
|
||||||
closedir($handle);
|
|
||||||
}
|
}
|
||||||
ksort($menuarray);
|
ksort($menuarray);
|
||||||
|
|
||||||
@@ -199,24 +203,28 @@ class FormAdmin
|
|||||||
|
|
||||||
foreach($dirmenuarray as $dirmenu)
|
foreach($dirmenuarray as $dirmenu)
|
||||||
{
|
{
|
||||||
$handle=opendir($dirmenu);
|
foreach ($conf->file->dol_document_root as $dirroot)
|
||||||
if (is_resource($handle))
|
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
$dir=$dirroot.$dirmenu;
|
||||||
{
|
$handle=opendir($dir);
|
||||||
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
$filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i','',$file);
|
while (($file = readdir($handle))!==false)
|
||||||
if (preg_match('/^default/i',$filelib)) continue;
|
{
|
||||||
if (preg_match('/^empty/i',$filelib)) continue;
|
if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||||
if (preg_match('/\.lib/i',$filelib)) continue;
|
{
|
||||||
if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file,$expdevmenu)) continue;
|
$filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i','',$file);
|
||||||
|
if (preg_match('/^default/i',$filelib)) continue;
|
||||||
|
if (preg_match('/^empty/i',$filelib)) continue;
|
||||||
|
if (preg_match('/\.lib/i',$filelib)) continue;
|
||||||
|
if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file,$expdevmenu)) continue;
|
||||||
|
|
||||||
$menuarray[$filelib]=1;
|
$menuarray[$filelib]=1;
|
||||||
}
|
}
|
||||||
$menuarray['all']=1;
|
$menuarray['all']=1;
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ function dol_getprefix()
|
|||||||
function dol_include_once($relpath)
|
function dol_include_once($relpath)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user,$mysoc; // Other global var must be retreived with $GLOBALS['var']
|
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';
|
if (! $conf->top_menu) $conf->top_menu ='eldy_backoffice.php';
|
||||||
|
|
||||||
|
|
||||||
// For backward compatibility with old modules
|
// For backward compatibility with old modules
|
||||||
if (empty($conf->headerdone)) top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
if (empty($conf->headerdone)) top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||||
|
|
||||||
@@ -1051,11 +1050,11 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
|||||||
if (GETPOST('menu')) $top_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
if (GETPOST('menu')) $top_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
||||||
|
|
||||||
// Load the top menu manager
|
// 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
|
if (! $result) // If failed to include, we try with standard
|
||||||
{
|
{
|
||||||
$top_menu='eldy_backoffice.php';
|
$top_menu='eldy_backoffice.php';
|
||||||
include_once(DOL_DOCUMENT_ROOT ."/includes/menus/standard/".$top_menu);
|
include_once(DOL_DOCUMENT_ROOT."/includes/menus/standard/".$top_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n".'<!-- Start top horizontal menu '.$top_menu.' -->'."\n";
|
print "\n".'<!-- Start top horizontal menu '.$top_menu.' -->'."\n";
|
||||||
@@ -1068,7 +1067,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
|||||||
$menutop = new MenuTop($db);
|
$menutop = new MenuTop($db);
|
||||||
$menutop->atarget=$target;
|
$menutop->atarget=$target;
|
||||||
$menutop->showmenu();
|
$menutop->showmenu();
|
||||||
|
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
// Link to login card
|
// Link to login card
|
||||||
@@ -1125,11 +1124,11 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
|||||||
$logouttext.=' alt="'.dol_escape_htmltag($langs->trans("Logout")).'" title=""';
|
$logouttext.=' alt="'.dol_escape_htmltag($langs->trans("Logout")).'" title=""';
|
||||||
$logouttext.='>';
|
$logouttext.='>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="login_block">'."\n";
|
print '<div class="login_block">'."\n";
|
||||||
|
|
||||||
print $html->textwithtooltip('',$loginhtmltext,2,1,$logintext);
|
print $html->textwithtooltip('',$loginhtmltext,2,1,$logintext);
|
||||||
|
|
||||||
// Select entity
|
// Select entity
|
||||||
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
|
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
|
||||||
{
|
{
|
||||||
@@ -1243,7 +1242,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
|
|||||||
if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
||||||
|
|
||||||
// Load the left menu manager
|
// 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
|
if (! $result) // If menu manager removed or not found
|
||||||
{
|
{
|
||||||
$left_menu='eldy_backoffice.php';
|
$left_menu='eldy_backoffice.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user