Display warning when bulk deleting posts, pages, attachments, comments, etc.

git-svn-id: http://svn.automattic.com/wordpress/trunk@9560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-11-07 03:13:50 +00:00
parent e662d424f3
commit 73959104bc
10 changed files with 153 additions and 16 deletions

View File

@ -289,6 +289,22 @@ if ( $page_links )
</div><!-- /col-container -->
</div><!-- /wrap -->
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var n = $('#the-list input[type="checkbox"]:checked').length;
var m = n > 1 ? '<?php echo js_escape(__("You are about to delete the selected categories.\n 'Cancel' to stop, 'OK' to delete.")); ?>' : '<?php echo js_escape(__("You are about to delete the selected category.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php
inline_edit_term_row('category');

View File

@ -1,7 +1,15 @@
.find-box-search {
background-color: #e4f2fd;
border-color: #c6d9e9;
border-color: #dfdfdf;
background-color: #f1f1f1;
}
.find-box {
background-color: #f1f1f1;
}
.find-box-inside {
background-color: #fff;
}
a.page-numbers:hover {
@ -10,8 +18,7 @@ a.page-numbers:hover {
body,
#wpbody,
.form-table .pre,
.find-box-inside {
.form-table .pre {
color: #333;
}
@ -1021,8 +1028,7 @@ div.star.select:hover {
background-color: #d00;
}
#plugin-information .fyi ul,
.find-box {
#plugin-information .fyi ul {
background-color: #eaf3fa;
}

View File

@ -338,6 +338,22 @@ if ( $page_links )
</div>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var n = $('#the-comment-list input[type="checkbox"]:checked').length;
var m = n > 1 ? '<?php echo js_escape(__("You are about to delete the selected comments.\n 'Cancel' to stop, 'OK' to delete.")); ?>' : '<?php echo js_escape(__("You are about to delete the selected comment.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php
wp_comment_reply('-1', true, 'detail');
include('admin-footer.php'); ?>

View File

@ -222,8 +222,22 @@ if ( $page_links )
</div><!-- /col-container -->
</div><!-- /wrap -->
</div>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var n = $('#the-list input[type="checkbox"]:checked').length;
var m = n > 1 ? '<?php echo js_escape(__("You are about to delete the selected link categories.\n 'Cancel' to stop, 'OK' to delete.")); ?>' : '<?php echo js_escape(__("You are about to delete the selected link category.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php inline_edit_term_row('link-category'); ?>
<?php include('admin-footer.php'); ?>

View File

@ -305,4 +305,20 @@ endif; // posts;
</div>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var n = $('table.post input[type="checkbox"]:checked').length;
var m = n > 1 ? '<?php echo js_escape(__("You are about to delete the selected pages.\n 'Cancel' to stop, 'OK' to delete.")); ?>' : '<?php echo js_escape(__("You are about to delete the selected page.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php include('admin-footer.php'); ?>

View File

@ -279,6 +279,23 @@ else
</div><!-- /col-container -->
</div><!-- /wrap -->
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var n = $('#the-list input[type="checkbox"]:checked').length;
var m = n > 1 ? '<?php echo js_escape(__("You are about to delete the selected tags.\n 'Cancel' to stop, 'OK' to delete.")); ?>' : '<?php echo js_escape(__("You are about to delete the selected tag.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php inline_edit_term_row('tag'); ?>
<?php

View File

@ -320,4 +320,20 @@ endif; // posts;
</div>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var n = $('table.post input[type="checkbox"]:checked').length;
var m = n > 1 ? '<?php echo js_escape(__("You are about to delete the selected posts.\n 'Cancel' to stop, 'OK' to delete.")); ?>' : '<?php echo js_escape(__("You are about to delete the selected post.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php include('admin-footer.php'); ?>

View File

@ -11,6 +11,23 @@ jQuery(document).ready( function() {
jQuery('form.validate').submit( function() { return wpAjax.validateForm( jQuery(this) ); } );
}
});
// stub for doing better warnings
(function($){
showNotice = {
warn : function(text) {
if ( confirm(text) )
return true;
return false;
},
note : function(text) {
alert(text);
}
}
})(jQuery);
/*
(function($) {
$.fn.tTips = function() {

View File

@ -271,4 +271,20 @@ if ( $links ) {
</div>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var n = $('table.widefat input[type="checkbox"]:checked').length;
var m = n > 1 ? '<?php echo js_escape(__("You are about to delete the selected links.\n 'Cancel' to stop, 'OK' to delete.")); ?>' : '<?php echo js_escape(__("You are about to delete the selected link.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php include('admin-footer.php'); ?>

View File

@ -450,21 +450,24 @@ endif; // posts;
</div>
<script type="text/javascript">
jQuery(function($) {
$('#doaction').click(function(e) {
if ( 'attach' == $('#posts-filter select[name="action"]').val() ) {
e.preventDefault();
findPosts.open();
}
});
$('#doaction2').click(function(e) {
if ( 'attach' == $('#posts-filter select[name="action2"]').val() ) {
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(e){
if ( $('select[name^="action"]').val() == 'delete' ) {
var n = $('#the-list input[type="checkbox"]:checked').length;
var m = n > 1 ? '<?php echo js_escape(__("You are about to delete the selected attachments.\n 'Cancel' to stop, 'OK' to delete.")); ?>' : '<?php echo js_escape(__("You are about to delete the selected attachment.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
} else if ( $('select[name^="action"]').val() == 'attach' ) {
e.preventDefault();
findPosts.open();
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php
include('admin-footer.php');