Fix pb in ecm
This commit is contained in:
parent
747719b3e8
commit
71d49f1c6f
@ -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='<br><div align="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>':'<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
|
||||
$next_ref = $object->ref_next?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>':'<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
|
||||
}
|
||||
$previous_ref = $object->ref_previous?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>':'<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
|
||||
$next_ref = $object->ref_next?'<a href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>':'<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
|
||||
|
||||
//print "xx".$previous_ref."x".$next_ref;
|
||||
$ret.='<!-- Start banner content --><div style="vertical-align: middle">';
|
||||
@ -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);
|
||||
|
||||
|
||||
|
||||
@ -1007,9 +1007,9 @@ class FormFile
|
||||
print '<table width="100%" id="tablelines" class="'.($useinecm?'liste noborder':'liste').'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
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('');
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1341,7 +1341,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>';
|
||||
}
|
||||
|
||||
if ($object->element != 'product' && $object->element != 'bookmark')
|
||||
if ($object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories')
|
||||
{
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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 '<input type="hidden" name="action" value="update">';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
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);
|
||||
$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 = '<a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s;
|
||||
|
||||
dol_banner_tab($object, '', $morehtml, 0, '', '', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
/*print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
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 class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '</td></tr>';*/
|
||||
print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<textarea class="flat" name="description" cols="80">';
|
||||
@ -283,20 +293,24 @@ print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
|
||||
print dol_print_size($totalsize);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<tr><td colspan="2" align="center">';
|
||||
print '<br><div 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>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '</form>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
@ -341,7 +355,7 @@ if ($action != 'edit' && $action != 'delete')
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Confirm remove file
|
||||
@ -349,7 +363,7 @@ if ($action == 'delete_dir')
|
||||
{
|
||||
$relativepathwithoutslash=preg_replace('/[\/]$/','',$relativepath);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$relativepathwithoutslash), 'confirm_deletedir', '', 1, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$formfile=new FormFile($db);
|
||||
|
||||
@ -110,7 +110,7 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', '', '');
|
||||
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', '', '', 0);
|
||||
if ($res > 0)
|
||||
{
|
||||
$result=$ecmdir->changeNbOfFiles('+');
|
||||
@ -430,7 +430,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
|
||||
|
||||
// Manual section
|
||||
$htmltooltip=$langs->trans("ECMAreaDesc2");
|
||||
|
||||
|
||||
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
|
||||
{
|
||||
print '<tr><td colspan="6">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user