Changeset 622 in tmcsimulator for branches/LCSv2/controllers/default.py


Ignore:
Timestamp:
08/21/2020 12:19:51 PM (6 years ago)
Author:
jdalbey
Message:

LCS implement closed lane checkboxes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/LCSv2/controllers/default.py

    r621 r622  
    9292    count = len(hwy) 
    9393    # Show the results in table format.  Get the radio call number from supervisor name lookup 
    94     header = THEAD(TR(TH(''), TH('DTM',BR(),'Area'), TH('Closure ID/',BR(),'Log No.'),TH('Route & Dir/',BR(),'Type of Closure'),TH('Start Date/',BR(),'End Date/',BR(),'Est. Delay'),TH('Facility'),TH('Limits'),TH('Work'), TH('TMP:',BR(),'Cozeep/',BR(),'Detour'),TH('Requestor/',BR(),'Radio Call No.'))) 
     94    header = THEAD(TR(TH(''), TH('DTM',BR(),'Area'), TH('Closure ID/',BR(),'Log No.'),TH('Route & Dir/',BR(),'Type of Closure'),TH('Start Date/',BR(),'End Date/',BR(),'Est. Delay'),TH('Facility/Lanes'),TH('Limits'),TH('Work'), TH('TMP:',BR(),'Cozeep/',BR(),'Detour'),TH('Requestor/',BR(),'Radio Call No.'))) 
    9595    multiform = [] 
    9696    # Iterates over all search results 
     
    103103                          INPUT(_type='submit',_name='btn2',_value='Show Status Form',_class="submit-button" ), 
    104104                          INPUT(_type='hidden',_name='row',_value=row.closureid))), 
    105                           TD(row.closureid[0]),TD(row.closureid,HR(),row.lognum), TD(row.route,' ',row.direction,HR(),row.closuretype), TD(row.startdate,' ',formatTime(row.starttime),HR(),row.enddate,' ',formatTime(row.endtime),HR(),row.estdelay), TD(row.facility),TD(row.startlocation,HR(),row.endlocation), TD(row.worktype), TD(row.tmpcozeep,BR(),row.tmpdetour), TD(row.supervisor,HR(),db(db.supervisors.name == row.supervisor).select().first().radiocallnum) ))  
     105                          TD(row.closureid[0]),TD(row.closureid,HR(),row.lognum), TD(row.route,' ',row.direction,HR(),row.closuretype), TD(row.startdate,' ',formatTime(row.starttime),HR(),row.enddate,' ',formatTime(row.endtime),HR(),row.estdelay), TD(row.facility,HR(),row.closedlanes), 
     106TD(row.startlocation,HR(),row.endlocation), TD(row.worktype), TD(row.tmpcozeep,BR(),row.tmpdetour), TD(row.supervisor,HR(),db(db.supervisors.name == row.supervisor).select().first().radiocallnum) ))  
    106107 
    107108    session.chosenid = request.vars.row #Pass the hidden field containing the closure ID 
     
    227228                LABEL('*Route',_for='route'), SELECT(hwys,_name='route', _id='routecombo', _onchange='routechanged()', requires=IS_LENGTH(minsize=1,error_message='route cannot be empty')), XML('   '),  
    228229           LABEL('*Direction',_for='direction'), SELECT(hwyDirections,_name='direction', requires=IS_LENGTH(minsize=1,error_message='direction cannot be empty')), XML('   '),  
    229            LABEL('*Facility',_for='facility'), SELECT(facilities,_name='facility', requires=IS_LENGTH(minsize=1,error_message='facility cannot be empty')), BR(),BR(),  
     230           LABEL('*Facility',_for='facility'), SELECT(facilities,_name='facility', _id='facilitycombo', requires=IS_LENGTH(minsize=1,error_message='facility cannot be empty')), BR(),BR(),  
    230231           TABLE(TR(TD(),TD(LABEL('*County')),TD(LABEL('*Location'))), 
    231232                TR(TD(LABEL('BEGIN=')),TD(SELECT('ORA',_name='startcounty')), 
     
    243244                    TD(LABEL('Estimated Delay')), 
    244245                    TD(LABEL('TMP Details'))),  
    245                  TR(TD(SELECT(closuretypes,_name='closuretype',requires=IS_LENGTH(minsize=1,error_message='type of closure cannot be empty'))),  
     246                 TR(TD(SELECT(closuretypes,_name='closuretype',_id='closuretype', _onchange='closuretypechanged()',requires=IS_LENGTH(minsize=1,error_message='type of closure cannot be empty'))),  
    246247                    TD(SELECT(worktypes,_name='worktype', requires=IS_LENGTH(minsize=1,error_message='type of work cannot be empty'))),  
    247248                    TD(INPUT(_name='estdelay',_size='4'),'minutes'),   
    248249                    TD(INPUT(_type='checkbox',_name='cozeep'),'CoZeep MaZeep/CHP',BR(),  
    249                        INPUT(_type='checkbox', _name='detour'),'Detour Available')),  
     250                       INPUT(_type='checkbox', _name='detour'),'Detour Available')), 
     251                 TR(TD(DIV(LABEL("Lanes closed"),DIV(INPUT(_type='checkbox', _name='lanes', _id='lanes', _value=' '), _id='boxes'),_id='lanechooser',_style='display:none')), 
     252                    TD(INPUT(_type='hidden', _name='lanecount', _id='lanecount', _value='4')), 
     253                    TD(), 
     254                    TD()), 
    250255                 _width='100%' ), 
    251256    TABLE(TR(TD(LABEL('*Supervisor')), 
     
    278283        supervisor_name = form.vars.supervisor[3:] 
    279284        fieldrep_name = form.vars.fieldrep[5:] 
     285        selectedlanes = buildLanesClosedString(form.vars.lanes,form.vars.lanecount) 
    280286        # Insert the record into the database 
    281         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='' ) 
    282         session.flash = 'New lane closure added: ' + newID + ' ' + newLognum 
     287        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, closedlanes=selectedlanes, 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='' ) 
     288        session.flash = 'New lane closure added: ' + newID + ' ' + newLognum + ': ' + selectedlanes 
    283289        redirect(URL('search.html')) 
    284290    return dict(form=form) 
     
    320326    else: 
    321327        return "NO" 
     328 
     329# Convert the lanes closed checkboxes into a human readable string 
     330# E.g.  #1 #3 of 4 
     331# Note: ckBoxGroup parameter contains only checked items 
     332def buildLanesClosedString(ckBoxGroup,lanecount): 
     333    result = "" 
     334    if ckBoxGroup is not None: 
     335        # Append each checked value to a string 
     336        for item in ckBoxGroup: 
     337            result = result + "#"+item + " " 
     338        result = result + "of " + lanecount 
     339    return result  
Note: See TracChangeset for help on using the changeset viewer.