Active
Project:
Country Ban
Version:
6.x-1.0
Component:
User interface
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
11 Oct 2010 at 14:37 UTC
Updated:
18 Oct 2012 at 17:43 UTC
Some form theming would make the admin page a lot easier on the eye -- make one row per country and put the radio buttons along that in three cells.
At the same time, the form code could really do with refactoring:
$form['countryban_afghanistan'] = array('#type' => 'radios', '#title' => t('Afghanistan'), '#default_value' => variable_get('countryban_afghanistan', 0), '#options' => array(t('No Ban'), t('Read Only'), t('Complete Ban')));
$form['countryban_albania'] = array('#type' => 'radios', '#title' => t('Albania'), '#default_value' => variable_get('countryban_albania', 0), '#options' => array(t('No Ban'), t('Read Only'), t('Complete Ban')));
// etc etc etc
200 lines of that!!?!? OMG my eyes!!!! :/
Comments
Comment #1
jboukes commentedThis is "partially" fixed as of 1.4 - the brute force method of creating the table is now correct.
Comment #2
mclinn commentedGreat module! Thank you to the developer, works well for me.
I tweaked the code a little bit to add fieldsets to the admin page, makes it easier to find a country in the list.
In countryban.module starting at line 47 (I'm using v. 6.4) I replaced the "foreach ($countries as $country)" block with the following:
PHP tags used here for highlighting, obviously not needed if inserting into existing code. Adjust $cnt to control # of country rows within each fieldset. The title is pretty basic, just the name of the first country in the fieldset, but easy enough to use... kinda like the phone book except the 2d half of the range is the next fieldset title.
I also added a "watchdog" entry to record countries and IP addresses that have been blocked.
One of these days I hope to sit down and do something similar for the block admin page -- I have a zillion blocks, takes forever to scroll through them all. The collapsible fieldsets are a godsend to highly complex pages as far as I am concerned. (If someone has done this for D6 I would love to know about it!)
Thanks again for a great module.