-
-
@@ -204,6 +208,23 @@ function output_attachment_id_holder_container($id) {
echo '
';
}
+function build_dropzone_markup($id = 'filedrop') {
+ global $hesklang, $hesk_settings;
+
+ echo '
+
+ ';
+ for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) {
+ $cls = ($i == 1 && in_array('attachments', $_SESSION['iserror'])) ? ' class="isError" ' : '';
+ echo '
';
+ }
+ echo '
+
+
+
'. $hesklang['ful'] . '';
+}
+
function display_dropzone_field($url, $id = 'filedrop') {
global $hesk_settings, $hesklang;
@@ -225,18 +246,40 @@ function display_dropzone_field($url, $id = 'filedrop') {
// Add the database id to the file
file['databaseId'] = response;
});
+ this.on('addedfile', function() {
+ var numberOfFiles = $('#" . $id . " .file-row').length;
+
+ var disabled = false;
+ if (numberOfFiles >= " . $max_files . ") {
+ disabled = true;
+ }
+ $('." . $id . "-button').attr('disabled', disabled);
+ });
this.on('removedfile', function(file) {
// Remove the attachment from the database and the filesystem.
removeAttachment(file['databaseId']);
+
+ var numberOfFiles = $('#" . $id . " .file-row').length;
+
+ var disabled = false;
+ if (numberOfFiles >= " . $max_files . ") {
+ disabled = true;
+ }
+ $('." . $id . "-button').attr('disabled', disabled);
});
- this.on('queuecomplete', function(progress) {
+ this.on('complete', function(file) {
// Stop animating if complete.
- $('#total-progress').removeClass('active');
+ $(file.previewTemplate).find('#total-progress').removeClass('active');
+ });
+ this.on('queuecomplete', function() {
$('input[type=\"submit\"]').attr('disabled', false);
});
this.on('processing', function() {
$('input[type=\"submit\"]').attr('disabled', true);
});
+ this.on('uploadprogress', function(file, percentage) {
+ $(file.previewTemplate).find('#percentage').text(percentage + '%');
+ });
},
paramName: 'attachment',
url: '" . $url . "',
@@ -253,7 +296,8 @@ function display_dropzone_field($url, $id = 'filedrop') {
dictCancelUpload: ".json_encode($hesklang['attachment_cancel']).",
dictCancelUploadConfirmation: ".json_encode($hesklang['attachment_confirm_cancel']).",
dictRemoveFile: ".json_encode($hesklang['attachment_remove']).",
- previewTemplate: $('#previews').html()
+ previewTemplate: $('#previews').html(),
+ clickable: '.fileinput-button'
};
";
diff --git a/index.php b/index.php
index 90d99636..9ed243b7 100644
--- a/index.php
+++ b/index.php
@@ -979,20 +979,7 @@ function print_add_ticket()
:
Add File';
// ADDED OR MODIFIED IN Mods for HESK 2.5.2
$hesklang['manage_statuses'] = 'Manage Statuses';
diff --git a/ticket.php b/ticket.php
index 6d4ab56c..75149564 100644
--- a/ticket.php
+++ b/ticket.php
@@ -654,20 +654,7 @@ function hesk_printCustomerReplyForm($reopen = 0)
: