def process(self, request): """ Handles a post from the webui and changes our state accordingly """ log.debug("process " + repr(request.args)) is_cancel = common.requestHasCancel(request) obj = request.args.get('object', [''])[0] if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] if obj != self.id: self.idevice.recreateResources() self.processCaptions(request) if obj != self.id: Block.process(self, request) return action = request.args.get('action', [''])[0] if action.startswith('gallery.'): self.processGallery(action) if self.mode == Block.Edit \ and not is_cancel: self.processCaptions(request) if action == 'done': self.idevice.recreateResources() if hasattr(self.idevice,'undo'): del self.idevice.undo Block.process(self, request)
def process(self, request): """ Handles a post from the webui and changes our state accordingly """ log.debug("process " + repr(request.args)) # If the commit is not to do with us forget it is_cancel = common.requestHasCancel(request) obj = request.args.get('object', [''])[0] if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] if obj != self.id: self.idevice.recreateResources() self.processCaptions(request) if obj != self.id: Block.process(self, request) return # Separate out the action we want to do and the params action = request.args.get('action', [''])[0] if action.startswith('gallery.'): self.processGallery(action) if self.mode == Block.Edit \ and not is_cancel: self.processCaptions(request) if action == 'done': self.idevice.recreateResources() # remove the undo flag in order to reenable it next time: if hasattr(self.idevice,'undo'): del self.idevice.undo # Let our ancestor deal with the rest Block.process(self, request)
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) self.idevice.message = "" if ("addQuestion"+unicode(self.id)) in request.args: self.idevice.addQuestion() self.idevice.edit = True if "title"+self.id in request.args: self.idevice.title = request.args["title"+self.id][0] for element in self.questionElements: element.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): for question in self.idevice.questions: isAnswered = False for option in question.options: if option.isCorrect: isAnswered = True break if not isAnswered: self.idevice.edit = True self.idevice.message = \ x_("Please select a correct answer for each question.") break
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) is_cancel = common.requestHasCancel(request) self.storyElement.process(request) if (u"addQuestion"+unicode(self.id)) in request.args: self.idevice.addQuestion() self.idevice.edit = True # disable Undo once another activity has been added: self.idevice.undo = False if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] if "action" in request.args and request.args[u"action"][0] != u"delete": for element in self.questionElements: element.process(request) if request.args[u"action"][0] == u'done': # remove the undo flag in order to reenable it next time: if hasattr(self.idevice,'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): self.imageMagnifierElement.process(request) self.textElement.process(request) if "float"+self.id in request.args: self.idevice.float = request.args["float"+self.id][0] if "caption"+self.id in request.args: self.idevice.caption = request.args["caption"+self.id][0] if "glass"+self.id in request.args: self.idevice.imageMagnifier.glassSize = \ request.args["glass"+self.id][0] if "initial"+self.id in request.args: if request.args["initial"+self.id][0] == "yes": self.idevice.imageMagnifier.initialZSize = "120" else: self.idevice.imageMagnifier.initialZSize ="100" if "maxZoom"+self.id in request.args: self.idevice.imageMagnifier.maxZSize = \ request.args["maxZoom"+self.id][0]
def process(self, request): """ Process the request arguments from the web server """ is_cancel = common.requestHasCancel(request) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): for element in self.elements: element.process(request) if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] if "iconiDevice"+self.id in request.args \ and not is_cancel: self.idevice.icon = request.args["iconiDevice"+self.id][0] if not is_cancel: if self.idevice.title !='' or self.idevice.icon !='': self.idevice.emphasis = Idevice.SomeEmphasis else: self.idevice.emphasis = Idevice.NoEmphasis
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ is_cancel = common.requestHasCancel(request) if is_cancel: self.idevice.edit = False # but double-check for first-edits, and ensure proper attributes: if not hasattr(self.idevice.content, 'content_w_resourcePaths'): self.idevice.content.content_w_resourcePaths = "" if not hasattr(self.idevice.content, 'content_wo_resourcePaths'): self.idevice.content.content_wo_resourcePaths = "" return Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): content = self.contentElement.process(request) if content: self.idevice.content = content if "export" + self.id in request.args and not is_cancel: self.idevice.exportType = request.args["export" + self.id][0]
def process(self, request): """ Process the request arguments from the web server """ is_cancel = common.requestHasCancel(request) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): for element in self.elements: element.process(request) if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] if "iconiDevice"+self.id in request.args \ and not is_cancel: self.idevice.icon = request.args["iconiDevice"+self.id][0] if not is_cancel: if self.idevice.title !='' or self.idevice.icon !='': self.idevice.emphasis = Idevice.SomeEmphasis else: self.idevice.emphasis = Idevice.NoEmphasis
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ self.idevice.message = "" Block.process(self, request) self.titleElement.process(request) self.questionOrderChoiceElement.process(request) self.timerChoiceElement.process(request) self.idevice.uploadNeededScripts() if "addClickableArea" + unicode(self.id) in request.args: self.idevice.addClickableField() self.idevice.edit = True self.idevice.undo = False for textAreaFieldName, textAreaElement in self.mainTextAreaElements.iteritems( ): textAreaElement.process(request) for textFieldName, textElement in self.mainTextElements.iteritems(): textElement.process(request) for clickableAreaElement in self.clickableAreaElements: clickableAreaElement.process(request) #validate integer fields are actually integers field_engine_check_fields_are_ints(self.mainTextElements, \ ["width", "height", "hintWidth", "hintHeight"], thisIdevice=self.idevice)
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ self.idevice.message = "" Block.process(self, request) for sortableElement in self.sortableItemElements: sortableElement.process(request) #check and see about deleting from the list field_engine_check_delete(sortableElement, request, self.idevice.itemsToSort) self.idevice.uploadNeededScripts() errorMsg = "" if "addSortableItem" + unicode(self.id) in request.args: self.idevice.addItemToSort() self.idevice.edit = True self.idevice.undo = False field_engine_process_all_elements(self.mainElements, request) self.idevice.title = self.mainElements['title'].renderView() field_engine_check_fields_are_ints(self.mainElements, ['itemwidth', 'itemheight'], thisIdevice=self.idevice)
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) if "code" + self.id in request.args: self.idevice.appletCode = request.args["code" + self.id][0] if "action" in request.args and request.args["action"][0] == self.id: self.idevice.deleteFile(request.args["object"][0]) self.idevice.edit = True if "action" in request.args and request.args["action"][0] == "changeType" + self.id: self.idevice.type = request.args["object"][0] self.idevice.copyFiles() self.idevice.edit = True if "upload" + self.id in request.args: if "path" + self.id in request.args: filePath = request.args["path"+self.id][0] if filePath: if self.idevice.type == "geogebra" and not filePath.endswith(".ggb"): self.idevice.message = _("Please upload a .ggb file.") else: self.idevice.uploadFile(filePath) self.idevice.message = "" self.idevice.edit = True
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) is_cancel = common.requestHasCancel(request) if 'emphasis'+self.id in request.args \ and not is_cancel: self.idevice.emphasis = int(request.args['emphasis'+self.id][0]) if 'site'+self.id in request.args \ and not is_cancel: self.idevice.site = request.args['site'+self.id][0] if 'title'+self.id in request.args \ and not is_cancel: self.idevice.title = request.args['title'+self.id][0] if "url" + self.id in request.args \ and not is_cancel: self.idevice.url = request.args['url'+ self.id][0] if 'loadRss'+self.id in request.args \ and not is_cancel: self.idevice.undo = False self.idevice.loadRss(request.args['url'+ self.id][0]) else: Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): self.rssElement.process(request) if "action" in request.args \ and request.args["action"][0] == "done": if hasattr(self.idevice,'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ Block.process(self, request) self.contentElement.process(request)
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ self.idevice.message = "" Block.process(self, request) for sortableElement in self.sortableItemElements: sortableElement.process(request) # check and see about deleting from the list field_engine_check_delete(sortableElement, request, self.idevice.itemsToSort) self.idevice.uploadNeededScripts() errorMsg = "" if "addSortableItem" + unicode(self.id) in request.args: self.idevice.addItemToSort() self.idevice.edit = True self.idevice.undo = False field_engine_process_all_elements(self.mainElements, request) self.idevice.title = self.mainElements["title"].renderView() field_engine_check_fields_are_ints(self.mainElements, ["itemwidth", "itemheight"], thisIdevice=self.idevice)
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) is_cancel = common.requestHasCancel(request) self.instructionElement.process(request) if ("addQuestion" + unicode(self.id)) in request.args: self.idevice.addQuestion() self.idevice.edit = True # disable Undo once a question has been added: self.idevice.undo = False if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title" + self.id][0] for element in self.questionElements: element.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): # remove the undo flag in order to reenable it next time: if hasattr(self.idevice, 'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ is_cancel = common.requestHasCancel(request) if is_cancel: self.idevice.edit = False # but double-check for first-edits, and ensure proper attributes: if not hasattr(self.idevice.content, 'content_w_resourcePaths'): self.idevice.content.content_w_resourcePaths = "" if not hasattr(self.idevice.content, 'content_wo_resourcePaths'): self.idevice.content.content_wo_resourcePaths = "" return Block.process(self, request) if "title" + self.id in request.args and not is_cancel: self.idevice.title = request.args["title" + self.id][0] if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): content = self.contentElement.process(request) if content: self.idevice.content = content
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ Block.process(self, request) is_cancel = common.requestHasCancel(request) self.showDescBlock.process(request) self.introHTMLElement.process(request) showDesc = False if self.showDescBlock.renderView() == "yes": showDesc = True if showDesc == True: self.idevice.emphasis = Idevice.SomeEmphasis else: self.idevice.emphasis = Idevice.NoEmphasis for fileElement in self.fileAttachmentElements: fileElement.process(request) if field_engine_is_delete(fileElement, request, self.idevice.fileAttachmentFields): #fileElement.field.deleteFile() field_engine_check_delete(fileElement, request, self.idevice.fileAttachmentFields) if "addFileAttachment" + unicode(self.id) in request.args: self.idevice.addFileAttachmentField() self.idevice.edit = True self.idevice.undo = False #check the title - lifted from genericblock if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ Block.process(self, request) is_cancel = common.requestHasCancel(request) self.showDescBlock.process(request) self.introHTMLElement.process(request) showDesc = False if self.showDescBlock.renderView() == "yes": showDesc = True if showDesc == True: self.idevice.emphasis = Idevice.SomeEmphasis else: self.idevice.emphasis = Idevice.NoEmphasis for fileElement in self.fileAttachmentElements: fileElement.process(request) if field_engine_is_delete(fileElement, request, self.idevice.fileAttachmentFields): #fileElement.field.deleteFile() field_engine_check_delete(fileElement, request, self.idevice.fileAttachmentFields) if "addFileAttachment" + unicode(self.id) in request.args: self.idevice.addFileAttachmentField() self.idevice.edit = True self.idevice.undo = False #check the title - lifted from genericblock if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ self.idevice.message = "" Block.process(self, request) self.idevice.uploadNeededScripts() if field_engine_is_delete_request(request): return if "addMapArea" + unicode(self.id) in request.args: self.idevice.add_map_area() self.idevice.edit = True self.idevice.undo = False field_engine_process_all_elements(self.mainElements, request) for map_area_el in self.map_area_elements: field_engine_check_delete(map_area_el, request, self.idevice.map_areas) map_area_el.process(request) self.idevice.title = self.mainElements['title'].renderView()
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) is_cancel = common.requestHasCancel(request) if 'emphasis'+self.id in request.args \ and not is_cancel: self.idevice.emphasis = int(request.args['emphasis'+self.id][0]) self.idevice.undo = False if 'ssite'+self.id in request.args \ and not is_cancel: self.idevice.site = request.args['ssite'+self.id][0] if 'ownUrl'+self.id in request.args \ and not is_cancel: self.idevice.ownUrl = request.args['ownUrl'+self.id][0] if 'title'+self.id in request.args \ and not is_cancel: self.idevice.title = request.args['title'+self.id][0] if ("object" in request.args and request.args["object"][0] == "site" + self.id): pass elif 'loadWikipedia'+self.id in request.args: self.idevice.loadArticle(request.args['article'][0]) self.idevice.undo = False else: Block.process(self, request) if (u"action" not in request.args \ or request.args[u"action"][0] != u"delete"): self.articleElement.process(request) if "action" in request.args \ and request.args["action"][0] == "done": if hasattr(self.idevice,'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ self.idevice.message = "" Block.process(self, request) self.titleElement.process(request) self.questionOrderChoiceElement.process(request) self.timerChoiceElement.process(request) self.idevice.uploadNeededScripts() if "addClickableArea" + unicode(self.id) in request.args: self.idevice.addClickableField() self.idevice.edit = True self.idevice.undo = False for textAreaFieldName, textAreaElement in self.mainTextAreaElements.iteritems(): textAreaElement.process(request) for textFieldName, textElement in self.mainTextElements.iteritems(): textElement.process(request) for clickableAreaElement in self.clickableAreaElements: clickableAreaElement.process(request) #validate integer fields are actually integers field_engine_check_fields_are_ints(self.mainTextElements, \ ["width", "height", "hintWidth", "hintHeight"], thisIdevice=self.idevice)
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) is_cancel = common.requestHasCancel(request) if ("addQuestion"+unicode(self.id)) in request.args: self.idevice.addQuestion() self.idevice.edit = True self.idevice.undo = False if "passrate" in request.args \ and not is_cancel: self.idevice.passRate = request.args["passrate"][0] for element in self.questionElements: element.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): self.idevice.isAnswered = True if hasattr(self.idevice,'undo'): del self.idevice.undo for question in self.idevice.questions: if question.correctAns == -2: self.idevice.isAnswered = False self.idevice.edit = True break if "submitScore" in request.args \ and not is_cancel: self.idevice.score = self.__calcScore() if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ Block.process(self, request) self.idevice.uploadNeededScripts() if "addPlacableObject" + unicode(self.id) in request.args: self.idevice.addPlacableObject() self.idevice.edit = True self.idevice.undo = False if "checktimer" + unicode(self.id) in request.args: if "enabletimer" + unicode(self.id) in request.args: self.idevice.gameTimerShown.content = True else: self.idevice.gameTimerShown.content = False self.titleElement.process(request) self.idevice.title = self.titleElement.renderView() self.contentElement.process(request) self.mainAreaElement.process(request) self.positiveResponseElement.process(request) self.negativeResponseElement.process(request) self.clickToStartElement.process(request) self.gameTimeLimit.process(request) self.partbinNumCols.process(request) for placableObjectElement in self.placableObjectElements: placableObjectElement.process(request)
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) is_cancel = common.requestHasCancel(request) if (u"action" not in request.args or (request.args[u"action"][0] != u"delete" and not is_cancel)): self.imageMagnifierElement.process(request) self.textElement.process(request) if "action" in request.args and request.args["action"][0] == "done": if hasattr(self.idevice,'undo'): del self.idevice.undo if "float"+self.id in request.args \ and not is_cancel: self.idevice.float = request.args["float"+self.id][0] if "caption"+self.id in request.args \ and not is_cancel: self.idevice.caption = request.args["caption"+self.id][0] if "glass"+self.id in request.args \ and not is_cancel: self.idevice.imageMagnifier.glassSize = \ request.args["glass"+self.id][0] if "initial"+self.id in request.args \ and not is_cancel: self.idevice.imageMagnifier.initialZSize = \ request.args["initial"+self.id][0] if "maxZoom"+self.id in request.args \ and not is_cancel: self.idevice.imageMagnifier.maxZSize = \ request.args["maxZoom"+self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ Block.process(self, request) self.contentElement.process(request)
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) is_cancel = common.requestHasCancel(request) if ("addQuestion"+self.id) in request.args: self.idevice.addQuestion() self.idevice.edit = True # disable Undo once a question has been added: self.idevice.undo = False for element in self.questionElements: element.process(request) if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): # remove the undo flag in order to reenable it next time: if hasattr(self.idevice,'undo'): del self.idevice.undo
def process(self, request): """ Handles a post from the webui and changes our state accordingly """ log.debug("process " + repr(request.args)) # If the commit is not to do with us forget it is_cancel = common.requestHasCancel(request) obj = request.args.get('object', [''])[0] if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] if obj != self.id: self.idevice.recreateResources() self.processCaptions(request) if obj != self.id: Block.process(self, request) return # Separate out the action we want to do and the params action = request.args.get('action', [''])[0] if action.startswith('gallery.'): self.processGallery(action) if self.mode == Block.Edit \ and not is_cancel: self.processCaptions(request) if action == 'done': self.idevice.recreateResources() # remove the undo flag in order to reenable it next time: if hasattr(self.idevice,'undo'): del self.idevice.undo # Let our ancestor deal with the rest Block.process(self, request)
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) self.activityElement.process(request) self.answerElement.process(request) if "title" + self.id in request.args: self.idevice.title = request.args["title" + self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ Block.process(self, request) content = self.contentElement.process(request) if content: self.idevice.content = content if 'emphasis'+self.id in request.args: self.idevice.emphasis = int(request.args['emphasis'+self.id][0])
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): for element in self.elements: element.process(request) if "title"+self.id in request.args: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) is_cancel = common.requestHasCancel(request) if not is_cancel: self.activityElement.process(request) if "title"+self.id in request.args: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Handles changes in the paragraph text from editing """ if "title"+self.id in request.args: self.idevice.title = request.args["title"+self.id][0] object = request.args.get('object', [''])[0] action = request.args.get('action', [''])[0] self.instructionElement.process(request) self.clozeElement.process(request) self.feedbackElement.process(request) Block.process(self, request)
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) if ("addQuestion"+self.id) in request.args: self.idevice.addQuestion() self.idevice.edit = True for element in self.questionElements: element.process(request) if "title"+self.id in request.args: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) is_cancel = common.requestHasCancel(request) if not is_cancel: self.activityElement.process(request) if "title" + self.id in request.args: self.idevice.title = request.args["title" + self.id][0]
def process(self, request): """ Process the request arguments from the web server """ is_cancel = common.requestHasCancel(request) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): for element in self.elements: element.process(request) if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Handles changes in the paragraph text from editing """ is_cancel = common.requestHasCancel(request) if "title" + self.id in request.args and not is_cancel: self.idevice.title = request.args["title" + self.id][0] object = request.args.get("object", [""])[0] action = request.args.get("action", [""])[0] self.instructionElement.process(request) self.clozeElement.process(request) self.feedbackElement.process(request) Block.process(self, request)
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) if u"action" not in request.args or request.args[u"action"][0] != u"delete": self.imageElement.process(request) self.textElement.process(request) if "float" + self.id in request.args: self.idevice.float = request.args["float" + self.id][0] if "caption" + self.id in request.args: self.idevice.caption = request.args["caption" + self.id][0]
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) self.storyElement.process(request) if (u"addQuestion"+unicode(self.id)) in request.args: self.idevice.addQuestion() self.idevice.edit = True if "title"+self.id in request.args: self.idevice.title = request.args["title"+self.id][0] if "action" in request.args and request.args[u"action"][0] != u"delete": for element in self.questionElements: element.process(request)
def process(self, request): """ Process the request arguments from the web server """ is_cancel = common.requestHasCancel(request) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): for element in self.elements: element.process(request) if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) if ("addQuestion" + self.id) in request.args: self.idevice.addQuestion() self.idevice.edit = True for element in self.questionElements: element.process(request) if "title" + self.id in request.args: self.idevice.title = request.args["title" + self.id][0]
def process(self, request): """ Handles changes in the paragraph text from editing """ is_cancel = common.requestHasCancel(request) if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] object = request.args.get('object', [''])[0] action = request.args.get('action', [''])[0] self.instructionElement.process(request) self.ScormDropDownElement.process(request) #self.feedbackElement.process(request) Block.process(self, request)
def process(self, request): """ Handles changes in the paragraph text from editing """ is_cancel = common.requestHasCancel(request) if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title" + self.id][0] object = request.args.get('object', [''])[0] action = request.args.get('action', [''])[0] self.instructionElement.process(request) self.clozeElement.process(request) self.feedbackElement.process(request) Block.process(self, request)
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ self.idevice.message = "" Block.process(self, request) self.idevice.uploadNeededScripts() if field_engine_is_delete_request(request): return field_engine_process_all_elements(self.mainElements, request) self.idevice.title = self.mainElements['title'].renderView() for memoryMatchElement in self.memoryMatchElements: memoryMatchElement.process(request) if "calcPairs" + unicode(self.id) in request.args: self.idevice.setNumMatchingPairs() self.idevice.edit = True self.idevice.undo = False field_engine_check_fields_are_ints(self.mainElements,\ ['cellwidth', 'cellheight', 'rows', 'cols'], None, thisIdevice=self.idevice) try: numRows = int(self.idevice.mainFieldSet.fields['rows'].content) numCols = int(self.idevice.mainFieldSet.fields['cols'].content) numCells = numRows * numCols if numCells % 2 == 1: self.idevice.edit = True self.idevice.message += _( "Number of rows x Number of cols must be an even number<br/>" ) numPairsExisting = len(self.idevice.matchPairFields) if numPairsExisting != (numCells / 2): self.idevice.edit = True self.idevice.message += _( "After you set the number of rows/cols please click Create/Trim pairs button at the bottom and enter in the matching pairs for the game" ) except: #only here in case there is an invalid integer, in which case would be caught beforehand pass
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) is_cancel = common.requestHasCancel(request) if 'emphasis'+self.id in request.args \ and not is_cancel: self.idevice.emphasis = int(request.args['emphasis' + self.id][0]) # disable Undo once an emphasis has changed: self.idevice.undo = False if 'ssite'+self.id in request.args \ and not is_cancel: self.idevice.site = request.args['ssite' + self.id][0] if 'ownUrl'+self.id in request.args \ and not is_cancel: self.idevice.ownUrl = request.args['ownUrl' + self.id][0] if 'title'+self.id in request.args \ and not is_cancel: self.idevice.title = request.args['title' + self.id][0] if ("object" in request.args and request.args["object"][0] == "site" + self.id): pass elif 'loadWikipedia' + self.id in request.args: # If they've hit "load" instead of "the tick" self.idevice.loadArticle(request.args['article'][0]) # disable Undo once an article has been loaded: self.idevice.undo = False else: # If they hit "the tick" instead of "load" Block.process(self, request) if (u"action" not in request.args \ or request.args[u"action"][0] != u"delete"): # If the text has been changed self.articleElement.process(request) if "action" in request.args \ and request.args["action"][0] == "done": # remove the undo flag in order to reenable it next time: if hasattr(self.idevice, 'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server """ is_cancel = common.requestHasCancel(request) Block.process(self, request) if "pages" + self.id in request.args and not is_cancel : self.idevice.pages = request.args["pages" + self.id][0] if "path" + self.id in request.args \ and not is_cancel: pdfPath = request.args["path"+self.id][0] self.idevice.path = pdfPath try: self.idevice.uploadFile() except IOError, e: log.error("Unable to add file %s" % pdfPath)
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) is_cancel = common.requestHasCancel(request) # If they hit "the tick" instead of "load" Block.process(self, request) if (u"action" not in request.args \ or request.args[u"action"][0] != u"delete"): # If the text has been changed self.articleElement.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): if hasattr(self.idevice, 'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): self.flashElement.process(request) self.textElement.process(request) if "float" + self.id in request.args: self.idevice.float = request.args["float" + self.id][0] if "caption" + self.id in request.args: self.idevice.caption = request.args["caption" + self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ is_cancel = common.requestHasCancel(request) Block.process(self, request) if "url"+self.id in request.args \ and not is_cancel: self.idevice.url = request.args["url" + self.id][0] if (self.idevice.url and not self.idevice.url.startswith("http://") and not self.idevice.url.startswith("https://") and not self.idevice.url.startswith("ftp://")): self.idevice.url = "http://" + self.idevice.url if "height"+self.id in request.args \ and not is_cancel: self.idevice.height = request.args["height" + self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) is_cancel = common.requestHasCancel(request) if 'emphasis'+self.id in request.args \ and not is_cancel: self.idevice.emphasis = int(request.args['emphasis' + self.id][0]) # disable Undo once an emphasis has changed: self.idevice.undo = False if 'title'+self.id in request.args \ and not is_cancel: self.idevice.title = request.args['title' + self.id][0] if 'kpse' + self.id in request.args and not is_cancel: path = \ request.args['kpse' + self.id][0] if not os.path.isdir(path): path = os.path.dirname(path) self.idevice.latexpath = path self.idevice.set_env() if 'loadSource' + self.id in request.args: # If they've hit "load" instead of "the tick" self.idevice.source = request.args['path' + self.id][0] self.idevice.loadSource() # disable Undo once an article has been loaded: self.idevice.undo = False else: # If they hit "the tick" instead of "load" Block.process(self, request) if (u"action" not in request.args \ or request.args[u"action"][0] != u"delete"): # If the text has been changed self.articleElement.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): if hasattr(self.idevice, 'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) is_cancel = common.requestHasCancel(request) if ("addQuestion"+unicode(self.id)) in request.args: self.idevice.addQuestion() self.idevice.edit = True # disable Undo once a question has been added: self.idevice.undo = False if "passrate" in request.args \ and not is_cancel: self.idevice.passRate = request.args["passrate"][0] for element in self.questionElements: element.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): self.idevice.isAnswered = True # remove the undo flag in order to reenable it next time: if hasattr(self.idevice,'undo'): del self.idevice.undo for question in self.idevice.questions: if question.correctAns == -2: self.idevice.isAnswered = False self.idevice.edit = True break if "submitScore" in request.args \ and not is_cancel: self.idevice.score = self.__calcScore() if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) is_cancel = common.requestHasCancel(request) if (u"action" not in request.args or (request.args[u"action"][0] != u"delete" and not is_cancel)): self.imageMagnifierElement.process(request) self.textElement.process(request) if "action" in request.args and request.args["action"][0] == "done": # remove the undo flag in order to reenable it next time: if hasattr(self.idevice, 'undo'): del self.idevice.undo if "float"+self.id in request.args \ and not is_cancel: self.idevice.float = request.args["float" + self.id][0] if "caption"+self.id in request.args \ and not is_cancel: self.idevice.caption = request.args["caption" + self.id][0] if "glass"+self.id in request.args \ and not is_cancel: self.idevice.imageMagnifier.glassSize = \ request.args["glass"+self.id][0] if "initial"+self.id in request.args \ and not is_cancel: self.idevice.imageMagnifier.initialZSize = \ request.args["initial"+self.id][0] if "maxZoom"+self.id in request.args \ and not is_cancel: self.idevice.imageMagnifier.maxZSize = \ request.args["maxZoom"+self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) is_cancel = common.requestHasCancel(request) if 'emphasis'+self.id in request.args \ and not is_cancel: self.idevice.emphasis = int(request.args['emphasis' + self.id][0]) if 'site'+self.id in request.args \ and not is_cancel: self.idevice.site = request.args['site' + self.id][0] if 'title'+self.id in request.args \ and not is_cancel: self.idevice.title = request.args['title' + self.id][0] if "url" + self.id in request.args \ and not is_cancel: self.idevice.url = request.args['url' + self.id][0] if 'loadRss'+self.id in request.args \ and not is_cancel: # disable Undo once a question has been added: self.idevice.undo = False self.idevice.loadRss(request.args['url' + self.id][0]) else: Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): # If the text has been changed self.rssElement.process(request) if "action" in request.args \ and request.args["action"][0] == "done": # remove the undo flag in order to reenable it next time: if hasattr(self.idevice, 'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) is_cancel = common.requestHasCancel(request) if "code" + self.id in request.args \ and not is_cancel: self.idevice.appletCode = request.args["code" + self.id][0] if "action" in request.args and request.args["action"][0] == self.id: self.idevice.deleteFile(request.args["object"][0]) self.idevice.edit = True self.idevice.undo = False if "action" in request.args and request.args["action"][0] == "changeType" + self.id: self.idevice.type = request.args["object"][0] self.idevice.copyFiles() self.idevice.edit = True self.idevice.undo = False if "action" in request.args and request.args["action"][0] == "done": # remove the undo flag in order to reenable it next time: if hasattr(self.idevice,'undo'): del self.idevice.undo if "upload" + self.id in request.args: if "path" + self.id in request.args: filePath = request.args["path"+self.id][0] if filePath: if self.idevice.type == "geogebra" and not filePath.endswith(".ggb"): self.idevice.message = _("Please upload a .ggb file.") else: self.idevice.uploadFile(filePath) self.idevice.message = "" self.idevice.edit = True self.idevice.undo = False
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): self.mediaElement.process(request) self.textElement.process(request) if 'emphasis' + self.id in request.args: self.idevice.emphasis = int(request.args['emphasis' + self.id][0]) if "float" + self.id in request.args: self.idevice.float = request.args["float" + self.id][0] if "title" + self.id in request.args: self.idevice.title = request.args["title" + self.id][0]
def process(self, request): """ Process the request arguments from the web server """ is_cancel = common.requestHasCancel(request) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): for element in self.elements: element.process(request) if "address" + self.id in request.args and not is_cancel: if request.args["address" + self.id][0] == self.package.email: self.idevice.address = "" else: self.idevice.address = request.args["address" + self.id][0] if "subject" + self.id in request.args and not is_cancel: self.idevice.subject = request.args["subject" + self.id][0] if "comment" + self.id in request.args and not is_cancel: self.idevice.comment = request.args["comment" + self.id][0] if "title"+self.id in request.args: self.idevice.title = request.args["title"+self.id][0]
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ Block.process(self, request) is_cancel = common.requestHasCancel(request) if "title" + self.id in request.args: self.idevice.title = request.args["title" + self.id][0] if ("addTerm" + self.id) in request.args: self.idevice.addTerm() self.idevice.edit = True self.idevice.undo = False for element in self.termElements: element.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): # remove the undo flag in order to reenable it next time: if hasattr(self.idevice, 'undo'): del self.idevice.undo
def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) self.idevice.message = "" is_cancel = common.requestHasCancel(request) if ("addQuestion"+unicode(self.id)) in request.args: self.idevice.addQuestion() self.idevice.edit = True # disable Undo once a question has been added: self.idevice.undo = False if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] for element in self.questionElements: element.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): # remove the undo flag in order to reenable it next time: if hasattr(self.idevice,'undo'): del self.idevice.undo for question in self.idevice.questions: isAnswered = False for option in question.options: if option.isCorrect: isAnswered = True break if not isAnswered: self.idevice.edit = True self.idevice.message = \ x_("Please select a correct answer for each question.") break
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ log.debug("process " + repr(request.args)) Block.process(self, request) if (u"action" not in request.args or request.args[u"action"][0] != u"delete"): if u"label" + self.id in request.args: self.idevice.label = request.args[u"label" + self.id][0] self.descriptionElement.process(request) if "path" + self.id in request.args: attachmentPath = request.args["path" + self.id][0] if attachmentPath: self.idevice.setAttachment(attachmentPath) if self.idevice.label == "": self.idevice.label = os.path.basename(attachmentPath)
def process(self, request): """ Process the request arguments from the web server to see if any apply to this block """ #Make sure that we don't do anything when it's time to die... Block.process(self, request) self.idevice.message = "" if field_engine_is_delete_request(request): return self.idevice.addGameScript() self.titleElement.process(request) self.idevice.title = self.titleElement.renderView() self.alphabetElement.process(request) self.wrongGuessTextElement.process(request) self.lostLevelTextElement.process(request) self.levelPassedTextElement.process(request) self.gameWonTextElement.process(request) self.letterButtonStyleElement.process(request) self.wrongLetterButtonStyleElement.process(request) self.rightLetterButtonStyleElement.process(request) self.hintFieldStyleElement.process(request) self.wordAreaStyleElement.process(request) self.resetButtonTextElement.process(request) self.resetButtonStyleElement.process(request) #see if we need to delete a word blankWords = False for wordIndex in range(0, len(self.wordElements)): if self.wordElements[wordIndex].renderView() == "": blankWords = True elif self.hintElements[wordIndex].renderView() == "": blankWords = True if blankWords is True: self.idevice.message = _("One or more words or hints are blank. Please do not have any blank hints or words - you can delete unused ones.") self.idevice.edit = True #see if we need to add another chance if ("addChance"+unicode(self.id)) in request.args: self.idevice.addChance() self.idevice.edit = True # disable Undo once a question has been added: self.idevice.undo = False if("addWord"+unicode(self.id)) in request.args: self.idevice.addWord() self.idevice.edit = True self.idevice.undo = False content = self.contentElement.process(request) for imgElement in self.chanceImageElements: imgElement.process(request) if "action" in request.args and request.args["action"][0] == imgElement.id: self.idevice.chanceImageFields.remove(imgElement.field) imgElement.field.idevice.undo = False imgElement.field.idevice.edit = True for wordElement in self.wordElements: wordElement.process(request) if "action" in request.args and request.args["action"][0] == wordElement.id: wordIdx = self.wordElements.index(wordElement) self.idevice.wordTextFields.remove(wordElement.field) self.idevice.hintTextFields.remove(self.hintElements[wordIdx].field) wordElement.field.idevice.undo = False wordElement.field.idevice.edit = True for hintElement in self.hintElements: hintElement.process(request) if content: self.idevice.content = content