Re: [Mailman-Users] default action on administrative requests

Richard and Heath,
Thank you for pointing me in the right direction. You got me to the correct file and looking at the right places. However, it wasn't at this location in the admindb.py file, but further down. Working with this part of the code:
radio = RadioButtonArray(id, (_('Defer'), _('Approve'), _('Reject'), _('Discard')), values=(mm_cfg.DEFER, mm_cfg.SUBSCRIBE, mm_cfg.REJECT, mm_cfg.DISCARD), checked=0).Format()
and setting "checked=3", did not do what I wanted.
The relevant lines of code appear to be around line 392.
Here is where I modified things:
== start code segment == # The encompassing sender table stable = Table(border=1) stable.AddRow([Center(Bold(_('From:')).Format() + esender)]) stable.AddCellInfo(stable.GetCurrentRowIndex(), 0, colspan=2) left = Table(border=0) left.AddRow([_('Action to take on all these held messages:')]) left.AddCellInfo(left.GetCurrentRowIndex(), 0, colspan=2) btns = hacky_radio_buttons( 'senderaction-' + qsender, (_('Defer'), _('Accept'), _('Reject'), _('Discard')), (mm_cfg.DEFER, mm_cfg.APPROVE, mm_cfg.REJECT, mm_cfg.DISCARD), (0, 0, 0, 1)) ### modifying line above to see if default action for "discard" is ### set here. Hal 7/30/2003 ### (1, 0, 0, 0)) == end code segment ==
As you can see, I changed the line "(1, 0, 0, 0))" to be "(0, 0, 0, 1))" and the "discard" radio button was selected as the default on the web page.
I realize this changes things for all my lists instead of just the one.
For now, that is ok since there are few lists to worry about.
I would like to request an enhancement by those who know how to develop that this feature be made available on a per list basis.
Thanks again,
Hal Huntley SRI International
On Wednesday, July 30, 2003, at 03:06 pm, Heath Raftery wrote:
Hi Hal,
On Wednesday, July 30, 2003, at 11:36 AM, Hal Huntley wrote:
I have a list that gets more spam than legit email. I would like to have the "Action to take on all these held messages" on the "admindb/<listname>" page to have a default of "discard" instead of "defer". This way I can quickly scan the "baddies" and then "submit all data" once I see they are all spam; no clicking on the "Discard" radio button.
Not a definitive answer, but I've found the following in Mailman/Mailman/Cgi/admindb.py:
radio = RadioButtonArray(id, (_('Defer'), _('Approve'), _('Reject'), _('Discard')), values=(mm_cfg.DEFER, mm_cfg.SUBSCRIBE, mm_cfg.REJECT, mm_cfg.DISCARD), checked=0).Format()
I reckon (but have not confirmed) that you could change the checked=0 bit to checked=4 for Approve checked=2 for Reject checked=3 for Discard
Not quite. The value assigned to the checked parameter is the offset of the radio button in the array which is initially checked when the form is rendered; the value is the offset in the preceding list of button names and their values. So:
checked=0 means the 'Defer' button would be checked checked=1 means the 'Approve' button would be checked checked=2 means the 'Reject' button would be checked checked=3 means the 'Discard' button would be checked
(got these values from the HTML source generated in a typical Administrative Requests page)
This seems to put a CHECKED flag in the <INPUT> tag, which I'm not actually sure is valid HTML.
It is valid HTML. CHECKED (without any value associated) is a valid attribute of an INPUT tag of TYPE="radio". It causes that radio button to be in the "on" state when the form is initially displayed.
My reading seems to suggest that a value="Yes" is required instead. If that is not visible, then the standard is unclear. One version says the user agent should select the first radio button in the group, so you may want to try rearranging the order of the buttons in the RadioButtonArray above instead.
Right now, I also wish this behavior for one list only, not as a default for all the lists that I have.
Hmm, dunno about that!
If you hack the code in the admindb.py file then the changes will affect all lists equally.
Hope that helps, tell us how you go! Heath
participants (1)
-
Hal Huntley