Example #1
0
    def POST(self):
        instr=validateInstructor()
        #instr = getUsername()
        wi = web.input()
        qid=wi['quiz']
        yoursections = control.getInstrSections(instr)

        #get all entries set up in the database
        for i in wi:
            if i in yoursections:
                sesname = instr+i+qid
                control.assignSession(sesname,i)#assigns session
                gradebook.makeSession(sesname,qid)#initializes gradebook
                control.sessionAdd(sesname)
                students = control.getStudentsBySec(i)
                for j in students:
                    gradebook.addStudent(j,sesname)
        print yoursections
        print qid
        formguts = []
        for i in yoursections: #produce form
            sesname = instr+i+qid
            already = (control.getAssignedQuiz(i) == sesname)
            entry = form.Checkbox(name = i, value="1", checked=already)
            formguts.append(entry)
            butt = form.Button(name="Assign "+qid, type="submit", value="Assign quiz")
        formguts.append(butt)
        f = form.Form(*formguts)
        return render.assign(bootpre,qid,f) #to be completed
Example #2
0
 def GET(self):
     username = validateInstructor()
     yoursession = str(control.getInstrSession(username))
     yoursections = control.getInstrSections(username)
     sessdic = {}
     for i in yoursections:
         sessdic[i] = str(control.getAssignedQuiz(i))
     return render.sessions(bootpre,yoursession,sessdic)
Example #3
0
 def GET(self):
     validateInstructor()
     instr = getUsername()
     allsections = control.getSections()
     print allsections
     for i in allsections:#repopulate section list in case of roster change
         control.addSection(i)
     allsections.sort()
     yoursections = control.getInstrSections(instr)
     formguts = []
     for i in allsections:
         insec = (i in yoursections)
         entry = form.Checkbox(name=i,value="1",checked=insec)
         formguts.append(entry)
     butt = form.Button(name="button", type="submit", value="Select sections")
     formguts.append(butt)
     f = form.Form(*formguts) #asterisk passes entries as arguments
     return render.manage(bootpre,f)