Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#9676 closed defect (bug) (fixed)

Bulk action request not properly caught

Reported by: gmpfree's profile gmpfree Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7.1
Component: Media Keywords:
Focuses: Cc:

Description

description:

the bulk action button at the bottom of Media Library is not working as intended.

symptom:

no warning alert before mass-delete & unable to mass-attach images to a post.

steps to reproduce:

  1. navigate to /wp-admin/upload.php (add ?detached=1 to test mass-attach function).
  1. use the bulk action button at the bottom of this page.
  1. "delete" will produce no alert; "attach" will only refresh the page.

Cause:

<div class="alignleft actions">
<select name="action2" class="select-action">
<option value="-1" selected="selected">Bulk Actions</option>
<option value="delete">Delete</option>
<option value="attach">Attach to a post</option>
</select>
<input type="submit" value="Apply" name="doaction2" id="doaction2" class="button-secondary action" />
</div>

select form at the bottom has name "action2", which is not caught by the following code on the same page.

(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(e){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = 'You are about to delete the selected attachments.\n  \'Cancel\' to stop, \'OK\' to delete.';
				return showNotice.warn(m);
			} else if ( $('select[name^="action"]').val() == 'attach' ) {
				e.preventDefault();
				findPosts.open();
			}
		});
	});
})(jQuery);

I haven't had the time to digg out where the code lies though.

Change History (8)

#1 @gmpfree
17 years ago

  • Severity changed from normal to minor

select form at the bottom has name "action2", which is not caught by the following code on the same page.

on a second thought, a more accurate description should be

It only caught the first select form, which has name "action".

So regardless of which submit button we use, the script only caught the value of first select form... still a defect, but minor.

#2 @Denis-de-Bernardy
17 years ago

  • Component changed from General to Media
  • Keywords needs-patch added
  • Owner anonymous deleted

#3 @hakre
17 years ago

Unable to reproduce (upload.php, action at bottom).
Unable to reproduce (upload.php?detached=1, action at bottom).

javascript is switched ON. maybe this does not work with javascript switched OFF?

#4 @hakre
17 years ago

  • Keywords needs-patch removed
  • Resolution set to worksforme
  • Status changed from new to closed

With javascrip switched OFF, there is no message. Since I think the Fallback Notice function has disappeared from ACP there is not taken care of anyway. So worksforme.

#5 @Denis-de-Bernardy
17 years ago

  • Milestone 2.8 deleted

#6 @gmpfree
17 years ago

  • Milestone set to 2.8
  • Resolution worksforme deleted
  • Severity changed from minor to normal
  • Status changed from closed to reopened
  • Version set to 2.7.1

hakre, is the first <select> set to empty when you're testing ?

look at this bit from the code I quote:

$('select[name^="action"]').val()

it will only visit the FIRST <select> element within a page (despite the careful consideration gone into catching any <select> with name="action*")

but there are TWO <select> elements on /wp-admin/upload.php, one for each apply button.

#7 @azaozz
17 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

This has been fixed in 2.8

#8 @hakre
17 years ago

My fault, I did not write clearly that I tested /reproduced (as usual these day) against 2.8 trunk.

Note: See TracTickets for help on using tickets.