22 if (empty($conf) || !is_object($conf))
24 print "Error, template enablefiletreeajax.tpl.php can't be called as URL";
30 <!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
31 <!-- Doc of fileTree plugin at https:
33 <script
type=
"text/javascript">
36 if (empty($module)) $module =
'ecm';
37 $paramwithoutsection = preg_replace(
'/&?section=(\d+)/',
'', $param);
44 $(document).ready(
function() {
46 $(
'#filetree').fileTree({
47 root:
'<?php print dol_escape_js($openeddir); ?>',
50 script:
'<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?token=
'.urlencode($_SESSION['token
']).'&modulepart=
'.urlencode($module).(empty($preopened) ? '' : '&preopened=
'.urlencode($preopened)).'&openeddir=
'.urlencode($openeddir).(empty($paramwithoutsection) ? '' : $paramwithoutsection); ?>',
55 console.log(
"We click on a file");
57 loadandshowpreview(file,0);
61 id=elem.attr(
'id').substr(12);
63 console.log(
"We click on a dir, we call the ajaxdirtree.php with modulepart=<?php echo $module; ?>, param=<?php echo $paramwithoutsection; ?>");
64 console.log(
"We also save dir name or id into <?php echo $nameforformuserfile ?>_section_... with name section_... id="+
id+
" rel="+rel);
65 jQuery(
"#<?php echo $nameforformuserfile ?>_section_dir").val(rel);
66 jQuery(
"#<?php echo $nameforformuserfile ?>_section_id").val(
id);
67 jQuery(
"#section_dir").val(rel);
68 jQuery(
"#section_id").val(
id);
69 jQuery(
"#section").val(
id);
70 jQuery(
'#<?php echo $nameforformuserfile ?>').show();
71 console.log(
"We also execute the loadandshowpreview() that is on the onclick of each li defined by ajaxdirtree");
76 $(
'#refreshbutton').click(
function() {
77 console.log(
"Click on refreshbutton");
78 $.pleaseBePatient(
"<?php echo $langs->trans('PleaseBePatient'); ?>");
79 $.get(
"<?php echo DOL_URL_ROOT.'/ecm/ajax/ecmdatabase.php'; ?>", {
85 location.href=
"<?php echo $_SERVER['PHP_SELF']; ?>";
90 function loadandshowpreview(filedirname,section)
96 $(
'#ecmfileview').empty();
98 var url =
'<?php echo dol_buildpath('/core/ajax/ajaxdirpreview.php
', 1); ?>?action=preview&module=<?php echo $module; ?>§ion='+section+
'&file='+urlencode(filedirname)<?php echo (empty($paramwithoutsection) ?
'' :
"+'".$paramwithoutsection.
"'"); ?>;
99 $.get(url,
function(data) {
101 pos=data.indexOf(
"TYPE=directory",0);
103 if ((pos > 0) && (pos < 20))
105 filediractive=filedirname;
106 filetypeactive=
'directory';
110 filediractive=filedirname;
111 filetypeactive=
'file';
113 $(
'#ecmfileview').append(data);
118 <!-- END PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
print
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type