Display warning on tab close if message contents are not empty
This commit is contained in:
parent
e21c26689a
commit
77089c79ec
@ -1949,6 +1949,7 @@ function hesk_printReplyForm()
|
||||
|
||||
?></textarea>
|
||||
<div class="help-block with-errors" id="message-help-block"></div></span>
|
||||
<p id="lang_ticket_message_contents_exist" style="display: none"><?php echo $hesklang['ticket_message_contents_exist']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
@ -41,5 +41,29 @@ $(document).ready(function() {
|
||||
$('#related-tickets-link').click(function() {
|
||||
$(this).hide();
|
||||
$('.related-ticket').show();
|
||||
})
|
||||
});
|
||||
|
||||
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();
|
||||
}
|
||||
};
|
||||
});
|
@ -47,6 +47,7 @@ $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?';
|
||||
|
||||
// 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 #
|
||||
|
Loading…
x
Reference in New Issue
Block a user