Changeset 622 in tmcsimulator for branches/LCSv2/controllers/default.py.bak
- Timestamp:
- 08/21/2020 12:19:51 PM (6 years ago)
- File:
-
- 1 edited
-
branches/LCSv2/controllers/default.py.bak (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/LCSv2/controllers/default.py.bak
r621 r622 220 220 existingclosures.append("") 221 221 for row in db().select(db.closures.ALL, orderby=db.closures.closureid): 222 existingclosures.append(row.closureid) 222 # Omit duplicate ID's (with different lognumbers) 223 if row.closureid not in existingclosures: 224 existingclosures.append(row.closureid) 223 225 224 226 form = FORM( 225 227 LABEL('*Route',_for='route'), SELECT(hwys,_name='route', _id='routecombo', _onchange='routechanged()', requires=IS_LENGTH(minsize=1,error_message='route cannot be empty')), XML(' '), 226 228 LABEL('*Direction',_for='direction'), SELECT(hwyDirections,_name='direction', requires=IS_LENGTH(minsize=1,error_message='direction cannot be empty')), XML(' '), 227 LABEL('*Facility',_for='facility'), SELECT(facilities,_name='facility', requires=IS_LENGTH(minsize=1,error_message='facility cannot be empty')), BR(),BR(),229 LABEL('*Facility',_for='facility'), SELECT(facilities,_name='facility', _id='facilitycombo', requires=IS_LENGTH(minsize=1,error_message='facility cannot be empty')), BR(),BR(), 228 230 TABLE(TR(TD(),TD(LABEL('*County')),TD(LABEL('*Location'))), 229 231 TR(TD(LABEL('BEGIN=')),TD(SELECT('ORA',_name='startcounty')), … … 241 243 TD(LABEL('Estimated Delay')), 242 244 TD(LABEL('TMP Details'))), 243 TR(TD(SELECT(closuretypes,_name='closuretype', requires=IS_LENGTH(minsize=1,error_message='type of closure cannot be empty'))),245 TR(TD(SELECT(closuretypes,_name='closuretype',_id='closuretype', _onchange='closuretypechanged()',requires=IS_LENGTH(minsize=1,error_message='type of closure cannot be empty'))), 244 246 TD(SELECT(worktypes,_name='worktype', requires=IS_LENGTH(minsize=1,error_message='type of work cannot be empty'))), 245 247 TD(INPUT(_name='estdelay',_size='4'),'minutes'), 246 248 TD(INPUT(_type='checkbox',_name='cozeep'),'CoZeep MaZeep/CHP',BR(), 247 INPUT(_type='checkbox', _name='detour'),'Detour Available')), 249 INPUT(_type='checkbox', _name='detour'),'Detour Available')), 250 TR(TD(DIV(LABEL("Lanes closed"),DIV(_id='boxes'),_id='lanechooser',_style='display:none')), 251 TD(INPUT(_type='hidden', _name='lanecount', _id='lanecount', _value='4')), 252 TD(), 253 TD()), 248 254 _width='100%' ), 249 255 TABLE(TR(TD(LABEL('*Supervisor')), … … 278 284 # Insert the record into the database 279 285 newrec = db.closures.insert(closureid=newID, lognum=newLognum, route=form.vars.route, direction=form.vars.direction, facility=form.vars.facility, startcounty=form.vars.startcounty, endcounty=form.vars.endcounty, startlocation=form.vars.startlocation, endlocation=form.vars.endlocation, startdate=form.vars.startdate, enddate=form.vars.enddate, starttime=form.vars.starttime+form.vars.starttimemin, endtime=form.vars.endtime+form.vars.endtimemin, closuretype=form.vars.closuretype, worktype=form.vars.worktype, estdelay=form.vars.estdelay, tmpcozeep=getCheckbox(form.vars.cozeep), tmpdetour=getCheckbox(form.vars.detour), supervisor=supervisor_name, fieldrep=fieldrep_name, s1097date='', s1098date='', s1022date='' ) 280 session.flash = 'New lane closure added: ' + newID + ' ' + newLognum 286 session.flash = 'New lane closure added: ' + newID + ' ' + newLognum + ', ' + buildLanesClosedString(form.vars.lanes) + ':' + form.vars.lanecount 281 287 redirect(URL('search.html')) 282 288 return dict(form=form) … … 318 324 else: 319 325 return "NO" 326 327 # Convert the lanes closed checkboxes into a human readable string 328 # E.g. #1 #3 of 4 329 # Note: ckBoxGroup parameter contains only checked items 330 def buildLanesClosedString(ckBoxGroup): 331 result = ">" 332 if ckBoxGroup is not None: 333 # Append each checked value to a string 334 for item in ckBoxGroup: 335 result = result + item + " " 336 return result
Note: See TracChangeset
for help on using the changeset viewer.
