mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Can setup tool to build html or pdf for module builder documentation
This commit is contained in:
parent
281bde5461
commit
da2aba96eb
|
|
@ -611,7 +611,8 @@ class Utils
|
|||
if (count($arrayversion))
|
||||
{
|
||||
$FILENAMEASCII=strtolower($module).'.asciidoc';
|
||||
$FILENAMEDOC=strtolower($module).'.html'; // TODO Use/text PDF
|
||||
$FILENAMEDOC=strtolower($module).'.html';
|
||||
$FILENAMEDOCPDF=strtolower($module).'.pdf';
|
||||
|
||||
$dirofmodule = dol_buildpath(strtolower($module), 0);
|
||||
$dirofmoduledoc = dol_buildpath(strtolower($module), 0).'/doc';
|
||||
|
|
@ -627,8 +628,7 @@ class Utils
|
|||
return -1;
|
||||
}
|
||||
|
||||
$conf->global->MODULEBUILDER_ASCIIDOCTOR='asciidoctor';
|
||||
if (empty($conf->global->MODULEBUILDER_ASCIIDOCTOR))
|
||||
if (empty($conf->global->MODULEBUILDER_ASCIIDOCTOR) && empty($conf->global->MODULEBUILDER_ASCIIDOCTORPDF))
|
||||
{
|
||||
$this->error = 'Setup of module ModuleBuilder not complete';
|
||||
return -1;
|
||||
|
|
@ -690,11 +690,13 @@ class Utils
|
|||
$currentdir = getcwd();
|
||||
chdir($dirofmodule);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
|
||||
$utils = new Utils($db);
|
||||
|
||||
// Build HTML doc
|
||||
$command=$conf->global->MODULEBUILDER_ASCIIDOCTOR.' '.$destfile.' -n -o '.$dirofmoduledoc.'/'.$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')
|
||||
{
|
||||
|
|
@ -702,6 +704,17 @@ class Utils
|
|||
}
|
||||
$result = ($resarray['result'] == 0) ? 1 : 0;
|
||||
|
||||
// Build PDF doc
|
||||
$command=$conf->global->MODULEBUILDER_ASCIIDOCTORPDF.' '.$destfile.' -n -o '.$dirofmoduledoc.'/'.$FILENAMEDOC;
|
||||
$outfile=$dirofmoduletmp.'/outpdf.tmp';
|
||||
|
||||
$resarray = $utils->executeCLI($command, $outfile);
|
||||
if ($resarray['result'] != '0')
|
||||
{
|
||||
$this->error = $resarray['error'].' '.$resarray['output'];
|
||||
}
|
||||
$result = ($resarray['result'] == 0) ? 1 : 0;
|
||||
|
||||
chdir($currentdir);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -35,9 +35,12 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
|||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($action=="update"){
|
||||
$res1=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README'), 'chaine', 0, '', $conf->entity);
|
||||
if ($res1 < 0) {
|
||||
if ($action=="update")
|
||||
{
|
||||
$res1=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README', 'none'), 'chaine', 0, '', $conf->entity);
|
||||
$res2=dolibarr_set_const($db, 'MODULEBUILDER_ASCIIDOCTOR', GETPOST('MODULEBUILDER_ASCIIDOCTOR', 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||
$res3=dolibarr_set_const($db, 'MODULEBUILDER_ASCIIDOCTORPDF', GETPOST('MODULEBUILDER_ASCIIDOCTORPDF', 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||
if ($res1 < 0 || $res2 < 0 || $res3 < 0) {
|
||||
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
|
|
@ -130,6 +133,23 @@ print '<td>';
|
|||
print '<textarea class="centpercent" rows="20" name="MODULEBUILDER_SPECIFIC_README">'.$conf->global->MODULEBUILDER_SPECIFIC_README.'</textarea>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="tdtop">' . $langs->trans("AsciiToHtmlConverter") . '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="MODULEBUILDER_ASCIIDOCTOR" value="'.$conf->global->MODULEBUILDER_ASCIIDOCTOR.'">';
|
||||
print ' '.$langs->trans("Example").': asciidoc, asciidoctor';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="tdtop">' . $langs->trans("AsciiToPdfConverter") . '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="MODULEBUILDER_ASCIIDOCTORPDF" value="'.$conf->global->MODULEBUILDER_ASCIIDOCTORPDF.'">';
|
||||
print ' '.$langs->trans("Example").': asciidoctor-pdf';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'" name="Button"></center>';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user