def buildListSelection(self): popupwrap = html5.Div() popupwrap.addClass(["box", "main-box"]) # build Buttonbar self.buttonbar = ButtonBar() # language=HTML self.buttonbar.addButton( "reloadbtn", """<flare-buttonbar-button text="neuladen" [name]="reloadbtn"></flare-buttonbar-button>""", ) # language=HTML self.filterbtn = self.buttonbar.addButton( "filterbtn", """<flare-buttonbar-search [name]="filterbtn"></flare-buttonbar-search>""", ) self.filterbtn.state.register("applyfilter", self) # language=HTML self.selectbtn = self.buttonbar.addButton( "selectbtn", """<flare-buttonbar-button text="auswählen" [name]="selectbtn"></flare-buttonbar-button>""", ) self.buttonbar.state.register("activeButton", self) popupwrap.appendChild(self.buttonbar) self.listelements = html5.Div() popupwrap.appendChild(self.listelements) self.requestClients() self.setContent(popupwrap)
def FileApiTest(): testDiv = html5.Div() divparamslist = dir(testDiv.element) return ('draggable' in divparamslist or ('ondragstart' in divparamslist and 'ondrop' in divparamslist)) and 'FormData' in dir( html5.window) and 'FileReader' in dir(html5.window)
def additionalDropAreas(self): ''' Drag and Drop areas ''' self.afterDiv = html5.Div() self.afterDiv["class"] = ["after-element"] self.afterDiv.hide() aftertxt = html5.TextNode(translate(u"Nach dem Element einfügen")) self.afterDiv.appendChild(aftertxt) self.nodeWrapper.appendChild(self.afterDiv) self.beforeDiv = html5.Div() self.beforeDiv["class"] = ["before-element"] self.beforeDiv.hide() beforetxt = html5.TextNode(translate(u"Vor dem Element einfügen")) self.beforeDiv.appendChild(beforetxt) self.nodeWrapper.prependChild(self.beforeDiv)
def FileApiTest(): testDiv = html5.Div() divparamslist = dir(testDiv.element) return (("draggable" in divparamslist or ("ondragstart" in divparamslist and "ondrop" in divparamslist)) and "FormData" in dir(html5.window) and "FileReader" in dir(html5.window))
def onAttach(self): if not self.formloaded: if "boneName" not in dir(self): logging.debug("Please add boneName attribute to {}", self) if "form" not in dir(self) or not self.form: logging.debug( "Please add :form attribute with a named form widget to {}.", self) if "skel" not in dir(self.form) or "structure" not in dir( self.form): logging.debug( "Missing :skel and :structure databinding on referenced form", self.form) if "moduleName" not in dir(self.form): logging.debug( "Missing moduleName attribute on referenced form", self.form) #self.form existiert und form hat skel und structure if isinstance(self.form.structure, list): self.structure = {k: v for k, v in self.form.structure} else: self.structure = self.form.structure self.skel = self.form.skel self.moduleName = self.form.moduleName formparam = {"formName": self.form.formName} try: boneFactory = boneSelector.select(self.moduleName, self.boneName, self.structure, **formparam)(self.moduleName, self.boneName, self.structure) self.bonewidget = boneFactory.editWidget() except Exception as e: logging.exception(e) self.bonewidget = html5.Div("Bone not Found %s" % self.boneName) self.appendChild(self.bonewidget) return 0 bonestructure = self.structure.get(self.boneName, {}) #label and bone wrapper self.addClass([ "input-group", "flr-bone", "flr-bone--%s" % bonestructure.get("type").replace(".", "-"), "flr-bone--%s" % self.boneName.replace("_", "-") ]) if self.boneName in self.form.hide or self.hidden: self._setHidden(True) else: self._setHidden(False) self.form.registerField(self.boneName, self) if self.label: #label optional self.appendChild(self.labelTemplate(), descr=bonestructure.get( "descr", self.boneName), type=bonestructure.get("type"), boneName=self.boneName) self.sinkEvent("onChange") self.appendChild(self.bonewidget) if self.defaultvalue: self.skel[ self. boneName] = self.defaultvalue # warning overrides server default self.unserialize(self.skel) self.formloaded = True
def onAttach(self): if not self.formloaded: if "boneName" not in dir(self): logging.debug("Please add boneName attribute to {}", self) if "form" not in dir(self) or not self.form: logging.debug( "Please add :form attribute with a named form widget to {}.", self) if "skel" not in dir(self.form) or "structure" not in dir( self.form): logging.debug( "Missing :skel and :structure databinding on referenced form", self.form) if "moduleName" not in dir(self.form): logging.debug( "Missing moduleName attribute on referenced form", self.form) #self.form existiert und form hat skel und structure if isinstance(self.form.structure, list): self.structure = {k: v for k, v in self.form.structure} else: self.structure = self.form.structure self.skel = self.form.skel self.moduleName = self.form.moduleName formparam = {"formName": self.form.formName} try: boneFactory = boneSelector.select( self.moduleName, self.boneName, self.structure, **formparam)(self.moduleName, self.boneName, self.structure, self.form.errors) containerDiv, descrLbl, self.bonewidget, hasError = boneFactory.boneWidget( self.label) except Exception as e: logging.exception(e) self.bonewidget = html5.Div("Bone not Found: %s" % self.boneName) self.appendChild(self.bonewidget) return 0 if self.boneName in self.form.hide or self.hidden: self._setHidden(True) else: self._setHidden(False) self.form.registerField(self.boneName, self) self.sinkEvent("onChange") self.appendChild(containerDiv) if self.defaultvalue: self.skel[ self. boneName] = self.defaultvalue # warning overrides server default self.unserialize(self.skel) self.formloaded = True