diff --git a/kool/Examples/WebInterfaces/server.py b/kool/Examples/WebInterfaces/server.py index d1eeb24..bcbacd6 100644 --- a/kool/Examples/WebInterfaces/server.py +++ b/kool/Examples/WebInterfaces/server.py @@ -69,27 +69,33 @@ def make_quiz_form(self): @cherrypy.expose def make_quiz(self, qname, numquestions, numoptions): - quizoptions = quizoptionstart + QUIZ_OPTIONS = t.QUIZ_OPTIONS_START for nn in range(0, int(numquestions)): - quizoptions = quizoptions + newquestion + QUIZ_OPTIONS = QUIZ_OPTIONS + t.NEW_QUESTION for n in range(0, int(numoptions)): - quizoptions = quizoptions + quizoption - quizoptions = quizoptions + quizoptionend + QUIZ_OPTIONS = QUIZ_OPTIONS + t.QUIZ_OPTION + QUIZ_OPTIONS = QUIZ_OPTIONS + t.QUIZ_OPTIONS_END #setup forms apporpriately to write to database - page = t.HEADER + quizoptions + t.FOOTER + page = t.HEADER + QUIZ_OPTIONS + t.FOOTER return page @cherrypy.expose def choose_quiz(self, quizchoice): #check firstname, lastname, quiz and score match - page = t.HEADER + quiz + t.FOOTER + page = t.HEADER + t.QUIZ_PAGE + t.FOOTER + return page + + @cherrypy.expose + def quiz_created(self, otext, qtext): + #put all values in otext and qtext, then reformat to save to database + page = t.HEADER + t.QUIZ_CREATED + t.FOOTER return page @cherrypy.expose def grade_quiz(self, option): #check firstname, lastname, quiz and score match - page = t.HEADER + quizscore + t.FOOTER + page = t.HEADER + t.QUIZ_SCORE + t.FOOTER return page @cherrypy.expose @@ -103,10 +109,21 @@ def show_students_scores(self): @cherrypy.expose def delete_student(self, value): - # delete t.STUDENT_FORM from database + # choose student to delete from database page = t.HEADER + t.DELETE_STUDENT + t.FOOTER return page + @cherrypy.expose + def display_student_scores(self,value): + page = t.HEADER + t.DISPLAY_STUDENT_SCORES + t.FOOTER + return page + + @cherrypy.expose + def complete_delete_student(self,value): + # delete t.STUDENT_FORM from database + page = t.HEADER + t.COMPLETE_DELETE_STUDENT + t.FOOTER + return page + @cherrypy.expose def educator_options(self): page = t.HEADER + t.NAVBAR + t.START_CONTAINER + t.EDUCATOR_FORM + t.END_CONTAINER + t.FOOTER @@ -119,20 +136,20 @@ def add_student(self, fname, lname, email, pword1, pword2): lname = escape(lname) email = escape(email) pword1 = escape(pword1) - pword2 = escape(pword2) + pword2 = escape(pword2) match = '' if pword1 != pword2: match = 'Passwords do not match, enter again' if not match: - response_body = t.SHOW_STUDENT.format( + response_body = t.SHOW_STUDENT.format( fname or 'No entry', lname or 'No entry', email or 'No entry', ) return t.HEADER + t.NAVBAR + t.START_CONTAINER + response_body + t.END_CONTAINER + t.FOOTER - else: + else: response_body = t.ERROR_MSG.format(match) return t.HEADER + t.NAVBAR + t.START_CONTAINER + response_body + t.ADD_STUDENT + t.END_CONTAINER + t.FOOTER diff --git a/kool/Examples/WebInterfaces/templates.py b/kool/Examples/WebInterfaces/templates.py index 80d7bce..2d7e62d 100644 --- a/kool/Examples/WebInterfaces/templates.py +++ b/kool/Examples/WebInterfaces/templates.py @@ -49,7 +49,7 @@ LOGIN_FORM = """
-
+

Login

@@ -126,7 +126,7 @@

Choose an option

- +
- +
@@ -198,17 +198,17 @@ SHOW_STUDENT_SCORES = """

Show student scores

- - + +
-

- +
@@ -219,10 +219,10 @@ DELETE_STUDENT = """

Select student record to delete from menu

- +
- @@ -234,12 +234,46 @@
""" +COMPLETE_DELETE_STUDENT = """ +
+

Record deleted

+ +

+ +

+ +
+""" + SHOW_MY_SCORE = """

My quiz scores

Placeholder for now - get scores from database and display them + + + + + + + + + + + + + + + + + + + + + +
QuizMy scoreTotal Score
A810
B1720
D1415
+

@@ -248,24 +282,60 @@

""" +DISPLAY_STUDENT_SCORES = """ +
+

Student quiz scores

+ +

+ Placeholder for now - get scores from database and display them + + + + + + + + + + + + + + + + + + + + + +
QuizMy scoreTotal Score
A810
B1720
D1415
+

+

+ +

+ +
+""" + MAKE_QUIZ = """

Make quiz

-
+
- +
- +
- +

@@ -275,27 +345,11 @@
""" -ADD_QUIZ_QUESTION = """ -
-

Add quiz question - modify to allow insertion of multiple questions

- -

- Question text:

- option text:

- option text:

- Answer:

-

-

- -

- -
-""" CHOOSE_QUIZ = """

Choose unattempted quiz to take

-
+

Placeholder sliding menu for now

-
+
""" QUIZ_PAGE = """

Quiz

-
+

Question 1
Answer 1
@@ -332,7 +386,7 @@ QUIZ_OPTIONS_START = """

- + """ NEW_QUESTION = """ @@ -343,6 +397,7 @@ Option text:
Correct answer
""" + QUIZ_OPTIONS_END = """ @@ -352,7 +407,16 @@ DEL_STUDENT_RECORD = """

Succefully deleted student record

-
+ + +
+
+""" + +QUIZ_CREATED = """ +
+

Succefully created quiz

+
@@ -379,4 +443,4 @@ -""" \ No newline at end of file +"""