diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php
index 5eaae25a67c..30751fc5222 100644
--- a/htdocs/core/modules/modApi.class.php
+++ b/htdocs/core/modules/modApi.class.php
@@ -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
diff --git a/htdocs/core/modules/modModuleBuilder.class.php b/htdocs/core/modules/modModuleBuilder.class.php
index 99c32e48bbd..2d6cafa9c2e 100644
--- a/htdocs/core/modules/modModuleBuilder.class.php
+++ b/htdocs/core/modules/modModuleBuilder.class.php
@@ -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);
}
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 6de9ada7e4d..cefdfaa1b41 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -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
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 705dc202932..eadef4684a4 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -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 ''.img_picto($langs->trans("Delete"), 'delete').'';
print ' ';
if (empty($conf->global->$const_name)) { // If module is not activated
- print ''.$langs->trans("GoToApiExplorer").'';
+ print ''.$langs->trans("ApiExplorer").'';
} else {
- print ''.$langs->trans("GoToApiExplorer").'';
+ print ''.$langs->trans("ApiExplorer").'';
}
} else {
print ''.img_picto('Generate', 'generate', 'class="paddingleft"').'';