Fix delete warnings for categories, link categories, tags and comments, fixes #9050

git-svn-id: http://svn.automattic.com/wordpress/trunk@10522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-02-07 15:26:01 +00:00
parent a4df9a5326
commit 515b09febb
8 changed files with 39 additions and 21 deletions

View File

@ -123,7 +123,7 @@ function _cat_row( $category, $level, $name_override = false ) {
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
if ( $default_cat_id != $category->term_id ) if ( $default_cat_id != $category->term_id )
$actions['delete'] = "<a class='delete:the-list:cat-$category->term_id submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $actions['delete'] = "<a class='delete:the-list:cat-$category->term_id submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "'>" . __('Delete') . "</a>";
$action_count = count($actions); $action_count = count($actions);
$i = 0; $i = 0;
$edit .= '<div class="row-actions">'; $edit .= '<div class="row-actions">';
@ -293,7 +293,7 @@ function link_cat_row( $category, $name_override = false ) {
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
if ( $default_cat_id != $category->term_id ) if ( $default_cat_id != $category->term_id )
$actions['delete'] = "<a class='delete:the-list:link-cat-$category->term_id submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $actions['delete'] = "<a class='delete:the-list:link-cat-$category->term_id submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "'>" . __('Delete') . "</a>";
$action_count = count($actions); $action_count = count($actions);
$i = 0; $i = 0;
$edit .= '<div class="row-actions">'; $edit .= '<div class="row-actions">';
@ -622,7 +622,7 @@ function _tag_row( $tag, $class = '', $taxonomy = 'post_tag' ) {
$actions = array(); $actions = array();
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
$actions['delete'] = "<a class='delete:the-list:tag-$tag->term_id submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n 'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; $actions['delete'] = "<a class='delete:the-list:tag-$tag->term_id submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
$action_count = count($actions); $action_count = count($actions);
$i = 0; $i = 0;
$out .= '<div class="row-actions">'; $out .= '<div class="row-actions">';

View File

@ -1,5 +1,5 @@
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
var options = false, addAfter, addAfter2, delAfter; var options = false, addAfter, addAfter2, delBefore, delAfter;
if ( document.forms['addcat'].category_parent ) if ( document.forms['addcat'].category_parent )
options = document.forms['addcat'].category_parent.options; options = document.forms['addcat'].category_parent.options;
@ -26,9 +26,17 @@ jQuery(document).ready(function($) {
options[o] = null; options[o] = null;
} }
if ( options ) delBefore = function(s) {
$('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } ); if ( 'undefined' != showNotice )
else return showNotice.warn() ? s : false;
$('#the-list').wpList({ addAfter: addAfter2 });
return s;
}
if ( options )
$('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } );
else
$('#the-list').wpList({ addAfter: addAfter2, delBefore: delBefore });
$('.delete a[class^="delete"]').click(function(){return false;});
}); });

View File

@ -1 +1 @@
jQuery(document).ready(function(c){var b=false,e,d,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}e=function(h,g){var f,i;f=c("<span>"+c("name",h).text()+"</span>").html();i=c("cat",h).attr("id");b[b.length]=new Option(f,i);d(h,g)};d=function(f,h){var g=c(h.parsed.responses[0].data);if(g.length==1){inlineEditTax.addEvents(c(g.id))}};a=function(g,f){var i=c("cat",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};if(b){c("#the-list").wpList({addAfter:e,delAfter:a})}else{c("#the-list").wpList({addAfter:d})}}); jQuery(document).ready(function(d){var b=false,f,e,c,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}f=function(i,h){var g,j;g=d("<span>"+d("name",i).text()+"</span>").html();j=d("cat",i).attr("id");b[b.length]=new Option(g,j);e(i,h)};e=function(g,i){var h=d(i.parsed.responses[0].data);if(h.length==1){inlineEditTax.addEvents(d(h.id))}};a=function(h,g){var j=d("cat",h).attr("id"),i;for(i=0;i<b.length;i++){if(j==b[i].value){b[i]=null}}};c=function(g){if("undefined"!=showNotice){return showNotice.warn()?g:false}return g};if(b){d("#the-list").wpList({addAfter:f,delBefore:c,delAfter:a})}else{d("#the-list").wpList({addAfter:e,delBefore:c})}d('.delete a[class^="delete"]').click(function(){return false})});

View File

@ -37,6 +37,10 @@ setCommentsList = function() {
settings.data._per_page = perPageInput.val(); settings.data._per_page = perPageInput.val();
settings.data._page = pageInput.val(); settings.data._page = pageInput.val();
settings.data._url = document.location.href; settings.data._url = document.location.href;
if ( 'undefined' != showNotice )
return showNotice.warn() ? settings : false;
return settings; return settings;
}; };
@ -128,10 +132,6 @@ setCommentsList = function() {
}; };
$(document).ready(function(){
setCommentsList();
});
commentReply = { commentReply = {
init : function() { init : function() {
@ -346,7 +346,9 @@ commentReply = {
$(document).ready(function(){ $(document).ready(function(){
var make_hotkeys_redirect, edit_comment, toggle_all, make_bulk; var make_hotkeys_redirect, edit_comment, toggle_all, make_bulk;
setCommentsList();
commentReply.init(); commentReply.init();
$('.delete a[class^="delete"]').click(function(){return false;});
if ( typeof QTags != 'undefined' ) if ( typeof QTags != 'undefined' )
ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more'); ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
var options = false, addAfter, addAfter2, delAfter; var options = false, addAfter, addAfter2, delBefore, delAfter;
addAfter = function( r, settings ) { addAfter = function( r, settings ) {
var name = $("<span>" + $('name', r).text() + "</span>").html(), id = $('tag', r).attr('id'); var name = $("<span>" + $('name', r).text() + "</span>").html(), id = $('tag', r).attr('id');
@ -19,9 +19,17 @@ jQuery(document).ready(function($) {
options[o] = null; options[o] = null;
} }
if ( options ) delBefore = function(s) {
$('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } ); if ( 'undefined' != showNotice )
else return showNotice.warn() ? s : false;
$('#the-list').wpList({ addAfter: addAfter2 });
return s;
}
if ( options )
$('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } );
else
$('#the-list').wpList({ addAfter: addAfter2, delBefore: delBefore });
$('.delete a[class^="delete"]').click(function(){return false;});
}); });

View File

@ -1 +1 @@
jQuery(document).ready(function(c){var b=false,e,d,a;e=function(h,g){var f=c("<span>"+c("name",h).text()+"</span>").html(),i=c("tag",h).attr("id");b[b.length]=new Option(f,i)};d=function(f,h){var g=c(h.parsed.responses[0].data);if(g.length==1){inlineEditTax.addEvents(c(g.id))}};a=function(g,f){var i=c("tag",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};if(b){c("#the-list").wpList({addAfter:e,delAfter:a})}else{c("#the-list").wpList({addAfter:d})}}); jQuery(document).ready(function(d){var b=false,f,e,c,a;f=function(i,h){var g=d("<span>"+d("name",i).text()+"</span>").html(),j=d("tag",i).attr("id");b[b.length]=new Option(g,j)};e=function(g,i){var h=d(i.parsed.responses[0].data);if(h.length==1){inlineEditTax.addEvents(d(h.id))}};a=function(h,g){var j=d("tag",h).attr("id"),i;for(i=0;i<b.length;i++){if(j==b[i].value){b[i]=null}}};c=function(g){if("undefined"!=showNotice){return showNotice.warn()?g:false}return g};if(b){d("#the-list").wpList({addAfter:f,delBefore:c,delAfter:a})}else{d("#the-list").wpList({addAfter:e,delBefore:c})}d('.delete a[class^="delete"]').click(function(){return false})});

View File

@ -205,10 +205,10 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};' 'l10n_print_after' => 'try{convertEntities(catL10n);}catch(e){};'
) ); ) );
$scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090102' ); $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), '20090207' );
$scripts->add_data( 'admin-categories', 'group', 1 ); $scripts->add_data( 'admin-categories', 'group', 1 );
$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090102' ); $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('wp-lists'), '20090207' );
$scripts->add_data( 'admin-tags', 'group', 1 ); $scripts->add_data( 'admin-tags', 'group', 1 );
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' ); $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
@ -225,7 +225,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
) ); ) );
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090112' ); $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090207' );
$scripts->add_data( 'admin-comments', 'group', 1 ); $scripts->add_data( 'admin-comments', 'group', 1 );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array( $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),