Beispiel #1
0
    def __init__(self):
        super(LogButton, self).__init__()

        self.logsList = []

        self["class"] = ["popout-opener", "popout-anchor", "popout--sw"]

        self.logbtn = Button(icon="icons-time",
                             className="btn btn--topbar btn--log")
        self.appendChild(self.logbtn)

        popout = html5.Div()
        popout["class"] = ["popout"]
        self.popoutlist = html5.Div()
        self.popoutlist["class"] = ["list"]

        popout.appendChild(self.popoutlist)
        self.appendChild(popout)
        self.sinkEvent("onClick")

        aitem = html5.Div()
        aitem["class"] = ["item", "has-hover", "item--small item--info"]
        listentry = logEntry({"msg": translate("Das Log ist Leer")})
        aitem.appendChild(listentry)
        self.popoutlist.appendChild(aitem)

        #load old logs from idb
        idb = conf["indexeddb"]
        if "vi_log" not in idb.objectStoreNames:
            idb.dbAction("createStore", "vi_log", None,
                         {"autoIncrement": True})
        data = idb.getList("vi_log")
        data.addEventListener("dataready", self.idbdata)
Beispiel #2
0
    def __init__(self, inputId, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.holdactive = False
        self.currentSelection = None

        self.input = html5.Input()
        self.input.addClass("input ignt-input")
        self["style"]["position"] = "relative"
        self.appendChild(self.input)

        self._suggestionContainer = html5.Div()
        self._suggestionContainer["style"]["position"] = "absolute"
        self._suggestionContainer["style"]["background-color"] = "white"
        self._suggestionContainer["style"]["width"] = "100%"
        self._suggestionContainer.hide()

        self.suggestionList = html5.Ul()
        self.suggestionList.addClass("list")
        self._suggestionContainer.appendChild(self.suggestionList)

        self.moreEntries = Button(translate("mehr laden"))
        #self._suggestionContainer.appendChild(self.moreEntries)
        self.appendChild(self._suggestionContainer)

        DeferredCall(self.updateContainer, _delay=1)
        self.sinkEvent("onClick")
        self.sinkEvent("onFocusOut")
        self.sinkEvent("onInput")
Beispiel #3
0
    def __init__(self, module, structure, item, *args, **kwargs):
        super(InternalPreview, self).__init__(*args, **kwargs)

        self.addClass("vi-sb-intprev box-body box--content")

        tmpDict = {key: bone for key, bone in structure}

        for key, bone in structure:
            if "params" in bone.keys() and bone["params"] \
              and "previewBone" in bone["params"].keys() \
              and bone["params"]["previewBone"] == False:
                continue

            self.ipli = html5.Li()
            self.ipli["class"] = [
                "vi-sb-intprev-item", "vi-sb-intprev--" + module,
                "vi-sb-intprev--" + bone["type"], "vi-sb-intprev--" + key
            ]

            self.ipdl = html5.Dl()
            self.ipdl.addClass("vi-sb-intprev-content")

            self.ipdt = html5.Dt()
            self.ipdt.addClass("vi-sb-intprev-title")
            self.ipdt.appendChild(
                html5.TextNode(
                    key if conf["showBoneNames"] else bone.get("descr", key)))

            self.ipdd = html5.Dd()
            self.ipdd.addClass("vi-sb-intprev-descr")
            boneFactory = boneSelector.select(module, key,
                                              tmpDict)(module, key, tmpDict)

            if key == "key":
                keydiv = html5.Div()
                keydiv["style"]["display"] = "inline-block"
                copybtn = Button("Copy", self.onCopyKey)

                keyvaluediv = boneFactory.viewWidget(item[key])

                keyfield = html5.Input()
                keyfield["value"] = item[key]
                keyfield["style"]["opacity"] = 0
                keyfield["style"]["position"] = "absolute"
                keyfield["id"] = "keyfield"

                keydiv.appendChild(keyfield, keyvaluediv, copybtn)
                self.ipdd.appendChild(keydiv)
            else:
                self.ipdd.appendChild(boneFactory.viewWidget(item[key]))

            self.ipdl.appendChild(self.ipdt)
            self.ipdl.appendChild(self.ipdd)
            self.ipli.appendChild(self.ipdl)

            self.appendChild(self.ipli)
Beispiel #4
0
    def __init__(self, *args, **kwargs):
        super(PageFindAction, self).__init__()
        self["class"].append("input-group")

        self.searchInput = html5.Input()
        self.searchInput["class"].append("input ignt-input input--small")
        self.appendChild(self.searchInput)

        btn = Button(translate("Find on Page"),
                     callback=self.onClick,
                     icon="icons-search")
        btn["class"] = "bar-item btn btn--small btn--pagefind"
        self.appendChild(btn)
        self.sinkEvent("onKeyPress")
Beispiel #5
0
    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
Beispiel #6
0
    def __init__(self, module, handler, actionName, *args, **kwargs):
        super(ListPreviewAction, self).__init__(*args, **kwargs)

        self.urls = conf["defaultPreview"]

        self.addClass("input-group")

        self.urlCb = html5.ignite.Select()
        self.appendChild(self.urlCb)

        btn = Button(translate("Preview"),
                     callback=self.onClick,
                     icon="icons-preview")
        btn["class"] = "bar-item btn btn--small btn--preview"
        self.appendChild(btn)

        self["disabled"] = True
        self.isDisabled = True
Beispiel #7
0
    def __init__(self, *args, **kwargs):
        super(UserState, self).__init__(*args, **kwargs)

        self["class"] = ["popout-opener", "popout-anchor", "popout--sw"]

        self.btn = Button(icon="icons-user",
                          className="btn btn--topbar btn--user")
        self.appendChild(self.btn)

        self.sinkEvent("onClick")

        popout = html5.Div()
        popout["class"] = ["popout"]
        self.popoutlist = html5.Div()
        self.popoutlist["class"] = ["list"]

        popout.appendChild(self.popoutlist)
        self.appendChild(popout)

        self.update()
Beispiel #8
0
    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
Beispiel #9
0
    def __init__(self, bone, widgetFactory: callable, **kwargs):
        # language=HTML
        super().__init__("""
			<div [name]="widgets" class="vi-bone-widgets"></div>
			<div [name]="actions" class="vi-bone-actions input-group"></div>
		""")

        languages = bone.skelStructure[bone.boneName]["languages"]
        assert languages, "This parameter must not be empty!"

        self.bone = bone
        self.languages = languages
        self._languageWidgets = {}

        # Create widget for every language
        for lang in self.languages:
            assert not any([ch in lang for ch in "<>\"'/"
                            ]), "This is not a valid language identifier!"

            langBtn = Button(lang, callback=self.onLangBtnClick)
            langBtn.addClass("btn--lang", "btn--lang-" + lang)

            if lang == conf["defaultLanguage"]:
                langBtn.addClass("is-active")

            self.actions.appendChild(langBtn)

            kwargs["language"] = lang
            langWidget = widgetFactory(self.bone, **kwargs)

            if lang != conf["defaultLanguage"]:
                langWidget.hide()

            self.widgets.appendChild(langWidget)

            self._languageWidgets[lang] = (langBtn, langWidget)
Beispiel #10
0
    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)
Beispiel #11
0
    def __init__(self, listWdg, *args, **kwargs):
        if not listWdg._structure:
            return

        super(SelectFieldsPopup,
              self).__init__(title=translate("Select fields"), *args, **kwargs)

        self.removeClass("popup--center")
        self.addClass("popup--n popup--selectfields")
        self.listWdg = listWdg
        self.checkboxes = []

        ul = html5.Ul()
        ul.addClass("option-group")
        self.popupBody.appendChild(ul)

        for key, bone in self.listWdg._structure:
            li = html5.Li()
            li.addClass("check")

            ul.appendChild(li)

            chkBox = html5.Input()
            chkBox.addClass("check-input")
            chkBox["type"] = "checkbox"
            chkBox["value"] = key

            li.appendChild(chkBox)
            self.checkboxes.append(chkBox)

            if key in self.listWdg.getFields():
                chkBox["checked"] = True
            lbl = html5.Label(bone["descr"], forElem=chkBox)
            lbl.addClass("check-label")
            li.appendChild(lbl)

        # Functions for Selection
        div = html5.Div()
        div["class"].append("selectiontools input-group")

        self.popupBody.appendChild(div)

        self.selectAllBtn = Button(translate("Select all"),
                                   callback=self.doSelectAll)
        self.selectAllBtn["class"].append("btn--selectall")
        self.unselectAllBtn = Button(translate("Unselect all"),
                                     callback=self.doUnselectAll)
        self.unselectAllBtn["class"].append("btn--unselectall")
        self.invertSelectionBtn = Button(translate("Invert selection"),
                                         callback=self.doInvertSelection)
        self.invertSelectionBtn["class"].append("btn--selectinvert")

        div.appendChild(self.selectAllBtn)
        div.appendChild(self.unselectAllBtn)
        div.appendChild(self.invertSelectionBtn)

        # Function for Commit
        self.cancelBtn = Button(translate("Cancel"), callback=self.doCancel)
        self.cancelBtn.addClass("btn btn--danger")

        self.applyBtn = Button(translate("Apply"), callback=self.doApply)
        self.applyBtn.addClass("btn btn--primary")

        self.popupFoot.appendChild(self.cancelBtn)
        self.popupFoot.appendChild(self.applyBtn)