Changeset 6117 for cows_wps/trunk/cows_wps/lib/ui/proc_config.py
- Timestamp:
- 14/12/09 12:40:11 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cows_wps/trunk/cows_wps/lib/ui/proc_config.py
r5994 r6117 143 143 144 144 # Now render the inputs dict as a form 145 145 count = 0 146 146 for (name, input) in inputs: 147 resp += """<tr><td width="25%%"><b>%s</b></td><td width="60%%">\n""" % name 147 148 # Set colour style for row 149 count += 1 150 row_style = ("even_row", "odd_row")[count % 2] 151 152 # Start HTML for row 153 resp += """<tr class="%s"><td width="25%%"><b>%s</b></td><td width="30%%">\n""" % (row_style, name) 154 155 # Parse arguments from config 148 156 al = input["allowed_length"] 149 157 pv = input["possible_values"] 158 default = input.get("default", None) 159 opt = input.get("optional", False) 150 160 array_or_item = input["item_type"] 161 162 multiple = False 163 if array_or_item == "list": 164 multiple = True 165 151 166 tp = input["type"] 152 167 168 # Add a default instruction for this input type 169 instruction = "" 170 if opt == True: 171 instruction = "This input is optional." 172 173 # Now render them according to data type etc 153 174 if pv != None: 154 resp += fm.renderSelectList(name, values=pv) 175 resp += fm.renderSelectList(name, values=pv, optional=opt, multiple=multiple) 176 n_items = "an item" 177 if multiple == True: n_items = "one or more items" 178 instruction += " Please select %s from the list." % n_items 155 179 156 180 elif tp == "bool": 157 181 resp += fm.renderRadioButton(name, is_boolean=True) 182 instruction += " Please select either true or false." 158 183 159 elif tp in ("float", "int", "string"): 160 resp += fm.renderTextInput(name, dtype=tp) 184 elif tp in ("float", "int", "string", "datetime"): 185 if tp == "datetime": 186 if default: 187 # Ensure time formatted correctly 188 default = str(default).replace(" ", "T") 189 190 instruction += " Please insert a date/time field in the format <kbd><B>YYYY-MM-DDThh:mm:ss</B></kbd> such as <kbd>2009-01-01T00:00:00</kbd>." 191 else: 192 instruction += " Please insert a value of type: %s." % tp 193 194 resp += fm.renderTextInput(name, dtype=tp, optional=opt, default=default) 161 195 162 196 elif tp == "filepath": 163 197 base_dir = input["basedir"] 164 198 resp += fm.renderTypeAheadDirList(name, base_dir) 165 166 resp += "</td><td>%s</td></tr>\n" % "Eventually we'll put some useful advice here." 199 instruction += " Please type a file path on the CEDA file system. Click down to auto-fill with one of the options on the drop-down list." 200 201 elif tp == "bbox": 202 extent = input.get("extent", False) 203 resp += fm.renderBBox(name, extent) 204 csv_extent = extent.replace("|", ", ") 205 instruction += " Please select a valid bounding box with the following geographical extent: %s" % csv_extent 206 207 resp += "</td><td>%s</td></tr>\n" % instruction 167 208 168 209 resp += '<tr><td></td><td><input type="submit" value="Submit" /></td><td></td></table>\n</form>\n'
Note: See TracChangeset
for help on using the changeset viewer.