Beispiel #1
0
    def __init__(self, parent, idevice):
        """
        Pre-create our field ids
        """
        Block.__init__(self, parent, idevice)
        
       
        # to compensate for the strange unpickling timing when objects are 
        # loaded from an elp, ensure that proper idevices are set:
        if idevice.instructionsForLearners.idevice is None: 
            idevice.instructionsForLearners.idevice = idevice
        if idevice.content.idevice is None: 
            idevice.content.idevice = idevice
        if idevice.feedback.idevice is None: 
            idevice.feedback.idevice = idevice
            
        dT = common.getExportDocType()
        sectionTag = "div"
        if dT == "HTML5":
            sectionTag = "section"
            
        idevice.instructionsForLearners.htmlTag = sectionTag
        idevice.instructionsForLearners.class_ = "block instructions"
        idevice.feedback.htmlTag = sectionTag            

        self.instructionElement = TextAreaElement(idevice.instructionsForLearners)
        self.instructionElement.field.content_w_resourcePaths = c_(self.instructionElement.field.content_w_resourcePaths)
        self.listaElement = ListaElement(idevice.content)
        self.feedbackElement = \
            TextAreaElement(idevice.feedback)
        self.previewing        = False # In view or preview render
        if not hasattr(self.idevice,'undo'): 
            self.idevice.undo = True
    def __init__(self, index, idevice, question):
        """
        Initialize
        'index' is our number in the list of questions
        'idevice' is a case study idevice
        'question' is a exe.engine.casestudyidevice.Question instance
        """
        self.index        = index
        self.id           = "q" + unicode(index) + "b" + idevice.id        
        self.idevice      = idevice


        self.quesId       = "quesQuestion" + unicode(index) + "b" + idevice.id
        self.feedbackId   = "quesFeedback" + unicode(index) + "b" + idevice.id

        self.question     = question
        # also split out each part for a separate TextAreaElement:

        # but first....  
        # to compensate for the strange unpickling timing when objects are 
        # loaded from an elp, ensure that proper idevices are set: 
        if question.questionTextArea.idevice is None: 
            question.questionTextArea.idevice = idevice 
        if question.feedbackTextArea.idevice is None: 
            question.feedbackTextArea.idevice = idevice

        self.question_question = TextAreaElement(question.questionTextArea)
        self.question_question.id = self.quesId 
        self.question_feedback = TextAreaElement(question.feedbackTextArea)
        self.question_feedback.id = self.feedbackId 
Beispiel #3
0
    def __init__(self, index, idevice, question):
        """
        Initialize
        """
        self.index = index
        self.id = unicode(index) + "b" + idevice.id
        self.idevice = idevice

        self.question = question
        # also split out each part for a separate TextAreaElement:
        # but first...
        # to compensate for the strange unpickling timing when objects are
        # loaded from an elp, ensure that proper idevices are set:
        if question.questionTextArea.idevice is None:
            question.questionTextArea.idevice = idevice
        if question.feedbackTextArea.idevice is None:
            question.feedbackTextArea.idevice = idevice
        if question.hintTextArea.idevice is None:
            question.hintTextArea.idevice = idevice
        #
        self.question_question = TextAreaElement(question.questionTextArea)
        self.question_feedback = TextAreaElement(question.feedbackTextArea)
        self.question_hint = TextAreaElement(question.hintTextArea)

        # note, question.isCorrect is left as it was, and not split out.
        # because there are low-level mechanisms in place somewhere
        # with the radio buttons or ??? expecting that as such.

        self.questionId = "question" + unicode(index) + "b" + idevice.id
        self.question_question.id = self.questionId
        self.feedbackId = "feedback" + unicode(index) + "b" + idevice.id
        self.question_feedback.id = self.feedbackId
        self.hintId = "hint" + unicode(index) + "b" + idevice.id
        self.question_hint.id = self.hintId
        self.keyId = "Key" + unicode(index) + "b" + idevice.id
Beispiel #4
0
    def __init__(self, index, idevice, question):
        """
        Initialize
        """
        self.index      = index
        self.id         = unicode(index) + "b" + idevice.id        
        self.idevice    = idevice

        # to compensate for the strange unpickling timing when objects are 
        # loaded from an elp, ensure that proper idevices are set:
        if question.questionTextArea.idevice is None: 
            question.questionTextArea.idevice = idevice
        self.questionElement = TextAreaElement(question.questionTextArea)
        self.question   = question

        self.questionId = "question"+self.id
        self.questionElement.id = self.questionId

        self.options    = []
        self.keyId      = "key" + self.id
        i = 0
        for option in question.options:
            self.options.append(TestoptionElement(i,
                                                  question, 
                                                  self.id, 
                                                  option,
                                                  idevice))
            i += 1
Beispiel #5
0
    def __init__(self, parent, idevice):
        """
        Initialize a new Block object
        """
        Block.__init__(self, parent, idevice)
        self.idevice = idevice
        self.questionElements = []
        self.questionInstruc = idevice.questionInstruc
        self.keyInstruc = idevice.keyInstruc
        self.feedbackInstruc = idevice.feedbackInstruc
        self.hintInstruc = idevice.hintInstruc

        # to compensate for the strange unpickling timing when objects are
        # loaded from an elp, ensure that proper idevices are set:
        if idevice.instructionsForLearners.idevice is None:
            idevice.instructionsForLearners.idevice = idevice
        self.instructionElement = \
            TextAreaElement(idevice.instructionsForLearners)

        if not hasattr(self.idevice, 'undo'):
            self.idevice.undo = True

        i = 0
        for question in idevice.questions:
            self.questionElements.append(TrueFalseElement(
                i, idevice, question))
            i += 1
    def __init__(self, parent, idevice):
        """
        Initialize a new Block object
        """
        Block.__init__(self, parent, idevice)
        self.idevice           = idevice
        self.questionElements  = []

        # to compensate for the strange unpickling timing when objects are 
        # loaded from an elp, ensure that proper idevices are set:
        if idevice.storyTextArea.idevice is None: 
            idevice.storyTextArea.idevice = idevice

        self.storyElement      = TextAreaElement(idevice.storyTextArea)

        self.questionInstruc   = idevice.questionInstruc
        self.storyInstruc      = idevice.storyInstruc
        self.feedbackInstruc   = idevice.feedbackInstruc
        self.previewing        = False # In view or preview render 

        if not hasattr(self.idevice,'undo'): 
            self.idevice.undo = True

        i = 0
        
        for question in idevice.questions:
            self.questionElements.append(QuestionElement(i, idevice, question))
            i += 1
Beispiel #7
0
    def __init__(self, parent, idevice):
        Block.__init__(self, parent, idevice)
        self.titleElement = TextElement(idevice.titleField)
        self.contentElement = TextAreaElement(idevice.content)
        self.contentElement.height = 250
        self.chanceImageElements = []

        #go through all image fields in the list and create an image element linked to that field
        for chanceImageField in idevice.chanceImageFields:
            newImgElement = ImageElement(chanceImageField)
            self.chanceImageElements.append(newImgElement)

        self.wordElements = []
        self.hintElements = []
        #go through all of the word fields and hint fields and create an
        for wordIndex, word in enumerate(idevice.wordTextFields):
            newWordElement = TextElement(word)
            self.wordElements.append(newWordElement)
            newHintElement = TextElement(idevice.hintTextFields[wordIndex])
            self.hintElements.append(newHintElement)

        #make an element for the alphabet
        self.alphabetElement = TextElement(idevice.alphabet)

        #element for the messages that are shown to the player
        self.wrongGuessTextElement = TextAreaElement(
            self.idevice.wrongGuessMessageField)
        self.lostLevelTextElement = TextAreaElement(
            self.idevice.lostLevelMessageField)
        self.levelPassedTextElement = TextAreaElement(
            self.idevice.levelPasssedMessageField)
        self.gameWonTextElement = TextAreaElement(
            self.idevice.gameWonMessageField)

        self.letterButtonStyleElement = TextElement(
            self.idevice.letterButtonStyle)
        self.wrongLetterButtonStyleElement = TextElement(
            self.idevice.wrongLetterButtonStyle)
        self.rightLetterButtonStyleElement = TextElement(
            self.idevice.rightLetterButtonStyle)

        self.hintFieldStyleElement = TextElement(self.idevice.hintFieldStyle)
        self.wordAreaStyleElement = TextElement(self.idevice.wordAreaStyle)

        self.resetButtonTextElement = TextElement(self.idevice.resetButtonText)
        self.resetButtonStyleElement = TextElement(
            self.idevice.resetButtonStyle)
Beispiel #8
0
    def __init__(self, parent, idevice):
        Block.__init__(self, parent, idevice)
        self.mainElements = idevice.mainFieldSet.makeElementDict()

        self.sortableItemElements = []
        for sortableField in idevice.itemsToSort:
            newSortableElement = TextAreaElement(sortableField)
            self.sortableItemElements.append(newSortableElement)
 def __init__(self, field):
     Element.__init__(self, field)
     # there is then field.maincontent, field.width, field.height, field.correctx, field.correcty , etc.
     self.mainContentElement = TextAreaElement(field.mainContentField)
     self.targetXElement = TextElement(field.targetX)
     self.targetYElement = TextElement(field.targetY)
     self.widthElement = TextElement(field.width)
     self.heightElement = TextElement(field.height)
     self.toleranceElement = TextElement(field.tolerance)
Beispiel #10
0
 def __init__(self, parent, idevice):
     Block.__init__(self, parent, idevice)
     self.fileAttachmentElements = []
     for fileField in self.idevice.fileAttachmentFields:
         fileElement = FileElement(fileField, False)
         self.fileAttachmentElements.append(fileElement)
     
     self.showDescBlock = ChoiceElement(idevice.showDesc)
     self.introHTMLElement = TextAreaElement(idevice.introHTML)
    def __init__(self, parent, idevice):
        Block.__init__(self, parent, idevice)
        self.contentElement = TextAreaElement(idevice.content)
        self.contentElement.height = 250
        self.titleElement = TextElement(idevice.titleField)

        self.mainAreaElement = TextAreaElement(idevice.mainArea)
        self.mainAreaElement.height = 200
        
        self.placableObjectElements = []
        for placableObjectField in idevice.objectsToPlace:
            newPlacableElement = PlacableObjectElement(placableObjectField)
            self.placableObjectElements.append(newPlacableElement)

        self.positiveResponseElement = TextAreaElement(idevice.positiveResponseArea)
        self.negativeResponseElement = TextAreaElement(idevice.negativeResponseArea)
        self.clickToStartElement = TextAreaElement(idevice.clickToStartGameArea)
        self.gameTimeLimit = TextElement(idevice.gameTimeLimit)
        self.gameTimerShown = TextElement(idevice.gameTimerShown)
        self.partbinNumCols = TextElement(idevice.partbinNumCols)
    def __init__(self, parent, idevice):
        Block.__init__(self, parent, idevice)
        if idevice.content.idevice is None:
            # due to the loading process's timing, idevice wasn't yet set;
            # set it here for the TextAreaElement's tinyMCE editor
            idevice.content.idevice = idevice

        self.contentElement = TextAreaElement(idevice.content)
        self.contentElement.height = 250
        if not hasattr(self.idevice, 'undo'):
            self.idevice.undo = True
    def __init__(self, parent, idevice):
        """
        Initialize a new Block object
        """
        Block.__init__(self, parent, idevice)
        self.activityInstruc = idevice.activityInstruc
        self.answerInstruc   = idevice.answerInstruc

        # to compensate for the strange unpickling timing when objects are 
        # loaded from an elp, ensure that proper idevices are set:
        if idevice.activityTextArea.idevice is None: 
            idevice.activityTextArea.idevice = idevice
        if idevice.answerTextArea.idevice is None: 
            idevice.answerTextArea.idevice = idevice

        self.activityElement  = TextAreaElement(idevice.activityTextArea)
        self.answerElement    = TextAreaElement(idevice.answerTextArea)

        self.previewing        = False # In view or preview render

        if not hasattr(self.idevice,'undo'): 
            self.idevice.undo = True
Beispiel #14
0
    def __init__(self, parent, idevice):
        """
        Initialize
        """

        Block.__init__(self, parent, idevice)

        # to compensate for the strange unpickling timing when objects are
        # loaded from an elp, ensure that proper idevices are set:
        if idevice.descriptionTextArea.idevice is None:
            idevice.descriptionTextArea.idevice = idevice

        self.descriptionElement = TextAreaElement(idevice.descriptionTextArea)
Beispiel #15
0
    def __init__(self, parent, idevice):
        """
        Initialize
        """
        Block.__init__(self, parent, idevice)
        self.flashElement = FlashElement(idevice.flash)

        # to compensate for the strange unpickling timing when objects are
        # loaded from an elp, ensure that proper idevices are set:
        # (only applies to the image-embeddable ones, not FlashElement)
        if idevice.text.idevice is None:
            idevice.text.idevice = idevice
        self.textElement = TextAreaElement(idevice.text)
Beispiel #16
0
    def __init__(self, parent, idevice):
        """
        Pre-create our field ids
        """
        Block.__init__(self, parent, idevice)

        # to compensate for the strange unpickling timing when objects are
        # loaded from an elp, ensure that proper idevices are set:
        if idevice.instructionsForLearners.idevice is None:
            idevice.instructionsForLearners.idevice = idevice
        if idevice.content.idevice is None:
            idevice.content.idevice = idevice
        if idevice.feedback.idevice is None:
            idevice.feedback.idevice = idevice

        self.instructionElement = \
            TextAreaElement(idevice.instructionsForLearners)
        self.clozeElement = ClozeElement(idevice.content)
        self.feedbackElement = \
            TextAreaElement(idevice.feedback)
        self.previewing = False  # In view or preview render
        if not hasattr(self.idevice, 'undo'):
            self.idevice.undo = True
Beispiel #17
0
    def __init__(self, parent, idevice):
        """
        Initialize
        """
        Block.__init__(self, parent, idevice)

        # to compensate for the strange unpickling timing when objects are
        # loaded from an elp, ensure that proper idevices are set:
        if idevice.article.idevice is None:
            idevice.article.idevice = idevice
        self.articleElement = TextAreaElement(idevice.article)
        self.articleElement.height = 300
        if not hasattr(self.idevice, 'undo'):
            self.idevice.undo = True
Beispiel #18
0
    def __init__(self, field):
        Element.__init__(self, field)

        self.textElements = {}
        self.textAreaElements = {}

        for textFieldName, textFieldDetails in field.textFieldNames.iteritems(
        ):
            self.textElements[textFieldName] = TextElement(
                field.textFields[textFieldName])

        for textAreaFieldName, textAreaFieldDetails in field.textAreaFieldNames.iteritems(
        ):
            self.textAreaElements[textAreaFieldName] = TextAreaElement(
                field.textAreaFields[textAreaFieldName])
Beispiel #19
0
    def __init__(self, parent, idevice):
        """
        Initialize a new Block object
        """
        Block.__init__(self, parent, idevice)
        self.commentInstruc = idevice.commentInstruc

        if idevice.commentTextArea.idevice is None:
            idevice.commentTextArea.idevice = idevice

        self.commentElement = TextAreaElement(idevice.commentTextArea)

        self.previewing = False  # In view or preview render

        if not hasattr(self.idevice, 'undo'):
            self.idevice.undo = True
Beispiel #20
0
    def __init__(self, parent, idevice):
        """
        Initialize
        """
        Block.__init__(self, parent, idevice)
        self.imageMagnifierElement = MagnifierElement(idevice.imageMagnifier)

        # to compensate for the strange unpickling timing when objects are
        # loaded from an elp, ensure that proper idevices are set:
        # (only applies to the image-embeddable ones, not MagnifierElement)
        if idevice.text.idevice is None:
            idevice.text.idevice = idevice
        self.textElement = TextAreaElement(idevice.text)

        if not hasattr(self.idevice, 'undo'):
            self.idevice.undo = True
Beispiel #21
0
def field_engine_build_elements_on_block(fieldInfoDict, fieldDict, idevice):
    fieldCounter = 0
    elementDict = {}
    for fieldInfoKey, fieldInfoArr in fieldInfoDict.items():
        elementTypeName = fieldInfoArr[EXEFIELDINFO_TYPE]

        #check the field - if this is a new one or src code edit etc. then add this field...
        field_engine_check_field(fieldInfoKey, fieldInfoDict, fieldDict,
                                 idevice)
        newElement = ""
        if elementTypeName == 'image':
            newElement = ImageElement(fieldDict[fieldInfoKey])
        elif elementTypeName == 'text':
            newElement = TextElement(fieldDict[fieldInfoKey])
        elif elementTypeName == 'textarea':
            newElement = TextAreaElement(fieldDict[fieldInfoKey])
        elif elementTypeName == 'choice':
            newElement = ChoiceElement(fieldDict[fieldInfoKey])

        if newElement != "":
            elementDict[fieldInfoKey] = newElement

    return elementDict
Beispiel #22
0
    def __init__(self, parent, idevice):
        Block.__init__(self, parent, idevice)
        self.mainTextAreaElements = {}
        self.mainTextElements = {}
        self.clickableAreaElements = []
        self.questionOrderChoiceElement = ChoiceElement(
            idevice.questionOrderChoiceField)
        self.timerChoiceElement = ChoiceElement(idevice.timerChoiceField)
        self.titleElement = TextElement(idevice.titleField)

        for textAreaFieldName, textAreaFieldVals in idevice.textAreaFieldNames.iteritems(
        ):
            self.mainTextAreaElements[textAreaFieldName] = TextAreaElement(
                idevice.textAreaFields[textAreaFieldName])

        for textFieldName, textFieldVals in idevice.textFieldNames.iteritems():
            self.mainTextElements[textFieldName] = TextElement(
                idevice.textFields[textFieldName])

        for clickableAreaField in idevice.clickableAreaFields:
            newClickableElement = ClickInOrderClickableAreaElement(
                clickableAreaField)
            self.clickableAreaElements.append(newClickableElement)
Beispiel #23
0
    def __init__(self, index, question, questionId, option, idevice):
        """
        Initialize
        """
        self.index = index
        self.id = unicode(index) + "q" + questionId
        self.question = question
        self.questionId = questionId
        self.option = option
        self.answerId = "optionAnswer" + unicode(index) + "q" + questionId
        self.keyId = "key" + questionId
        self.idevice = idevice
        self.checked = False

        # to compensate for the strange unpickling timing when objects are
        # loaded from an elp, ensure that proper idevices are set:
        # (only applies to the image-embeddable ones, not FlashElement)
        if option.answerTextArea.idevice is None:
            option.answerTextArea.idevice = idevice
        self.answerElement = TextAreaElement(option.answerTextArea)
        self.answerElement.id = self.answerId

        if not hasattr(self.idevice, 'undo'):
            self.idevice.undo = True
Beispiel #24
0
 def __init__(self, parent, idevice):
     Block.__init__(self, parent, idevice)
     self.contentElement = TextAreaElement(idevice.content)
     self.contentElement.height = 250