From 5e5ce0043eb4c6b691dbd168b6a3c02f3d321256 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Mon, 28 Nov 2016 12:03:33 +0100 Subject: [PATCH] Debug module ECM. --- htdocs/core/class/html.formfile.class.php | 9 ++-- htdocs/ecm/docfile.php | 50 ++++++++++++++++------- htdocs/ecm/docmine.php | 6 +-- htdocs/langs/en_US/main.lang | 2 + 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index dadc470e273..b55d2ee9c21 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -935,7 +935,8 @@ class FormFile print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="modulepart" value="'.$modulepart.'">'; } - print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').'">'; + print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').'">'."\n"; + print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); @@ -971,6 +972,7 @@ class FormFile $editline=0; + print '<!-- Line list_of_documents '.$key.' -->'."\n"; print '<tr '.$bc[$var].'>'; print '<td class="tdoverflow">'; @@ -1131,7 +1133,7 @@ class FormFile // Show list of documents if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; - print '<table width="100%" class="nobordernopadding">'; + print '<table width="100%" class="nobordernopadding">'."\n"; print '<tr class="liste_titre">'; $sortref="fullname"; if ($modulepart == 'invoice_supplier') $sortref='level1name'; @@ -1140,7 +1142,7 @@ class FormFile print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre('','',''); - print '</tr>'; + print '</tr>'."\n"; // To show ref or specific information according to view to show (defined by $module) if ($modulepart == 'company') @@ -1276,6 +1278,7 @@ class FormFile if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files $var=!$var; + print '<!-- Line list_of_autoecmfiles '.$key.' -->'."\n"; print '<tr '.$bc[$var].'>'; print '<td>'; if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document'); diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index ce4bf480668..89caaf91824 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2008-2016 Laurent Destailleur <eldy@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -159,14 +159,13 @@ llxHeader(); $form=new Form($db); -$fullpath=$conf->ecm->dir_output.'/'.$ecmdir->label.'/'.$urlfile; +$fullpath=$conf->ecm->dir_output.'/'.$relativepath.$urlfile; $file = new stdClass(); $file->section_id=$ecmdir->id; $file->label=$urlfile; $head = ecm_file_prepare_head($file); -dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); if ($_GET["action"] == 'edit') { @@ -177,8 +176,10 @@ if ($_GET["action"] == 'edit') print '<input type="hidden" name="action" value="update">'; } +dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); + print '<table class="border" width="100%">'; -print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'; +print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -203,7 +204,7 @@ while ($tmpecmdir && $result > 0) print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '; print $s; print ' -> '; -if (GETPOST('action') == 'edit') print '<input type="text" name="label" size="64" value="'.$urlfile.'">'; +if (GETPOST('action') == 'edit') print '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfile.'">'; else print $urlfile; print '</td></tr>'; /*print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; @@ -234,20 +235,39 @@ print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>'; print dol_print_size($totalsize); print '</td></tr>'; */ -if ($_GET["action"] == 'edit') -{ - print '<tr><td colspan="2" align="center">'; - print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">'; - print ' '; - print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; - print '</td></tr>'; -} + +// Define $urlwithroot +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + +print '<tr><td>'.$langs->trans("DirectDownloadLink").'</td><td>'; +$modulepart='ecm'; +$forcedownload=1; +$rellink='/document.php?modulepart='.$modulepart; +if ($forcedownload) $rellink.='&attachment=1'; +if (! empty($object->entity)) $rellink.='&entity='.$object->entity; +$filepath=$relativepath.$file->label; +$rellink.='&file='.urlencode($filepath); +$fulllink=$urlwithroot.$rellink; +print img_picto('','object_globe.png').' '; +print '<input type="text" class="quatrevingtpercent" name="downloadlink" value="'.dol_escape_htmltag($fulllink).'">'; +print ' <a data-ajax="false" href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; +print '</td></tr>'; print '</table>'; + +dol_fiche_end(); + if ($_GET["action"] == 'edit') { - print '</form>'; + print '<div class="center">'; + print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">'; + print ' '; + print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; + print '</div>'; + + print '</form>'; } -print '</div>'; // Confirmation de la suppression d'une ligne categorie diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index 17e1a1a4308..0099e831776 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -222,7 +222,7 @@ if ($action == 'edit') } print '<table class="border" width="100%">'; -print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'; +print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -233,7 +233,7 @@ while ($tmpecmdir && $result > 0) $tmpecmdir->ref=$tmpecmdir->label; if ($i == 0 && $action == 'edit') { - $s='<input type="text" name="label" size="40" maxlength="32" value="'.$tmpecmdir->label.'">'; + $s='<input type="text" name="label" class="minwidth300" maxlength="32" value="'.$tmpecmdir->label.'">'; } else $s=$tmpecmdir->getNomUrl(1).$s; if ($tmpecmdir->fk_parent) @@ -251,7 +251,7 @@ while ($tmpecmdir && $result > 0) print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '; print $s; print '</td></tr>'; -print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; +print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; if ($action == 'edit') { print '<textarea class="flat" name="description" cols="80">'; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c83afdb2333..a668f9377d3 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -750,6 +750,8 @@ GroupBy=Group by... ViewFlatList=View flat list RemoveString=Remove string '%s' SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix language files registering to <a href="https://transifex.com/projects/p/dolibarr/" target="_blank">http://transifex.com/projects/p/dolibarr/</a>. +DirectDownloadLink=Direct download link +Download=Download # Week day Monday=Monday Tuesday=Tuesday -- GitLab