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


Ignore:
Timestamp:
08/29/2020 08:19:30 AM (6 years ago)
Author:
jdalbey
Message:

LCS show lanes for On/Off? ramp Facility. Add Drop down box for user on login page.

File:
1 edited

Legend:

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

    r622 r623  
    33hwys = ['','1','5', '22', '55', '57', '73', '74', '91', '133', '142', '241', '261', '405', '605'] 
    44hwyDirections = ['','NB', 'SB', 'NB/SB','EB','WB','EB/WB'] 
     5# Names to appeaer in the username dropdown box 
     6users = [] 
    57# Show the login page 
    68def index(): 
    7     form = FORM(LABEL('Username:',_for='username', _class="label username-label"), 
    8                 INPUT(_name='username', _size='15', _style="font-size: 18px;"), BR(), 
     9    userfile = open('student_names.txt','r') 
     10    users = [line.strip() for line in userfile.readlines()] 
     11    users.insert(0,'') 
     12    form = FORM(LABEL('User:',_for='username', _class="label username-label"), 
     13                #INPUT(_name='username', _size='15', _style="font-size: 18px;"), BR(), 
     14                SELECT(users,_name='username',requires=IS_LENGTH(minsize=1,error_message='Must select a user from the list.')),BR(), 
    915                INPUT(_type='submit',_value="Log in", _class=" btn btn-primary", _style="margin-top: 3%;")) 
    1016    if form.process().accepted: 
     
    298304# Calculate the closure id to assign to the new closure 
    299305def calcNextClosureID(routeNum): 
    300     # Retrieve any existing closures on this route 
    301     item = db(db.closures.closureid.startswith('T'+routeNum)).select().last() # Might need to sort these 
     306    # Retrieve the last existing closure on this route 
     307    #item = db(db.closures.closureid.startswith('T'+routeNum)).select().last() # defective 
     308    item = db(db.closures.route == routeNum).select().last()  
    302309    if (item != None): 
    303310        currID = item.closureid 
Note: See TracChangeset for help on using the changeset viewer.