Confirm image delete with jQuery UI modal dialog.
Added config option for jQuery delete as well.
This commit is contained in:
parent
80ff538b73
commit
eb5ff191c6
@ -98,6 +98,7 @@ class ImageIO extends SimpleExtension {
|
|||||||
$config->set_default_string('thumb_convert_path', 'convert.exe');
|
$config->set_default_string('thumb_convert_path', 'convert.exe');
|
||||||
|
|
||||||
$config->set_default_bool('image_show_meta', false);
|
$config->set_default_bool('image_show_meta', false);
|
||||||
|
$config->set_default_bool('jquery_confirm', true);
|
||||||
$config->set_default_string('image_ilink', '');
|
$config->set_default_string('image_ilink', '');
|
||||||
$config->set_default_string('image_tlink', '');
|
$config->set_default_string('image_tlink', '');
|
||||||
$config->set_default_string('image_tip', '$tags // $size // $filesize');
|
$config->set_default_string('image_tip', '$tags // $size // $filesize');
|
||||||
@ -170,6 +171,7 @@ class ImageIO extends SimpleExtension {
|
|||||||
if(!in_array("OS", $_SERVER) || $_SERVER["OS"] != 'Windows_NT') {
|
if(!in_array("OS", $_SERVER) || $_SERVER["OS"] != 'Windows_NT') {
|
||||||
$sb->add_bool_option("image_show_meta", "<br>Show metadata: ");
|
$sb->add_bool_option("image_show_meta", "<br>Show metadata: ");
|
||||||
}
|
}
|
||||||
|
$sb->add_bool_option("jquery_confirm", "<br>Confirm Delete with jQuery: ");
|
||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
|
|
||||||
$thumbers = array();
|
$thumbers = array();
|
||||||
|
@ -8,14 +8,25 @@ class ImageIOTheme {
|
|||||||
*/
|
*/
|
||||||
public function get_deleter_html($image_id) {
|
public function get_deleter_html($image_id) {
|
||||||
global $user;
|
global $user;
|
||||||
|
global $config;
|
||||||
|
|
||||||
$i_image_id = int_escape($image_id);
|
$i_image_id = int_escape($image_id);
|
||||||
$html = "
|
|
||||||
".make_form(make_link("image_admin/delete"),'POST',false,'delete_image')."
|
if($config->get_bool("jquery_confirm")) {
|
||||||
<input type='hidden' name='image_id' value='$i_image_id'>
|
$html = "
|
||||||
<input type='submit' value='Delete' onclick='return confirm(\"Delete the image?\");'>
|
".make_form(make_link("image_admin/delete"),'POST',false,'delete_image')."
|
||||||
</form>
|
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||||
";
|
<input type='submit' value='Delete' id='delete_image_submit' />
|
||||||
|
</form>
|
||||||
|
";
|
||||||
|
} else {
|
||||||
|
$html = "
|
||||||
|
".make_form(make_link("image_admin/delete"))."
|
||||||
|
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||||
|
<input type='submit' value='Delete' onclick='return confirm(\"Delete the image?\");' />
|
||||||
|
</form>
|
||||||
|
";
|
||||||
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,33 @@
|
|||||||
|
|
||||||
|
// Adding jQuery ui stuff
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var $confirm = $('<div id="dialog-confirm"></div>')
|
||||||
|
.html('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>This image will be permanently deleted and cannot be recovered. Are you sure?</p>')
|
||||||
|
.dialog({
|
||||||
|
resizable: false,
|
||||||
|
height:220,
|
||||||
|
modal: true,
|
||||||
|
autoOpen: false,
|
||||||
|
title: 'Delete Image?',
|
||||||
|
buttons: {
|
||||||
|
"Delete Image": function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
$('form#delete_image').submit();
|
||||||
|
},
|
||||||
|
Cancel: function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('form#delete_image #delete_image_submit').click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
$confirm.dialog('open');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
var defaultTexts = new Array();
|
var defaultTexts = new Array();
|
||||||
|
|
||||||
window.onload = function(e) {
|
window.onload = function(e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user