Example #1
0
def delete():
    TID = session.getTeamFromSession()
    curs = session.cursor(session.connect())
    curs.execute('DELETE from team where TID=%s',(TID,))
    curs.execute('DELETE from player where team=%s',(TID,))
    curs.execute('DELETE from coach where team=%s',(TID,))
    curs.execute('UPDATE session set TID=NULL where TID=%s',(TID))
    
    line = "<div class='alert alert-danger'> Team deleted \t <a href='userDashboard.cgi'>Return to Dashboard</a></div>"
    return line
Example #2
0
def submit():
    #print "submit method in createTeam.py"
    #connect to the database
    

    #retrieves the data from the form for the sql query
    TID = session.getTeamFromSession()
    
    if (TID != None):    
        return getRoster(str(TID))
    else:
        return ""
Example #3
0
def submit(form_data):
    #connect to the database
    

        # Retrieve and escape the necessary data to insert into the database
    tid = session.getTeamFromSession()
    email = cgi.escape(str(form_data.getfirst("email")))
    type = form_data.getfirst("type")
    sbmt = form_data.getfirst("submit")

    if (email == "None"):
        return "" #returns blank if there is no form data
    else:

        return addMember(tid,email,type)        
Example #4
0
def submit(form_data):
    
    # Retrieve and escape the necessary data to insert into the database
    host = session.getTeamFromSession()
    location = cgi.escape(str(form_data.getfirst("event_loc"))) 
    name = cgi.escape(str(form_data.getfirst("event_name")))

    #put this into the date format that SQL understands
    month = form_data.getfirst("month")
    day = form_data.getfirst("day")
    year = form_data.getfirst("year")
    sql_date = str(year)+ "-" + str(month) + "-" + str(day)
        #print sql_date
        #creates the event, even if the sql_date is empty
    if (location == "None" or name == "None"):
        return ""
    else:
        return createEvent(host,sql_date,name,location)
Example #5
0
def submit(form_data,submit_type): 
    #need a different submit_type so that it executes the right code
    #print "submit method in createTeam.py"
    #connect to the database
        
    if (submit_type == "Update Attendance"):
        #retrieves the data from the form to update the database
        return updateAttendance(form_data)
        #execute Attendance thing
    elif (submit_type == "View Attendance"):
        return printAttendance(form_data) # Needs to retrieve the proper information in the data
    else:
    #retrieves the data from the form for the sql query for events
        view = form_data.getfirst("view") #whether in team or user mode
        TID = session.getTeamFromSession()
        UID = session.getUserFromSession()
    
    # print "view: " + view +", " + id #debugging ometimes doesn't work if id is empty
        return getEvent(str(TID),str(UID),view)
Example #6
0
def updateName(name):
    curs = session.cursor(session.connect())
    TID = session.getTeamFromSession()
    curs.execute('UPDATE team set name=%s where TID=%s',(name,TID))
    return "<div class='alert alert-success'>Team name successfully updated!</div>"
Example #7
0
def updateLocation(location):
    curs = session.cursor(session.connect())
    TID = session.getTeamFromSession()
    curs.execute('UPDATE team set location=%s where TID=%s',(location,TID))
    return "<div class='alert alert-success'>Location successfully updated!</div>"