mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Can add a left menu (first level) into an existing top menu.
This commit is contained in:
parent
af4627d5ed
commit
92c27b1732
17
ChangeLog
17
ChangeLog
|
|
@ -35,22 +35,23 @@ For users:
|
|||
- Fix: Can use POS module with several concurrent users.
|
||||
|
||||
For developers:
|
||||
- New: Add webservice to get or create a product, service.
|
||||
- New: Add webservice to get a user.
|
||||
- New: Add hooks to change way of showing/editing lines into dictionnaries.
|
||||
- New: Can add a left menu (first level) into an existing top menu.
|
||||
- New: Add webservice to get or create a product or service.
|
||||
- New: Add webservice to get a user.
|
||||
- New: Add more "hooks" (like hooks to change way of showing/editing lines into dictionnaries).
|
||||
- New: Log module outputs can be setup with "or" rule (not only "xor").
|
||||
- New: Add FirePHP output for logging module.
|
||||
- New: Add trigger ACTION_DELETE and ACTION_MODIFY
|
||||
- New: Add trigger ACTION_DELETE and ACTION_MODIFY.
|
||||
- New: Can define different requests according to database type into migration files.
|
||||
- New: Add "canvas" feature to overwrite page of thirdparty, contact, product with yours.
|
||||
- Qual: Add a lot of more PHPUnit tests.
|
||||
- Qual: Data structure for supplier prices is simpler.
|
||||
- Qual: Removed no more used external libraries.
|
||||
- Qual: Cleaned a lot of dead code.
|
||||
- Qual: Add more "hooks".
|
||||
- Qual: Add "canvas" feature to overwrite page of thirdparty, contact, product with yours.
|
||||
- Qual: More OOP (usage of "abstract", "static", ...), uniformize constructors.
|
||||
- Qual: task #216 : Move /lib in /core/lib directory
|
||||
- Qual: task #217 : Move core files in core directory (login, menus, triggers, boxes, modules)
|
||||
- Qual: Fix a lot of checkstyle warnings.
|
||||
- Qual: task #216 : Move /lib into /core/lib directory
|
||||
- Qual: task #217 : Move core files into core directory (login, menus, triggers, boxes, modules)
|
||||
|
||||
|
||||
***** ChangeLog for 3.1 compared to 3.0 *****
|
||||
|
|
|
|||
|
|
@ -169,7 +169,8 @@ class modMyModule extends DolibarrModules
|
|||
$r=0;
|
||||
|
||||
// Add here entries to declare new menus
|
||||
// Example to declare the Top Menu entry:
|
||||
//
|
||||
// Example to declare a new Top Menu entry and its Left menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
||||
// 'type'=>'top', // This is a Top menu entry
|
||||
// 'titre'=>'MyModule top menu',
|
||||
|
|
@ -182,11 +183,9 @@ class modMyModule extends DolibarrModules
|
|||
// 'target'=>'',
|
||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
//
|
||||
// Example to declare a Left Menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry) or use 'fk_mainmenu=xxx,fk_leftmenu=yyy'
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
// 'type'=>'left', // This is a Left menu entry
|
||||
// 'titre'=>'MyModule left menu 1',
|
||||
// 'titre'=>'MyModule left menu',
|
||||
// 'mainmenu'=>'mymodule',
|
||||
// 'url'=>'/mymodule/pagelevel1.php',
|
||||
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
|
|
@ -197,10 +196,10 @@ class modMyModule extends DolibarrModules
|
|||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
//
|
||||
// Example to declare another Left Menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'r=1', // Use r=value where r is index key used for the parent menu entry (higher parent must be a top menu entry)
|
||||
// Example to declare a Left Menu entry into an existing Top menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=mainmenucode', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
|
||||
// 'type'=>'left', // This is a Left menu entry
|
||||
// 'titre'=>'MyModule left menu 2',
|
||||
// 'titre'=>'MyModule left menu',
|
||||
// 'mainmenu'=>'mymodule',
|
||||
// 'url'=>'/mymodule/pagelevel2.php',
|
||||
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
|
|
|
|||
|
|
@ -392,24 +392,11 @@ class Menubase
|
|||
for ($x = 0; $x < $num; $x++)
|
||||
{
|
||||
//si un element a pour pere : $pere
|
||||
if ($tab[$x]['fk_menu'] == $pere)
|
||||
if ($tab[$x]['fk_menu'] == $pere && $tab[$x]['enabled'])
|
||||
{
|
||||
if ($tab[$x]['enabled'])
|
||||
{
|
||||
$leftmenuConstraint = true;
|
||||
if ($tab[$x]['leftmenu'])
|
||||
{
|
||||
$leftmenuConstraint = verifCond($tab[$x]['leftmenu']);
|
||||
}
|
||||
|
||||
if ($leftmenuConstraint)
|
||||
{
|
||||
//print 'name='.$tab[$x][3].' pere='.$pere." ".$tab[$x][6];
|
||||
|
||||
$this->newmenu->add((! preg_match("/^(http:\/\/|https:\/\/)/i",$tab[$x]['url'])) ? $tab[$x]['url'] : $tab[$x]['url'], $tab[$x]['titre'], $rang -1, $tab[$x]['perms'], $tab[$x]['atarget'], $tab[$x]['mainmenu']);
|
||||
$this->recur($tab, $tab[$x]['rowid'], $rang +1, $leftmenu);
|
||||
}
|
||||
}
|
||||
//print 'mainmenu='.$tab[$x]['mainmenu'];
|
||||
$this->newmenu->add($tab[$x]['url'], $tab[$x]['titre'], $rang - 1, $tab[$x]['perms'], $tab[$x]['atarget'], $tab[$x]['mainmenu']);
|
||||
$this->recur($tab, $tab[$x]['rowid'], $rang + 1, $leftmenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -483,23 +470,23 @@ class Menubase
|
|||
|
||||
$leftmenu=$myleftmenu; // To export to dol_eval function
|
||||
|
||||
// We initialize newmenu to return with first already found menu entries
|
||||
// We initialize newmenu with first already found menu entries
|
||||
$this->newmenu = $newmenu;
|
||||
|
||||
// Load datas from database into $tabMenu
|
||||
// Load datas from database into $tabMenu, then we will complete this->newmenu with values into $tabMenu
|
||||
if (count($tabMenu) == 0)
|
||||
{
|
||||
$this->menuLoad($leftmenu, $type_user, $menu_handler, $tabMenu);
|
||||
}
|
||||
//var_dump($tabMenu);
|
||||
|
||||
// Define menutopid
|
||||
$menutopid='';
|
||||
if (is_array($tabMenu))
|
||||
{
|
||||
foreach($tabMenu as $val)
|
||||
foreach($tabMenu as $key => $val)
|
||||
{
|
||||
if ($val['type'] == 'top' && $val['mainmenu'] == $mainmenu) // 9 is type, 8 is mainmenu
|
||||
// Define menutopid of mainmenu
|
||||
if (empty($menutopid) && $val['type'] == 'top' && $val['mainmenu'] == $mainmenu) // 9 is type, 8 is mainmenu
|
||||
{
|
||||
$menutopid=$val['rowid'];
|
||||
break;
|
||||
|
|
@ -507,8 +494,48 @@ class Menubase
|
|||
}
|
||||
}
|
||||
|
||||
// Now edit this->newmenu->list to add entries found into tabMenu that are in childs of mainmenu claimed
|
||||
// Update fk_menu when value is -1 (left menu added by modules with no top menu)
|
||||
if (is_array($tabMenu))
|
||||
{
|
||||
foreach($tabMenu as $key => $val)
|
||||
{
|
||||
if ($val['fk_menu'] == -1 && $val['fk_mainmenu'] == $mainmenu)
|
||||
{
|
||||
if (empty($val['fk_leftmenu']))
|
||||
{
|
||||
//print 'Try to find fk_menu for '.join(',',$val);
|
||||
//var_dump($this->newmenu->liste);exit;
|
||||
$tabMenu[$key]['fk_menu']=$menutopid;
|
||||
}
|
||||
else if ($val['fk_leftmenu'] == $fk_leftmenu)
|
||||
{
|
||||
// TODO
|
||||
/*
|
||||
foreach($this->newmenu as $keyparent => $valparent)
|
||||
{
|
||||
if (empty($val['fk_leftmenu']) && $valparent['type'] == 'top' && $valparent['mainmenu'] == $val['fk_mainmenu'])
|
||||
{
|
||||
$tabMenu[$key]['fk_menu']=$valparent['rowid'];
|
||||
break;
|
||||
}
|
||||
//var_dump($tabMenu);exit;
|
||||
if (! empty($val['fk_leftmenu']) && $valparent['type'] == 'left' && $valparent['mainmenu'] == $val['fk_mainmenu'] && $valparent['leftmenu'] == $val['fk_leftmenu'])
|
||||
{
|
||||
print 'eeee';
|
||||
$tabMenu[$key]['fk_menu']=$valparent['rowid'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
//exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now edit this->newmenu->list to add entries found into tabMenu that are childs of mainmenu claimed
|
||||
$this->recur($tabMenu, $menutopid, 1, $leftmenu);
|
||||
//var_dump($this->newmenu->liste);exit;
|
||||
|
||||
return $this->newmenu;
|
||||
}
|
||||
|
|
@ -596,6 +623,7 @@ class Menubase
|
|||
//print "verifCond chaine=".$chaine." rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."<br>\n";
|
||||
}
|
||||
|
||||
/*
|
||||
// 0=rowid, 1=fk_menu, 2=url, 3=text, 4=perms, 5=target, 8=mainmenu
|
||||
$tabMenu[$b][0] = $menu['rowid'];
|
||||
$tabMenu[$b][1] = $menu['fk_menu'];
|
||||
|
|
@ -615,7 +643,7 @@ class Menubase
|
|||
$tabMenu[$b][8] = $menu['mainmenu'];
|
||||
$tabMenu[$b][9] = $menu['type'];
|
||||
$tabMenu[$b][10] = $menu['langs'];
|
||||
|
||||
*/
|
||||
// We complete tabMenu
|
||||
$tabMenu[$b]['rowid'] = $menu['rowid'];
|
||||
$tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
|
||||
|
|
|
|||
|
|
@ -1129,6 +1129,13 @@ abstract class DolibarrModules
|
|||
$menu->fk_leftmenu=$reg[2];
|
||||
$foundparent=1;
|
||||
}
|
||||
elseif (preg_match('/fk_mainmenu=(.*)/',$fk_parent,$reg))
|
||||
{
|
||||
$menu->fk_menu=-1;
|
||||
$menu->fk_mainmenu=$reg[1];
|
||||
$menu->fk_leftmenu='';
|
||||
$foundparent=1;
|
||||
}
|
||||
if (! $foundparent)
|
||||
{
|
||||
$this->error="ErrorBadDefinitionOfMenuArrayInModuleDescriptor (bad value for key fk_menu)";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user