diff --git a/htdocs/ecm/ecmdirectory.class.php b/htdocs/ecm/ecmdirectory.class.php index 6b141d65d01..f8a17f66992 100644 --- a/htdocs/ecm/ecmdirectory.class.php +++ b/htdocs/ecm/ecmdirectory.class.php @@ -431,7 +431,7 @@ class EcmDirectory // extends CommonObject } /** - * \brief Load this->motherof array + * \brief Load this->motherof that is array(id_son=>id_parent, ...) * \return int <0 if KO, >0 if OK */ function load_motherof() @@ -469,9 +469,14 @@ class EcmDirectory // extends CommonObject * id_mere = id de la categorie mere * id_children = tableau des id enfant * label = nom de la categorie - * fulllabel = nom avec chemin complet de la categorie - * fullpath = chemin complet compose des id - * \param force Force reload of full arbo even if already loaded + * cachenbofdoc = nb of documents + * date_c = date creation + * fk_user_c = user creation + * login_c = login creation + * fullpath Full path (Added by build_path_from_id_categ call) + * fulllabel Full label (Added by build_path_from_id_categ call) + * level Level of line (Added by build_path_from_id_categ call) + * \param force Force reload of full arbo even if already loaded * \return array Tableau de array */ function get_full_arbo($force=0) @@ -481,8 +486,8 @@ class EcmDirectory // extends CommonObject return $this->cats; } - // Init this->motherof array - $this->load_motherof(); + // Init this->motherof that is array(id_son=>id_parent, ...) + $this->load_motherof(); // Charge tableau des categories $sql = "SELECT c.rowid as rowid, c.label as label,"; diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index bde92b547a2..3394c571e45 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -17,16 +17,17 @@ */ /** - \file htdoc/ecm/index.php - \ingroup ecm - \brief Main page for ECM section area - \version $Id$ - \author Laurent Destailleur -*/ + \file htdoc/ecm/index.php + \ingroup ecm + \brief Main page for ECM section area + \version $Id$ + \author Laurent Destailleur + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/ecm.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/treeview.lib.php"); require_once(DOL_DOCUMENT_ROOT."/ecm/ecmdirectory.class.php"); @@ -46,15 +47,15 @@ $user->getrights('ecm'); // Get parameters $socid = isset($_GET["socid"])?$_GET["socid"]:''; $action = isset($_GET["action"])?$_GET["action"]:$_POST['action']; +$section=isset($_GET["section"])?$_GET["section"]:$_POST['section']; +if (! $section) $section=0; -$section=$_GET["section"]; -if (! $section) $section='misc'; $upload_dir = $conf->ecm->dir_output.'/'.$section; $page=$_GET["page"]; $sortorder=$_GET["sortorder"]; $sortfield=$_GET["sortfield"]; - + $limit = $conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) $sortorder="ASC"; @@ -73,10 +74,79 @@ if (! empty($_REQUEST["section"])) /******************************************************************* -* ACTIONS -* -* Put here all code to do according to value of "action" parameter -********************************************************************/ + * ACTIONS + * + * Put here all code to do according to value of "action" parameter + ********************************************************************/ + +// Envoie fichier +if ( $_POST["sendit"] && $conf->upload != 0) +{ + $result=$ecmdir->fetch($_REQUEST["section"]); + if (! $result > 0) + { + dolibarr_print_error($db,$ecmdir->error); + exit; + } + $relativepath=$ecmdir->getRelativePath(); + $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; + + if (! is_dir($upload_dir)) + { + $result=create_exdir($upload_dir); + } + + if (is_dir($upload_dir)) + { + $result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0); + if ($result > 0) + { + //$mesg = '
| ';
-
-// Left area
-
+if ($mesg) { print $mesg." "; } // Tool bar $selected='file_manager'; @@ -155,14 +228,18 @@ if (eregi('search',$action)) $selected='search_form'; $head = ecm_prepare_head_fm($fac); dolibarr_fiche_head($head, $selected, '', 1); -print '
| |||||||||||||||||||||||||||||||||||||||||||