index_auto.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <?php
  2. /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2008-2010 Regis Houssin <regis.houssin@inodbox.com>
  4. * Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/ecm/index_auto.php
  21. * \ingroup ecm
  22. * \brief Main page for ECM section area
  23. */
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
  30. // Load translation files required by the page
  31. $langs->loadLangs(array("ecm", "companies", "other", "users", "orders", "propal", "bills", "contracts"));
  32. // Security check
  33. if ($user->socid) {
  34. $socid = $user->socid;
  35. }
  36. $result = restrictedArea($user, 'ecm', 0);
  37. // Get parameters
  38. $socid = GETPOST('socid', 'int');
  39. $action = GETPOST('action', 'aZ09');
  40. $section = GETPOST('section', 'int') ?GETPOST('section', 'int') : GETPOST('section_id', 'int');
  41. $module = GETPOST('module', 'alpha');
  42. if (!$section) {
  43. $section = 0;
  44. }
  45. $section_dir = GETPOST('section_dir', 'alpha');
  46. $search_doc_ref = GETPOST('search_doc_ref', 'alpha');
  47. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  48. $sortfield = GETPOST('sortfield', 'aZ09comma');
  49. $sortorder = GETPOST('sortorder', 'aZ09comma');
  50. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  51. if (empty($page) || $page == -1) {
  52. $page = 0;
  53. } // If $page is not defined, or '' or -1
  54. $offset = $limit * $page;
  55. $pageprev = $page - 1;
  56. $pagenext = $page + 1;
  57. if (!$sortorder) {
  58. $sortorder = "ASC";
  59. }
  60. if (!$sortfield) {
  61. $sortfield = "fullname";
  62. }
  63. if ($module == 'invoice_supplier' && $sortfield == "fullname") {
  64. $sortfield = "level1name";
  65. }
  66. $ecmdir = new EcmDirectory($db);
  67. if ($section) {
  68. $result = $ecmdir->fetch($section);
  69. if (!$result > 0) {
  70. dol_print_error($db, $ecmdir->error);
  71. exit;
  72. }
  73. }
  74. $form = new Form($db);
  75. $ecmdirstatic = new EcmDirectory($db);
  76. $userstatic = new User($db);
  77. $error = 0;
  78. /*
  79. * Actions
  80. */
  81. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  82. $hookmanager->initHooks(array('ecmautocard', 'globalcard'));
  83. // Purge search criteria
  84. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
  85. $search_doc_ref = '';
  86. }
  87. // Add directory
  88. if ($action == 'add' && $user->rights->ecm->setup) {
  89. $ecmdir->ref = 'NOTUSEDYET';
  90. $ecmdir->label = GETPOST("label");
  91. $ecmdir->description = GETPOST("desc");
  92. $id = $ecmdir->create($user);
  93. if ($id > 0) {
  94. header("Location: ".$_SERVER["PHP_SELF"]);
  95. exit;
  96. } else {
  97. setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors');
  98. $action = "create";
  99. }
  100. clearstatcache();
  101. }
  102. // Remove file
  103. if ($action == 'confirm_deletefile') {
  104. if (GETPOST('confirm') == 'yes') {
  105. $langs->load("other");
  106. if ($section) {
  107. $result = $ecmdir->fetch($section);
  108. if (!($result > 0)) {
  109. dol_print_error($db, $ecmdir->error);
  110. exit;
  111. }
  112. $relativepath = $ecmdir->getRelativePath();
  113. } else {
  114. $relativepath = '';
  115. }
  116. $upload_dir = $conf->ecm->dir_output.($relativepath ? '/'.$relativepath : '');
  117. $file = $upload_dir."/".GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP).
  118. $ret = dol_delete_file($file);
  119. if ($ret) {
  120. setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
  121. } else {
  122. setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
  123. }
  124. $result = $ecmdir->changeNbOfFiles('-');
  125. clearstatcache();
  126. }
  127. $action = 'file_manager';
  128. }
  129. // Remove directory
  130. if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') {
  131. $result = $ecmdir->delete($user);
  132. setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
  133. clearstatcache();
  134. }
  135. // Refresh directory view
  136. // This refresh list of dirs, not list of files (for preformance reason). List of files is refresh only if dir was not synchronized.
  137. // To refresh content of dir with cache, just open the dir in edit mode.
  138. if ($action == 'refreshmanual') {
  139. $ecmdirtmp = new EcmDirectory($db);
  140. // This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate
  141. clearstatcache();
  142. $diroutputslash = str_replace('\\', '/', $conf->ecm->dir_output);
  143. $diroutputslash .= '/';
  144. // Scan directory tree on disk
  145. $disktree = dol_dir_list($conf->ecm->dir_output, 'directories', 1, '', '^temp$', '', '', 0);
  146. // Scan directory tree in database
  147. $sqltree = $ecmdirstatic->get_full_arbo(0);
  148. $adirwascreated = 0;
  149. // Now we compare both trees to complete missing trees into database
  150. //var_dump($disktree);
  151. //var_dump($sqltree);
  152. foreach ($disktree as $dirdesc) { // Loop on tree onto disk
  153. $dirisindatabase = 0;
  154. foreach ($sqltree as $dirsqldesc) {
  155. if ($conf->ecm->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname']) {
  156. $dirisindatabase = 1;
  157. break;
  158. }
  159. }
  160. if (!$dirisindatabase) {
  161. $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
  162. dol_syslog($txt);
  163. //print $txt."<br>\n";
  164. // We must first find the fk_parent of directory to create $dirdesc['fullname']
  165. $fk_parent = -1;
  166. $relativepathmissing = str_replace($diroutputslash, '', $dirdesc['fullname']);
  167. $relativepathtosearchparent = $relativepathmissing;
  168. //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent);
  169. if (preg_match('/\//', $relativepathtosearchparent)) {
  170. //while (preg_match('/\//',$relativepathtosearchparent))
  171. $relativepathtosearchparent = preg_replace('/\/[^\/]*$/', '', $relativepathtosearchparent);
  172. $txt = "Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?";
  173. dol_syslog($txt);
  174. //print $txt." -> ";
  175. $parentdirisindatabase = 0;
  176. foreach ($sqltree as $dirsqldesc) {
  177. if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent) {
  178. $parentdirisindatabase = $dirsqldesc['id'];
  179. break;
  180. }
  181. }
  182. if ($parentdirisindatabase > 0) {
  183. dol_syslog("Yes with id ".$parentdirisindatabase);
  184. //print "Yes with id ".$parentdirisindatabase."<br>\n";
  185. $fk_parent = $parentdirisindatabase;
  186. //break; // We found parent, we can stop the while loop
  187. } else {
  188. dol_syslog("No");
  189. //print "No<br>\n";
  190. }
  191. } else {
  192. dol_syslog("Parent is root");
  193. $fk_parent = 0; // Parent is root
  194. }
  195. if ($fk_parent >= 0) {
  196. $ecmdirtmp->ref = 'NOTUSEDYET';
  197. $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
  198. $ecmdirtmp->description = '';
  199. $ecmdirtmp->fk_parent = $fk_parent;
  200. $txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
  201. dol_syslog($txt);
  202. //print $ecmdirtmp->cachenbofdoc."<br>\n";exit;
  203. $id = $ecmdirtmp->create($user);
  204. if ($id > 0) {
  205. $newdirsql = array('id'=>$id,
  206. 'id_mere'=>$ecmdirtmp->fk_parent,
  207. 'label'=>$ecmdirtmp->label,
  208. 'description'=>$ecmdirtmp->description,
  209. 'fullrelativename'=>$relativepathmissing);
  210. $sqltree[] = $newdirsql; // We complete fulltree for following loops
  211. //var_dump($sqltree);
  212. $adirwascreated = 1;
  213. } else {
  214. dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
  215. }
  216. } else {
  217. $txt = "Parent of ".$dirdesc['fullname']." not found";
  218. dol_syslog($txt);
  219. //print $txt."<br>\n";
  220. }
  221. }
  222. }
  223. // Loop now on each sql tree to check if dir exists
  224. foreach ($sqltree as $dirdesc) { // Loop on each sqltree to check dir is on disk
  225. $dirtotest = $conf->ecm->dir_output.'/'.$dirdesc['fullrelativename'];
  226. if (!dol_is_dir($dirtotest)) {
  227. $ecmdirtmp->id = $dirdesc['id'];
  228. $ecmdirtmp->delete($user, 'databaseonly');
  229. //exit;
  230. }
  231. }
  232. $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown"
  233. dol_syslog("sql = ".$sql);
  234. $db->query($sql);
  235. // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean
  236. // it to be sure that fulltree array is not used without reloading it.
  237. if ($adirwascreated) {
  238. $sqltree = null;
  239. }
  240. }
  241. /*
  242. * View
  243. */
  244. // Define height of file area (depends on $_SESSION["dol_screenheight"])
  245. //print $_SESSION["dol_screenheight"];
  246. $maxheightwin = (isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466) ? ($_SESSION["dol_screenheight"] - 136) : 660; // Also into index.php file
  247. $moreheadcss = '';
  248. $moreheadjs = '';
  249. //$morejs=array();
  250. $morejs = array('includes/jquery/plugins/blockUI/jquery.blockUI.js', 'core/js/blockUI.js'); // Used by ecm/tpl/enabledfiletreeajax.tpl.pgp
  251. if (empty($conf->global->MAIN_ECM_DISABLE_JS)) {
  252. $morejs[] = "includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js";
  253. }
  254. $moreheadjs .= '<script type="text/javascript">'."\n";
  255. $moreheadjs .= 'var indicatorBlockUI = \''.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'\';'."\n";
  256. $moreheadjs .= '</script>'."\n";
  257. llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $morejs, '', 0, 0);
  258. // Add sections to manage
  259. $rowspan = 0;
  260. $sectionauto = array();
  261. if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
  262. if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
  263. $langs->load("products");
  264. $rowspan++; $sectionauto[] = array('position'=>10, 'level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts"));
  265. }
  266. if (!empty($conf->societe->enabled)) {
  267. $rowspan++; $sectionauto[] = array('position'=>20, 'level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties")));
  268. }
  269. if (!empty($conf->propal->enabled)) {
  270. $rowspan++; $sectionauto[] = array('position'=>30, 'level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals")));
  271. }
  272. if (!empty($conf->contrat->enabled)) {
  273. $rowspan++; $sectionauto[] = array('position'=>40, 'level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts")));
  274. }
  275. if (!empty($conf->commande->enabled)) {
  276. $rowspan++; $sectionauto[] = array('position'=>50, 'level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
  277. }
  278. if (!empty($conf->facture->enabled)) {
  279. $rowspan++; $sectionauto[] = array('position'=>60, 'level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
  280. }
  281. if (!empty($conf->supplier_proposal->enabled)) {
  282. $langs->load("supplier_proposal");
  283. $rowspan++; $sectionauto[] = array('position'=>70, 'level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
  284. }
  285. if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) {
  286. $rowspan++; $sectionauto[] = array('position'=>80, 'level'=>1, 'module'=>'order_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
  287. }
  288. if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) {
  289. $rowspan++; $sectionauto[] = array('position'=>90, 'level'=>1, 'module'=>'invoice_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
  290. }
  291. if (!empty($conf->tax->enabled)) {
  292. $langs->load("compta");
  293. $rowspan++; $sectionauto[] = array('position'=>100, 'level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
  294. $rowspan++; $sectionauto[] = array('position'=>110, 'level'=>1, 'module'=>'tax-vat', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("VAT"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("VAT")));
  295. }
  296. if (!empty($conf->salaries->enabled)) {
  297. $langs->load("compta");
  298. $rowspan++; $sectionauto[] = array('position'=>120, 'level'=>1, 'module'=>'salaries', 'test'=>$conf->salaries->enabled, 'label'=>$langs->trans("Salaries"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Salaries")));
  299. }
  300. if (!empty($conf->projet->enabled)) {
  301. $rowspan++; $sectionauto[] = array('position'=>130, 'level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
  302. $rowspan++; $sectionauto[] = array('position'=>140, 'level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
  303. }
  304. if (!empty($conf->ficheinter->enabled)) {
  305. $langs->load("interventions");
  306. $rowspan++; $sectionauto[] = array('position'=>150, 'level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
  307. }
  308. if (!empty($conf->expensereport->enabled)) {
  309. $langs->load("trips");
  310. $rowspan++; $sectionauto[] = array('position'=>160, 'level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports")));
  311. }
  312. if (!empty($conf->holiday->enabled)) {
  313. $langs->load("holiday");
  314. $rowspan++; $sectionauto[] = array('position'=>170, 'level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays")));
  315. }
  316. if (!empty($conf->banque->enabled)) {
  317. $langs->load("banks");
  318. $rowspan++; $sectionauto[] = array('position'=>180, 'level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
  319. $rowspan++; $sectionauto[] = array('position'=>190, 'level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
  320. }
  321. if (!empty($conf->mrp->enabled)) {
  322. $langs->load("mrp");
  323. $rowspan++; $sectionauto[] = array('position'=>200, 'level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
  324. }
  325. if (!empty($conf->recruitment->enabled)) {
  326. $langs->load("recruitment");
  327. $rowspan++; $sectionauto[] = array('position'=>210, 'level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications")));
  328. }
  329. $rowspan++; $sectionauto[] = array('position'=>220, 'level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
  330. $parameters = array();
  331. $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
  332. if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
  333. $sectionauto[] = $hookmanager->resArray;
  334. $rowspan += count($hookmanager->resArray);
  335. }
  336. }
  337. $head = ecm_prepare_dasboard_head('');
  338. print dol_get_fiche_head($head, 'index_auto', '', -1, '');
  339. // Confirm remove file (for non javascript users)
  340. if ($action == 'deletefile' && empty($conf->use_javascript_ajax)) {
  341. print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1);
  342. }
  343. // Start container of all panels
  344. ?>
  345. <!-- Begin div id="containerlayout" -->
  346. <div id="containerlayout">
  347. <div id="ecm-layout-north" class="toolbar largebutton">
  348. <?php
  349. // Start top panel, toolbar
  350. print '<div class="inline-block toolbarbutton centpercent">';
  351. // Toolbar
  352. $url = ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&amp;module='.$module : '').($section ? '&amp;section='.$section : '')));
  353. print '<a href="'.$url.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">';
  354. print img_picto('', 'refresh', 'id="refreshbutton"', false, 0, 0, '', 'size15x marginrightonly');
  355. print '</a>';
  356. print '</div>';
  357. // End top panel, toolbar
  358. ?>
  359. </div>
  360. <div id="ecm-layout-west" class="inline-block">
  361. <?php
  362. // Start left area
  363. // Confirmation de la suppression d'une ligne categorie
  364. if ($action == 'delete_section') {
  365. print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1);
  366. }
  367. // End confirm
  368. if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'deletefile') {
  369. print '<table class="liste centpercent">'."\n";
  370. print '<!-- Title for auto directories -->'."\n";
  371. print '<tr class="liste_titre">'."\n";
  372. print '<th class="liste_titre" align="left" colspan="6">';
  373. print '&nbsp;'.$langs->trans("ECMSections");
  374. print '</th></tr>';
  375. $showonrightsize = '';
  376. // Auto section
  377. if (count($sectionauto)) {
  378. $htmltooltip = $langs->trans("ECMAreaDesc2");
  379. $sectionauto = dol_sort_array($sectionauto, 'label', 'ASC', true, false);
  380. print '<tr>';
  381. print '<td colspan="6">';
  382. print '<div id="filetreeauto" class="ecmfiletree"><ul class="ecmjqft">';
  383. $nbofentries = 0;
  384. $oldvallevel = 0;
  385. foreach ($sectionauto as $key => $val) {
  386. if (empty($val['test'])) {
  387. continue; // If condition to show the ECM auto directory is ok
  388. }
  389. print '<li class="directory collapsed">';
  390. if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
  391. print '<a class="fmdirlia jqft ecmjqft" href="'.$_SERVER["PHP_SELF"].'?module='.urlencode($val['module']).'">';
  392. print $val['label'];
  393. print '</a>';
  394. } else {
  395. print '<a class="fmdirlia jqft ecmjqft" href="'.$_SERVER["PHP_SELF"].'?module='.urlencode($val['module']).'">';
  396. print $val['label'];
  397. print '</a>';
  398. }
  399. print '<div class="ecmjqft">';
  400. // Info
  401. $htmltooltip = '<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
  402. $htmltooltip .= '<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionAuto").'<br>';
  403. $htmltooltip .= '<b>'.$langs->trans("ECMCreationUser").'</b>: '.$langs->trans("ECMTypeAuto").'<br>';
  404. $htmltooltip .= '<b>'.$langs->trans("Description").'</b>: '.$val['desc'];
  405. print $form->textwithpicto('', $htmltooltip, 1, 'info');
  406. print '</div>';
  407. print '</li>';
  408. $nbofentries++;
  409. }
  410. print '</ul></div></td></tr>';
  411. }
  412. print "</table>";
  413. }
  414. // End left panel
  415. ?>
  416. </div>
  417. <div id="ecm-layout-center" class="inline-block">
  418. <div class="pane-in ecm-in-layout-center">
  419. <div id="ecmfileview" class="ecmfileview">
  420. <?php
  421. // Start right panel
  422. $mode = 'noajax';
  423. $url = DOL_URL_ROOT.'/ecm/index_auto.php';
  424. include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
  425. // End right panel
  426. ?>
  427. </div>
  428. </div>
  429. </div>
  430. </div> <!-- End div id="containerlayout" -->
  431. <?php
  432. // End of page
  433. if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
  434. include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php';
  435. }
  436. print dol_get_fiche_end();
  437. llxFooter();
  438. $db->close();