mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 17:05:50 +02:00
7ecbf49ac9
git-svn-id: http://svn.silverstripe.com/projects/ss2doc/branches/v2@117896 467b73ca-7a2a-4603-9d3b-597d59a354a9
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
(function($) {
|
|
|
|
$('#Form_DeleteFileForm_action_delete').click(function(e) {
|
|
var deleteMessage = ss.i18n._t('FILEIFRAMEFIELD.CONFIRMDELETE', 'Are you sure you want to delete this file?');
|
|
|
|
if(typeof(parent.jQuery.fn.dialog) != 'undefined') {
|
|
var buttons = {};
|
|
var $dialog = undefined;
|
|
var $deleteForm = $('#Form_DeleteFileForm');
|
|
var $deleteFile = $('#Form_DeleteFileForm_DeleteFile');
|
|
|
|
buttons[ss.i18n._t('FILEIFRAMEFIELD.DELETEFILE', 'Delete File')] = function() {
|
|
$deleteFile.attr('value', 'true');
|
|
$deleteForm.submit();
|
|
|
|
$dialog.dialog('close');
|
|
};
|
|
|
|
buttons[ss.i18n._t('FILEIFRAMEFIELD.UNATTACHFILE', 'Un-Attach File')] = function() {
|
|
$deleteForm.submit();
|
|
$dialog.dialog('close');
|
|
};
|
|
|
|
buttons[ss.i18n._t('CANCEL', 'Cancel')] = function() {
|
|
$dialog.dialog('close');
|
|
};
|
|
|
|
$dialog = parent.jQuery('<p><span class="ui-icon ui-icon-alert" style="float:left;margin-right:5px;"></span>' + deleteMessage + '</p>').dialog({
|
|
bgiframe: true,
|
|
resizable: false,
|
|
modal: true,
|
|
height: 140,
|
|
overlay: {
|
|
backgroundColor: '#000',
|
|
opacity: 0.5
|
|
},
|
|
title: ss.i18n._t('FILEIFRAMEFIELD.DELETEIMAGE', 'Delete Image'),
|
|
buttons: buttons
|
|
});
|
|
|
|
e.preventDefault();
|
|
} else if(!confirm(deleteMessage)) {
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
|
|
})(jQuery); |