Remove no more used option MODULEBUILDER_FOREVERYONE
Add menu entry in main menu Tools for Modulebuilder and API explorer
This commit is contained in:
parent
28a6a879cb
commit
9aeb1b0f86
@ -152,37 +152,20 @@ class modApi extends DolibarrModules
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r = 0;
|
||||
|
||||
// Add here entries to declare new menus
|
||||
//
|
||||
// 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'=>'Api top menu',
|
||||
// 'mainmenu'=>'api',
|
||||
// 'leftmenu'=>'api',
|
||||
// 'url'=>'/api/pagetop.php',
|
||||
// 'langs'=>'mylangfile@api', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
// 'position'=>100,
|
||||
// 'enabled'=>'$conf->api->enabled', // Define condition to show or hide menu entry. Use '$conf->api->enabled' if entry must be visible if module is enabled.
|
||||
// 'perms'=>'1', // Use 'perms'=>'$user->rights->api->level1->level2' if you want your menu with a permission rules
|
||||
// 'target'=>'',
|
||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
//
|
||||
// Example to declare a Left Menu entry into an existing Top menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
// 'type'=>'left', // This is a Left menu entry
|
||||
// 'titre'=>'Api left menu',
|
||||
// 'mainmenu'=>'xxx',
|
||||
// 'leftmenu'=>'api',
|
||||
// 'url'=>'/api/pagelevel2.php',
|
||||
// 'langs'=>'mylangfile@api', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
// 'position'=>100,
|
||||
// 'enabled'=>'$conf->api->enabled', // Define condition to show or hide menu entry. Use '$conf->api->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
// 'perms'=>'1', // Use 'perms'=>'$user->rights->api->level1->level2' if you want your menu with a permission rules
|
||||
// 'target'=>'',
|
||||
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// $r++;
|
||||
$this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools',
|
||||
'type'=>'left',
|
||||
'titre'=>'ApiExplorer',
|
||||
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'devtools_api',
|
||||
'url'=>'/api/index.php/explorer',
|
||||
'langs'=>'modulebuilder',
|
||||
'position'=>100,
|
||||
'perms'=>'1',
|
||||
//'enabled'=>'isModEnabled("api") && preg_match(\'/^(devtools)/\',$leftmenu)',
|
||||
'enabled'=>'isModEnabled("api")',
|
||||
'target'=>'_apiexplorer',
|
||||
'user'=>0);
|
||||
|
||||
|
||||
// Exports
|
||||
|
||||
@ -102,16 +102,18 @@ class modModuleBuilder extends DolibarrModules
|
||||
//------------------
|
||||
$this->menu = array();
|
||||
|
||||
$this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools',
|
||||
$this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools',
|
||||
'type'=>'left',
|
||||
'titre'=>'ModuleBuilder',
|
||||
'mainmenu'=>'home',
|
||||
'leftmenu'=>'admintools_modulebuilder',
|
||||
'url'=>'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools',
|
||||
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'devtools_modulebuilder',
|
||||
'url'=>'/modulebuilder/index.php?mainmenu=tools&leftmenu=devtools',
|
||||
'langs'=>'modulebuilder',
|
||||
'position'=>100,
|
||||
'perms'=>'1',
|
||||
'enabled'=>'$conf->modulebuilder->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu) && ($user->admin || $conf->global->MODULEBUILDER_FOREVERYONE)',
|
||||
'perms'=>'$user->hasRight("modulebuilder", "run")',
|
||||
//'enabled'=>'isModEnabled("modulebuilder") && preg_match(\'/^(devtools|all)/\',$leftmenu)',
|
||||
'enabled'=>'isModEnabled("modulebuilder")',
|
||||
'target'=>'_modulebuilder',
|
||||
'user'=>0);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ IsAMeasure=Is a measure
|
||||
DirScanned=Directory scanned
|
||||
NoTrigger=No trigger
|
||||
NoWidget=No widget
|
||||
GoToApiExplorer=API explorer
|
||||
ApiExplorer=API explorer
|
||||
ListOfMenusEntries=List of menu entries
|
||||
ListOfDictionariesEntries=List of dictionaries entries
|
||||
ListOfPermissionsDefined=List of defined permissions
|
||||
|
||||
@ -84,7 +84,7 @@ $idmodule= GETPOST('idmodule', 'alpha');
|
||||
if (!isModEnabled('modulebuilder')) {
|
||||
accessforbidden('Module ModuleBuilder not enabled');
|
||||
}
|
||||
if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) {
|
||||
if (!$user->hasRight("modulebuilder", "run")) {
|
||||
accessforbidden('ModuleBuilderNotAllowed');
|
||||
}
|
||||
|
||||
@ -2836,9 +2836,9 @@ if ($module == 'initmodule') {
|
||||
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.urlencode($tab).'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||
print ' ';
|
||||
if (empty($conf->global->$const_name)) { // If module is not activated
|
||||
print '<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled", $module).'"><strike>'.$langs->trans("GoToApiExplorer").'</strike></a>';
|
||||
print '<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled", $module).'"><strike>'.$langs->trans("ApiExplorer").'</strike></a>';
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("ApiExplorer").'</a>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.urlencode($tab).'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initapi&token='.newToken().'&format=php&file='.urlencode($pathtoapi).'">'.img_picto('Generate', 'generate', 'class="paddingleft"').'</a>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user