def __init__(self, urls, entry, modul, *args, **kwargs): super(Preview, self).__init__(*args, **kwargs) self.addClass("vi-widget vi-widget--preview") self.urls = urls self.entry = entry self.module = modul containerDiv = html5.Div() containerDiv.addClass("vi-actionbar") self.appendChild(containerDiv) self.urlCb = html5.Select() containerDiv.appendChild(self.urlCb) self.previewFrame = html5.Iframe() self.appendChild(self.previewFrame) btnClose = html5.ext.Button("Close", callback=self.doClose) btnClose.addClass("btn--close") containerDiv.appendChild(btnClose) currentUrl = None for name, url in urls.items(): o = html5.Option() o["value"] = url o.appendChild(html5.TextNode(name)) self.urlCb.appendChild(o) if currentUrl is None: currentUrl = url self.setUrl(currentUrl) self.sinkEvent("onChange") self.addClass("preview")
def onRootNodesAvailable(self, req): res = NetworkService.decode(req) for node in res: option = html5.Option() option["value"] = node["key"] option.appendChild(html5.TextNode(node["name"])) if node["key"] == self.parent().parent().rootNode: option["selected"] = True self.appendChild(option) if len(self.children()) > 1: self.show() else: self.hide()
def __init__(self, *args, **kwargs): super(LoadNextBatchAction, self).__init__() self["class"].append("input-group bar-item") self.pages = html5.Select() self.pages["class"].append("select ignt-select select--small") for x in [1, 5, 10]: opt = html5.Option(x) opt["value"] = x self.pages.appendChild(opt) self.appendChild(self.pages) self.btn = Button(translate("load next pages"), callback=self.onClick) self.btn["class"] = "bar-item btn btn--small btn--loadnext" self.appendChild(self.btn) self.sinkEvent("onChange") self.currentLoadedPages = 0
def rebuildCB(self, *args, **kwargs): self.urlCb.removeAllChildren() if isinstance(self.urls, list): self.urls = {x: x for x in self.urls} if not isinstance(self.urls, dict) or len(self.urls.keys()) == 1: self.urlCb.addClass("is-hidden") return for name, url in self.urls.items(): o = html5.Option() o["value"] = url o.appendChild(html5.TextNode(name)) self.urlCb.appendChild(o) self.urlCb.removeClass("is-hidden")
def __init__(self, *args, **kwargs): super(SetPageRowAmountAction, self).__init__() self["class"].append("input-group") self.pages = html5.Select() self.pages["class"].append("select ignt-select select--small") defaultSizes = [5, 10, 25, 50, 75, 99] if not conf["batchSize"] in defaultSizes: defaultSizes.insert(0, conf["batchSize"]) for x in defaultSizes: opt = html5.Option(x) opt["value"] = x self.pages.appendChild(opt) self.appendChild(self.pages) self.btn = Button(translate("amount"), callback=self.onClick) self.btn["class"] = "bar-item btn btn--small btn--amount" self.appendChild(self.btn) self.sinkEvent("onChange") self.currentLoadedPages = 0
def __init__( self ): super( TaskSelectWidget, self ).__init__( title = translate( "vi.tasks.headline" ) ) self.sinkEvent( "onChange" ) div = html5.Div() div[ "class" ] = [ "vi-tasks-selector" ] self.popupBody.appendChild( div ) self.select = html5.ignite.Select() div.appendChild( self.select ) for type in [ "server", "client" ]: for i, task in enumerate( conf[ "tasks" ][ type ] ): if type == "client": assert task[ "task" ], "task-Attribute must be set for client-side tasks" if not "type" in task.keys(): task[ "type" ] = type opt = html5.Option() opt.task = task opt.appendChild( html5.TextNode( task[ "name" ] ) ) if not self.select._children: opt._setSelected( True ) self.select.appendChild( opt ) self.descr = html5.Div() self.descr[ "class" ] = [ "vi-tasks-description" ] self.popupBody.appendChild( self.descr ) self.popupFoot.appendChild( html5.ext.Button( translate( "Cancel" ), self.close ) ) self.popupFoot.appendChild( html5.ext.Button( translate( "Run" ), self.invokeTask ) ) # Init self.setActiveTask()
def __init__(self, widget, *args, **kwargs): super(ExportCsvStarter, self).__init__(title=translate("CSV Export")) self.widget = widget if "viur.defaultlangsvalues" in conf["server"].keys(): self.langSelect = html5.Select() self.langSelect.addClass("select") self.langSelect["id"] = "lang-select" lbl = html5.Label(translate("Language selection")) lbl.addClass("label") lbl["for"] = "lang-select" div = html5.Div() div.appendChild(lbl) div.appendChild(self.langSelect) div.addClass("input-group") self.popupBody.appendChild(div) for key, value in conf["server"]["viur.defaultlangsvalues"].items( ): opt = html5.Option() opt["value"] = key opt.appendChild(html5.TextNode(value)) if key == conf["currentLanguage"]: opt["selected"] = True self.langSelect.appendChild(opt) else: self.langSelect = None # Encoding self.encodingSelect = html5.Select() self.encodingSelect.addClass("select") self.encodingSelect["id"] = "encoding-select" lbl = html5.Label(translate("Encoding")) lbl.addClass("label") lbl["for"] = "encoding-select" div = html5.Div() div.appendChild(lbl) div.appendChild(self.encodingSelect) div.addClass("input-group") self.popupBody.appendChild(div) for i, (k, v) in enumerate([("iso-8859-15", "ISO-8859-15"), ("utf-8", "UTF-8")]): opt = html5.Option() opt["value"] = k if i == 0: opt["selected"] = True opt.appendChild(html5.TextNode(v)) self.encodingSelect.appendChild(opt) self.cancelBtn = Button(translate("Cancel"), self.close, icon="icons-cancel") self.popupFoot.appendChild(self.cancelBtn) self.exportBtn = Button(translate("Export"), self.onExportBtnClick, icon="icons-download-file") self.exportBtn.addClass("btn--edit") self.popupFoot.appendChild(self.exportBtn)