It'd be nice to fix the UI on the node/N/signups admin pages so that instead of a big pile of individual "Cancel signup" buttons, we just had a column of checkboxes and a single button to cancel those signups (probably with a confirm form).

Comments

dww’s picture

Title: Remove pile of "Cancel signup" buttons and use checkboxes for node/N/signups admin pages » Remove pile of broken "Cancel signup" buttons and use checkboxes for node/N/signups admin pages
Category: feature » bug

Due to some errors during FAPI3 conversion, this "pile" of cancel buttons doesn't even work right. See #333446: "Cancel signup" buttons do not work properly on node/N/signups admin pages which I'm marking duplicate with this.

scottrigby’s picture

Ok great to hear that checkboxes are an intended part of the fix for the broken buttons issue :) that would be a sweet additional feature.

Is it just me, or does this also relate to #166619: expose form elements as views "fields" ?
If the form elements were 'viewable' then this checkbox feature could be configured using Views, views bulk operations, etc ;)

dww’s picture

Assigned: Unassigned » dww
Status: Active » Needs review
StatusFileSize
new9.56 KB

This seems to do the trick, although it's slightly weird in a few ways:

A) The confirm form is a little funky. It asks "Are you sure you want to cancel signups for these users?", and the button is "Cancel all signups" and the cancel link says "Cancel operation". ;) Not sure how to best word a confirm form if the action you're trying to confirm is something called "cancel"...

B) As a hold-over from how the rest of the code is organized, the node/N/signups page is still 3 distinct forms. That makes the confirm form also a little weird, since you still see the "Signup summary" fieldset at the top of the page, and the "Sign up another user" fieldset below. I should probably be redirecting to another page for the confirm form, now that I think about it.

C) I'm not sure the best way to propagate the table header from the form builder where it's used by tablesort_sql() to the theme function where the table is rendered. I tried sticking it in a '#type' == 'hidden' form element, but that couldn't handle an array. So, I'm using '#type' == 'value'. I don't know if there's a way to do it via form_state, since it doesn't appear that form theme functions get $form_state passed in.

D) They way I have to handle identifying anonymous signups seems a bit like a hack. It'd be nice if a single checkbox could have multiple keys, but it appears that this "__anon:" thing is about the best way I know of to let a single checkbox represent either an authenticated user (where the key is their uid) or an anonymous signup (using "__anon:[anon_mail]" for the key).

dww’s picture

- Rerolled after #333259: Rename signup_admin_node_form to signup_node_admin_summary_form
- Based on feedback in IRC, fixed (A) by calling the cancel link "Keep signups".
- (B), (C), and (D) are still not fixed.

(B) could be solved by either:
B.1) redirecting to another page for the confirm form (maybe)
B.2) merging the other forms into a single form for all of node/N/signups

I took a stab at B.2 and I'm not sure if that's better or not. ;) I'm going to await feedback from chx before I go much further here.

dww’s picture

Oh, and @scottrigby: I don't see how #166619: expose form elements as views "fields" can help us here, especially if we're doing this bulk cancel confirm form stuff. I could be wrong, but it seems like we really need to solve this with "native" FAPI code for now, and then work on exposing various form elements to views2 later on.

dww’s picture

StatusFileSize
new10.58 KB

Here's the (B.1) solution of redirecting to another page for the confirm form. Seems to work pretty well without too much additional complication.

dww’s picture

Bah, except #6 kind of breaks things if you just click the "Cancel signups" button without selecting anyone. You hit the form validation code as expected, but then you're on node/N/signups/confirm and the rest of the page has disappeared. :(

scottrigby’s picture

@dww re: #5 - You may be right about the order of things (probably don't want Signup's admin pages to be dependent on Views and Views Bulk Operations) - but we could optionally use Views Bulk Operations for bulk canceling, just as you already offer optional views for admin and user signup screens? Views Bulk Operations by default has a confirmation screen on all bulk operations (which you can optionally circumvent as well #329009: Is there an option to skip the "confirm" step? ).

Anyway, I see & agree with your point about solving this with FAPI first -- (though it would be great to offer the Views / VBO option after :)

dww’s picture

StatusFileSize
new11.46 KB

More thorough solution for redirecting to another page for the confirm form. Now it's just a totally separate form. The first form stashes the selected users into SESSION and redirects to node/N/signups/confirm. That page is only the confirm form, and it redirects back to node/N/signups when you submit it. So, (B) is solved. Not sure about (C) and (D), but those are just aesthetics of the code, not actual functionality problems. This definitely needs review (and testing) now. Thanks.

scottrigby’s picture

dww, tested with current dev version (from today) and this works great! Had to run update.php and then works like a charm ;)
only really tested this functionality though, and not site-wide comprehensive testing -- will report back if any issues, but good so far!

dww’s picture

Minor cosmetic changes to the code for HEAD, and a backport to DRUPAL-5--2. The cancel buttons aren't actually broken in 5.x-2.*, but I like this new UI so much better, I wanted to include it in 5.x-2.6. ;)

dww’s picture

Fixes (C) from comment #3 by stashing the header in $form['#header'], which is propagated nicely to the theme function and this way, none of that shows up as form values. Thanks for the suggestion, chx. ;)

dww’s picture

Status: Needs review » Fixed

Decided my solution for (D) from #3 is good enough. There might be another way using type == 'checkbox', an #anon field, and a bunch of other effort, but this works as-is, and isn't that terrible. ;) Committed to HEAD and DRUPAL-5--2.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.