diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index e21505543e3..feabdf97b8b 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -18,14 +18,15 @@ */ /** - \file htdocs/admin/menus/index.php - \ingroup core - \brief Index page for menu editor - \version $Id$ -*/ + * \file htdocs/admin/menus/index.php + * \ingroup core + * \brief Index page for menu editor + * \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/treeview.lib.php"); $langs->load("other"); $langs->load("admin"); @@ -250,7 +251,7 @@ $rangLast = 0; $idLast = -1; if ($conf->use_javascript_ajax) { - print ''; + tree_addjs(); /*-------------------- MAIN ----------------------- tableau des éléments de l'arbre: @@ -289,12 +290,10 @@ if ($conf->use_javascript_ajax) } } - //appelle de la fonction récursive (ammorce) - //avec recherche depuis la racine. - print ''; + // Appelle de la fonction récursive (ammorce) + // avec recherche depuis la racine. + // array($menu['rowid'],$menu['fk_menu'],$titre); + tree_recur($data,0,0); print ''; @@ -324,101 +323,5 @@ $db->close(); print '
'; llxFooter('$Date$ - $Revision$'); - - - -/* cette fonction gère le décallage des éléments - suivant leur position dans l'arborescence -*/ -function affiche($tab,$rang) -{ - global $conf, $rangLast, $idLast, $menu_handler; - - if ($conf->use_javascript_ajax) - { - if($rang == $rangLast) - { - print ''; - //print 'aa'; - } - elseif($rang > $rangLast) - { - - print '
  • '; - echo "\n"; - } - - } - } - else - { - if($rang > $rangLast) - { - - print '
  • '; - echo "\n"; - } - - } - } - - print '
  • '; - print ''; - print ''.$tab[2].''; - print ''; - print ''; - print ''; - print ''; - print '
  • '; - echo "\n"; - - $rangLast = $rang; - $idLast = $tab[0]; -} - - -/*fonction récursive d'affichage de l'arbre - $tab :tableau des éléments - $pere :index de l'élément courrant - $rang :décallage de l'élément -*/ -function recur($tab,$pere,$rang) { - - if ($rang > 10) return; // Protection contre boucle infinie - - //ballayage du tableau - for ($x=0;$x diff --git a/htdocs/admin/menus/menu.js b/htdocs/admin/menus/menu.js index 19e0ee82462..12ec1919d70 100644 --- a/htdocs/admin/menus/menu.js +++ b/htdocs/admin/menus/menu.js @@ -11,7 +11,7 @@ function arbre() { // Choix de la balise contenant le texte. par defaut. balise = "STRONG"; // Presentation de l'arbre au depart : deployee ('yes') ou fermee ('no') - extend = "yes"; + extend = "no"; // Textes du lien plier / deplier plier_text = 'Replier tout'; plier_title = 'Replier tous les noeuds de l\'arbre' @@ -27,6 +27,7 @@ function arbre() { } } + // ------------------------------------------------------- // Creation des liens plier /deplier tout function linkSwitch(ul) { @@ -165,7 +166,7 @@ function imgDel(id) var delId='del'+id; var imgDel = document.getElementById('del'+id); - imgDel.style.display='block'; + if (imgDel != null) imgDel.style.display='block'; return true; } diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 18ea4cdb34e..7458b5b0c2b 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -43,6 +43,7 @@ $user->getrights('ecm'); // Get parameters $socid = isset($_GET["socid"])?$_GET["socid"]:''; +$action = isset($_GET["action"])?$_GET["action"]:$_POST['action']; $section=$_GET["section"]; if (! $section) $section='misc'; @@ -140,205 +141,204 @@ print $langs->trans("ECMAreaDesc")."
    "; print $langs->trans("ECMAreaDesc2")."
    "; print "
    \n"; -print ''; + print '
    '; +// Tool bar +$colspan=3; +print ''; +print ''; +print ''; +print ''; +print '
    '; +print $langs->trans("Toolbar").'
    '.img_picto('','object_list').' '.$langs->trans("ECMFileManager").''.img_picto('','search').' '.$langs->trans("Search").'
    '; +print '
    '; -//print_fiche_titre($langs->trans("ECMManualOrg")); -print '
    '; -print ''; -print ""; -print ''; -print "'; -print ''; -print "'; -print "'; -print "
    '.$langs->trans("ECMSearchByKeywords").'
    ".$langs->trans("Ref").':
    ".$langs->trans("Title").':
    ".$langs->trans("Keyword").':

    "; -//print $langs->trans("ECMManualOrgDesc"); - -print '
    '; - -//print_fiche_titre($langs->trans("ECMAutoOrg")); - -print '
    '; -print ''; -print ""; -print ''; - -$buthtml=''; -$butshown=0; -foreach($sectionauto as $section) +if (eregi('search',$action)) { - if (! $section['test']) continue; - if ($butshown % 2 == 0) print ''; - print "'; - print ''; - print ''; - print ''; - if ($butshown % 2 == 1) print ''; - $butshown++; -} -if ($butshown % 2 == 1) print ''; - -print ''; -print "
    '.$langs->trans("ECMSearchByEntity").'
    ".$section['label'].':
      

    "; -//print $langs->trans("ECMAutoOrgDesc"); + print ''; -print '
    '; -print '
    '; - - -//*********************** -// Files -//*********************** -print_fiche_titre($langs->trans("ECMSectionOfDocuments")); -//print '
    '; - -// Confirmation de la suppression d'une ligne categorie -if ($_GET['action'] == 'delete_section') -{ - $form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); - print '
    '; -} - -if ($mesg) { print $mesg."
    "; } - - -// Construit liste des répertoires -print ''; - -if (sizeof($sectionauto)) -{ - // Automatic sections - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + //print_fiche_titre($langs->trans("ECMManualOrg")); - $sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false); + print ''; + print '
    '.$langs->trans("ECMSectionAuto").''.$langs->trans("Description").''.$langs->trans("ECMNbOfDocsSmall").''; - print ' '; - print '
    '; + print ""; + print ''; + print "'; + print ''; + print "'; + print "'; + print "
    '.$langs->trans("ECMSearchByKeywords").'
    ".$langs->trans("Ref").':
    ".$langs->trans("Title").':
    ".$langs->trans("Keyword").':

    "; + //print $langs->trans("ECMManualOrgDesc"); + + print '
    '; - $var=true; - foreach ($sectionauto as $key => $val) + //print_fiche_titre($langs->trans("ECMAutoOrg")); + + print '
    '; + print ''; + print ""; + print ''; + + $buthtml=''; + $butshown=0; + foreach($sectionauto as $section) { - if ($val['test']) - { - $var=! $var; + if (! $section['test']) continue; + if ($butshown % 2 == 0) print ''; + print "'; + print ''; + print ''; + print ''; + if ($butshown % 2 == 1) print ''; + $butshown++; + } + if ($butshown % 2 == 1) print ''; + + print ''; + print "
    '.$langs->trans("ECMSearchByEntity").'
    ".$section['label'].':
      

    "; + //print $langs->trans("ECMAutoOrgDesc"); + + print '
    '; +} - print ''; - - // Section - print ''; - print img_picto('','object_dir').' '; - print ''; - print $val['label']; - print ''; - print "\n"; - - // Description - print ''.$val['desc'].''; - print '?'; - print ''; - $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
    '; - $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMAutoOrg").'
    '; - $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$langs->trans("ECMTypeAuto"); - print $form->textwithhelp('',$htmltooltip,1,0); - print ''; - print "\n"; + +if (empty($action) || $action == 'refresh') +{ + // Confirmation de la suppression d'une ligne categorie + if ($_GET['action'] == 'delete_section') + { + $form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); + print '
    '; + } + + if ($mesg) { print $mesg."
    "; } + + + // Construit liste des répertoires + print ''; + + if (sizeof($sectionauto)) + { + // Automatic sections + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $sectionauto=dol_sort_array($sectionauto,'label',$sortorder,true,false); + + $var=true; + foreach ($sectionauto as $key => $val) + { + if ($val['test']) + { + $var=! $var; + + print ''; + + // Section + print '\n"; + + // Type + print ''; + print ''; + print ''; + print "\n"; + } } } -} - - -// Manual sections - -print ''; -$param='&socid='.$socid; - -print ''; -print ''; -print ''; -print ''; -print ''; - -$ecmdirstatic = new ECMDirectory($db); -$rub=$ecmdirstatic->get_full_arbo(); - -$userstatic = new User($db); - -$nbofentries=0; -$var=true; -foreach($rub as $key => $val) -{ - $var=!$var; - - $ecmdirstatic->id=$val['id']; - $ecmdirstatic->ref=$val['label']; - - // Refresh cache - if ($_GET['action'] == 'refreshauto') + + + // Manual sections + $ecmdirstatic = new ECMDirectory($db); + $rub=$ecmdirstatic->get_full_arbo(); + + $userstatic = new User($db); + + $nbofentries=0; + $var=true; + foreach($rub as $key => $val) { - $result=$ecmdirstatic->fetch($val['id']); - $ecmdirstatic->ref=$ecmdirstatic->label; - - $result=$ecmdirstatic->refreshcachenboffile(); - $val['cachenbofdoc']=$result; + $var=!$var; + + $ecmdirstatic->id=$val['id']; + $ecmdirstatic->ref=$val['label']; + + // Refresh cache + if ($_GET['action'] == 'refreshauto') + { + $result=$ecmdirstatic->fetch($val['id']); + $ecmdirstatic->ref=$ecmdirstatic->label; + + $result=$ecmdirstatic->refreshcachenboffile(); + $val['cachenbofdoc']=$result; + } + + + print ''; + + // Section + print '\n"; + + // Description + print ''; + + // Nb of docs + //print ''; + print ''; + + print '\n"; + + $nbofentries++; } - - print ''; - - // Section - print '\n"; - - // Description - print ''; - - // Nb of docs - //print ''; - print ''; + // If nothing to show + if ($nbofentries == 0) + { + print ''; + } - print '\n"; - - $nbofentries++; + print "
    '.$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 ' '; + } + print '
    '; + print img_picto('','object_dir').' '; + print ''; + print $val['label']; + print ''; + print "'.$langs->trans('ECMTypeAuto').'?'; + $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
    '; + $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMAutoOrg").'
    '; + $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$langs->trans("ECMTypeAuto").'
    '; + $htmltooltip.=''.$langs->trans("Description").': '.$val['desc']; + print $form->textwithhelp('',$htmltooltip,1,0); + print '
    '.$langs->trans("ECMSectionManual").''.$langs->trans("Description").''.$langs->trans("ECMNbOfDocsSmall"); -print ''.img_picto($langs->trans("Refresh"),'refresh').''; -print ''; -if ($user->rights->ecm->setup) -{ - print ''.img_picto($langs->trans("ECMNewSection"),'edit_add').''; -} -else -{ - print ' '; -} -print '
    '; + print str_repeat('     ',$val['level']-1); + print $ecmdirstatic->getNomUrl(1); + print "'.$langs->trans("ECMTypeManual").''.$obj->cachenbofdoc.''.$val['cachenbofdoc'].''; + $userstatic->id=$val['fk_user_c']; + $userstatic->nom=$val['login_c']; + $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
    '; + $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMManualOrg").'
    '; + $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1).'
    '; + $htmltooltip.=''.$langs->trans("ECMCreationDate").': '.dolibarr_print_date($val['date_c'],"dayhour").'
    '; + $htmltooltip.=''.$langs->trans("Description").': '.$val['description']; + print $form->textwithhelp('',$htmltooltip,1,0); + print "
    '; - print str_repeat('     ',$val['level']-1); - print $ecmdirstatic->getNomUrl(1); - print "'.dolibarr_trunc($val['description'],48).''.$obj->cachenbofdoc.''.$val['cachenbofdoc'].'
    '.$langs->trans("ECMNoDirecotyYet").'
    '; - $userstatic->id=$val['fk_user_c']; - $userstatic->nom=$val['login_c']; - $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
    '; - $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMManualOrg").'
    '; - $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1).'
    '; - $htmltooltip.=''.$langs->trans("ECMCreationDate").': '.dolibarr_print_date($val['date_c'],"dayhour"); - print $form->textwithhelp('',$htmltooltip,1,0); - print "
    "; + // Fin de zone Ajax + } -// If nothing to show -if ($nbofentries == 0) -{ - print ''.$langs->trans("ECMNoDirecotyYet").''; -} - -print ""; -// Fin de zone Ajax - - // Actions buttons /* print '
    '; diff --git a/htdocs/ecm/pre.inc.php b/htdocs/ecm/pre.inc.php index 848db0e6538..997f19a6f46 100644 --- a/htdocs/ecm/pre.inc.php +++ b/htdocs/ecm/pre.inc.php @@ -27,7 +27,7 @@ require ("../main.inc.php"); $user->getrights('ecm'); -function llxHeader($head = "", $title="", $help_url='') +function llxHeader($head = "", $title="", $help_url='', $morehtml='') { global $conf,$langs,$user; $langs->load("ecm"); @@ -50,6 +50,6 @@ function llxHeader($head = "", $title="", $help_url='') if ($conf->commande->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsOrders"),2); if ($conf->facture->enabled) $menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsInvoices"),2); */ - left_menu($menu->liste, $help_url); + left_menu($menu->liste, $help_url, $morehtml); } ?> diff --git a/htdocs/includes/modules/modECM.class.php b/htdocs/includes/modules/modECM.class.php index 35e917e46f0..266033838c5 100644 --- a/htdocs/includes/modules/modECM.class.php +++ b/htdocs/includes/modules/modECM.class.php @@ -139,7 +139,7 @@ class modECM extends DolibarrModules // Left menu linked to top menu $this->menu[$r]=array('fk_menu'=>'r=0', 'type'=>'left', - 'titre'=>'ECMArea', + 'titre'=>'ECMFileManager', 'mainmenu'=>'ecm', 'url'=>'/ecm/index.php', 'langs'=>'ecm', diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index 2dc7150c425..fc9b422446b 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -44,4 +44,5 @@ ShowECMSection=Show directory DeleteSection=Remove directory ConfirmDeleteSection=Can you confirm you want to delete the directory %s ? ECMDirectoryForFiles=Relative directory for files -CannotRemoveDirectoryContainsFiles=Removed not possible because it contains some files \ No newline at end of file +CannotRemoveDirectoryContainsFiles=Removed not possible because it contains some files +ECMFileManager=File manager \ No newline at end of file diff --git a/htdocs/langs/fr_FR/ecm.lang b/htdocs/langs/fr_FR/ecm.lang index 6c89141d05f..21df4e9ab1e 100644 --- a/htdocs/langs/fr_FR/ecm.lang +++ b/htdocs/langs/fr_FR/ecm.lang @@ -44,4 +44,5 @@ ShowECMSection=Afficher rubrique DeleteSection=Suppression rubrique ConfirmDeleteSection=Confirmez-vous la suppression de la rubrique %s ? ECMDirectoryForFiles=Répertoire relatif pour les fichiers -CannotRemoveDirectoryContainsFiles=Suppression impossible car des fichiers sont présents \ No newline at end of file +CannotRemoveDirectoryContainsFiles=Suppression impossible car des fichiers sont présents +ECMFileManager=Gestionnaire fichier \ No newline at end of file diff --git a/htdocs/lib/treeview.lib.php b/htdocs/lib/treeview.lib.php new file mode 100644 index 00000000000..e14bc50eb35 --- /dev/null +++ b/htdocs/lib/treeview.lib.php @@ -0,0 +1,135 @@ + + * Copyright (C) 2007-2008 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/lib/treeview.lib.php + * \ingroup core + * \brief Libraries for tree views + * \version $Id$ + */ + +/** + * \brief Ad javascript tree functions + */ +function tree_addjs() +{ + print ''; +} + + +/* cette fonction gère le décallage des éléments + suivant leur position dans l'arborescence + */ +function tree_showline($tab,$rang) +{ + global $conf, $rangLast, $idLast, $menu_handler; + + if ($conf->use_javascript_ajax) + { + if($rang == $rangLast) + { + print ''; + //print 'aa'; + } + elseif($rang > $rangLast) + { + + print '
    • '; + + } + elseif($rang < $rangLast) + { + print ''; + + for($i=$rang; $i < $rangLast; $i++) + { + print '
  • '; + echo "\n"; + } + + } + } + else + { + if($rang > $rangLast) + { + + print '
    • '; + + } + elseif($rang < $rangLast) + { + + for($i=$rang; $i < $rangLast; $i++) + { + print '
  • '; + echo "\n"; + } + + } + } + + print '
  • '; + + // Content of line + print ''.$tab[2].''; + print ''; + print ''; + print ''; + print ''; + + print '
  • '; + echo "\n"; + + $rangLast = $rang; + $idLast = $tab[0]; +} + + +/*fonction récursive d'affichage de l'arbre + $tab :tableau des éléments + $pere :index de l'élément courant + $rang :décallage de l'élément + */ +function tree_recur($tab,$pere,$rang) +{ + if ($pere == 0) print '
      '; + + if ($rang > 10) return; // Protection contre boucle infinie + + //ballayage du tableau + for ($x=0;$x'; +} + +?> \ No newline at end of file