Work on module builder

This commit is contained in:
Laurent Destailleur 2017-11-19 16:26:39 +01:00
parent 4938a0ba2a
commit 304819a726
9 changed files with 257 additions and 162 deletions

View File

@ -34,8 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
$langs->load("errors");
$langs->load("admin");
$langs->loadLangs(array("errors","admin","modulebuilder"));
$mode=GETPOST('mode', 'alpha');
if (empty($mode)) $mode='common';
@ -1009,9 +1008,21 @@ if ($mode == 'develop')
print '<td>'.$langs->trans("URL").'</td>';
print '</tr>';
print "<tr class=\"oddeven\">\n";
print '<tr class="oddeven" height="80">'."\n";
print '<td align="left">';
//span class="fa fa-bug"></span>
//print '<img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png">';
print '<div class="imgmaxheight50 logo_setup"></div>';
print '</td>';
print '<td>'.$langs->trans("TryToUseTheModuleBuilder").'</td>';
print '<td>'.$langs->trans("SeeTopRightMenu").'</td>';
print '</tr>';
print '<tr class="oddeven" height="80">'."\n";
$url='https://partners.dolibarr.org';
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
print '<td align="left">';
print'<a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a>';
print '</td>';
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
print '</tr>';

View File

@ -46,7 +46,7 @@ function dol_basename($pathfile)
* @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
* but must not contains the start and end '/'. Filter is checked into basename only.
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked into fullpath.
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked both into fullpath and into basename (So '^xxx' may exclude 'xxx/dirscanned/...' and dirscanned/xxx').
* @param string $sortcriteria Sort criteria ('','fullname','relativename','name','date','size')
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
@ -107,6 +107,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
while (false !== ($file = readdir($dir))) // $file is always a basename (into directory $newpath)
{
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in utf8 in memory
$fullpathfile=($newpath?$newpath.'/':'').$file;
$qualified=1;
@ -120,10 +121,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
// Check if file is qualified
foreach($excludefilterarray as $filt)
{
if (preg_match('/'.$filt.'/i',$file)) {
if (preg_match('/'.$filt.'/i', $file) || preg_match('/'.$filt.'/i', $fullpathfile)) {
$qualified=0; break;
}
}
//print $fullpathfile.' '.$file.' '.$qualified.'<br>';
if ($qualified)
{

View File

@ -60,6 +60,7 @@ ReadmeFile=Readme file
ChangeLog=ChangeLog file
TestClassFile=File for PHP Unit Test class
SqlFile=Sql file
PageForLib=File for PHP libraries
SqlFileExtraFields=Sql file for complementary attributes
SqlFileKey=Sql file for keys
AnObjectAlreadyExistWithThisNameAndDiffCase=An object already exists with this name and a different case
@ -69,6 +70,7 @@ DirScanned=Directory scanned
NoTrigger=No trigger
NoWidget=No widget
GoToApiExplorer=Go to API explorer
ListOfMenusEntries=List of menu entries
ListOfPermissionsDefined=List of defined permissions
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only. Using a negative value means field is not shown by default on list but can be selected for viewing)
@ -82,4 +84,8 @@ HooksDefDesc=Define in the <b>module_parts['hooks']</b> property, in the module
TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed.
SeeIDsInUse=See IDs in use in your installation
SeeReservedIDsRangeHere=See range of reserved IDs
ToolkitForDevelopers=Toolkit for Dolibarr developers
ToolkitForDevelopers=Toolkit for Dolibarr developers
TryToUseTheModuleBuilder=If you have knowledge in SQL and PHP, you can try to use the native module builder wizard. Just enable the module and use the wizard by clicking the <span class="fa fa-bug"></span> on the top right menu. Warning: This is a developer feature, bad use may breaks your application.
SeeTopRightMenu=See <span class="fa fa-bug"></span> on the top right menu
AddLanguageFile=Add language file
YouCanUseTranslationKey=You can use here a key that is the translation key found into language file (see tab "Languages")

View File

@ -172,6 +172,14 @@ if ($dirins && $action == 'initmodule' && $modulename)
}
}
if ($dirins && $action == 'addlanguage' && !empty($module))
{
$newlangcode=GETPOST('newlangcode', 'aZ09');
$srcfile = $dirins.'/'.strtolower($module).'/langs/en_US';
$destfile = $dirins.'/'.strtolower($module).'/langs/'.$newlangcode;
$result = dolCopyDir($srcfile, $destfile, 0, 0);
}
if ($dirins && $action == 'initobject' && $module && $objectname)
{
if (preg_match('/[^a-z0-9_]/i', $objectname))
@ -643,16 +651,51 @@ if ($dirins && $action == 'generatedoc')
$arrayversion=explode('.',$moduleobj->version,3);
if (count($arrayversion))
{
$FILENAMEDOC=$modulelowercase.'.html';
$FILENAMEASCII=$modulelowercase.'.asciidoc';
$FILENAMEDOC=$modulelowercase.'.html'; // TODO Use/text PDF
$dirofmodule = dol_buildpath($modulelowercase, 0).'/doc';
$dirofmoduletmp = dol_buildpath($modulelowercase, 0).'/doc/temp';
$outputfiledoc = $dirofmodule.'/'.$FILENAMEDOC;
if ($dirofmodule)
{
if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule);
//...
if (! dol_is_dir($dirofmoduletmp)) dol_mkdir($dirofmoduletmp);
$result = 0;
$srcfile=$dirofmodule.'/Specifications.asciidoc';
$destfile=$dirofmoduletmp.'/'.$FILENAMEASCII;
dol_copy($srcfile, $destfile, 0, 1);
$fhandle = fopen($dirofmoduletmp.'/'.$FILENAMEASCII, 'a+');
if ($fhandle)
{
fwrite($fhandle, "\n\n\n== DATA SPECIFICATIONS...\n\n");
// TODO
fwrite($fhandle, "TODO...");
fclose($fhandle);
}
$conf->global->MODULEBUILDER_ASCIIDOCTOR='asciidoctor';
if (empty($conf->global->MODULEBUILDER_ASCIIDOCTOR))
{
dol_print_error('', 'Module setup not complete');
exit;
}
$command=$conf->global->MODULEBUILDER_ASCIIDOCTOR.' '.$destfile.' -n -o '.$dirofmodule.'/'.$FILENAMEDOC;
$outfile=$dirofmoduletmp.'/out.tmp';
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
$utils = new Utils($db);
$resarray = $utils->executeCLI($command, $outfile);
if ($resarray['result'] != '0')
{
setEventMessages($resarray['error'].' '.$resarray['output'], null, 'errors');
}
$result = ($resarray['result'] == 0) ? 1 : 0;
}
else
{
@ -1062,15 +1105,15 @@ elseif (! empty($module))
print $langs->trans("ModuleBuilderDesc".$tab).'<br><br>';
print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("ReadmeFile").' : <strong>'.$pathtofilereadme.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ReadmeFile").' : <strong>'.$pathtofilereadme.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtofilereadme).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("ChangeLog").' : <strong>'.$pathtochangelog.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ChangeLog").' : <strong>'.$pathtochangelog.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=markdown&file='.urlencode($pathtochangelog).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
@ -1213,14 +1256,14 @@ elseif (! empty($module))
print $langs->trans("SpecDefDesc").'<br>';
print '<br>';
$specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$');
$specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/'));
foreach ($specs as $spec)
{
$pathtofile = $modulelowercase.'/doc/'.$spec['relativename'];
$format='asciidoc';
if (preg_match('/\.md$/i', $spec['name'])) $format='markdown';
print '<span class="fa fa-file"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SpecificationFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
}
@ -1270,7 +1313,7 @@ elseif (! empty($module))
print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">';
print '<input type="hidden" name="tab" value="'.$tab.'">';
print '<input type="hidden" name="module" value="'.$module.'">';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 1);
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'newlangcode', 0, 0, 1, 0, 0, 'minwidth300', 1);
print '<input type="submit" name="addlanguage" class="button" value="'.dol_escape_htmltag($langs->trans("AddLanguageFile")).'"><br>';
print '</form>';
@ -1282,7 +1325,7 @@ elseif (! empty($module))
foreach ($langfiles as $langfile)
{
$pathtofile = $modulelowercase.'/langs/'.$langfile['relativename'];
print '<span class="fa fa-file"></span> '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
}
@ -1443,37 +1486,37 @@ elseif (! empty($module))
$realpathtopicto = dol_buildpath($pathtopicto, 0, 1);
print '<div class="fichehalfleft">';
print '<span class="fa fa-file"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi?'':'<strike>').$pathtoapi.($realpathtoapi?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi?'':'<strike>').$pathtoapi.($realpathtoapi?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit?'':'<strike>').$pathtophpunit.($realpathtophpunit?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit?'':'<strike>').$pathtophpunit.($realpathtophpunit?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib?'':'<strike>').$pathtolib.($realpathtodocument?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib?'':'<strike>').$pathtolib.($realpathtodocument?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForPicto").' : <strong>'.($realpathtopicto?'':'<strike>').$pathtopicto.($realpathtopicto?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("Image").' : <strong>'.($realpathtopicto?'':'<strike>').$pathtopicto.($realpathtopicto?'':'</strike>').'</strong>';
//print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql?'':'<strike>').$pathtosql.($realpathtosql?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql?'':'<strike>').$pathtosql.($realpathtosql?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("DropTableIfEmpty").'</a>';
print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=droptable">'.$langs->trans("DropTableIfEmpty").'</a>';
//print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra?'':'<strike>').$pathtosqlextra.($realpathtosqlextra?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra?'':'<strike>').$pathtosqlextra.($realpathtosqlextra?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
//print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey?'':'<strike>').$pathtosqlkey.($realpathtosqlkey?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey?'':'<strike>').$pathtosqlkey.($realpathtosqlkey?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
//print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>';
@ -1485,19 +1528,19 @@ elseif (! empty($module))
$urlofcard = dol_buildpath($pathtocard, 1);
print '<div class="fichehalfleft">';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtosql?'':'<strike>').$pathtolist.($realpathtosql?'':'</strike>').'</a></strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtosql?'':'<strike>').$pathtolist.($realpathtosql?'':'</strike>').'</a></strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard?'':'<strike>').$pathtocard.($realpathtocard?'':'</strike>').'?action=create</a></strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard?'':'<strike>').$pathtocard.($realpathtocard?'':'</strike>').'?action=create</a></strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda?'':'<strike>').$pathtoagenda.($realpathtoagenda?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda?'':'<strike>').$pathtoagenda.($realpathtoagenda?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument?'':'<strike>').$pathtodocument.($realpathtodocument?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument?'':'<strike>').$pathtodocument.($realpathtodocument?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote?'':'<strike>').$pathtonote.($realpathtonote?'':'</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote?'':'<strike>').$pathtonote.($realpathtonote?'':'</strike>').'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
@ -1742,13 +1785,14 @@ elseif (! empty($module))
print $langs->trans("MenusDefDesc", '<a href="'.DOL_URL_ROOT.'/admin/menus/index.php">'.$langs->trans('Menus').'</a>').'<br>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<br>';
//print load_fiche_titre($langs->trans("MenusList"), '', '');
print load_fiche_titre($langs->trans("ListOfMenusEntries"), '', '');
print 'TODO...';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addproperty">';
@ -1866,7 +1910,7 @@ elseif (! empty($module))
print $langs->trans("PermissionsDefDesc", '<a href="'.DOL_URL_ROOT.'/admin/perms.php">'.$langs->trans('DefaultPermissions').'</a>').'<br>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
@ -1988,12 +2032,12 @@ elseif (! empty($module))
print '<br>';
$pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php';
print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
$pathtohook = strtolower($module).'/class/actions_'.strtolower($module).'.class.php';
print '<span class="fa fa-file"></span> '.$langs->trans("HooksFile").' : <strong>'.$pathtohook.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("HooksFile").' : <strong>'.$pathtohook.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
}
@ -2042,7 +2086,7 @@ elseif (! empty($module))
{
$pathtofile = $trigger['relpath'];
print '<span class="fa fa-file"></span> '.$langs->trans("TriggersFile").' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("TriggersFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
}
@ -2093,7 +2137,7 @@ elseif (! empty($module))
{
$pathtofile = $widget['relpath'];
print '<span class="fa fa-file"></span> '.$langs->trans("WidgetFile").' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("WidgetFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
}
@ -2138,10 +2182,10 @@ elseif (! empty($module))
if ($action != 'editfile' || empty($file))
{
print $langs->trans("CronJobDefDesc", '<a href="'.DOL_URL_ROOT.'/cron/list.php?status=-2">'.$langs->trans('CronList').'</a>').'<br>';
print $langs->trans("CronJobDefDesc", '<a href="'.DOL_URL_ROOT.'/cron/list.php?status=-2">'.$langs->transnoentities('CronList').'</a>').'<br>';
print '<br>';
print '<span class="fa fa-file"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
@ -2296,11 +2340,13 @@ elseif (! empty($module))
$FILENAMEDOC=$modulelowercase.'.html';
$outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
$outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
// TODO Use/test PDF
}
print '<br>';
print '<span class="fa fa-file"></span> '. $langs->trans("PathToModulePackage") . ' : ';
print '<span class="fa fa-file-o"></span> '. $langs->trans("PathToModulePackage") . ' : ';
if (! dol_is_file($outputfilezip)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>';
else {
$relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP;
@ -2320,10 +2366,14 @@ elseif (! empty($module))
print '<br><br><br>';
print '<span class="fa fa-file"></span> '. $langs->trans("PathToModuleDocumentation") . ' : ';
print '<span class="fa fa-file-o"></span> '. $langs->trans("PathToModuleDocumentation") . ' : ';
if (! dol_is_file($outputfiledoc)) print '<strong>'.$langs->trans("FileNotYetGenerated").'</strong>';
else {
print '<strong>'.$outputfiledoc.'</strong>';
print '<strong>';
print '<a href="'.$outputfiledocurl.'" target="_blank">';
print $outputfiledoc;
print '</a>';
print '</strong>';
print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')';
}
print '</strong><br>';

View File

@ -1,38 +1,11 @@
= MYMODULE =
Copyright (C) ---Put here your own copyright and developer email---
:subtitle: MYMODULE SPECIFICATIONS
== Topic of document
This document was build from following input:
* Date 1
...
* Date 2
...
The document includes an introductory chapter of functional specifications, presenting the different actors involved in the rebuild of the definitions
of business terms that will be used (some of which may be new or different).
The main following chapter will present the entire process, also known as *uses cases*, according to a principle of a description, in chronological sequence if possible,
to present the actor and the action performed, as in the following example:
* *X* Actor realizes Action A.
* *Y* Actor communicates Info B to Actor *Z*
* *Automaton* performs update of data for...
* Etc ...
Functional requirements are complemented by a chapter of technical requirements.
The chapter on data lists key information specific to Presto that were identified at the time of writing specification. It will be enriched as
iterations occurs.
Finally, in the Appendix, the documents known when writing this document are centralized to illustrate the existing document or inspire the new expected one.
These documents have their content directly integrated in this specification or have a reference to
external documents stored in the *Appendices* directory accompanying this document.
== TOPIC OF DOCUMENT
This document describe specifications of module MyModule
*Log of versions*
@ -40,88 +13,14 @@ external documents stored in the *Appendices* directory accompanying this docume
[options="header",format="csv"]
|===
Author, Date, Version
John Doe, Date YYY-MM-DD, Version 1.0
---Put here your own copyright and developer email---, Date YYY-MM-DD, Version 1.0
|===
<<<
== BUSINESS SPECIFICATIONS - INTRODUCTION
=== List of actors [[actors]]
Actors are physical people or moral entities working on at least one process.
The following chart prensts list of actors or partners identified by the project for the defined scope of project. We will use then the name defined into first column to speak about roles in the rest of documents.
[options="header",format="csv"]
|===
Actor/profil/role, Description of role, Access to system or not, Example of actor
Customer Service, Receive and create Sales orders (SO), Yes, Mr Smith
Purchase, Make puchase order (PO), Yes, 5 people
Administrator - IT, Administration of users/groups and IT services, Yes, John Doe
Automaton, Execute automatic data processing, Yes, NA
|===
=== Definitions [[definitions]]
To understand the descriptions of the target process, it was necessary to define or redefine some vocabulary concepts. We must see these definitions as defined in the
new system. Indeed, some terms are already being used but have either not a definition in line with standards, or even differs between services. To bring everyone,
and to consolidate the process, these terms are redefined here, and with their definition in the target objective.
*Definition ABC*
...
*Definition DEF*
...
[NOTE]
==============
Important information will be noticed with a notice like this one.
* Main information 1
* Main information 2
This document was generated using Dolibarr ERP CRM process
==============
== BUSINESS SPECIFICATION - PROCESS
Specifications were cut into different business process. We call a business process a workflow with a starting situation and ending situation. Between start and end, we will find actions
done by actors to bring the value of the company. This actions are described using the syntax rule:
*Actor X* do action Y, *Actor Z* do action W.
_Each process/use case is described into a separate chapter._
=== Use case / Process 1 [[process_1]]
==== Title and goals
...
==== Actors or roles
* Members of group *...*
==== Standard flow
* Members of Groupe *...*: Do ...
* Members of Groupe *...*: Do ...
* Members of Groupe *...*: Do ...
==== Alternative flow
* A user without role *...*: Can't do ...
==== Business rules
* Business rule 1
* Business rule 2
<<<

View File

@ -0,0 +1,126 @@
= MYMODULE =
:subtitle: MYMODULE SPECIFICATIONS
== TOPIC OF DOCUMENT
This document was build from following input:
* Date 1
...
* Date 2
...
The document includes an introductory chapter of functional specifications, presenting the different actors involved in the rebuild of the definitions
of business terms that will be used (some of which may be new or different).
The main following chapter will present the entire process, also known as *uses cases*, according to a principle of a description, in chronological sequence if possible,
to present the actor and the action performed, as in the following example:
* *X* Actor realizes Action A.
* *Y* Actor communicates Info B to Actor *Z*
* *Automaton* performs update of data for...
* Etc ...
Functional requirements are complemented by a chapter of technical requirements.
The chapter on data lists key information specific to Presto that were identified at the time of writing specification. It will be enriched as
iterations occurs.
Finally, in the Appendix, the documents known when writing this document are centralized to illustrate the existing document or inspire the new expected one.
These documents have their content directly integrated in this specification or have a reference to
external documents stored in the *Appendices* directory accompanying this document.
*Log of versions*
[options="header",format="csv"]
|===
Author, Date, Version
John Doe, Date YYY-MM-DD, Version 1.0
|===
<<<
== BUSINESS SPECIFICATIONS - INTRODUCTION
=== List of actors [[actors]]
Actors are physical people or moral entities working on at least one process.
The following chart prensts list of actors or partners identified by the project for the defined scope of project. We will use then the name defined into first column to speak about roles in the rest of documents.
[options="header",format="csv"]
|===
Actor/profil/role, Description of role, Access to system or not, Example of actor
Customer Service, Receive and create Sales orders (SO), Yes, Mr Smith
Purchase, Make puchase order (PO), Yes, 5 people
Administrator - IT, Administration of users/groups and IT services, Yes, John Doe
Automaton, Execute automatic data processing, Yes, NA
|===
=== Definitions [[definitions]]
To understand the descriptions of the target process, it was necessary to define or redefine some vocabulary concepts. We must see these definitions as defined in the
new system. Indeed, some terms are already being used but have either not a definition in line with standards, or even differs between services. To bring everyone,
and to consolidate the process, these terms are redefined here, and with their definition in the target objective.
*Definition ABC*
...
*Definition DEF*
...
[NOTE]
==============
Important information will be noticed with a notice like this one.
* Main information 1
* Main information 2
==============
== BUSINESS SPECIFICATION - PROCESS
Specifications were cut into different business process. We call a business process a workflow with a starting situation and ending situation. Between start and end, we will find actions
done by actors to bring the value of the company. This actions are described using the syntax rule:
*Actor X* do action Y, *Actor Z* do action W.
_Each process/use case is described into a separate chapter._
=== Use case / Process 1 [[process_1]]
==== Title and goals
...
==== Actors or roles
* Members of group *...*
==== Standard flow
* Members of Groupe *...*: Do ...
* Members of Groupe *...*: Do ...
* Members of Groupe *...*: Do ...
==== Alternative flow
* A user without role *...*: Can't do ...
==== Business rules
* Business rule 1
* Business rule 2

View File

@ -18,16 +18,16 @@
#
# Module label 'ModuleMyModuleName'
ModuleMyModuleName = My module
ModuleMyModuleName = MyModule
# Module description 'ModuleMyModuleDesc'
ModuleMyModuleDesc = My module description
ModuleMyModuleDesc = MyModule description
#
# Admin page
#
MyModuleSetup = My module setup
MyModuleSetup = MyModule setup
Settings = Settings
MyModuleSetupPage = My module setup page
MyModuleSetupPage = MyModule setup page
MYMODULE_MYPARAM1 = My param 1
MYMODULE_MYPARAM1Tooltip = My param 1 tooltip
MYMODULE_MYPARAM2=My param 2
@ -38,8 +38,8 @@ MYMODULE_MYPARAM2Tooltip=My param 2 tooltip
# About page
#
About = About
MyModuleAbout = About my module
MyModuleAboutPage = My module about page
MyModuleAbout = About MyModule
MyModuleAboutPage = MyModule about page
#
# Sample page
@ -47,7 +47,7 @@ MyModuleAboutPage = My module about page
MyPageName = My page name
#
# Sample box
# Sample widget
#
MyWidget = My widget
MyWidgetDescription = My widget description
MyWidgetDescription = My widget description

View File

@ -20,21 +20,21 @@
# Module label 'ModuleMyModuleName'
ModuleMyModuleName = Mon module
# Module description 'ModuleMyModuleDesc'
ModuleMyModuleDesc = Description de mon module
ModuleMyModuleDesc = Description de MyModule
#
# Page d'administration
#
MyModuleSetup = Configuration du module mon module
MyModuleSetup = Configuration du module MyModule
Settings = Réglages
MyModuleSetupPage = Page de réglage de mon module
MyModuleSetupPage = Page de configuration du module MyModule
#
# Page À propos
#
About = À propos
MyModuleAbout = À propos de mon module
MyModuleAboutPage = Page à propos de mon module
MyModuleAbout = À propos de MyModule
MyModuleAboutPage = Page à propos de MyModule
#
# Page d'exemple

View File

@ -854,6 +854,7 @@ select.selectarrowonleft option {
.titlefield { width: 25%; }
.titlefieldmiddle { width: 50%; }
.imgmaxwidth180 { max-width: 180px; }
.imgmaxheight50 { max-height: 50px; }
.width20p { width:20%; }
.width25p { width:25%; }