From 0b6d7a5b575f2ddb74607659d85adff363c2d6da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Jun 2017 11:44:12 +0200 Subject: [PATCH] Modulebuilder --- htdocs/admin/modules.php | 11 +++- htdocs/langs/en_US/modulebuilder.lang | 9 ++- htdocs/modulebuilder/index.php | 62 +++++++++++++++--- htdocs/modulebuilder/template/admin/about.php | 6 +- htdocs/modulebuilder/template/admin/setup.php | 4 +- ...{object_mytest.png => object_mymodule.png} | Bin 6 files changed, 73 insertions(+), 19 deletions(-) rename htdocs/modulebuilder/template/img/{object_mytest.png => object_mymodule.png} (100%) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 57ed97c9b20..8bea1c6dcb7 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -865,6 +865,7 @@ if ($mode == 'deploy') print '
'; } + print '
'; if ($allowfromweb >= 0) { @@ -885,12 +886,20 @@ if ($mode == 'deploy') if ($allowfromweb == 1) { print $langs->trans("UnpackPackageInModulesRoot",$dirins).'
'; - print '
'; + + print '
'; + + print ''; print ''; print ''; print $langs->trans("YouCanSubmitFile").' '; print ''; print '
'; + + print '
'; + print '
'; + + print '
'; } else { diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index b717bafc57c..adce0950b88 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -11,7 +11,14 @@ ModuleBuilderDescobjects=Define here the new objects you want to manage with you ModuleBuilderDescmenus=This tab is dedicated to define menu entries provided by your module. ModuleBuilderDescpermissions=This tab is dedicated to define the new permissions you want to provide with your module. ModuleBuilderDesctriggers=This is the view of triggers provided by your module. To include code executed when a triggered business event is launched, just edit this file with your IDE. +ModuleBuilderDeschooks=This tab is dedicated to hooks. +ModuleBuilderDescwidgets=This tab is dedicated to manage/build widgets. ModuleBuilderDescbuildpackage=You can generate here a "ready to distribute" package file (a normalized .zip file) of your module. Just click on button to get your module package file. +ModuleBuilderDescdangerzone=You can delete your module. WARNING: All files of module will be definetly lost ! +DangerZone=Danger zone BuildPackage=Build package ModuleIsNotActive=This module was not activated yet (go into Home-Setup-Module to make it live) -ModuleIsLive=This module has been activated. Any change on it may break a current active feature. \ No newline at end of file +ModuleIsLive=This module has been activated. Any change on it may break a current active feature. +DescriptionLong=Long description +EditorName=Name of editor +EditorUrl=URL of editor \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 5b3a33c9d41..8cabec1bdfb 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -113,6 +113,19 @@ if ($dirins && $action == 'initmodule' && $modulename) } } +if ($dirins && $action == 'confirm_delete') +{ + $modulelowercase=strtolower($module); + + // Dir for module + $dir = $dirins.'/'.$modulelowercase; + + dol_delete_dir_recursive($dir); + + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); + exit; +} + if ($dirins && $action == 'generatepackage') { $modulelowercase=strtolower($module); @@ -373,16 +386,31 @@ elseif (! empty($module)) $head2[$h][2] = 'permissions'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module; + $head2[$h][1] = $langs->trans("Hooks"); + $head2[$h][2] = 'hooks'; + $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module; $head2[$h][1] = $langs->trans("Triggers"); $head2[$h][2] = 'triggers'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module; + $head2[$h][1] = $langs->trans("Widgets"); + $head2[$h][2] = 'widgets'; + $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module; $head2[$h][1] = $langs->trans("BuildPackage"); $head2[$h][2] = 'buildpackage'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dangerzone&module='.$module; + $head2[$h][1] = $langs->trans("DangerZone"); + $head2[$h][2] = 'dangerzone'; + $h++; + print $modulestatusinfo.'

'; dol_fiche_head($head2, $tab, '', -1, ''); @@ -421,7 +449,7 @@ elseif (! empty($module)) print ''; print $langs->trans("Family"); - print "
'crm','financial','hr','projects','products','ecm','technic','interface','other'"; + //print "
'crm','financial','hr','projects','products','ecm','technic','interface','other'"; print ''; print $moduleobj->family; print ''; @@ -445,7 +473,7 @@ elseif (! empty($module)) print ''; print ''; - print $langs->trans("LongDescription"); + print $langs->trans("DescriptionLong"); print ''; print $moduleobj->getDescLong(); print ''; @@ -453,14 +481,6 @@ elseif (! empty($module)) print ''; print ''; - - print '

'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print '
'; } if ($tab == 'objects') @@ -483,6 +503,12 @@ elseif (! empty($module)) } + if ($tab == 'hooks') + { + print $langs->trans("FeatureNotYetAvailable"); + + } + if ($tab == 'triggers') { require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; @@ -520,6 +546,12 @@ elseif (! empty($module)) print ''; } + if ($tab == 'widget') + { + print $langs->trans("FeatureNotYetAvailable"); + + } + if ($tab == 'buildpackage') { if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) @@ -536,6 +568,16 @@ elseif (! empty($module)) print ''; } + if ($tab == 'dangerzone') + { + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + } + dol_fiche_end(); } } diff --git a/htdocs/modulebuilder/template/admin/about.php b/htdocs/modulebuilder/template/admin/about.php index 844c444bad2..1306b0aef6a 100644 --- a/htdocs/modulebuilder/template/admin/about.php +++ b/htdocs/modulebuilder/template/admin/about.php @@ -20,8 +20,6 @@ * \file htdocs/modulebuilder/template/admin/about.php * \ingroup mymodule * \brief About page of module MyModule. - * - * MyModuleDescription. */ // Load Dolibarr environment @@ -84,8 +82,8 @@ echo $langs->trans("MyModuleAboutPage"); echo '
'; -require_once '../core/modulebuilder/mymodule/core/modules/modMyModule.class.php'; -$tmpmodule = new MyModule($db); +dol_include_once('/mymodule/core/modules/modMyModule.class.php'); +$tmpmodule = new modMyModule($db); print $tmpmodule->getDescLong(); // Page end diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index b3f2cc87d73..421452f06e8 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -19,9 +19,7 @@ /** * \file htdocs/modulebuilder/template/admin/setup.php * \ingroup mymodule - * \brief Example module setup page. - * - * Put detailed description here. + * \brief MyModule setup page. */ // Load Dolibarr environment diff --git a/htdocs/modulebuilder/template/img/object_mytest.png b/htdocs/modulebuilder/template/img/object_mymodule.png similarity index 100% rename from htdocs/modulebuilder/template/img/object_mytest.png rename to htdocs/modulebuilder/template/img/object_mymodule.png