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><!-- /col-container -->
</div><!-- /wrap --> </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 <?php
inline_edit_term_row('category'); inline_edit_term_row('category');

View File

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

View File

@ -338,6 +338,22 @@ if ( $page_links )
</div> </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 <?php
wp_comment_reply('-1', true, 'detail'); wp_comment_reply('-1', true, 'detail');
include('admin-footer.php'); ?> include('admin-footer.php'); ?>

View File

@ -222,8 +222,22 @@ if ( $page_links )
</div><!-- /col-container --> </div><!-- /col-container -->
</div><!-- /wrap --> </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 inline_edit_term_row('link-category'); ?>
<?php include('admin-footer.php'); ?> <?php include('admin-footer.php'); ?>

View File

@ -305,4 +305,20 @@ endif; // posts;
</div> </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'); ?> <?php include('admin-footer.php'); ?>

View File

@ -279,6 +279,23 @@ else
</div><!-- /col-container --> </div><!-- /col-container -->
</div><!-- /wrap --> </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 inline_edit_term_row('tag'); ?>
<?php <?php

View File

@ -320,4 +320,20 @@ endif; // posts;
</div> </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'); ?> <?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) ); } ); 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($) { (function($) {
$.fn.tTips = function() { $.fn.tTips = function() {

View File

@ -271,4 +271,20 @@ if ( $links ) {
</div> </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'); ?> <?php include('admin-footer.php'); ?>

View File

@ -450,21 +450,24 @@ endif; // posts;
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
jQuery(function($) { /* <![CDATA[ */
$('#doaction').click(function(e) { (function($){
if ( 'attach' == $('#posts-filter select[name="action"]').val() ) { $(document).ready(function(){
e.preventDefault(); $('#doaction, #doaction2').click(function(e){
findPosts.open(); 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.")); ?>';
$('#doaction2').click(function(e) { return showNotice.warn(m);
if ( 'attach' == $('#posts-filter select[name="action2"]').val() ) { } else if ( $('select[name^="action"]').val() == 'attach' ) {
e.preventDefault(); e.preventDefault();
findPosts.open(); findPosts.open();
} }
}); });
}); });
})(jQuery);
/* ]]> */
</script> </script>
<?php <?php
include('admin-footer.php'); include('admin-footer.php');