dolibarr  7.0.0-beta
filemanager.tpl.php
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Output code for the filemanager
18  * $module must be defined ('ecm', 'medias', ...)
19  */
20 
21 // Protection to avoid direct call of template
22 if (empty($conf) || ! is_object($conf))
23 {
24  print "Error, template page filemanager.tpl.php can't be called as URL";
25  exit;
26 }
27 
28 ?>
29 
30 <!-- BEGIN PHP TEMPLATE core/tpl/filemanager.tpl.php -->
31 <!-- Doc of fileTree plugin at http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ -->
32 
33 <?php
34 
35 require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
36 
37 if (empty($module)) $module='ecm';
38 
39 $permtoadd = 0;
40 $permtoupload = 0;
41 if ($module == 'ecm')
42 {
43  $permtoadd = $user->rights->ecm->setup;
44  $permtoupload = $user->rights->ecm->upload;
45 }
46 if ($module == 'medias')
47 {
48  $permtoadd = ($user->rights->mailing->creer || $user->rights->website->write);
49  $permtoupload = ($user->rights->mailing->creer || $user->rights->website->write);
50 }
51 
52 
53 
54 // Confirm remove file (for non javascript users)
55 if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->use_javascript_ajax))
56 {
57  // TODO Add website, pageid, filemanager if defined
58  print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1);
59 }
60 
61 // Start container of all panels
62 ?>
63 <!-- Begin div id="containerlayout" -->
64 <div id="containerlayout">
65 <div id="ecm-layout-north" class="toolbar largebutton">
66 <?php
67 
68 // Start top panel, toolbar
69 print '<div class="inline-block toolbarbutton centpercent">';
70 
71 // Toolbar
72 //if (preg_match('/\/ecm/', $_SERVER['PHP_SELF'])) {
73 //if ($module == 'ecm') {
74 
75  if ($permtoadd)
76  {
77  print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&module='.urlencode($module).($website?'&website='.$website:'').($pageid?'&pageid='.$pageid:'').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$website.'&pageid='.$pageid).'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
78  print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
79  print '</a>';
80  }
81  else
82  {
83  print '<a href="#" class="inline-block valignmiddle toolbarbutton" title="'.$langs->trans("NotAllowed").'">';
84  print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
85  print '</a>';
86  }
87  if ($module == 'ecm')
88  {
89  $tmpurl=((! 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:'')));
90  print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
91  print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
92  print '</a>';
93  }
94 //}
95 
96 // Start "Add new file" area
97 $nameforformuserfile = 'formuserfileecm';
98 
99 print '<div class="inline-block valignmiddle floatright">';
100 
101 // To attach new file
102 if ((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section))
103 {
104  if ((empty($section) || $section == -1) && ($module != 'medias'))
105  {
106  ?>
107  <script type="text/javascript">
108  jQuery(document).ready(function() {
109  jQuery('#<?php echo $nameforformuserfile ?>').hide();
110  });
111  </script>
112  <?php
113  }
114 
115  $sectiondir=GETPOST('file','alpha');
116  print '<!-- Start form to attach new file in filemanager.tpl.php sectionid='.$section.' sectiondir='.$sectiondir.' -->'."\n";
117  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
118  $formfile=new FormFile($db);
119  $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir);
120 }
121 else print '&nbsp;';
122 
123 print '</div>';
124 // End "Add new file" area
125 
126 
127 print '</div>';
128 // End top panel, toolbar
129 
130 ?>
131 </div>
132 <div id="ecm-layout-west" class="inline-block">
133 <?php
134 // Start left area
135 
136 
137 // Confirmation de la suppression d'une ligne categorie
138 if ($action == 'delete_section')
139 {
140  print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1);
141 }
142 // End confirm
143 
144 
145 if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
146 {
147  print '<table width="100%" class="liste noborderbottom">'."\n";
148 
149  print '<!-- Title for manual directories -->'."\n";
150  print '<tr class="liste_titre">'."\n";
151  print '<th class="liste_titre" align="left" colspan="6">';
152  print '&nbsp;'.$langs->trans("ECMSections");
153  print '</th></tr>';
154 
155  $showonrightsize='';
156 
157  // Manual section
158  $htmltooltip=$langs->trans("ECMAreaDesc2");
159 
160  if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
161  {
162  print '<tr><td colspan="6">';
163 
164  // Show filemanager tree (will be filled by call of ajax enablefiletreeajax.tpl.php that execute ajaxdirtree.php)
165  print '<div id="filetree" class="ecmfiletree"></div>';
166 
167  if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
168 
169  print '</td></tr>';
170  }
171  else
172  {
173  print '<tr><td colspan="6" style="padding-left: 20px">';
174 
175  $_POST['modulepart'] = $module;
176  $_POST['openeddir'] = GETPOST('openeddir');
177  $_POST['dir'] = empty($_POST['dir'])?'/':$_POST['dir'];
178 
179  // Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show)
180  print '<div id="filetree" class="ecmfiletree">';
181 
182  $mode='noajax';
183  if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
184  include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php';
185 
186  print '</div>';
187  print '</td></tr>';
188  }
189 
190 
191  print "</table>";
192 }
193 
194 
195 // End left panel
196 ?>
197 </div>
198 <div id="ecm-layout-center" class="inline-block">
199 <div class="pane-in ecm-in-layout-center">
200 <div id="ecmfileview" class="ecmfileview">
201 <?php
202 // Start right panel
203 
204 
205 $mode='noajax';
206 if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
207 include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
208 
209 
210 // End right panel
211 ?>
212 </div>
213 </div>
214 
215 </div>
216 </div> <!-- End div id="containerlayout" -->
217 <?php
218 
219 
220 if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
221  include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php';
222 }
223 
224 ?>
225 <!-- END PHP TEMPLATE core/tpl/filemanager.tpl.php -->
if(empty($reshook)) $form
View.
Definition: perms.php:103
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to offer components to list and upload files.
print
Draft customers invoices.
Definition: index.php:91
type
Definition: viewcat.php:283