From 5e5ce0043eb4c6b691dbd168b6a3c02f3d321256 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 12:03:33 +0100 Subject: [PATCH 1/6] 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 ''; print ''; } - print ''; + print '
'."\n"; + print ''; 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 ''."\n"; print ''; print '
'; @@ -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 ''; + print '
'."\n"; print ''; $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 ''; + print ''."\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 ''."\n"; print ''; print '
'; 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 @@ +/* Copyright (C) 2008-2016 Laurent Destailleur * * 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 ''; } +dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); + print ''; -print ''; /*print ''; */ -if ($_GET["action"] == 'edit') -{ - print ''; -} + +// 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 ''; print '
'.$langs->trans("Ref").''; +print '
'.$langs->trans("Ref").''; $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').' '.$langs->trans("ECMRoot").' -> '; print $s; print ' -> '; -if (GETPOST('action') == 'edit') print ''; +if (GETPOST('action') == 'edit') print ''; else print $urlfile; print '
'.$langs->trans("Description").''; @@ -234,20 +235,39 @@ print '
'.$langs->trans("TotalSizeOfAttachedFiles").''; print dol_print_size($totalsize); print '
'; - print ''; - print '     '; - print ''; - print '
'.$langs->trans("DirectDownloadLink").''; +$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 ''; +print ' '.$langs->trans("Download").''; +print '
'; + +dol_fiche_end(); + if ($_GET["action"] == 'edit') { - print ''; + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print ''; } -print ''; // 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 ''; -print ''; -print '
'.$langs->trans("Ref").''; +print '
'.$langs->trans("Ref").''; $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=''; + $s=''; } else $s=$tmpecmdir->getNomUrl(1).$s; if ($tmpecmdir->fk_parent) @@ -251,7 +251,7 @@ while ($tmpecmdir && $result > 0) print img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '; print $s; print '
'.$langs->trans("Description").''; +print '
'.$langs->trans("Description").''; if ($action == 'edit') { print '