diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index 709d07c0832..cee16f923f5 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -202,7 +202,7 @@ if ($type == 'directory')
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
// If $section defined with value 0
- if ($section === '0')
+ if ($section === '0' || empty($section))
{
$filearray=array();
}
@@ -216,7 +216,7 @@ if ($type == 'directory')
else if ($section === '0') $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'
';
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
- $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url);
+ $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url);
}
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 27115d12eb7..c7dd20547f4 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5890,18 +5890,22 @@ class Form
$object->next_prev_filter.=$hookmanager->resPrint;
}
- //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
- $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
-
- $navurl = $_SERVER["PHP_SELF"];
- // Special case for project/task page
- if ($paramid == 'project_ref')
+ $previous_ref = $next_ref = '';
+ if ($shownav)
{
- $navurl = preg_replace('/\/tasks\/(task|contact|time|note|document).php/','/tasks.php',$navurl);
- $paramid='ref';
+ //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
+ $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
+
+ $navurl = $_SERVER["PHP_SELF"];
+ // Special case for project/task page
+ if ($paramid == 'project_ref')
+ {
+ $navurl = preg_replace('/\/tasks\/(task|contact|time|note|document)\.php/','/tasks.php',$navurl);
+ $paramid='ref';
+ }
+ $previous_ref = $object->ref_previous?'':'';
+ $next_ref = $object->ref_next?'':'';
}
- $previous_ref = $object->ref_previous?'':'';
- $next_ref = $object->ref_next?'':'';
//print "xx".$previous_ref."x".$next_ref;
$ret.='
';
@@ -5955,6 +5959,10 @@ class Form
{
$ret.=$object->label;
}
+ else if ($object->element == 'ecm_directories')
+ {
+ $ret.='';
+ }
else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref);
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 040ae1ba96e..c02d2b5c2be 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1007,9 +1007,9 @@ class FormFile
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);
- print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder);
+ print_liste_field_titre('Documents2',$url,"name","",$param,'align="left"',$sortfield,$sortorder);
+ print_liste_field_titre('Size',$url,"size","",$param,'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre('Date',$url,"date","",$param,'align="center"',$sortfield,$sortorder);
if (empty($useinecm)) print_liste_field_titre('',$url,"","",$param,'align="center"');
print_liste_field_titre('');
if (! $disablemove) print_liste_field_titre('');
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 0b8282ad5b6..394b3e76778 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -1349,14 +1349,15 @@ function dol_init_file_process($pathtoscan='', $trackid='')
*
* @param string $upload_dir Directory where to store uploaded file (note: used to forge $destpath = $upload_dir + filename)
* @param int $allowoverwrite 1=Allow overwrite existing file
- * @param int $donotupdatesession 1=Do no edit _SESSION variable
+ * @param int $donotupdatesession 1=Do no edit _SESSION variable but update database index. 0=Update _SESSION and not database index.
* @param string $varfiles _FILES var name
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param string $link Link to add (to add a link instead of a file)
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
+ * @param int $generatethumbs 1=Generate also thumbs for uploaded image files
* @return int <=0 if KO, >0 if OK
*/
-function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='')
+function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='', $generatethumbs=1)
{
global $db,$user,$conf,$langs;
@@ -1407,16 +1408,19 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
// Generate thumbs.
- if (image_format_supported($destfull) == 1)
+ if ($generatethumbs)
{
- // Create thumbs
- // We can't use $object->addThumbs here because there is no $object known
+ if (image_format_supported($destfull) == 1)
+ {
+ // Create thumbs
+ // We can't use $object->addThumbs here because there is no $object known
- // Used on logon for example
- $imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
- // Create mini thumbs for image (Ratio is near 16/9)
- // Used on menu or for setup page for example
- $imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
+ // Used on logon for example
+ $imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
+ }
}
// Update session
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 61093ebcc52..0b629c1f215 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1341,7 +1341,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (! empty($object->label)) $morehtmlref.='
';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php
index b263b16e29e..bfe0e45e02c 100644
--- a/htdocs/core/modules/modECM.class.php
+++ b/htdocs/core/modules/modECM.class.php
@@ -63,7 +63,7 @@ class modECM extends DolibarrModules
$this->picto='dir';
// Data directories to create when module is enabled
- $this->dirs = array("/ecm/temp");
+ $this->dirs = array("/ecm/My_First_Directory","/ecm/temp");
// Config pages. Put here list of php page names stored in admmin directory used to setup module
$this->config_page_url = array('ecm.php');
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index 31439fa5ba3..5f713bdab91 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -27,8 +27,9 @@
*/
class EcmDirectory // extends CommonObject
{
- //public $element='ecm_directories'; //!< Id that identify managed objects
+ public $element='ecm_directories'; //!< Id that identify managed objects
//public $table_element='ecm_directories'; //!< Name of table without prefix where object is stored
+ var $picto = 'dir';
var $id;
@@ -514,6 +515,31 @@ class EcmDirectory // extends CommonObject
}
+ /**
+ * Retourne le libelle du status d'un user (actif, inactif)
+ *
+ * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @return string Label of status
+ */
+ function getLibStatut($mode=0)
+ {
+ return $this->LibStatut($this->status,$mode);
+ }
+
+ /**
+ * Return the status
+ *
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto
+ * @return string Label of status
+ */
+ static function LibStatut($status,$mode=0)
+ {
+ global $langs;
+ return '';
+ }
+
+
/**
* Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée
* Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec:
diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php
index 31f9b6b11c2..577ac3e0262 100644
--- a/htdocs/ecm/docfile.php
+++ b/htdocs/ecm/docfile.php
@@ -78,7 +78,7 @@ if (! $urlfile)
// Load ecm object
$ecmdir = new EcmDirectory($db);
-$result=$ecmdir->fetch(GETPOST("section"));
+$result=$ecmdir->fetch(GETPOST("section",'alpha'));
if (! $result > 0)
{
dol_print_error($db,$ecmdir->error);
@@ -109,10 +109,10 @@ if (! empty($_GET["fileid"]))
* Put here all code to do according to value of "action" parameter
********************************************************************/
-if ($action == 'cancel')
+if ($action == 'cancel')
{
$action ='';
- if ($backtourl)
+ if ($backtourl)
{
header("Location: ".$backtourl);
exit;
@@ -144,7 +144,7 @@ if ($action == 'update')
//print $oldfile.' - '.$newfile;
if ($newlabel != $oldlabel)
{
- $result=dol_move($oldfile,$newfile);
+ $result=dol_move($oldfile, $newfile);
if (! $result)
{
$langs->load('errors');
diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php
index 48f39cb12f2..f418627d1be 100644
--- a/htdocs/ecm/docmine.php
+++ b/htdocs/ecm/docmine.php
@@ -191,15 +191,15 @@ if ($action == 'update' && ! GETPOST('cancel'))
/*******************************************************************
-* PAGE
-*
-* Put here all code to do according to value of "action" parameter
+* View
********************************************************************/
-llxHeader();
-
$form=new Form($db);
+$object=new EcmDirectory($db); // Need to create a new one
+$object->fetch($ecmdir->id);
+
+llxHeader();
// Built the file List
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
@@ -211,7 +211,8 @@ foreach($filearray as $key => $file)
$head = ecm_prepare_head($ecmdir);
-dol_fiche_head($head, 'card', $langs->trans("ECMSectionManual"), '', 'dir');
+dol_fiche_head($head, 'card', $langs->trans("ECMSectionManual"), -1, 'dir');
+
if ($action == 'edit')
{
@@ -221,13 +222,11 @@ if ($action == 'edit')
print '';
}
-print '
';
-print '
'.$langs->trans("Ref").'
';
$s='';
-$tmpecmdir=new EcmDirectory($db); // Need to create a new one
-$tmpecmdir->fetch($ecmdir->id);
$result = 1;
$i=0;
+$tmpecmdir=new EcmDirectory($db); // Need to create a new one
+$tmpecmdir->fetch($ecmdir->id);
while ($tmpecmdir && $result > 0)
{
$tmpecmdir->ref=$tmpecmdir->label;
@@ -248,10 +247,21 @@ while ($tmpecmdir && $result > 0)
$i++;
}
+$morehtml='';
+
+$morehtmlref = ''.$langs->trans("ECMRoot").' -> '.$s;
+
+dol_banner_tab($object, '', $morehtml, 0, '', '', $morehtmlref);
+
+print '