Modulebuilder

This commit is contained in:
Laurent Destailleur 2017-06-14 11:44:12 +02:00
parent ce9e1dfb98
commit 0b6d7a5b57
6 changed files with 73 additions and 19 deletions

View File

@ -865,6 +865,7 @@ if ($mode == 'deploy')
print '<br>';
}
print '<br>';
if ($allowfromweb >= 0)
{
@ -885,12 +886,20 @@ if ($mode == 'deploy')
if ($allowfromweb == 1)
{
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">';
print '<input type="hidden" name="mode" value="deploy">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>';
print '<br>';
print '<br>';
print '<div class="center"><div class="logo_setup"></div></div>';
}
else
{

View File

@ -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.
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

View File

@ -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.'<br><br>';
dol_fiche_head($head2, $tab, '', -1, '');
@ -421,7 +449,7 @@ elseif (! empty($module))
print '<tr><td>';
print $langs->trans("Family");
print "<br>'crm','financial','hr','projects','products','ecm','technic','interface','other'";
//print "<br>'crm','financial','hr','projects','products','ecm','technic','interface','other'";
print '</td><td>';
print $moduleobj->family;
print '</td></tr>';
@ -445,7 +473,7 @@ elseif (! empty($module))
print '</td></tr>';
print '<tr><td>';
print $langs->trans("LongDescription");
print $langs->trans("DescriptionLong");
print '</td><td>';
print $moduleobj->getDescLong();
print '</td></tr>';
@ -453,14 +481,6 @@ elseif (! empty($module))
print '</table>';
print '</div>';
print '<br><br>';
print '<form name="delete">';
print '<input type="hidden" name="action" value="confirm_delete">';
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="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins?'':' disabled="disabled"').'>';
print '</form>';
}
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 '</div>';
}
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 '</form>';
}
if ($tab == 'dangerzone')
{
print '<form name="delete">';
print '<input type="hidden" name="action" value="confirm_delete">';
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="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins?'':' disabled="disabled"').'>';
print '</form>';
}
dol_fiche_end();
}
}

View File

@ -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 '<br>';
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

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 360 B