diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php
index af3c8346..c3144151 100644
--- a/admin/admin_ticket.php
+++ b/admin/admin_ticket.php
@@ -1501,14 +1501,19 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1)
$options = $reply ? '' : '
';
// Resend email notification
+ $replyDataAttribute = '';
if ($reply) {
- $options .= '
-
- ';
+ $replyDataAttribute = 'data-reply-id="' . $reply['id'] . '"';
}
+ $options .= '
+
+ ' . $hesklang['email_notification_sent'] . '
+ ' . $hesklang['email_notification_resend_failed'] . '
+ ';
+
/* Edit post */
if ($can_edit) {
$tmp = $reply ? '&reply=' . $reply['id'] : '';
diff --git a/internal-api/js/admin-ticket.js b/internal-api/js/admin-ticket.js
index 7749ee04..4c654f13 100644
--- a/internal-api/js/admin-ticket.js
+++ b/internal-api/js/admin-ticket.js
@@ -49,42 +49,26 @@ $(document).ready(function() {
var ticketId = $this.data('ticket-id');
var replyId = $this.data('reply-id');
var heskUrl = $('span#heskUrl').text();
- var apiUrl = heskUrl + '/api/v1-internal/staff/tickets/' + ticketId + '/resend-email?replyId=' + replyId;
+ var apiUrl = heskUrl + '/api/v1-internal/staff/tickets/' + ticketId + '/resend-email';
+ if (replyId !== undefined) {
+ apiUrl += '?replyId=' + replyId;
+ }
+
+ $this.attr('disabled', true);
$.ajax({
method: 'GET',
url: apiUrl,
headers: { 'X-Internal-Call': true },
success: function() {
- $.jGrowl("Email notification sent!", { theme: 'alert-success', closeTemplate: '' });
+ $.jGrowl($('#lang_email_notification_sent').text(), { theme: 'alert-success', closeTemplate: '' });
},
error: function() {
- $.jGrowl("Error occurred when trying to send notification email", { theme: 'alert-danger', closeTemplate: '' });
+ $.jGrowl($('#lang_email_notification_resend_failed').text(), { theme: 'alert-danger', closeTemplate: '' });
+ },
+ complete: function() {
+ $this.attr('disabled', false);
}
});
});
-
- window.onbeforeunload = function (e) {
- e = e || window.event;
-
- var plaintextEditorHasContents = $('textarea[name="message"]').val() !== '';
- var htmlEditorHasContents = false;
-
- if (tinymce.get("message") !== undefined) {
- plaintextEditorHasContents = false;
- htmlEditorHasContents = tinymce.get("message").getContent() !== '';
- }
-
- if (plaintextEditorHasContents || htmlEditorHasContents) {
- var $langText = $('#lang_ticket_message_contents_exist');
-
- // For IE and Firefox prior to version 4
- if (e) {
- e.returnValue = $langText.text();
- }
-
- // For Safari
- return $langText.text();
- }
- };
});
\ No newline at end of file
diff --git a/language/en/text.php b/language/en/text.php
index d8a6a7ac..75a716f3 100644
--- a/language/en/text.php
+++ b/language/en/text.php
@@ -48,6 +48,9 @@ $hesklang['EMAIL_HR']='------ Reply above this line ------';
// ADDED OR MODIFIED IN Mods for HESK 3.1.0
$hesklang['stack_trace_header'] = 'Stack Trace';
$hesklang['ticket_message_contents_exist'] = 'The ticket message is not empty. Are you sure you want to leave this page?';
+$hesklang['resend_email_notification'] = 'Re-send Email Notification';
+$hesklang['email_notification_sent'] = 'Email notification sent!';
+$hesklang['email_notification_resend_failed'] = 'Error occurred when trying to send notification email.';
// ADDED OR MODIFIED IN Mods for HESK 3.0.0
$hesklang['you_have_x_messages'] = 'You have %s new %s'; // %s: Number of new messages, "message" or "messages", depending on #