diff --git a/ChangeLog b/ChangeLog index 9499ea30dfd..886799698fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -74,6 +74,8 @@ For developers: - New: Normalize code for barcode generation to match other modules. - New: Uniformize code for contacts forms. - New: Add some hooks for financial reports. +- New: A module can add its own ECM view. +- New: A module can disable a standard ECM view. WARNING: Following change may create regression for some external modules, but was necessary to make Dolibarr better: diff --git a/htdocs/core/lib/ecm.lib.php b/htdocs/core/lib/ecm.lib.php index 6050c39da74..0652573ca37 100644 --- a/htdocs/core/lib/ecm.lib.php +++ b/htdocs/core/lib/ecm.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2014 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 @@ -23,6 +23,43 @@ */ +/** + * Prepare array with list of different ecm main dashboard + * + * @param object $object Object related to tabs + * @return array Array of tabs to shoc + */ +function ecm_prepare_dasboard_head($object) +{ + global $langs, $conf, $user; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/ecm/index.php'; + $head[$h][1] = $langs->trans("ECMSectionsManual").img_help(1,$helptext1); + $head[$h][2] = 'index'; + $h++; + + if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) + { + $head[$h][0] = DOL_URL_ROOT.'/ecm/index_auto.php'; + $head[$h][1] = $langs->trans("ECMSectionsAuto").img_help(1,$helptext2); + $head[$h][2] = 'index_auto'; + $h++; + } + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'ecm'); + + complete_head_from_modules($conf,$langs,$object,$head,$h,'ecm','remove'); + + return $head; +} + + /** * Prepare array with list of tabs * diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ff9710ae6fd..fd562fc8d15 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -581,7 +581,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename=' * @param array $links Array of tabs * @param string $active Active tab name (document', 'info', 'ldap', ....) * @param string $title Title - * @param int $notab 0=Add tab header, 1=no tab header + * @param int $notab 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required. * @param string $picto Add a picto on tab title * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @return void @@ -597,7 +597,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto * @param array $links Array of tabs * @param int $active Active tab name * @param string $title Title - * @param int $notab 0=Add tab header, 1=no tab header + * @param int $notab 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required. * @param string $picto Add a picto on tab title * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @return void @@ -4333,6 +4333,7 @@ function picto_from_langcode($codelang) * 'group' to add a tab in group view * 'member' to add a tab in fundation member view * 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member) + * 'ecm' to add a tab for another ecm view * @param string $mode 'add' to complete head, 'remove' to remove entries * @return void */ diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index 4822479e95f..3e365ba06e1 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -74,13 +74,13 @@ class modECM extends DolibarrModules // Constants $this->const = array(); // List of parameters $r=0; - + $this->const[$r][0] = "ECM_AUTO_TREE_ENABLED"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "1"; $this->const[$r][3] = 'Auto tree is enabled by default'; $this->const[$r][4] = 0; - + // Boxes $this->boxes = array(); // List of boxes $r=0; @@ -138,11 +138,12 @@ class modECM extends DolibarrModules $r++; // Left menu linked to top menu - $this->menu[$r]=array('fk_menu'=>'r=0', + $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=ecm', 'type'=>'left', 'titre'=>'ECMArea', 'mainmenu'=>'ecm', - 'url'=>'/ecm/index.php', + 'leftmenu'=>'ecm', + 'url'=>'/ecm/index.php?mainmenu=ecm&leftmenu=ecm', 'langs'=>'ecm', 'position'=>101, 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload', @@ -151,24 +152,12 @@ class modECM extends DolibarrModules 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; - $this->menu[$r]=array('fk_menu'=>'r=1', + $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm', 'type'=>'left', - 'titre'=>'ECMNewSection', + 'titre'=>'ECMSectionsManual', 'mainmenu'=>'ecm', - 'url'=>'/ecm/docdir.php?action=create', - 'langs'=>'ecm', - 'position'=>100, - 'perms'=>'$user->rights->ecm->setup', - 'enabled'=>'$user->rights->ecm->setup', - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - $r++; - - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'ECMFileManager', - 'mainmenu'=>'ecm', - 'url'=>'/ecm/index.php?action=file_manager', + 'leftmenu'=>'ecm_manual', + 'url'=>'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm', 'langs'=>'ecm', 'position'=>102, 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload', @@ -177,21 +166,18 @@ class modECM extends DolibarrModules 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; - /* - $this->menu[$r]=array('fk_menu'=>'r=1', + $this->menu[$r]=array('fk_menu'=>'fk_mainmenu=ecm,fk_leftmenu=ecm', 'type'=>'left', - 'titre'=>'Search', + 'titre'=>'ECMSectionsAuto', 'mainmenu'=>'ecm', - 'url'=>'/ecm/search.php', + 'url'=>'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm', 'langs'=>'ecm', 'position'=>103, - 'perms'=>'$user->rights->ecm->read', - 'enabled'=>'$user->rights->ecm->read', + 'perms'=>'$user->rights->ecm->read || $user->rights->ecm->upload', + 'enabled'=>'$user->rights->ecm->read || $user->rights->ecm->upload', 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - - $r++;*/ - + $r++; } /** diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 8cdcc3c2000..0ca94ef6df2 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -346,8 +346,10 @@ if ($action == 'refreshmanual') * View */ -//print "xx".$_SESSION["dol_screenheight"]; -$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 500)?($_SESSION["dol_screenheight"]-166):660; +// Define height of file area (depends on $_SESSION["dol_screenheight"]) +//print $_SESSION["dol_screenheight"]; +$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-186):660; // Also into index_auto.php file + $morejs=array(); if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs=array("/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"); $moreheadcss=" @@ -417,11 +419,19 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); +$helptext1=''; $helptext2=''; +$helptext1.=$langs->trans("ECMAreaDesc"); +$helptext1.=$langs->trans("ECMAreaDesc2"); +$helptext2.=$langs->trans("ECMAreaDesc"); +$helptext2.=$langs->trans("ECMAreaDesc2"); + +/* print '
'; print $langs->trans("ECMAreaDesc")."
"; print $langs->trans("ECMAreaDesc2")."
"; print "
\n"; print '
'; +*/ // Confirm remove file (for non javascript users) if ($action == 'delete' && empty($conf->use_javascript_ajax)) @@ -436,6 +446,13 @@ dol_htmloutput_mesg($mesg); if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden'; else $classviewhide='visible'; + +if (empty($conf->dol_use_jmobile)) +{ +$head = ecm_prepare_dasboard_head(''); +dol_fiche_head($head, 'index', '', 1, ''); +} + // Start container of all panels ?>
@@ -492,75 +509,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti print ''; $showonrightsize=''; - // Auto section - if (count($sectionauto)) - { - $htmltooltip=$langs->trans("ECMAreaDesc2"); - - // Root title line (Automatic section) - print ''; - print ''; - print ''; - print ''; - print '
'; - print img_picto_common('','treemenu/base.gif'); - print ''; - $txt=$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsAuto").')'; - print $form->textwithpicto($txt, $htmltooltip, 1, 0); - print '
'; - print ''; - print ' '; - print ' '; - print ' '; - print ' '; - print ''; - print ''; - print ''; - - $sectionauto=dol_sort_array($sectionauto,'label','ASC',true,false); - - print ''; - print ''; - print '
    '; - - $nbofentries=0; - $oldvallevel=0; - foreach ($sectionauto as $key => $val) - { - if (empty($val['test'])) continue; // If condition to show is ok - - $var=false; - - print ''; - - $nbofentries++; - } - - print '
'; - } - // Manual section $htmltooltip=$langs->trans("ECMAreaDesc2"); @@ -768,7 +716,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti } -// End left banner +// End left panel ?>
@@ -806,7 +754,7 @@ if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABL } $formfile=new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, 'formuserfile'); + $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, 'formuserfile'); } else print ' '; @@ -821,9 +769,11 @@ else print ' '; // End of page +//dol_fiche_end(); + if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { - include 'tpl/builddatabase.tpl.php'; + include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php'; } diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php new file mode 100644 index 00000000000..b2d1b7eabee --- /dev/null +++ b/htdocs/ecm/index_auto.php @@ -0,0 +1,605 @@ + + * Copyright (C) 2008-2010 Regis Houssin + * + * 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 3 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, see . + */ + +/** + * \file htdocs/ecm/index_auto.php + * \ingroup ecm + * \brief Main page for ECM section area + * \author Laurent Destailleur + */ + +if (! defined('REQUIRE_JQUERY_LAYOUT')) define('REQUIRE_JQUERY_LAYOUT','1'); +if (! defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1); + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; + +// Load traductions files +$langs->load("ecm"); +$langs->load("companies"); +$langs->load("other"); +$langs->load("users"); +$langs->load("orders"); +$langs->load("propal"); +$langs->load("bills"); +$langs->load("contracts"); + +// Security check +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'ecm', 0); + +// Get parameters +$socid=GETPOST('socid','int'); +$action=GETPOST("action"); +$section=GETPOST("section")?GETPOST("section","int"):GETPOST("section_id","int"); +$module=GETPOST("module"); +if (! $section) $section=0; +$section_dir=GETPOST('section_dir'); + +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="fullname"; +if ($module == 'invoice_supplier' && $sortfield == "fullname") $sortfield="level1name"; + +$ecmdir = new EcmDirectory($db); +if ($section) +{ + $result=$ecmdir->fetch($section); + if (! $result > 0) + { + dol_print_error($db,$ecmdir->error); + exit; + } +} + +$form=new Form($db); +$ecmdirstatic = new EcmDirectory($db); +$userstatic = new User($db); + +$error=0; + + +/* + * Actions + */ + +// Upload file +if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) +{ + // Define relativepath and upload_dir + $relativepath=''; + if ($ecmdir->id) $relativepath=$ecmdir->getRelativePath(); + else $relativepath=$section_dir; + $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; + + if (empty($_FILES['userfile']['tmp_name'])) + { + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("File")), 'errors'); + } + + if (! $error) + { + if (dol_mkdir($upload_dir) >= 0) + { + $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']); + if (is_numeric($resupload) && $resupload > 0) + { + //$mesg = '
'.$langs->trans("FileTransferComplete").'
'; + //print_r($_FILES); + $result=$ecmdir->changeNbOfFiles('+'); + } + else + { + $langs->load("errors"); + if ($resupload < 0) // Unknown error + { + setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors'); + } + else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus + { + setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors'); + } + else // Known error + { + setEventMessage($langs->trans($resupload), 'errors'); + } + } + } + else + { + $langs->load("errors"); + $mesg = '
'.$langs->trans("ErrorFailToCreateDir",$upload_dir).'
'; + } + } +} + + + +// Add directory +if ($action == 'add' && $user->rights->ecm->setup) +{ + $ecmdir->ref = 'NOTUSEDYET'; + $ecmdir->label = GETPOST("label"); + $ecmdir->description = GETPOST("desc"); + + $id = $ecmdir->create($user); + if ($id > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + $mesg='
Error '.$langs->trans($ecmdir->error).'
'; + $action = "create"; + } + + clearstatcache(); +} + +// Remove file +if ($action == 'confirm_deletefile') +{ + if (GETPOST('confirm') == 'yes') + { + $langs->load("other"); + if ($section) + { + $result=$ecmdir->fetch($section); + if (! ($result > 0)) + { + dol_print_error($db,$ecmdir->error); + exit; + } + $relativepath=$ecmdir->getRelativePath(); + } + else $relativepath=''; + $upload_dir = $conf->ecm->dir_output.($relativepath?'/'.$relativepath:''); + $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP). + + $ret=dol_delete_file($file); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + + $result=$ecmdir->changeNbOfFiles('-'); + + clearstatcache(); + } + $action='file_manager'; +} + +// Remove directory +if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') +{ + $result=$ecmdir->delete($user); + $mesg = '
'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'
'; + + clearstatcache(); +} + +// Refresh directory view +if ($action == 'refreshmanual') +{ + $ecmdirtmp = new EcmDirectory($db); + + // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate + clearstatcache(); + + $diroutputslash=str_replace('\\','/',$conf->ecm->dir_output); + $diroutputslash.='/'; + + // Scan directory tree on disk + $disktree=dol_dir_list($conf->ecm->dir_output,'directories',1,'','^temp$','','',0); + + // Scan directory tree in database + $sqltree=$ecmdirstatic->get_full_arbo(0); + + $adirwascreated=0; + + // Now we compare both trees to complete missing trees into database + //var_dump($disktree); + //var_dump($sqltree); + foreach($disktree as $dirdesc) // Loop on tree onto disk + { + $dirisindatabase=0; + foreach($sqltree as $dirsqldesc) + { + if ($conf->ecm->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname']) + { + $dirisindatabase=1; + break; + } + } + + if (! $dirisindatabase) + { + $txt="Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it"; + dol_syslog($txt); + //print $txt."
\n"; + + // We must first find the fk_parent of directory to create $dirdesc['fullname'] + $fk_parent=-1; + $relativepathmissing=str_replace($diroutputslash,'',$dirdesc['fullname']); + $relativepathtosearchparent=$relativepathmissing; + //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent); + if (preg_match('/\//',$relativepathtosearchparent)) + //while (preg_match('/\//',$relativepathtosearchparent)) + { + $relativepathtosearchparent=preg_replace('/\/[^\/]*$/','',$relativepathtosearchparent); + $txt="Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?"; + dol_syslog($txt); + //print $txt." -> "; + $parentdirisindatabase=0; + foreach($sqltree as $dirsqldesc) + { + if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent) + { + $parentdirisindatabase=$dirsqldesc['id']; + break; + } + } + if ($parentdirisindatabase > 0) + { + dol_syslog("Yes with id ".$parentdirisindatabase); + //print "Yes with id ".$parentdirisindatabase."
\n"; + $fk_parent=$parentdirisindatabase; + //break; // We found parent, we can stop the while loop + } + else + { + dol_syslog("No"); + //print "No
\n"; + } + } + else + { + dol_syslog("Parent is root"); + $fk_parent=0; // Parent is root + } + + if ($fk_parent >= 0) + { + $ecmdirtmp->ref = 'NOTUSEDYET'; + $ecmdirtmp->label = dol_basename($dirdesc['fullname']); + $ecmdirtmp->description = ''; + $ecmdirtmp->fk_parent = $fk_parent; + + $txt="We create directory ".$ecmdirtmp->label." with parent ".$fk_parent; + dol_syslog($txt); + //print $ecmdirtmp->cachenbofdoc."
\n";exit; + $id = $ecmdirtmp->create($user); + if ($id > 0) + { + $newdirsql=array('id'=>$id, + 'id_mere'=>$ecmdirtmp->fk_parent, + 'label'=>$ecmdirtmp->label, + 'description'=>$ecmdirtmp->description, + 'fullrelativename'=>$relativepathmissing); + $sqltree[]=$newdirsql; // We complete fulltree for following loops + //var_dump($sqltree); + $adirwascreated=1; + } + else + { + dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR); + } + } + else { + $txt="Parent of ".$dirdesc['fullname']." not found"; + dol_syslog($txt); + //print $txt."
\n"; + } + } + } + + // Loop now on each sql tree to check if dir exists + foreach($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk + { + $dirtotest=$conf->ecm->dir_output.'/'.$dirdesc['fullrelativename']; + if (! dol_is_dir($dirtotest)) + { + $mesg.=$dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."
\n"; + $ecmdirtmp->id=$dirdesc['id']; + $ecmdirtmp->delete($user,'databaseonly'); + //exit; + } + } + + $sql="UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown" + dol_syslog("sql = ".$sql); + $db->query($sql); + + // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean + // it to be sure that fulltree array is not used without reloading it. + if ($adirwascreated) $sqltree=null; +} + + + +/* + * View + */ + +// Define height of file area (depends on $_SESSION["dol_screenheight"]) +//print $_SESSION["dol_screenheight"]; +$maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-186):660; // Also into index.php file + +$morejs=array(); +if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs=array("/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"); +$moreheadcss=" + +"; +$moreheadjs=empty($conf->use_javascript_ajax)?"":" +"; + +llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,'',0,0); + + +// Add sections to manage +$rowspan=0; +$sectionauto=array(); +if (! empty($conf->global->ECM_AUTO_TREE_ENABLED)) +{ + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } + if (! empty($conf->societe->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } + if (! empty($conf->propal->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } + if (! empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } + if (! empty($conf->commande->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled,'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } + if (! empty($conf->facture->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } + if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } + if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } + if (! empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } + if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } +} + +print_fiche_titre($langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager")); + +$helptext1=''; $helptext2=''; +$helptext1.=$langs->trans("ECMAreaDesc"); +$helptext1.=$langs->trans("ECMAreaDesc2"); +$helptext2.=$langs->trans("ECMAreaDesc"); +$helptext2.=$langs->trans("ECMAreaDesc2"); + +/* +print '
'; +print $langs->trans("ECMAreaDesc")."
"; +print $langs->trans("ECMAreaDesc2")."
"; +print "
\n"; +print '
'; +*/ + +// Confirm remove file (for non javascript users) +if ($action == 'delete' && empty($conf->use_javascript_ajax)) +{ + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1); + +} + +dol_htmloutput_mesg($mesg); + + +if (! empty($conf->use_javascript_ajax)) $classviewhide='hidden'; +else $classviewhide='visible'; + + +if (empty($conf->dol_use_jmobile)) +{ +$head = ecm_prepare_dasboard_head(''); +dol_fiche_head($head, 'index_auto', '', 1, ''); +} + +// Start container of all panels +?> +
+
+'; + +// Toolbar +$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); +print ''; +print ''; +print ''; + +print '
'; +// End top panel, toolbar + +?> +
+
+formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); +} +// End confirm + + +if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete') +{ + print ''; + + print ''; + print ''; + + $showonrightsize=''; + // Auto section + if (count($sectionauto)) + { + $htmltooltip=$langs->trans("ECMAreaDesc2"); + + // Root title line (Automatic section) + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $sectionauto=dol_sort_array($sectionauto,'label','ASC',true,false); + + print ''; + print ''; + } + + print "
'; + print ' '.$langs->trans("ECMSections"); + print '
'; + print ''; + print ''; + print '
'; + print img_picto_common('','treemenu/base.gif'); + print ''; + $txt=$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsAuto").')'; + print $form->textwithpicto($txt, $htmltooltip, 1, 0); + print '
'; + print '
    '; + print '
'; + print '
    '; + + $nbofentries=0; + $oldvallevel=0; + foreach ($sectionauto as $key => $val) + { + if (empty($val['test'])) continue; // If condition to show is ok + + $var=false; + + print ''; + + $nbofentries++; + } + + print '
"; +} + + +// End left banner +?> +
+
+
+
+ +
+
+ +
+
+use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { + include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php'; +} + + + +llxFooter(); + +$db->close(); +?> diff --git a/htdocs/ecm/tpl/builddatabase.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php similarity index 96% rename from htdocs/ecm/tpl/builddatabase.tpl.php rename to htdocs/ecm/tpl/enablefiletreeajax.tpl.php index 1b34027142f..301fa5f955b 100644 --- a/htdocs/ecm/tpl/builddatabase.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -13,12 +13,12 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Output javascript for interactions code of ecm module */ ?> - +