Skip to content

Commit

Permalink
Work on module builder
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 3, 2017
1 parent 7f64796 commit cb1c461
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
15 changes: 9 additions & 6 deletions 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
Expand All @@ -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
Expand All @@ -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
FileNotYetGenerated=File not yet generated
43 changes: 39 additions & 4 deletions htdocs/modulebuilder/index.php
Expand Up @@ -579,6 +579,11 @@
$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';
Expand Down Expand Up @@ -692,6 +697,13 @@
print '</div>';
}


if ($tab == 'specifications')
{
print $langs->trans("FeatureNotYetAvailable");

}

if ($tab == 'objects')
{
$head3 = array();
Expand Down Expand Up @@ -849,7 +861,6 @@
{
print $langs->trans("FeatureNotYetAvailable");


}

if ($tab == 'permissions')
Expand Down Expand Up @@ -900,7 +911,7 @@
print '</div>';
}

if ($tab == 'widget')
if ($tab == 'widgets')
{
print $langs->trans("FeatureNotYetAvailable");

Expand Down Expand Up @@ -947,24 +958,48 @@
{
$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">';
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("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();
Expand Down

0 comments on commit cb1c461

Please sign in to comment.