From cb1c461b69440755cd5241c02807c14f1318ebb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Mon, 3 Jul 2017 12:28:52 +0200 Subject: [PATCH] Work on module builder --- htdocs/langs/en_US/modulebuilder.lang | 15 ++++++---- htdocs/modulebuilder/index.php | 43 ++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 1c3a7932263..9eb910da360 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -1,8 +1,8 @@ # Dolibarr language file - Source file is en_US - loan -ModuleBuilderDesc=This tools give you utilites to build or edit your own module (<a href="%s" target="_blank">More information here</a>). +ModuleBuilderDesc=This tools must be used by experienced users or developers. It gives you utilities to build or edit your own module (Documentation for alternative <a href="%s" target="_blank">manual development is here</a>). EnterNameOfModuleDesc=Enter name of the module/application to create with no spaces. Use uppercase to separate words (For example: MyModule, EcommerceForShop, SyncWithMySystem...) EnterNameOfObjectDesc=Enter name of the object to create with no spaces. Use uppercase to separate words (For example: MyObject, Student, Teacher...) -ModuleBuilderDesc2=Path were modules are generated/edited (first alternative directory defined into %s): <strong>%s</strong> +ModuleBuilderDesc2=Path where modules are generated/edited (first alternative directory defined into %s): <strong>%s</strong> ModuleBuilderDesc3=Generated/editable modules found: <strong>%s</strong> (they are detected as editable when the file <strong>%s</strong> exists in root of module directory). NewModule=New module NewObject=New object @@ -11,17 +11,19 @@ ObjectKey=Object key ModuleInitialized=Module initialized FilesForObjectInitialized=Files for new object initialized ModuleBuilderDescdescription=Enter here all general information that describe your module +ModuleBuilderDescspecifications=You can enter here a long text to describe the specifications of your module that is not already structured into other tabs. So you have on hand the rules to develop. Also this text content will be included into the generated documentation (see last tab). ModuleBuilderDescobjects=Define here the objects you want to manage with your module. A sql file, a page to list them, to create/edit/view a card and an API will be generated. 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 build the module package file. -EnterNameOfModuleToDeleteDesc=You can delete your module. WARNING: All files of module will be definitly lost ! +ModuleBuilderDescbuildpackage=You can generate here a "ready to distribute" package file (a normalized .zip file) of your module and a "ready to distribute" documentation file. Just click on button to build the package or documentation file. +EnterNameOfModuleToDeleteDesc=You can delete your module. WARNING: All files of module but also structured data and documentation will be definitly lost ! EnterNameOfObjectToDeleteDesc=You can delete an object. WARNING: All files related to object will be definitly lost ! DangerZone=Danger zone -BuildPackage=Build package +BuildPackage=Build package/documentation +BuildDocumentation=Build documentation 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. DescriptionLong=Long description @@ -33,5 +35,6 @@ ApiClassFile=File for PHP API class PageForList=PHP page for list of record PageForCreateEditView=PHP page to create/edit/view a record PathToModulePackage=Path to zip of module/application package +PathToModuleDocumentation=Path to file of module/application documentation SpaceOrSpecialCharAreNotAllowed=Spaces or special characters are not allowed. -PackageFileNotYetGenerated=Package file not yet generated \ No newline at end of file +FileNotYetGenerated=File not yet generated diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index caa99d4b089..8ea54b78454 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -579,6 +579,11 @@ elseif (! empty($module)) $head2[$h][2] = 'description'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module; + $head2[$h][1] = $langs->trans("Specifications"); + $head2[$h][2] = 'specifications'; + $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module; $head2[$h][1] = $langs->trans("Objects"); $head2[$h][2] = 'objects'; @@ -692,6 +697,13 @@ elseif (! empty($module)) print '</div>'; } + + if ($tab == 'specifications') + { + print $langs->trans("FeatureNotYetAvailable"); + + } + if ($tab == 'objects') { $head3 = array(); @@ -849,7 +861,6 @@ elseif (! empty($module)) { print $langs->trans("FeatureNotYetAvailable"); - } if ($tab == 'permissions') @@ -900,7 +911,7 @@ elseif (! empty($module)) print '</div>'; } - if ($tab == 'widget') + if ($tab == 'widgets') { print $langs->trans("FeatureNotYetAvailable"); @@ -947,17 +958,22 @@ elseif (! empty($module)) { $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; $outputfile = $conf->admin->dir_temp.'/'.$FILENAMEZIP; + + $FILENAMEDOC="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".md"; + $outputfiledoc = $conf->admin->dir_temp.'/'.$FILENAMEDOC; } + print '<br>'; + print '<span class="fa fa-file"></span> '. $langs->trans("PathToModulePackage") . ' : '; - if (! dol_is_file($outputfile)) print '<strong>'.$langs->trans("PackageFileNotYetGenerated").'</strong>'; + if (! dol_is_file($outputfile)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; else { print '<strong>'.$outputfile.'</strong>'; print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfile), 'dayhour').')'; } print '</strong><br>'; - print '<br><br>'; + print '<br>'; print '<form name="generatepackage">'; print '<input type="hidden" name="action" value="generatepackage">'; @@ -965,6 +981,25 @@ elseif (! empty($module)) print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; print '<input type="submit" class="button" value="'.$langs->trans("BuildPackage").'">'; print '</form>'; + + print '<br><br><br>'; + + print '<span class="fa fa-file"></span> '. $langs->trans("PathToModuleDocumentation") . ' : '; + if (! dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>'; + else { + print '<strong>'.$outputfiledoc.'</strong>'; + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; + } + print '</strong><br>'; + + print '<br>'; + + print '<form name="generatepackage">'; + print '<input type="hidden" name="action" value="generatedoc">'; + print '<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).'">'; + print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; + print '<input type="submit" class="button" value="'.$langs->trans("BuildDocumentation").'">'; + print '</form>'; } dol_fiche_end(); -- GitLab