30@phan-var-force string $param
34 print
"Error, template enablefiletreeajax.tpl.php can't be called as URL";
40<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
41<!-- Doc of fileTree plugin at https:
43<script
type=
"text/javascript">
49if (empty($nameforformuserfile)) {
50 $nameforformuserfile =
'';
52$paramwithoutsection = preg_replace(
'/&?section=(\d+)/',
'', $param);
59$(document).ready(
function() {
61 $(
'#filetree').fileTree({
62 root:
'<?php print dol_escape_js($openeddir); ?>',
65 script:
'<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?token=
'.currentToken().'&modulepart=
'.urlencode($module).(empty($preopened) ? '' : '&preopened=
'.urlencode($preopened)).'&openeddir=
'.urlencode($openeddir).(empty($paramwithoutsection) ? '' : $paramwithoutsection); ?>',
70 console.log(
"We click on a file "+file);
72 loadandshowpreview(file,0);
76 id=elem.attr(
'id').substr(12);
78 console.log(
"We click on a dir id="+
id+
", we call the ajaxdirtree.php with modulepart=<?php echo $module; ?>, param=<?php echo $paramwithoutsection; ?>");
79 console.log(
"We also save id and dir name into <?php echo $nameforformuserfile ?>_section_id|dir (vars into form to attach new file in filemanager.tpl.php) with id="+
id+
" and rel="+rel);
80 jQuery(
"#<?php echo $nameforformuserfile ?>_section_dir").val(rel);
81 jQuery(
"#<?php echo $nameforformuserfile ?>_section_id").val(
id);
82 jQuery(
"#section_dir").val(rel);
83 jQuery(
"#section_id").val(
id);
84 jQuery(
"#section").val(
id);
85 jQuery(
'#<?php echo $nameforformuserfile ?>').show();
86 console.log(
"We also execute the loadandshowpreview() that is on the onclick of each li defined by ajaxdirtree");
91 $(
'#refreshbutton').click(
function() {
92 console.log(
"Click on refreshbutton");
94 dolBlockUI(
"<?php echo $langs->transnoentities('PleaseBePatient'); ?>");
96 $.get(
"<?php echo DOL_URL_ROOT.'/ecm/ajax/ecmdatabase.php'; ?>", {
98 token:
'<?php echo newToken(); ?>',
100 },
function(response) {
104 location.href=
'<?php echo $_SERVER['PHP_SELF
']; ?>';
110function loadandshowpreview(filedirname,section)
116 $(
'#ecmfileview').empty();
118 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.
"'"); ?>;
119 $.get(url,
function(data) {
121 pos=data.indexOf(
"TYPE=directory",0);
123 if ((pos > 0) && (pos < 20))
125 filediractive=filedirname;
126 filetypeactive=
'directory';
130 filediractive=filedirname;
131 filetypeactive=
'file';
133 $(
'#ecmfileview').append(data);
138<!-- END PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...