Changeset 7002 for cows_wps


Ignore:
Timestamp:
13/06/10 20:58:08 (9 years ago)
Author:
astephen
Message:

got bbox validation working

Location:
cows_wps/trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/cows_wps/public/js/ui/validate.js

    r7001 r7002  
    9393 
    9494        // If we get here then bbox definitions are valid 
    95         if ((bbox1[2] >= bbox2[0]) || (bbox1[0] >= bbox2[2])) { 
    96                 return false; 
    97         } else if ((bbox1[1] >= bbox2[3]) || (bbox1[1] >= bbox2[3])) { 
     95        if ((bbox1[0] >= bbox2[2]) || (bbox2[0] >= bbox1[2])) { 
     96                return false; 
     97        } else if ((bbox1[1] >= bbox2[3]) || (bbox2[1] >= bbox1[3])) { 
    9898                return false; 
    9999        } 
     
    135135        // which represents (west, south, east, north) 
    136136        // Checks domain is within spec_arg domain 
    137         return true; 
    138137        var selected_bbox = parseBBoxString(input); 
    139138        var valid_bbox = parseBBoxString(valid_bbox); 
  • cows_wps/trunk/cows_wps/renderer/form_renderer.py

    r7001 r7002  
    9999        return html 
    100100 
    101     def OLDrenderBBox(self, name, extent="90|-180|-90|180"): 
    102         """ 
    103         Renders a bounding box and N/W/S/E/ selectors. 
    104         """ 
    105         if extent == False: extent = "90|-180|-90|180" 
    106  
    107         (n, w, s, e) = extent.split("|") 
    108  
    109         html = """      <label for="_north">North:</label> <input type="text" id="_north" name="_north" value="%s" onChange="updateBBox('%s');" /><br> 
    110         <label for="_west">West:</label> <input type="text" id="_west" name="_west" value="%s" onChange="updateBBox('%s');" /><br> 
    111         <label for="_south">South:</label> <input type="text" id="_south" name="_south" value="%s" onChange="updateBBox('%s');" /><br> 
    112         <label for="_east">East:</label> <input type="text" id="_east" name="_east" value="%s" onChange="updateBBox('%s');" /><br> 
    113         <input type="hidden" id="%s" name="%s" value="%s" /> 
    114         """ % (n, name, w, name, s, name, e, name, name, name, extent) 
    115  
    116         return html 
    117  
    118  
    119101    def renderBBox(self, name, extent): 
    120102        """ 
    121         Renders a bounding box and N/W/S/E selectors. 
    122         ``extent`` is received as a string of "north|west|south|east". 
     103        Renders a bounding box and (west, south, east, north) selectors. 
     104        ``extent`` is received as a string of "west|south|east|north". 
    123105        """ 
    124         if extent == False: extent = "90|-180|-90|180" 
    125         (n, w, s, e) = extent.split("|") 
     106        if extent == False: extent = "-180|-90|180|90" 
     107        (w, s, e, n) = extent.split("|") 
    126108 
    127109        html = """    <div id="bounding_container"> 
     
    134116            <script type="text/javascript"> 
    135117                var initial_extent = [%s, %s, %s, %s]; 
    136                 addValidator('%s', 'bounding_box', extent, 'Your selected spatial bounding box must overlap with the available extent of: (%s) as ("north|west|south|east").', false); 
     118                addValidator('bbox_hidden_input', 'bounding_box', '%s', 'Your selected spatial bounding box must overlap with the available extent of: (%s) as ("west|south|east|north").', false); 
    137119            </script> 
    138120        </div> 
    139         """ % (name, n, w, s, e, name, extent) 
     121        """ % (name, w, s, e, n, extent, extent) 
    140122        return html      
    141123 
  • cows_wps/trunk/process_configs/ExtractUKStationData.ini

    r6976 r7002  
    2929BBox = bbox 
    3030BBox.optional = True 
    31 BBox.extent = 61.0|-12.0|49.0|3.0 
     31BBox.extent = -12.0|49.0|3.0|61.0 
    3232Counties = string.list 
    3333Counties.optional = True 
  • cows_wps/trunk/process_configs/GetWeatherStations.ini

    r6976 r7002  
    2626BBox = bbox 
    2727BBox.optional = True 
    28 BBox.extent = 60|-10|40|20 
     28BBox.extent = -10|40|20|61 
    2929Counties = string.list 
    3030Counties.optional = True 
  • cows_wps/trunk/process_modules/lib_extract_uk_station_data/utils.py

    r6976 r7002  
    6060 
    6161 
    62 def downloadFileAndExtractStations(url): 
     62def readFileAndExtractStations(url): 
    6363    """ 
    6464    Downloads file and extracts stations to a list. 
    6565    """ 
    66     f = urllib.urlopen(url) 
    67     data = f.read() 
    68     f.close() 
     66    #f = urllib.urlopen(url) 
     67    #data = f.read() 
     68    #f.close() 
    6969 
     70    local_path = generateLocalFilePath(url) 
    7071    station_ids = data.split()  
    7172    return station_ids 
Note: See TracChangeset for help on using the changeset viewer.