use array instead of hash for radio button group#13
use array instead of hash for radio button group#13meeg wants to merge 3 commits intoericvaandering:masterfrom
Conversation
On any of the administration pages with new/delete/modify radio buttons (e.g. AdministerForm), our DocDB installation (DocDB 8.8.6) orders the radio buttons randomly. I don't think this can be intended behavior, and AuthorAdminDisable.js expects a consistent ordering of [new, delete, modify]. I think this is a bug in the AdministerActions method of AdministerElements.pm, which exists in trunk as well as in 8.8.6. The button names are stored in a hash when an array is appropriate. This commit fixes the bug.
|
Thanks. I wonder why we've never encountered this before. Maybe different versions of CGI.pm? |
|
Good thought. I agree it would be hard to miss this behavior, so it must be somehow environment-dependent. We're running on a Raspberry Pi with Raspbian Jessie, CGI.pm version 4.09-1. I found this, which seems relevant: leejo/CGI.pm#196. I have zero Perl experience, much less CGI.pm, but it sounds like my problem pops up when you have a "recent perl version" (whatever that means) and CGI.pm < 4.26, and have not set the CGI.pm flag that forces sorting. So I guess DocDB could set that flag, though I do think using an array is the correct way to go. |
|
Agree - this is not purely a UI annoyance. Because of the interaction between the CGI-generated web page and the JavaScript, this breaks various forms, including the "Administer Events" page you're using and whatever I was doing 5 years ago that uses AuthorAdminDisable.js. I should have flagged that more prominently. Thanks for confirming that I'm not alone. |
|
Note that PR #98 also mentions this bug/patch. |
marcmengel
left a comment
There was a problem hiding this comment.
Shouldn't line 41 here be :
unshift(@Action, "Transfer");
then, to keep Action an array?
|
Thanks, makes sense, good catch! I cherry-picked your commit back into my tree. |
|
Mmmh, there seems to be a problem with the patch suggested by @marcmengel: at least on my site, it breaks the "User Administration" form (EmailAdministerForm). If I apply that change, two things happens:
Does that happen to you too? Any idea about how to fix that? I guess some other script needs to be modified to use array instead of hash (but I'm no Perl expert). For the moment, I have reverted the last patch. |
|
I'm not currently running a DocDB instance (that was 6 years ago . . .) so I can't test, but -
So . . . my hope is that using I wonder whether the AdminDisable.js scripts need to be rewritten to be aware of the element names, and maybe also to handle the "transfer" option, but that is way over my head, my Javascript knowledge is no better than my Perl (zero!). |
nope: doing so will cause an error, and the page will not work at all... (maybe using "shift" would requires a different syntax) |
|
Sorry sorry, I misread the Perl docs. |
OK, with (*) at least, from a very quick test. I'll let you know in case some problem or other unexpected behavior will be discovered. |
|
I dropped the ball here, but have now updated my fork to use |
Various EGI-related patches or fixes that didn't reach upstream's master: * Add lock images to show login status * Fix syntax See also ericvaandering#116 * Display a permalink * Import legacy fix for a division by zero * Import fix for issue with radio buttons on admin page See also ericvaandering#13 * Add legacy EGI customisation relating to X.509 usage * Import legacy EGI customisation
On any of the administration pages with new/delete/modify radio buttons (e.g. AdministerForm), our DocDB installation (DocDB 8.8.6) orders the radio buttons randomly. I don't think this can be intended behavior, and AuthorAdminDisable.js expects a consistent ordering of [new, delete, modify].
I think this is a bug in the AdministerActions method of AdministerElements.pm, which exists in trunk as well as in 8.8.6. The button names are stored in a hash when an array is appropriate. This commit fixes the bug.