Changeset 1509

Show
Ignore:
Timestamp:
06/06/08 15:22:46 (7 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1507 r1509  
    112008-06-06  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * admin/ModuleGeoip.py, admin/flags.py: Now the GeoIP module shows 
     4        a fancy flag icon besides the contry name. 
     5 
     6        * admin/static/images/Makefile.am, admin/Makefile.am, 
     7        configure.in: Added 245 flag images. 
    28 
    39        * qa/base.py (TestBase.has_module), 
  • cherokee/trunk/admin/Makefile.am

    r1498 r1509  
    6969pyscgi.py \ 
    7070validations.py \ 
    71 CherokeeManagement.py 
     71CherokeeManagement.py \ 
     72flags.py 
    7273 
    7374adminhelpdir = "$(datadir)/cherokee/admin" 
  • cherokee/trunk/admin/ModuleGeoip.py

    r1499 r1509  
    22from Table import * 
    33from Module import * 
     4from flags import * 
     5 
    46import validations 
    57 
    6 ISO3166_URL    = "http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm" 
    7 NOTE_COUNTRIES = "List of countries from the client IPs. It must use the " + \ 
    8                  "<a target=\"_blank\" href=\"%s\">ISO 3166</a> contry notation." % (ISO3166_URL) 
     8ISO3166_URL      = "http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm" 
     9NOTE_NEW_COUNTRY = "Add the initial country. It's possible to add more later on." 
     10NOTE_COUNTRIES   = "List of countries from the client IPs. It must use the " + \ 
     11    "<a target=\"_blank\" href=\"%s\">ISO 3166</a> contry notation." % (ISO3166_URL) 
    912 
    1013class ModuleGeoip (Module, FormHelper): 
     
    1518        FormHelper.__init__ (self, 'geoip', cfg) 
    1619 
     20    def _render_new_entry (self): 
     21        cfg_key = '%s!value'%(self._prefix) 
     22        flags = OptionFlags (cfg_key) 
     23        button = '<input type="submit" value="Add" />' 
     24 
     25        table = TableProps() 
     26        self.AddProp (table, 'Country', cfg_key, str(flags) + button, NOTE_NEW_COUNTRY) 
     27        return str(table) 
     28 
     29    def _render_modify_entry (self): 
     30        cfg_key = '%s!countries'%(self._prefix) 
     31        key_val = self._cfg.get_val (cfg_key, "") 
     32 
     33        # Text entry 
     34        table = TableProps() 
     35        self.AddPropEntry (table, 'Countries', cfg_key, NOTE_COUNTRIES) 
     36 
     37        # Flags 
     38        cfg_key_fake = 'tmp!add_county' 
     39        flags = OptionFlags (cfg_key_fake) 
     40         
     41        # Button 
     42        button = '<input type="button" value="Add" onClick="flags_add_to_key(\'%s\',\'%s\',\'%s\',\'%s\');"/>' % ( 
     43                 cfg_key_fake, cfg_key, key_val, '/ajax/update') 
     44 
     45        content = ADD_FLAGS_TO_KEY_JS + str(flags) + button 
     46        self.AddProp (table, 'Add Country', "", content, NOTE_NEW_COUNTRY) 
     47 
     48        return str(table) 
     49     
    1750    def _op_render (self): 
    18         table = TableProps() 
    1951        if self._prefix.startswith('tmp!'): 
    20             self.AddPropEntry (table, 'Countries', '%s!value'%(self._prefix), NOTE_COUNTRIES) 
    21         else: 
    22             self.AddPropEntry (table, 'Countries', '%s!countries'%(self._prefix), NOTE_COUNTRIES) 
    23         return str(table) 
     52            return self._render_new_entry() 
     53 
     54        return self._render_modify_entry() 
    2455         
    2556    def _op_apply_changes (self, uri, post): 
     
    3061            print "ERROR, a 'value' entry is needed!" 
    3162 
    32         exts = values['value'] 
    33         self._cfg['%s!match!countries'%(self._prefix)] = exts 
     63        cfg_key  = '%s!match!countries'%(self._prefix) 
     64        contries = values['value'] 
     65        self._cfg[cfg_key] = contries 
    3466 
    3567    def get_name (self): 
  • cherokee/trunk/admin/static/images/Makefile.am

    r1297 r1509  
    11## Cherokee: Makefile.am  -*- makefile -*- 
     2 
     3SUBDIRS = flags 
    24 
    35DARKGLASS_ICONS = \ 
  • cherokee/trunk/configure.in

    r1504 r1509  
    13131313admin/static/css/Makefile 
    13141314admin/static/images/Makefile 
     1315admin/static/images/flags/Makefile 
    13151316]) 
    13161317