dolibarr  7.0.0-beta
fileupload_main.tpl.php
1 <?php
2 /* Copyright (C) 2011-2013 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 MAIN -->
28 <script type="text/javascript">
29 window.locale = {
30  "fileupload": {
31  "errors": {
32  "maxFileSize": "<?php echo $langs->trans('FileIsTooBig'); ?>",
33  "minFileSize": "<?php echo $langs->trans('FileIsTooSmall'); ?>",
34  "acceptFileTypes": "<?php echo $langs->trans('FileTypeNotAllowed'); ?>",
35  "maxNumberOfFiles": "<?php echo $langs->trans('MaxNumberOfFilesExceeded'); ?>",
36  "uploadedBytes": "<?php echo $langs->trans('UploadedBytesExceedFileSize'); ?>",
37  "emptyResult": "<?php echo $langs->trans('EmptyFileUploadResult'); ?>"
38  },
39  "error": "<?php echo $langs->trans('Error'); ?>",
40  "start": "<?php echo $langs->trans('Start'); ?>",
41  "cancel": "<?php echo $langs->trans('Cancel'); ?>",
42  "destroy": "<?php echo $langs->trans('Delete'); ?>"
43  }
44 };
45 
46 $(function () {
47  'use strict';
48 
49  // Initialize the jQuery File Upload widget:
50  $('#fileupload').fileupload();
51 
52  // Events
53  $('#fileupload').fileupload({
54  stop: function (e, data) {
55  location.href='<?php echo dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]); ?>';
56  },
57  destroy: function (e, data) {
58  var that = $(this).data('fileupload');
59  $( "#confirm-delete" ).dialog({
60  resizable: false,
61  width: 400,
62  modal: true,
63  buttons: {
64  "<?php echo $langs->trans('Ok'); ?>": function() {
65  $( "#confirm-delete" ).dialog( "close" );
66  if (data.url) {
67  $.ajax(data)
68  .success(function (data) {
69  if (data) {
70  that._adjustMaxNumberOfFiles(1);
71  $(this).fadeOut(function () {
72  $(this).remove();
73  $.jnotify("<?php echo $langs->trans('FileIsDelete'); ?>");
74  });
75  } else {
76  $.jnotify("<?php echo $langs->trans('ErrorFileNotDeleted'); ?>", "error", true);
77  }
78  });
79  } else {
80  data.context.fadeOut(function () {
81  $(this).remove();
82  });
83  }
84  },
85  "<?php echo $langs->trans('Cancel'); ?>": function() {
86  $( "#confirm-delete" ).dialog( "close" );
87  }
88  }
89  });
90  }
91  });
92 });
93 </script>
94 <!-- END TEMPLATE FILE UPLOAD MAIN -->
print
Draft customers invoices.
Definition: index.php:91
type
Definition: viewcat.php:283