From 78cc976e9f6d6f2d835ec8cf517e54ee120b9010 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Thu, 30 Mar 2017 10:40:15 +0200 Subject: [PATCH] Work on module builder --- htdocs/core/modules/modCron.class.php | 2 +- htdocs/core/modules/modModuleBuilder.class.php | 14 ++++++++++++++ htdocs/core/modules/modPrinting.class.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/modulebuilder.lang | 1 - htdocs/main.inc.php | 2 +- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 88b154f891e..7f949501023 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -138,7 +138,7 @@ class modCron extends DolibarrModules 'url'=>'/cron/list.php?status=-2&leftmenu=admintools', 'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>200, - 'enabled'=>'($leftmenu==\'admintools\' || $leftmenu==\'admintools_info\')', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'enabled'=>'$conf->cron->enabled && preg_match(\'/^admintools/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both diff --git a/htdocs/core/modules/modModuleBuilder.class.php b/htdocs/core/modules/modModuleBuilder.class.php index b68148377c3..dce442720a3 100644 --- a/htdocs/core/modules/modModuleBuilder.class.php +++ b/htdocs/core/modules/modModuleBuilder.class.php @@ -85,5 +85,19 @@ class modModuleBuilder extends DolibarrModules // Main menu entries //------------------ $this->menu = array(); + + $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', + 'type'=>'left', + 'titre'=>'ModuleBuilder', + 'mainmenu'=>'home', + 'leftmenu'=>'admintools_modulebuilder', + 'url'=>'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools_modulebuilder', + 'langs'=>'modulebuilder', + 'position'=>100, + 'perms'=>'1', + 'enabled'=>'$conf->modulebuilder->enabled && preg_match(\'/^admintools/\',$leftmenu) && ($user->admin || $conf->global->MODULEBUILDER_FOREVERYONE)', + 'target'=>'_modulebuilder', + 'user'=>0); + } } diff --git a/htdocs/core/modules/modPrinting.class.php b/htdocs/core/modules/modPrinting.class.php index fd101615809..89bf6115dae 100644 --- a/htdocs/core/modules/modPrinting.class.php +++ b/htdocs/core/modules/modPrinting.class.php @@ -111,7 +111,7 @@ class modPrinting extends DolibarrModules 'url'=>'/printing/index.php?mainmenu=home&leftmenu=admintools', 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>300, - 'enabled'=>'$conf->printing->enabled && ($leftmenu==\'admintools\' || $leftmenu==\'admintools_info\')', + 'enabled'=>'$conf->printing->enabled && preg_match(\'/^admintools/\', $leftmenu)', 'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules 'target'=>'', 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3831fb49007..b3f43698843 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1664,7 +1664,7 @@ UserHasNoPermissions=This user has no permission defined TypeCdr=Use "None" if the date of payment term is date of invoice plus a delta in days (delta is field "Nb of days")<br>Use "At end of month", if, after delta, the date must be increased to reach the end of month (+ an optional "Offset" in days)<br>Use "Current/Next" to have payment term date being the first Nth of the month (N is stored into field "Nb of days") BaseCurrency=Reference currency of the company (go into setup of company to change this) WarningNoteModuleInvoiceForFrenchLaw=This module %s is compliant with french laws (Loi Finance 2016). -WarningInstallationMayBecomeNotCompliantWithLaw=You try to install the module <strong>%s</strong> that is an external module. Activate an external module only if it does not alterate negatively the behavior required by your country laws (%s). If the module bring a non legal feature, you are the only responsible for the use of a non-compliant software. +WarningInstallationMayBecomeNotCompliantWithLaw=You try to install the module %s that is an external module. Activating an external module means you trust the editor of the module and you are sure that this module does not alterate negatively the behavior of your application and is compliant with laws of your country (%s). If the module bring a non legal feature, you become responsible for the use of a non legal software. ##### Resource #### ResourceSetup=Configuration du module Resource UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list). diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 53d727d9965..918f46a44b7 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -763,6 +763,7 @@ DirectDownloadLink=Direct download link Download=Download ActualizeCurrency=Update currency rate Fiscalyear=Fiscal year +ModuleBuilder=Module Builder # Week day Monday=Monday Tuesday=Tuesday diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 6605a7b6a63..9979760bc4f 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -1,3 +1,2 @@ # Dolibarr language file - Source file is en_US - loan -ModuleBuilder=Module Builder ModuleBuilderDesc=This tools give you utilites to build your own module. Your modules will be generated into the first alternative directory: <strong>%s</strong>. diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index fe1ed01a68f..88e2760ecb4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1440,7 +1440,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a // Link to module builder if (! empty($conf->modulebuilder->enabled)) { - $text ='<a href="'.DOL_URL_ROOT.'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_blank">'; + $text ='<a href="'.DOL_URL_ROOT.'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"'); $text.='<span class="fa fa-bug atoplogin"></span>'; $text.='</a>'; -- GitLab