doxygen
This commit is contained in:
parent
19339bb0ea
commit
b9bac939e6
@ -62,8 +62,19 @@ class EcmDirectory extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $description;
|
public $description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int cache nb of doc
|
||||||
|
*/
|
||||||
public $cachenbofdoc = -1; // By default cache initialized with value 'not calculated'
|
public $cachenbofdoc = -1; // By default cache initialized with value 'not calculated'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int date_c
|
||||||
|
*/
|
||||||
public $date_c;
|
public $date_c;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int date_m
|
||||||
|
*/
|
||||||
public $date_m;
|
public $date_m;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,25 +92,31 @@ class EcmDirectory extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $ref;
|
public $ref;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array array of categories
|
||||||
|
*/
|
||||||
public $cats = array();
|
public $cats = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array array of children categories
|
||||||
|
*/
|
||||||
public $motherof = array();
|
public $motherof = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array array of forbidden chars
|
||||||
|
*/
|
||||||
public $forbiddenchars = array('<', '>', ':', '/', '\\', '?', '*', '|', '"');
|
public $forbiddenchars = array('<', '>', ':', '/', '\\', '?', '*', '|', '"');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array array of forbidden chars for dir
|
||||||
|
*/
|
||||||
public $forbiddencharsdir = array('<', '>', ':', '?', '*', '|', '"');
|
public $forbiddencharsdir = array('<', '>', ':', '?', '*', '|', '"');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int 1 if full arbo loaded
|
||||||
|
*/
|
||||||
public $full_arbo_loaded;
|
public $full_arbo_loaded;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string Error code (or message)
|
|
||||||
*/
|
|
||||||
public $error;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string[] Error codes (or messages)
|
|
||||||
*/
|
|
||||||
public $errors = array();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -131,13 +148,14 @@ class EcmDirectory extends CommonObject
|
|||||||
$this->description = trim($this->description);
|
$this->description = trim($this->description);
|
||||||
$this->date_c = $now;
|
$this->date_c = $now;
|
||||||
$this->fk_user_c = $user->id;
|
$this->fk_user_c = $user->id;
|
||||||
if ($this->fk_parent <= 0) $this->fk_parent = 0;
|
if ($this->fk_parent <= 0) {
|
||||||
|
$this->fk_parent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if same directory does not exists with this name
|
// Check if same directory does not exists with this name
|
||||||
$relativepath = $this->label;
|
$relativepath = $this->label;
|
||||||
if ($this->fk_parent)
|
if ($this->fk_parent) {
|
||||||
{
|
|
||||||
$parent = new EcmDirectory($this->db);
|
$parent = new EcmDirectory($this->db);
|
||||||
$parent->fetch($this->fk_parent);
|
$parent->fetch($this->fk_parent);
|
||||||
$relativepath = $parent->getRelativePath().$relativepath;
|
$relativepath = $parent->getRelativePath().$relativepath;
|
||||||
@ -148,19 +166,16 @@ class EcmDirectory extends CommonObject
|
|||||||
$cat = new EcmDirectory($this->db);
|
$cat = new EcmDirectory($this->db);
|
||||||
$cate_arbo = $cat->get_full_arbo(1);
|
$cate_arbo = $cat->get_full_arbo(1);
|
||||||
$pathfound = 0;
|
$pathfound = 0;
|
||||||
foreach ($cate_arbo as $key => $categ)
|
foreach ($cate_arbo as $key => $categ) {
|
||||||
{
|
|
||||||
$path = str_replace($this->forbiddencharsdir, '_', $categ['fullrelativename']);
|
$path = str_replace($this->forbiddencharsdir, '_', $categ['fullrelativename']);
|
||||||
//print $relativepath.' - '.$path.'<br>';
|
//print $relativepath.' - '.$path.'<br>';
|
||||||
if ($path == $relativepath)
|
if ($path == $relativepath) {
|
||||||
{
|
|
||||||
$pathfound = 1;
|
$pathfound = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pathfound)
|
if ($pathfound) {
|
||||||
{
|
|
||||||
$this->error = "ErrorDirAlreadyExists";
|
$this->error = "ErrorDirAlreadyExists";
|
||||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING);
|
dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING);
|
||||||
return -1;
|
return -1;
|
||||||
@ -188,21 +203,23 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ecm_directories");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ecm_directories");
|
||||||
|
|
||||||
$dir = $conf->ecm->dir_output.'/'.$this->getRelativePath();
|
$dir = $conf->ecm->dir_output.'/'.$this->getRelativePath();
|
||||||
$result = dol_mkdir($dir);
|
$result = dol_mkdir($dir);
|
||||||
if ($result < 0) { $error++; $this->error = "ErrorFailedToCreateDir"; }
|
if ($result < 0) {
|
||||||
|
$error++; $this->error = "ErrorFailedToCreateDir";
|
||||||
|
}
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('MYECMDIR_CREATE', $user);
|
$result = $this->call_trigger('MYECMDIR_CREATE', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
} else {
|
} else {
|
||||||
@ -249,22 +266,21 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = "Error ".$this->db->lasterror();
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !$notrigger)
|
if (!$error && !$notrigger) {
|
||||||
{
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('MYECMDIR_MODIFY', $user);
|
$result = $this->call_trigger('MYECMDIR_MODIFY', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
@ -284,20 +300,26 @@ class EcmDirectory extends CommonObject
|
|||||||
{
|
{
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
|
||||||
if (preg_match('/[0-9]+/', $value)) $sql .= " cachenbofdoc = ".(int) $value;
|
if (preg_match('/[0-9]+/', $value)) {
|
||||||
else $sql .= " cachenbofdoc = cachenbofdoc ".$value." 1";
|
$sql .= " cachenbofdoc = ".(int) $value;
|
||||||
|
} else {
|
||||||
|
$sql .= " cachenbofdoc = cachenbofdoc ".$value." 1";
|
||||||
|
}
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::changeNbOfFiles", LOG_DEBUG);
|
dol_syslog(get_class($this)."::changeNbOfFiles", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql) {
|
||||||
{
|
|
||||||
$this->error = "Error ".$this->db->lasterror();
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
if (preg_match('/[0-9]+/', $value)) $this->cachenbofdoc = (int) $value;
|
if (preg_match('/[0-9]+/', $value)) {
|
||||||
elseif ($value == '+') $this->cachenbofdoc++;
|
$this->cachenbofdoc = (int) $value;
|
||||||
elseif ($value == '-') $this->cachenbofdoc--;
|
} elseif ($value == '+') {
|
||||||
|
$this->cachenbofdoc++;
|
||||||
|
} elseif ($value == '-') {
|
||||||
|
$this->cachenbofdoc--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -327,11 +349,9 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($obj)
|
if ($obj) {
|
||||||
{
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
|
|
||||||
@ -374,7 +394,9 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ($mode != 'databaseonly') $relativepath = $this->getRelativePath(1); // Ex: dir1/dir2/dir3
|
if ($mode != 'databaseonly') {
|
||||||
|
$relativepath = $this->getRelativePath(1); // Ex: dir1/dir2/dir3
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete remove directory id=".$this->id." mode=".$mode.(($mode == 'databaseonly') ? '' : ' relativepath='.$relativepath));
|
dol_syslog(get_class($this)."::delete remove directory id=".$this->id." mode=".$mode.(($mode == 'databaseonly') ? '' : ' relativepath='.$relativepath));
|
||||||
|
|
||||||
@ -385,35 +407,30 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql) {
|
||||||
{
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error = "Error ".$this->db->lasterror();
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
return -2;
|
return -2;
|
||||||
} else {
|
} else {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('MYECMDIR_DELETE', $user);
|
$result = $this->call_trigger('MYECMDIR_DELETE', $user);
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode != 'databaseonly')
|
if ($mode != 'databaseonly') {
|
||||||
{
|
|
||||||
$file = $conf->ecm->dir_output."/".$relativepath;
|
$file = $conf->ecm->dir_output."/".$relativepath;
|
||||||
if ($deletedirrecursive)
|
if ($deletedirrecursive) {
|
||||||
{
|
|
||||||
$result = @dol_delete_dir_recursive($file, 0, 0);
|
$result = @dol_delete_dir_recursive($file, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
$result = @dol_delete_dir($file, 0);
|
$result = @dol_delete_dir($file, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result || !@is_dir(dol_osencode($file)))
|
if ($result || !@is_dir(dol_osencode($file))) {
|
||||||
{
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
} else {
|
} else {
|
||||||
$this->error = 'ErrorFailToDeleteDir';
|
$this->error = 'ErrorFailToDeleteDir';
|
||||||
@ -422,8 +439,11 @@ class EcmDirectory extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) return 1;
|
if (!$error) {
|
||||||
else return -1;
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -465,17 +485,27 @@ class EcmDirectory extends CommonObject
|
|||||||
$linkclose = '"'.($more ? ' '.$more : '').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkclose = '"'.($more ? ' '.$more : '').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
|
|
||||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/dir_card.php?section='.$this->id.$linkclose;
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/dir_card.php?section='.$this->id.$linkclose;
|
||||||
if ($option == 'index') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true'.$linkclose;
|
if ($option == 'index') {
|
||||||
if ($option == 'indexexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=false'.$linkclose;
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true'.$linkclose;
|
||||||
if ($option == 'indexnotexpanded') $linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true'.$linkclose;
|
}
|
||||||
|
if ($option == 'indexexpanded') {
|
||||||
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=false'.$linkclose;
|
||||||
|
}
|
||||||
|
if ($option == 'indexnotexpanded') {
|
||||||
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&sectionexpand=true'.$linkclose;
|
||||||
|
}
|
||||||
$linkend = '</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
|
//$picto=DOL_URL_ROOT.'/theme/common/treemenu/folder.gif';
|
||||||
$picto = 'dir';
|
$picto = 'dir';
|
||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
if ($withpicto) {
|
||||||
if ($withpicto != 2) $result .= ($max ?dol_trunc($newref, $max, 'middle') : $newref);
|
$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||||
|
}
|
||||||
|
if ($withpicto != 2) {
|
||||||
|
$result .= ($max ?dol_trunc($newref, $max, 'middle') : $newref);
|
||||||
|
}
|
||||||
$result .= $linkend;
|
$result .= $linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -497,18 +527,15 @@ class EcmDirectory extends CommonObject
|
|||||||
do {
|
do {
|
||||||
// Get index cursor in this->cats for id_mere
|
// Get index cursor in this->cats for id_mere
|
||||||
$cursorindex = -1;
|
$cursorindex = -1;
|
||||||
foreach ($this->cats as $key => $val)
|
foreach ($this->cats as $key => $val) {
|
||||||
{
|
if ($this->cats[$key]['id'] == $idtosearch) {
|
||||||
if ($this->cats[$key]['id'] == $idtosearch)
|
|
||||||
{
|
|
||||||
$cursorindex = $key;
|
$cursorindex = $key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//print "c=".$idtosearch."-".$cursorindex;
|
//print "c=".$idtosearch."-".$cursorindex;
|
||||||
|
|
||||||
if ($cursorindex >= 0)
|
if ($cursorindex >= 0) {
|
||||||
{
|
|
||||||
// Path is label sanitized (no space and no special char) and concatenated
|
// Path is label sanitized (no space and no special char) and concatenated
|
||||||
$ret = dol_sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret;
|
$ret = dol_sanitizeFileName($this->cats[$cursorindex]['label']).'/'.$ret;
|
||||||
|
|
||||||
@ -541,11 +568,9 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG);
|
dol_syslog(get_class($this)."::load_motherof", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
{
|
|
||||||
$this->motherof[$obj->id_son] = $obj->id_parent;
|
$this->motherof[$obj->id_son] = $obj->id_parent;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -608,8 +633,7 @@ class EcmDirectory extends CommonObject
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if (empty($force) && !empty($this->full_arbo_loaded))
|
if (empty($force) && !empty($this->full_arbo_loaded)) {
|
||||||
{
|
|
||||||
return $this->cats;
|
return $this->cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,13 +656,11 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::get_full_arbo", LOG_DEBUG);
|
dol_syslog(get_class($this)."::get_full_arbo", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$this->cats = array();
|
$this->cats = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
// This assignment in condition is not a bug. It allows walking the results.
|
// This assignment in condition is not a bug. It allows walking the results.
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
{
|
|
||||||
$this->cats[$obj->rowid]['id'] = $obj->rowid;
|
$this->cats[$obj->rowid]['id'] = $obj->rowid;
|
||||||
$this->cats[$obj->rowid]['id_mere'] = (isset($this->motherof[$obj->rowid]) ? $this->motherof[$obj->rowid] : '');
|
$this->cats[$obj->rowid]['id_mere'] = (isset($this->motherof[$obj->rowid]) ? $this->motherof[$obj->rowid] : '');
|
||||||
$this->cats[$obj->rowid]['label'] = $obj->label;
|
$this->cats[$obj->rowid]['label'] = $obj->label;
|
||||||
@ -648,10 +670,8 @@ class EcmDirectory extends CommonObject
|
|||||||
$this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c;
|
$this->cats[$obj->rowid]['fk_user_c'] = $obj->fk_user_c;
|
||||||
$this->cats[$obj->rowid]['login_c'] = $obj->login_c;
|
$this->cats[$obj->rowid]['login_c'] = $obj->login_c;
|
||||||
|
|
||||||
if (!empty($obj->rowid_fille))
|
if (!empty($obj->rowid_fille)) {
|
||||||
{
|
if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children'])) {
|
||||||
if (isset($this->cats[$obj->rowid]['id_children']) && is_array($this->cats[$obj->rowid]['id_children']))
|
|
||||||
{
|
|
||||||
$newelempos = count($this->cats[$obj->rowid]['id_children']);
|
$newelempos = count($this->cats[$obj->rowid]['id_children']);
|
||||||
//print "this->cats[$i]['id_children'] est deja un tableau de $newelem elements<br>";
|
//print "this->cats[$i]['id_children'] est deja un tableau de $newelem elements<br>";
|
||||||
$this->cats[$obj->rowid]['id_children'][$newelempos] = $obj->rowid_fille;
|
$this->cats[$obj->rowid]['id_children'][$newelempos] = $obj->rowid_fille;
|
||||||
@ -668,9 +688,10 @@ class EcmDirectory extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We add properties fullxxx to all elements
|
// We add properties fullxxx to all elements
|
||||||
foreach ($this->cats as $key => $val)
|
foreach ($this->cats as $key => $val) {
|
||||||
{
|
if (isset($motherof[$key])) {
|
||||||
if (isset($motherof[$key])) continue;
|
continue;
|
||||||
|
}
|
||||||
$this->build_path_from_id_categ($key, 0);
|
$this->build_path_from_id_categ($key, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,8 +714,7 @@ class EcmDirectory extends CommonObject
|
|||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
// Define fullpath
|
// Define fullpath
|
||||||
if (!empty($this->cats[$id_categ]['id_mere']))
|
if (!empty($this->cats[$id_categ]['id_mere'])) {
|
||||||
{
|
|
||||||
$this->cats[$id_categ]['fullpath'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullpath'];
|
$this->cats[$id_categ]['fullpath'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullpath'];
|
||||||
$this->cats[$id_categ]['fullpath'] .= '_'.$id_categ;
|
$this->cats[$id_categ]['fullpath'] .= '_'.$id_categ;
|
||||||
$this->cats[$id_categ]['fullrelativename'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullrelativename'];
|
$this->cats[$id_categ]['fullrelativename'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fullrelativename'];
|
||||||
@ -711,11 +731,11 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
// Traite ces enfants
|
// Traite ces enfants
|
||||||
$protection++;
|
$protection++;
|
||||||
if ($protection > 20) return; // On ne traite pas plus de 20 niveaux
|
if ($protection > 20) {
|
||||||
if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children']))
|
return; // On ne traite pas plus de 20 niveaux
|
||||||
{
|
}
|
||||||
foreach ($this->cats[$id_categ]['id_children'] as $key => $val)
|
if (isset($this->cats[$id_categ]['id_children']) && is_array($this->cats[$id_categ]['id_children'])) {
|
||||||
{
|
foreach ($this->cats[$id_categ]['id_children'] as $key => $val) {
|
||||||
$this->build_path_from_id_categ($val, $protection);
|
$this->build_path_from_id_categ($val, $protection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -741,8 +761,7 @@ class EcmDirectory extends CommonObject
|
|||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET";
|
||||||
$sql .= " cachenbofdoc = '".count($filelist)."'";
|
$sql .= " cachenbofdoc = '".count($filelist)."'";
|
||||||
if (empty($all)) // By default
|
if (empty($all)) { // By default
|
||||||
{
|
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
} else {
|
} else {
|
||||||
$sql .= " WHERE entity = ".$conf->entity;
|
$sql .= " WHERE entity = ".$conf->entity;
|
||||||
@ -750,8 +769,7 @@ class EcmDirectory extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::refreshcachenboffile", LOG_DEBUG);
|
dol_syslog(get_class($this)."::refreshcachenboffile", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$this->cachenbofdoc = count($filelist);
|
$this->cachenbofdoc = count($filelist);
|
||||||
return $this->cachenbofdoc;
|
return $this->cachenbofdoc;
|
||||||
} else {
|
} else {
|
||||||
@ -782,8 +800,7 @@ class EcmDirectory extends CommonObject
|
|||||||
$interface = new Interfaces($this->db);
|
$interface = new Interfaces($this->db);
|
||||||
$result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf);
|
$result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if (!empty($this->errors))
|
if (!empty($this->errors)) {
|
||||||
{
|
|
||||||
$this->errors = array_merge($this->errors, $interface->errors);
|
$this->errors = array_merge($this->errors, $interface->errors);
|
||||||
} else {
|
} else {
|
||||||
$this->errors = $interface->errors;
|
$this->errors = $interface->errors;
|
||||||
|
|||||||
@ -94,7 +94,15 @@ class EcmFiles extends CommonObject
|
|||||||
* @var string keywords
|
* @var string keywords
|
||||||
*/
|
*/
|
||||||
public $keywords;
|
public $keywords;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string cover
|
||||||
|
*/
|
||||||
public $cover;
|
public $cover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int position
|
||||||
|
*/
|
||||||
public $position;
|
public $position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,7 +139,15 @@ class EcmFiles extends CommonObject
|
|||||||
* @var string acl
|
* @var string acl
|
||||||
*/
|
*/
|
||||||
public $acl;
|
public $acl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string src object type
|
||||||
|
*/
|
||||||
public $src_object_type;
|
public $src_object_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int src object id
|
||||||
|
*/
|
||||||
public $src_object_id;
|
public $src_object_id;
|
||||||
|
|
||||||
|
|
||||||
@ -233,8 +249,7 @@ class EcmFiles extends CommonObject
|
|||||||
$sql .= " WHERE filepath ='".$this->db->escape($this->filepath)."'";
|
$sql .= " WHERE filepath ='".$this->db->escape($this->filepath)."'";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$maxposition = (int) $obj->maxposition;
|
$maxposition = (int) $obj->maxposition;
|
||||||
} else {
|
} else {
|
||||||
@ -247,13 +262,11 @@ class EcmFiles extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->filename) || empty($this->filepath))
|
if (empty($this->filename) || empty($this->filepath)) {
|
||||||
{
|
|
||||||
$this->errors[] = 'Bad property filename or filepath';
|
$this->errors[] = 'Bad property filename or filepath';
|
||||||
return --$error;
|
return --$error;
|
||||||
}
|
}
|
||||||
if (!isset($this->entity))
|
if (!isset($this->entity)) {
|
||||||
{
|
|
||||||
$this->entity = $conf->entity;
|
$this->entity = $conf->entity;
|
||||||
}
|
}
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -317,11 +330,12 @@ class EcmFiles extends CommonObject
|
|||||||
$this->position = $maxposition;
|
$this->position = $maxposition;
|
||||||
|
|
||||||
// Triggers
|
// Triggers
|
||||||
if (!$notrigger)
|
if (!$notrigger) {
|
||||||
{
|
|
||||||
// Call triggers
|
// Call triggers
|
||||||
$result = $this->call_trigger(strtoupper(get_class($this)).'_CREATE', $user);
|
$result = $this->call_trigger(strtoupper(get_class($this)).'_CREATE', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -401,8 +415,7 @@ class EcmFiles extends CommonObject
|
|||||||
} elseif (!empty($hashforshare)) {
|
} elseif (!empty($hashforshare)) {
|
||||||
$sql .= " AND t.share = '".$this->db->escape($hashforshare)."'";
|
$sql .= " AND t.share = '".$this->db->escape($hashforshare)."'";
|
||||||
//$sql .= " AND t.entity = ".$conf->entity; // hashforshare already unique
|
//$sql .= " AND t.entity = ".$conf->entity; // hashforshare already unique
|
||||||
} elseif ($src_object_type && $src_object_id)
|
} elseif ($src_object_type && $src_object_id) {
|
||||||
{
|
|
||||||
// Warning: May return several record, and only first one is returned !
|
// Warning: May return several record, and only first one is returned !
|
||||||
$sql .= " AND t.src_object_type ='".$this->db->escape($src_object_type)."' AND t.src_object_id = ".$this->db->escape($src_object_id);
|
$sql .= " AND t.src_object_type ='".$this->db->escape($src_object_type)."' AND t.src_object_id = ".$this->db->escape($src_object_id);
|
||||||
$sql .= " AND t.entity = ".$conf->entity;
|
$sql .= " AND t.entity = ".$conf->entity;
|
||||||
@ -668,11 +681,12 @@ class EcmFiles extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Triggers
|
// Triggers
|
||||||
if (!$error && !$notrigger)
|
if (!$error && !$notrigger) {
|
||||||
{
|
|
||||||
// Call triggers
|
// Call triggers
|
||||||
$result = $this->call_trigger(strtoupper(get_class($this)).'_MODIFY', $user);
|
$result = $this->call_trigger(strtoupper(get_class($this)).'_MODIFY', $user);
|
||||||
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
} //Do also here what you must do to rollback action if trigger fail
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,11 +719,12 @@ class EcmFiles extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Triggers
|
// Triggers
|
||||||
if (!$notrigger)
|
if (!$notrigger) {
|
||||||
{
|
|
||||||
// Call triggers
|
// Call triggers
|
||||||
$result = $this->call_trigger(strtoupper(get_class($this)).'_DELETE', $user);
|
$result = $this->call_trigger(strtoupper(get_class($this)).'_DELETE', $user);
|
||||||
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
} //Do also here what you must do to rollback action if trigger fail
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,7 +819,9 @@ class EcmFiles extends CommonObject
|
|||||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
global $menumanager;
|
global $menumanager;
|
||||||
|
|
||||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
if (!empty($conf->dol_no_mouse_hover)) {
|
||||||
|
$notooltip = 1; // Force disable tooltips
|
||||||
|
}
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
@ -815,25 +832,26 @@ class EcmFiles extends CommonObject
|
|||||||
$url = DOL_URL_ROOT.'/ecm/'.$this->table_name.'_card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/ecm/'.$this->table_name.'_card.php?id='.$this->id;
|
||||||
|
|
||||||
$linkclose = '';
|
$linkclose = '';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip)) {
|
||||||
{
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
|
||||||
{
|
|
||||||
$label = $langs->trans("ShowProject");
|
$label = $langs->trans("ShowProject");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||||
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
} else {
|
||||||
|
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||||
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
$linkstart .= $linkclose.'>';
|
$linkstart .= $linkclose.'>';
|
||||||
$linkend = '</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
if ($withpicto)
|
if ($withpicto) {
|
||||||
{
|
|
||||||
$result .= ($linkstart.img_object(($notooltip ? '' : $label), 'label', ($notooltip ? '' : 'class="classfortooltip"')).$linkend);
|
$result .= ($linkstart.img_object(($notooltip ? '' : $label), 'label', ($notooltip ? '' : 'class="classfortooltip"')).$linkend);
|
||||||
if ($withpicto != 2) $result .= ' ';
|
if ($withpicto != 2) {
|
||||||
|
$result .= ' ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$result .= $linkstart.$this->ref.$linkend;
|
$result .= $linkstart.$this->ref.$linkend;
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -41,20 +41,22 @@ $confirm = GETPOST('confirm', 'alpha');
|
|||||||
$module = GETPOST('module', 'alpha');
|
$module = GETPOST('module', 'alpha');
|
||||||
$website = GETPOST('website', 'alpha');
|
$website = GETPOST('website', 'alpha');
|
||||||
$pageid = GETPOST('pageid', 'int');
|
$pageid = GETPOST('pageid', 'int');
|
||||||
if (empty($module)) $module = 'ecm';
|
if (empty($module)) {
|
||||||
|
$module = 'ecm';
|
||||||
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->socid > 0)
|
if ($user->socid > 0) {
|
||||||
{
|
|
||||||
$action = '';
|
$action = '';
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$section = $urlsection = GETPOST('section', 'alpha');
|
$section = $urlsection = GETPOST('section', 'alpha');
|
||||||
if (empty($urlsection)) $urlsection = 'misc';
|
if (empty($urlsection)) {
|
||||||
|
$urlsection = 'misc';
|
||||||
|
}
|
||||||
|
|
||||||
if ($module == 'ecm')
|
if ($module == 'ecm') {
|
||||||
{
|
|
||||||
$upload_dir = $conf->ecm->dir_output.'/'.$urlsection;
|
$upload_dir = $conf->ecm->dir_output.'/'.$urlsection;
|
||||||
} else // For example $module == 'medias'
|
} else // For example $module == 'medias'
|
||||||
{
|
{
|
||||||
@ -65,19 +67,23 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (!$sortorder) $sortorder = "ASC";
|
if (!$sortorder) {
|
||||||
if (!$sortfield) $sortfield = "label";
|
$sortorder = "ASC";
|
||||||
|
}
|
||||||
|
if (!$sortfield) {
|
||||||
|
$sortfield = "label";
|
||||||
|
}
|
||||||
|
|
||||||
$ecmdir = new EcmDirectory($db);
|
$ecmdir = new EcmDirectory($db);
|
||||||
if (!empty($section))
|
if (!empty($section)) {
|
||||||
{
|
|
||||||
$result = $ecmdir->fetch($section);
|
$result = $ecmdir->fetch($section);
|
||||||
if (!$result > 0)
|
if (!$result > 0) {
|
||||||
{
|
|
||||||
dol_print_error($db, $ecmdir->error);
|
dol_print_error($db, $ecmdir->error);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -86,18 +92,18 @@ if (!empty($section))
|
|||||||
// Permissions
|
// Permissions
|
||||||
$permtoadd = 0;
|
$permtoadd = 0;
|
||||||
$permtoupload = 0;
|
$permtoupload = 0;
|
||||||
if ($module == 'ecm')
|
if ($module == 'ecm') {
|
||||||
{
|
|
||||||
$permtoadd = $user->rights->ecm->setup;
|
$permtoadd = $user->rights->ecm->setup;
|
||||||
$permtoupload = $user->rights->ecm->upload;
|
$permtoupload = $user->rights->ecm->upload;
|
||||||
}
|
}
|
||||||
if ($module == 'medias')
|
if ($module == 'medias') {
|
||||||
{
|
|
||||||
$permtoadd = ($user->rights->mailing->creer || $user->rights->website->write);
|
$permtoadd = ($user->rights->mailing->creer || $user->rights->website->write);
|
||||||
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->write);
|
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->write);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$permtoadd) accessforbidden();
|
if (!$permtoadd) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -106,12 +112,9 @@ if (!$permtoadd) accessforbidden();
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Action ajout d'un produit ou service
|
// Action ajout d'un produit ou service
|
||||||
if ($action == 'add' && $permtoadd)
|
if ($action == 'add' && $permtoadd) {
|
||||||
{
|
if ($cancel) {
|
||||||
if ($cancel)
|
if (!empty($backtopage)) {
|
||||||
{
|
|
||||||
if (!empty($backtopage))
|
|
||||||
{
|
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
@ -120,33 +123,31 @@ if ($action == 'add' && $permtoadd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ref = GETPOST("ref", 'alpha');
|
$ref = (string) GETPOST("ref", 'alpha');
|
||||||
$label = GETPOST("label", 'alpha');
|
$label = (string) GETPOST("label", 'alpha');
|
||||||
$desc = GETPOST("desc", 'alpha');
|
$desc = (string) GETPOST("desc", 'alpha');
|
||||||
$catParent = GETPOST("catParent", 'alpha'); // Can be an int (with ECM) or a string (with generic filemanager)
|
$catParent = GETPOST("catParent", 'alpha'); // Can be an int (with ECM) or a string (with generic filemanager)
|
||||||
if ($catParent == '-1') $catParent = 0;
|
if ($catParent == '-1') {
|
||||||
|
$catParent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (empty($label))
|
if (empty($label)) {
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
if ($module == 'ecm') {
|
||||||
if ($module == 'ecm')
|
|
||||||
{
|
|
||||||
$ecmdir->ref = $ref;
|
$ecmdir->ref = $ref;
|
||||||
$ecmdir->label = $label;
|
$ecmdir->label = $label;
|
||||||
$ecmdir->description = $desc;
|
$ecmdir->description = $desc;
|
||||||
$ecmdir->fk_parent = (int) $catParent;
|
$ecmdir->fk_parent = (int) $catParent;
|
||||||
|
|
||||||
$id = $ecmdir->create($user);
|
$id = $ecmdir->create($user);
|
||||||
if ($id <= 0)
|
if ($id <= 0) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
|
setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
|
||||||
@ -155,22 +156,18 @@ if ($action == 'add' && $permtoadd)
|
|||||||
} else // For example $module == 'medias'
|
} else // For example $module == 'medias'
|
||||||
{
|
{
|
||||||
$dirfornewdir = '';
|
$dirfornewdir = '';
|
||||||
if ($module == 'medias')
|
if ($module == 'medias') {
|
||||||
{
|
|
||||||
$dirfornewdir = $conf->medias->multidir_output[$conf->entity];
|
$dirfornewdir = $conf->medias->multidir_output[$conf->entity];
|
||||||
}
|
}
|
||||||
if (empty($dirfornewdir))
|
if (empty($dirfornewdir)) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
dol_print_error('', 'Bad value for module. Not supported.');
|
dol_print_error('', 'Bad value for module. Not supported.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$fullpathofdir = $dirfornewdir.'/'.($catParent ? $catParent.'/' : '').$label;
|
$fullpathofdir = $dirfornewdir.'/'.($catParent ? $catParent.'/' : '').$label;
|
||||||
$result = dol_mkdir($fullpathofdir, DOL_DATA_ROOT);
|
$result = dol_mkdir($fullpathofdir, DOL_DATA_ROOT);
|
||||||
if ($result < 0)
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessages($langs->trans('ErrorFailToCreateDir', $label), null, 'errors');
|
setEventMessages($langs->trans('ErrorFailToCreateDir', $label), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
} else {
|
} else {
|
||||||
@ -180,10 +177,8 @@ if ($action == 'add' && $permtoadd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
if (!empty($backtopage)) {
|
||||||
if (!empty($backtopage))
|
|
||||||
{
|
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
@ -194,8 +189,7 @@ if ($action == 'add' && $permtoadd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deleting file
|
// Deleting file
|
||||||
elseif ($action == 'confirm_deletesection' && $confirm == 'yes')
|
elseif ($action == 'confirm_deletesection' && $confirm == 'yes') {
|
||||||
{
|
|
||||||
$result = $ecmdir->delete($user);
|
$result = $ecmdir->delete($user);
|
||||||
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
|
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -212,8 +206,7 @@ llxHeader('', $langs->trans("ECMNewSection"));
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formecm = new FormEcm($db);
|
$formecm = new FormEcm($db);
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create') {
|
||||||
{
|
|
||||||
//***********************
|
//***********************
|
||||||
// Create
|
// Create
|
||||||
//***********************
|
//***********************
|
||||||
@ -222,8 +215,12 @@ if ($action == 'create')
|
|||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
|
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
|
||||||
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
if ($website) print '<input type="hidden" name="website" value="'.dol_escape_htmltag($website).'">';
|
if ($website) {
|
||||||
if ($pageid) print '<input type="hidden" name="pageid" value="'.dol_escape_htmltag($pageid).'">';
|
print '<input type="hidden" name="website" value="'.dol_escape_htmltag($website).'">';
|
||||||
|
}
|
||||||
|
if ($pageid) {
|
||||||
|
print '<input type="hidden" name="pageid" value="'.dol_escape_htmltag($pageid).'">';
|
||||||
|
}
|
||||||
|
|
||||||
$title = $langs->trans("ECMNewSection");
|
$title = $langs->trans("ECMNewSection");
|
||||||
print load_fiche_titre($title);
|
print load_fiche_titre($title);
|
||||||
@ -240,8 +237,7 @@ if ($action == 'create')
|
|||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
if ($module == 'ecm')
|
if ($module == 'ecm') {
|
||||||
{
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print '<textarea name="desc" rows="4" class="quatrevingtpercent">';
|
print '<textarea name="desc" rows="4" class="quatrevingtpercent">';
|
||||||
print $ecmdir->description;
|
print $ecmdir->description;
|
||||||
@ -262,8 +258,7 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($action) || $action == 'delete_section')
|
if (empty($action) || $action == 'delete_section') {
|
||||||
{
|
|
||||||
//***********************
|
//***********************
|
||||||
// List
|
// List
|
||||||
//***********************
|
//***********************
|
||||||
@ -277,21 +272,17 @@ if (empty($action) || $action == 'delete_section')
|
|||||||
print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php">'.$langs->trans("ECMRoot").'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php">'.$langs->trans("ECMRoot").'</a>';
|
||||||
//print ' -> <b>'.$ecmdir->getNomUrl(1).'</b><br>';
|
//print ' -> <b>'.$ecmdir->getNomUrl(1).'</b><br>';
|
||||||
print "<br><br>";
|
print "<br><br>";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Confirmation de la suppression d'une ligne categorie
|
// Confirmation de la suppression d'une ligne categorie
|
||||||
if ($action == 'delete_section')
|
if ($action == 'delete_section') {
|
||||||
{
|
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection');
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construit fiche rubrique
|
|
||||||
|
|
||||||
|
|
||||||
// Actions buttons
|
// Actions buttons
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
if ($user->rights->ecm->setup)
|
if ($user->rights->ecm->setup) {
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=delete_section&token='.newToken().'">'.$langs->trans('Delete').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=delete_section&token='.newToken().'">'.$langs->trans('Delete').'</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user