diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 32f7499e4ff..41a31f2660d 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -18,11 +18,11 @@ */ /** - \file htdoc/ecm/docdir.php - \ingroup ecm - \brief Main page for ECM section area - \version $Id$ - \author Laurent Destailleur + * \file htdoc/ecm/docdir.php + * \ingroup ecm + * \brief Main page for ECM section area + * \version $Id$ + * \author Laurent Destailleur */ require("./pre.inc.php"); @@ -103,7 +103,7 @@ if ($_POST["action"] == 'add' && $user->rights->ecm->setup) if ($id > 0) { - Header("Location: ".DOL_URL_ROOT.'/ecm/index.php'); + Header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); exit; } else @@ -154,7 +154,7 @@ if ($_GET["action"] == 'create') print ''.$langs->trans("Label").''."\n"; print ''.$langs->trans ("AddIn").''; - print $formecm->select_all_sections($ecmdir->fk_parent,'catParent'); + print $formecm->select_all_sections(! empty($_GET["catParent"])?$_GET["catParent"]:$ecmdir->fk_parent,'catParent'); print ''."\n"; // Description diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 661a6ad0dae..fed66f070e4 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -26,6 +26,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/treeview.lib.php"); require_once(DOL_DOCUMENT_ROOT."/ecm/ecmdirectory.class.php"); // Load traductions files @@ -122,14 +123,14 @@ $userstatic = new User($db); // Ajout rubriques automatiques $rowspan=0; $sectionauto=array(); -if ($conf->produit->enabled) { $rowspan++; $sectionauto[]=array('module'=>'product', 'test'=>$conf->produit->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } -if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } -if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } -if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } -if ($conf->commande->enabled) { $rowspan++; $sectionauto[]=array('module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } -if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('module'=>'supplier_order', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); } -if ($conf->facture->enabled) { $rowspan++; $sectionauto[]=array('module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } -if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('module'=>'supplier_invoice', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } +if ($conf->produit->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>$conf->produit->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } +if ($conf->societe->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } +if ($conf->propal->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } +if ($conf->contrat->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } +if ($conf->commande->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } +if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'supplier_order', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); } +if ($conf->facture->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } +if ($conf->fournisseur->enabled) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'supplier_invoice', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } //*********************** @@ -145,7 +146,7 @@ print "
\n"; $colspan=3; print ''; print ''; -print ''; +print ''; print ''; print '
'.img_picto('','object_list').' '.$langs->trans("ECMFileManager").''.img_picto('','object_list').' '.$langs->trans("ECMFileManager").''.img_picto('','search').' '.$langs->trans("Search").'
'; @@ -202,7 +203,7 @@ if (eregi('search',$action)) } -if (empty($action) || $action == 'refresh') +if (empty($action) || $action == 'file_manager' || eregi('refresh',$action)) { // Confirmation de la suppression d'une ligne categorie if ($_GET['action'] == 'delete_section') @@ -215,54 +216,52 @@ if (empty($action) || $action == 'refresh') // Construit liste des répertoires - print ''; + print '
'; + + print ''; + print ''; + print ''; if (sizeof($sectionauto)) { - // Automatic sections - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + //print ''; print ''; $sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false); - $var=true; + $nbofentries=0; + $oldvallevel=0; foreach ($sectionauto as $key => $val) { if ($val['test']) { - $var=! $var; + $var=false; print ''; // Section print '\n"; - // Type - print ''; - print ''; - - // Edit link - print ''; - + // Info print ''; + + // Edit link + print ''; + + // Add link + print ''; + + // Nb of doc + print ''; print "\n"; + + $oldvallevel=$val['level']; + $nbofentries++; } } } + // Manual sections title line + print ''; + print ''; + print ''; + print ''; - // Manual sections $ecmdirstatic = new ECMDirectory($db); $rub=$ecmdirstatic->get_full_arbo(); $userstatic = new User($db); $nbofentries=0; + $oldvallevel=0; $var=true; foreach($rub as $key => $val) { - $var=!$var; + $var=false; $ecmdirstatic->id=$val['id']; $ecmdirstatic->ref=$val['label']; @@ -307,20 +330,16 @@ if (empty($action) || $action == 'refresh') // Section print '\n"; - // Description - print ''; - - // Nb of docs - //print ''; - print ''; - - // Edit link - print ''; - + // Info print '"; + // Edit link + print ''; + + // Add link + print ''; + + // Nb of docs + //print ''; + print ''; + print "\n"; + $oldvallevel=$val['level']; $nbofentries++; } diff --git a/htdocs/includes/modules/modECM.class.php b/htdocs/includes/modules/modECM.class.php index a6f7d370bd1..f69747be23c 100644 --- a/htdocs/includes/modules/modECM.class.php +++ b/htdocs/includes/modules/modECM.class.php @@ -153,7 +153,7 @@ class modECM extends DolibarrModules 'type'=>'left', 'titre'=>'ECMFileManager', 'mainmenu'=>'ecm', - 'url'=>'/ecm/index.php', + 'url'=>'/ecm/index.php?action=file_manager', 'langs'=>'ecm', 'position'=>100, 'perms'=>'$user->rights->ecm->read', diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index f10144d6080..9ac630d6a76 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -811,7 +811,7 @@ function img_object($alt, $object) \brief Affiche picto (fonction g�n�rique) \param alt Texte sur le alt de l'image \param picto Nom de l'image a afficher (Si pas d'extension, on met '.png') - \param options Attribut suppl�mentaire a la balise img + \param options Attribut supplementaire a la balise img \param pictoisfullpath If 1, image path is a full path \return string Retourne tag img */ @@ -823,6 +823,22 @@ function img_picto($alt, $picto, $options='', $pictoisfullpath=0) return ''.$alt.''; } +/** + \brief Affiche picto (fonction g�n�rique) + \param alt Texte sur le alt de l'image + \param picto Nom de l'image a afficher (Si pas d'extension, on met '.png') + \param options Attribut supplementaire a la balise img + \param pictoisfullpath If 1, image path is a full path + \return string Retourne tag img + */ +function img_picto_common($alt, $picto, $options='', $pictoisfullpath=0) +{ + global $conf; + if (! eregi('(\.png|\.gif)$',$picto)) $picto.='.png'; + if ($pictoisfullpath) return ''.$alt.''; + return ''.$alt.''; +} + /** \brief Affiche logo action \param alt Texte sur le alt de l'image diff --git a/htdocs/lib/treeview.lib.php b/htdocs/lib/treeview.lib.php index e14bc50eb35..b113ce1ee14 100644 --- a/htdocs/lib/treeview.lib.php +++ b/htdocs/lib/treeview.lib.php @@ -24,6 +24,40 @@ * \version $Id$ */ +/** + * Show picto of a tree view + * + * @param unknown_type $tab Array of entries in correct order + * @param unknown_type $key Key of value + */ +function tree_showpad(&$tab,$key) +{ + $pos=1; + while ($pos <= $tab[$key]['level'] && $tab[$key]['level'] > 0) + { + // Process picto for column $pos + // \TODO If at least one of this level + $atleastonofthislevelafter=1; + if ($atleastonofthislevelafter) + { + if ($tab[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif'); + else print img_picto_common('','treemenu/line.gif'); + } + else + { + if ($tab[$key]['level'] == $pos) print img_picto_common('','treemenu/branchbottom.gif'); + else print img_picto_common('','treemenu/linebottom.gif'); + } + $pos++; + } +} + + + + + +// ------------------------------- Used by enu editor ----------------- + /** * \brief Ad javascript tree functions */
'.$langs->trans("ECMSectionOfDocuments").'
'.$langs->trans("ECMSectionOfDocuments").''.$langs->trans("Type").''.$langs->trans("ECMNbOfDocsSmall").' '.img_picto($langs->trans("Refresh"),'refresh').''; - if ($user->rights->ecm->setup) - { - print ''.img_picto($langs->trans("ECMNewSection"),'edit_add').''; - } - else - { - print ' '; - } + // Automatic sections title line + print '
'; + print ''; + print ''; - print ''; + print '
'; + print img_picto_common('','treemenu/base.gif'); + print ''.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionAuto").')'; print ' 
'; + print '
  '.$langs->trans("ECMNbOfDocsSmall").' '.img_picto($langs->trans("Refresh"),'refresh').'
'; - print img_picto('','object_dir').' '; - print ''; + print '
'; + print tree_showpad($sectionauto,$key); + print ''; + print img_picto('','object_dir'); + print ''; + print '  '; print $val['label']; - print ''; + print '
'; print "
'.$langs->trans('ECMTypeAuto').'? '; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMAutoOrg").'
'; @@ -270,24 +269,48 @@ if (empty($action) || $action == 'refresh') $htmltooltip.=''.$langs->trans("Description").': '.$val['desc']; print $form->textwithhelp('',$htmltooltip,1,0); print '
  ?
'; + print ''; + print ''; + print '
'; + print img_picto_common('','treemenu/base.gif'); + print ''.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionManual").')'; + print '
'; + print '
 '.img_edit_add().''.$langs->trans("ECMNbOfDocsSmall").' '.img_picto($langs->trans("Refresh"),'refresh').'
'; - print str_repeat('     ',$val['level']-1); + print '
'; + print tree_showpad($rub,$key); + print ''; print $ecmdirstatic->getNomUrl(1); + print ''; + print '  '; + print '
'; print "
'.$langs->trans("ECMTypeManual").''.$obj->cachenbofdoc.''.$val['cachenbofdoc'].''.img_edit().''; $userstatic->id=$val['fk_user_c']; $userstatic->nom=$val['login_c']; @@ -332,8 +351,19 @@ if (empty($action) || $action == 'refresh') print $form->textwithhelp('',$htmltooltip,1,0); print "'.img_edit().''.img_edit_add().''.$obj->cachenbofdoc.''.$val['cachenbofdoc'].'