Permalink
Browse files

fix how bb8 matching questions are handled

They need to have an outside div with the appropriate class

refs #4422

Change-Id: I8ada4bbc0962c28cbef8ad3233a41f7b0cc21670
Reviewed-on: https://gerrit.instructure.com/4019
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
  • Loading branch information...
1 parent ba54beb commit a909decce5eee48cf74da1c8eda0f8afa095e94a @bracken bracken committed Jun 3, 2011
Showing with 17 additions and 3 deletions.
  1. +17 −3 lib/imsqtiv1.py
View
@@ -3021,6 +3021,7 @@ def __init__(self,name,attrs,parent):
self.flowclass=None
self.CheckLocation((FlowV1,Presentation),"<flow>")
self.ParseAttributes(attrs)
+ self.div_container=None
if isinstance(self.parent,FlowV1):
self.flow_level=parent.GetFlowLevel()+1
else:
@@ -3035,14 +3036,24 @@ def AppendElement (self,element):
def GetFlowLevel (self):
return self.flow_level
+
+ def AppendToParent(self, element):
+ if self.flowclass == 'RESPONSE_BLOCK' or self.flowclass == 'RIGHT_MATCH_BLOCK':
+ if not self.div_container:
+ self.div_container = xhtml_div()
+ self.div_container.escaped = True
+ self.div_container.SetClass(self.flowclass)
+ self.div_container.AppendElement(element)
+ else:
+ self.parent.AppendElement(element)
def AppendHTMLContainer (self,content):
container=xhtml_div()
container.escaped = True
container.SetClass('html')
container.AppendElement(xhtml_text(content))
- self.parent.AppendElement(container)
-
+ self.AppendToParent(container)
+
def CloseObject (self):
buffer=None
for child in self.children:
@@ -3057,9 +3068,11 @@ def CloseObject (self):
if buffer:
self.AppendHTMLContainer(buffer.getvalue())
buffer=None
- self.parent.AppendElement(child)
+ self.AppendToParent(child)
if buffer:
self.AppendHTMLContainer(buffer.getvalue())
+ if self.div_container:
+ self.parent.AppendElement(self.div_container)
# FlowMat
@@ -3079,6 +3092,7 @@ def __init__(self,name,attrs,parent):
self.CheckLocation((FlowMat,ItemFeedback,ResponseLabel,Rubric,Objectives,SolutionMaterial,HintMaterial),"<flow_mat>")
self.ParseAttributes(attrs)
self.flow_level=parent.GetFlowLevel()+1
+ self.div_container=None
self.children=[]

0 comments on commit a909dec

Please sign in to comment.