The adventures of the infamous poll module continue. Since adding weighting to poll choices, two problems have cropped up regarding their display. First, if you enter a poll title, two choices, reorder the choices, then click "more choices", the order is lost. Second, if you reorder the choices and click preview, the order is both lost in the preview and in the form. Actually the form weights are still correct if you save the form, but they appear out of order because the form elements are not sorted.
We'll likely need a new sort function to sort the poll choices since this needs to be done in multiple places (in the preview and in the node form).
Related #371235: How many different ways can you sort elements by weight?, since this will add yet another sort function, though we can reuse the drupal_sort_weight() function at least in the uasort (but only after we add microweights to prevent reordering of elements with the same weight).
Comment | File | Size | Author |
---|---|---|---|
#21 | drupal.poll-choice-weight-access.21.patch | 20.71 KB | sun |
#19 | drupal.poll-choice-weight-access.19.patch | 19.77 KB | sun |
#17 | drupal.poll-choice-weight-access.17.patch | 19.77 KB | sun |
#13 | drupal.poll-choice-weight-access.13.patch | 20.23 KB | sun |
#11 | drupal.poll-choice-weight-access.11.patch | 20.23 KB | sun |
Comments
Comment #1
sunI've mixed a fix for this into #757154-36: Base form_id via hook_forms() not taken into account for #validate, #submit, hook_form_FORMID_alter()
Comment #2
sunExtracted.
Comment #3
sunReviews, tests, anyone?
This patch may be a prerequisite for aforementioned issue.
Comment #4
sunExtracting the actual bugs into required assertions:
Comment #5
sunAlright, technically this should fail.
Comment #6
sunAnd, technically, this one should pass. ;)
Comment #7
sunInteresting. The preview indeed seems to need some more work :)
Comment #9
sun#7: drupal.poll-choice-weight-access.7.patch queued for re-testing.
Comment #11
sunwow, we badly need to train people in PHP data types a bit more. :(
Comment #13
sunWeird aggregator tests.
Now someone needs to make the weights in poll previews work.
Comment #15
effulgentsia CreditAttribution: effulgentsia commented#13: drupal.poll-choice-weight-access.13.patch queued for re-testing.
Comment #17
sunComment #19
sunRe-rolled against HEAD.
Comment #21
sunThis one should pass.
Comment #22
webchickWow, that is quite a patch for such a simpleish sounding issue title. :) Could we maybe get a summary of what's going on and how we got roped into Aggregator and other things?
Comment #23
sunHeh, yarrr :)
A summary of bugs this patch fixes is in #4.
However, in order to write tests for this, I had to change the function/method signature of assertFieldByXPath() and the corresponding assertNoFieldByXPath() to accept a $value of NULL that really means NULL/nothing. Currently, the $value argument basically defaults to an empty string, but an empty string is a valid value of an input field; i.e.,
Therefore, it's impossible to actually assert an empty string as value currently. Thus, I had to update a few test assertions throughout core to not pass totally weird values for $value (such as '', FALSE, and whatnot) when they really meant to pass NULL to completely skip the additional assertion of the field/input's value.
Comment #24
webchickAh, ok. Thanks for the context. That means this involves an API change for test authors. We might not have a choice, though. Hm.
Comment #25
sun@quicksketch or anyone else: Could you review and possibly sign off this patch?
To summarize the bugs that this patch fixes once again:
1. Enter a poll title, two choices, re-order the choices, and add "more choices". The original order of choices is lost.
2. Re-order the choices and click "preview". The order is lost in the form and in the preview.
3. A user without administrative permissions should not be able to enter/alter poll vote counts in the node form. The corresponding "vote count" column should also not be visible.
as well as
4. assertFieldByXPath() and assertNoFieldByXPath() do not allow to assert a field with a value attribute of '' (empty string), which is required to make the added tests for Poll work.
Comment #26
sunmmm, if anyone would use and install Poll module, we'd see much more traction on this issue. :(
Comment #27
sunquicksketch, anyone, any feedback?
Comment #28
sunActually, if you look at the current user interface, then you see that the very basic UI of Poll module's node form is completely b0rked. This must be fixed before release, so I think that the "Release blocker" tag is justified here. (At least we talked about the idea of solidly using this tag this way; feel free to revert, please.)
Comment #29
sunI can't help. Asked several times and waited for reviews, even sent a tweet about this issue, but nothing.
Intensively and manually tested this patch myself, in addition to the automated tests that have been added.
Comment #30
webchickThanks for trying, sun. Poor, decrepit, neglected Poll module. :(
Committed to HEAD. It can't be worse than it already is. :P
Comment #31
webchickComment #32
rfayWhat's the API change here? Can you describe it? Does it need to be announced?
Comment #33
webchickI don't think so, really. It's a change to assertFieldByXPath() and assertNoFieldByXPath() signature. Only affects test authors doing weird things.