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