예제 #1
0
def make_navbar():
    str = cgi_utils_sda.file_contents("navbar.html")
    type = session.getStatus()
    team = session.getTeamName()
    #TODO if team is deleted, fix header

    if type == "m" or type == "c" and (team != "None" or team != "NULL" or team != None):
        dashboard = "<li><a href='managerDashboard.cgi'>Manage Team: "+team+"</a></li>"
        switch = "<li><a href='viewTeams.cgi'>Switch Team </a></li>"
        
    elif type == "p" and (team != "None" or team != None):
        dashboard = "<li><a href='playerDashboard.cgi'>View Team: "+team+"</a></li>"
        switch = "<li><a href='viewTeams.cgi'>Switch Team </a></li>"
       
    else:
        dashboard = ""
        switch = ""
       

    #logged status printed so capital L on l abel, lower l on URL
    if logged_status():
        status = "ogout"
        userdash = "<li><a href='userDashboard.cgi'>My Dashboard</a></li>"
        settings ="<li><a href='userSettings.cgi'>Settings</a></li>"
        index = "#"
    else:
        status = "ogin"
        userdash = ""
        index = "index.cgi"
        settings = ""
    return str.format(index=index,userdash=userdash,dashboard=dashboard,status=status,team=team,switch=switch,settings=settings)
예제 #2
0
def getRoster(id):
    curs = session.cursor(session.connect())
    name = session.getTeamName()
    
    curs.execute('select name,PID from player inner join user where PID=UID and team=%s',(id,))
    

   
    header = "<div class=\"panel panel-default\"><div class='panel-heading'> Roster for team " + str(name) +  "</div>"
    tableHead = "<table class=\"table table-striped\"> <thead><tr> \n <th> PID </th> \n <th> Player Name </th> \n </tr></thead>"
    tableEnd = "</table></div>"

    lines = []    

    while True:
        row = curs.fetchone()
        
        if row == None:
        
            return header + tableHead + "\n".join(lines) + tableEnd
        lines.append("<tr>" + "<td>" +  str(row.get('PID')) + "</td>")
        lines.append("<td>" + row.get('name') + "</td>" + "</tr>")