24 print
"Error, template enablefiletreeajax.tpl.php can't be called as URL";
31<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
32<!-- Doc of fileTree plugin at https:
34<script
type=
"text/javascript">
40if (empty($nameforformuserfile)) {
41 $nameforformuserfile =
'';
43$paramwithoutsection = preg_replace(
'/&?section=(\d+)/',
'', $param);
50$(document).ready(
function() {
52 $(
'#filetree').fileTree({
53 root:
'<?php print dol_escape_js($openeddir); ?>',
56 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); ?>',
61 console.log(
"We click on a file "+file);
63 loadandshowpreview(file,0);
67 id=elem.attr(
'id').substr(12);
69 console.log(
"We click on a dir id="+
id+
", we call the ajaxdirtree.php with modulepart=<?php echo $module; ?>, param=<?php echo $paramwithoutsection; ?>");
70 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);
71 jQuery(
"#<?php echo $nameforformuserfile ?>_section_dir").val(rel);
72 jQuery(
"#<?php echo $nameforformuserfile ?>_section_id").val(
id);
73 jQuery(
"#section_dir").val(rel);
74 jQuery(
"#section_id").val(
id);
75 jQuery(
"#section").val(
id);
76 jQuery(
'#<?php echo $nameforformuserfile ?>').show();
77 console.log(
"We also execute the loadandshowpreview() that is on the onclick of each li defined by ajaxdirtree");
82 $(
'#refreshbutton').click(
function() {
83 console.log(
"Click on refreshbutton");
84 $.pleaseBePatient(
"<?php echo $langs->trans('PleaseBePatient'); ?>");
85 $.get(
"<?php echo DOL_URL_ROOT.'/ecm/ajax/ecmdatabase.php'; ?>", {
87 token:
'<?php echo newToken(); ?>',
92 location.href=
'<?php echo $_SERVER['PHP_SELF
']; ?>';
97function loadandshowpreview(filedirname,section)
103 $(
'#ecmfileview').empty();
105 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.
"'"); ?>;
106 $.get(url,
function(data) {
108 pos=data.indexOf(
"TYPE=directory",0);
110 if ((pos > 0) && (pos < 20))
112 filediractive=filedirname;
113 filetypeactive=
'directory';
117 filediractive=filedirname;
118 filetypeactive=
'file';
120 $(
'#ecmfileview').append(data);
125<!-- END PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type