28if (empty($conf) || !is_object($conf)) {
29 print
"Error, template enablefiletreeajax.tpl.php can't be called as URL";
35<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->
36<!-- Doc of fileTree plugin at https:
38<script
type=
"text/javascript">
44if (empty($nameforformuserfile)) {
45 $nameforformuserfile =
'';
47$paramwithoutsection = preg_replace(
'/&?section=(\d+)/',
'', $param);
54$(document).ready(
function() {
56 $(
'#filetree').fileTree({
57 root:
'<?php print dol_escape_js($openeddir); ?>',
60 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); ?>',
65 console.log(
"We click on a file "+file);
67 loadandshowpreview(file,0);
71 id=elem.attr(
'id').substr(12);
73 console.log(
"We click on a dir id="+
id+
", we call the ajaxdirtree.php with modulepart=<?php echo $module; ?>, param=<?php echo $paramwithoutsection; ?>");
74 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);
75 jQuery(
"#<?php echo $nameforformuserfile ?>_section_dir").val(rel);
76 jQuery(
"#<?php echo $nameforformuserfile ?>_section_id").val(
id);
77 jQuery(
"#section_dir").val(rel);
78 jQuery(
"#section_id").val(
id);
79 jQuery(
"#section").val(
id);
80 jQuery(
'#<?php echo $nameforformuserfile ?>').show();
81 console.log(
"We also execute the loadandshowpreview() that is on the onclick of each li defined by ajaxdirtree");
86 $(
'#refreshbutton').click(
function() {
87 console.log(
"Click on refreshbutton");
89 dolBlockUI(
"<?php echo $langs->transnoentities('PleaseBePatient'); ?>");
91 $.get(
"<?php echo DOL_URL_ROOT.'/ecm/ajax/ecmdatabase.php'; ?>", {
93 token:
'<?php echo newToken(); ?>',
95 },
function(response) {
99 location.href=
'<?php echo $_SERVER['PHP_SELF
']; ?>';
105function loadandshowpreview(filedirname,section)
111 $(
'#ecmfileview').empty();
113 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.
"'"); ?>;
114 $.get(url,
function(data) {
116 pos=data.indexOf(
"TYPE=directory",0);
118 if ((pos > 0) && (pos < 20))
120 filediractive=filedirname;
121 filetypeactive=
'directory';
125 filediractive=filedirname;
126 filetypeactive=
'file';
128 $(
'#ecmfileview').append(data);
133<!-- 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]]]',...