Commit 74e6834c by Vik Paruchuri

move rubric and problem to forms

parent 1bf548af
...@@ -19,7 +19,12 @@ from xmodule.contentstore.content import XASSET_SRCREF_PREFIX, StaticContent ...@@ -19,7 +19,12 @@ from xmodule.contentstore.content import XASSET_SRCREF_PREFIX, StaticContent
log = logging.getLogger("mitx.courseware") log = logging.getLogger("mitx.courseware")
problem_form=('<form action="show()"><input type="text" name="answer" '
'id="answer"/><br/><input type="submit" value="Check"/></form>')
rubric_form=('<form action="save()"><input type="radio" name="assessment" value="correct"/>Correct<br/>'
'<input type="radio" name="assessment" value="incorrect">'
'Incorrect<input type="submit" value="Submit"/></form>')
def only_one(lst, default="", process=lambda x: x): def only_one(lst, default="", process=lambda x: x):
""" """
...@@ -53,15 +58,17 @@ class SelfAssessmentModule(XModule): ...@@ -53,15 +58,17 @@ class SelfAssessmentModule(XModule):
instance_state, shared_state, **kwargs) instance_state, shared_state, **kwargs)
dom2=etree.fromstring("<selfassessment>" + self.definition['data'] + "</selfassessment>") dom2=etree.fromstring("<selfassessment>" + self.definition['data'] + "</selfassessment>")
rubric=''.join([etree.tostring(child) for child in only_one(dom2.xpath('rubric'))]) self.rubric=''.join([etree.tostring(child) for child in only_one(dom2.xpath('rubric'))])
problem=''.join([etree.tostring(child) for child in only_one(dom2.xpath('problem'))]) self.problem=''.join([etree.tostring(child) for child in only_one(dom2.xpath('problem'))])
self.problem=''.join([self.problem,problem_form])
self.rubric=''.join([self.rubric,rubric_form])
#print(etree.tostring(rubric)) #print(etree.tostring(rubric))
#print(etree.tostring(problem)) #print(etree.tostring(problem))
self.html = etree.tostring(problem) self.html = self.problem
#self.html=self.definition['data']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment