Ignore:
Timestamp:
11/12/09 21:03:17 (11 years ago)
Author:
astephen
Message:

added date time validator and data type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/cows_wps/renderer/form_renderer.py

    r5994 r6111  
    3737        Returns HTML for text input including onChange validator. 
    3838        """ 
    39         allowed_dtypes = ("float", "int", "string") 
     39        allowed_dtypes = ("float", "int", "string", "datetime") 
     40 
    4041        if dtype not in allowed_dtypes: 
    4142            raise Exception("Invalid type sent to FormRenderer.renderTextInput(): %s" % dtype) 
     
    4344        validators = {"int": ("/^[0-9]+$/", "The %s input must be an integer." % name),  
    4445                      "float": ("/^[-+]?([0-9]*\.[0-9]+|[0-9]+)$/", "The %s input must be a decimal number." % name), 
    45                       "string": ("/[0-9a-zA-Z]+/", "The %s input must include text characters." % name)} 
     46                      "string": ("/[0-9a-zA-Z]+/", "The %s input must include text characters." % name), 
     47                      "datetime": ("/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}/", "The %s input must be a date/time entry as follows YYYY-MM-DDThh:mm:ss (e.g. 2009-01-01T12:00:00)." % name)} 
    4648 
    4749        (regex, msg) = validators[dtype] 
     
    6163 
    6264        return html 
     65 
     66    def renderBBox(self, name, extent): 
     67        """ 
     68        Renders a bounding box and N/W/S/E selectors. 
     69        """ 
     70        html = """      <script type="text/javascript" src="/js/ext/jquery-1.3.2/jquery-1.3.2.js"></script> 
     71        <script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script> 
     72        <script type="text/javascript" src="/js/ui/openlayers-x.js"></script> 
     73        <script type="text/javascript" src="/js/ui/boundingBoxMapSelect.js"></script> 
     74        <script type="text/javascript"> 
     75                var layers = new Array(); 
     76                var layer_data = false; 
     77                var bboxSelect = false; 
     78 
     79                $(document).ready(function() { 
     80                        var layer_data = new OpenLayers.Layer.WMS( "World Map", "http://labs.metacarta.com/wms-c/Basic.py?", {layers: 'basic', format: 'image/png' } ); 
     81                        layers.push(layer_data); 
     82                        var bboxSelect = new BoundingBoxMapSelect('map', 'bounds_control_container', layers,  'bbox_hidden_input', null); 
     83                }); 
     84        </script> 
     85 
     86        <div id="bounding_container"> 
     87                <div id="bounds_control_container"></div>        
     88                <div id="map_container"> 
     89                        <div id='map'></div> 
     90                </div> 
     91                <input type="hidden" name="bbox" id="bbox_hidden_input" value="" /> 
     92        </div> 
     93        """ 
     94        return html      
    6395 
    6496    def renderTypeAheadDirList(self, name, base_dir): 
Note: See TracChangeset for help on using the changeset viewer.