dolibarr  16.0.5
fileupload_view.tpl.php
1 <?php
2 /* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
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 <https://www.gnu.org/licenses/>.
16  */
17 
18 // Protection to avoid direct call of template
19 if (empty($conf) || !is_object($conf)) {
20  print "Error, template page can't be called as URL";
21  exit;
22 }
23 
24 ?>
25 
26 <!-- START TEMPLATE FILE UPLOAD -->
27 
28 <!-- The file upload form used as target for the file upload widget -->
29 <form id="fileupload" action="<?php echo DOL_URL_ROOT; ?>/core/ajax/fileupload.php" method="POST" enctype="multipart/form-data">
30 <input type="hidden" name="fk_element" value="<?php echo $object->id; ?>">
31 <input type="hidden" name="element" value="<?php echo $object->element; ?>">
32 <input type="hidden" name="redirect" value="<?php echo $_SERVER['PHP_SELF'].'?id='.$object->id; ?>">
33 <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
34 <div class="row fileupload-buttonbar">
35  <div class="span7">
36  <!-- The fileinput-button span is used to style the file input field as button -->
37  <span class="btn btn-success fileinput-button">
38  <i class="icon-plus icon-white"></i>
39  <span><?php echo $langs->trans('AddFiles'); ?></span>
40  <?php
41  $maxfilesizearray = getMaxFileSizeArray();
42  $maxmin = $maxfilesizearray['maxmin'];
43  if ($maxmin > 0) {
44  print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
45  }
46  ?>
47  <input type="file" name="files[]" multiple>
48  </span>
49  <button type="submit" class="btn btn-primary start">
50  <i class="icon-upload icon-white"></i>
51  <span><?php echo $langs->trans('StartUpload'); ?></span>
52  </button>
53  <button type="reset" class="btn btn-warning cancel">
54  <i class="icon-ban-circle icon-white"></i>
55  <span><?php echo $langs->trans('CancelUpload'); ?></span>
56  </button>
57  <!--
58  <button type="button" class="btn btn-danger delete">
59  <i class="icon-trash icon-white"></i>
60  <span><?php echo $langs->trans('Delete'); ?></span>
61  </button>
62  <input type="checkbox" class="toggle">
63  -->
64  </div>
65  <!-- The global progress information -->
66  <div class="span5 fileupload-progress fade">
67  <!-- The global progress bar -->
68  <!--
69  <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
70  <div class="bar" style="width:0%;"></div>
71  </div>
72  -->
73  <!-- The extended global progress information -->
74  <div class="progress-extended">&nbsp;</div>
75  </div>
76 </div>
77 <!-- The loading indicator is shown during file processing -->
78 <div class="fileupload-loading"></div>
79 <br>
80 <!-- The table listing the files available for upload/download -->
81 <table role="presentation" class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
82 </form>
83 
84 <!-- The template to display files available for upload -->
85 <!-- Warning id on script is not W3C compliant and is reported as error by phpcs but it is required by fileupload plugin -->
86 <script id="template-upload" type="text/x-tmpl">
87 {% for (var i=0, file; file=o.files[i]; i++) { %}
88  <tr class="template-upload fade">
89  <td class="preview"><span class="fade"></span></td>
90  <td class="name"><span>{%=file.name%}</span></td>
91  <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
92  {% if (file.error) { %}
93  <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
94  {% } else if (o.files.valid && !i) { %}
95  <td>
96  <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
97  </td>
98  <td class="start">{% if (!o.options.autoUpload) { %}
99  <button class="btn btn-primary">
100  <i class="icon-upload icon-white"></i>
101  <span>{%=locale.fileupload.start%}</span>
102  </button>
103  {% } %}</td>
104  {% } else { %}
105  <td colspan="2"></td>
106  {% } %}
107  <td class="cancel">{% if (!i) { %}
108  <button class="btn btn-warning">
109  <i class="icon-ban-circle icon-white"></i>
110  <span>{%=locale.fileupload.cancel%}</span>
111  </button>
112  {% } %}</td>
113  </tr>
114 {% } %}
115 </script>
116 <!-- The template to display files available for download -->
117 <!-- Warning id on script is not W3C compliant and is reported as error by phpcs but it is required by jfilepload plugin -->
118 <script id="template-download" type="text/x-tmpl">
119 {% for (var i=0, file; file=o.files[i]; i++) { %}
120  <tr class="template-download fade">
121  {% if (file.error) { %}
122  <td></td>
123  <td class="name"><span>{%=file.name%}</span></td>
124  <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
125  <td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
126  {% } else { %}
127  <td class="preview">{% if (file.thumbnail_url) { %}
128  <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
129  {% } %}</td>
130  <td class="name">
131  <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
132  </td>
133  <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
134  <td colspan="2"></td>
135  {% } %}
136  <td class="delete">
137  <button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
138  <i class="icon-trash icon-white"></i>
139  <span>{%=locale.fileupload.destroy%}</span>
140  </button>
141  <input type="checkbox" name="delete" value="1">
142  </td>
143  </tr>
144 {% } %}
145 </script>
146 <br>
147 <!-- END PHP TEMPLATE -->
name
$conf db name
Definition: repair.php:122
getMaxFileSizeArray
getMaxFileSizeArray()
Return the max allowed for file upload.
Definition: security.lib.php:993
start
padding inline start
Definition: style.css.php:726
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119