Exemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     super(UserLogoutMsg,
           self).__init__(title=translate("Session terminated"),
                          enableShortcuts=False,
                          *args,
                          **kwargs)
     self.addClass("userloggedoutmsg")
     self.isCurrentlyFailed = False
     self.loginWindow = None
     self.lastChecked = datetime.now()
     self.lbl = html5.Label(
         translate(
             "Your session was terminated by our server. "
             "Perhaps your computer fall asleep and broke connection?\n"
             "Please relogin to continue your mission."))
     self.popupBody.appendChild(self.lbl)
     self.popupFoot.appendChild(
         html5.ext.Button(translate("Refresh"), callback=self.startPolling))
     self.popupFoot.appendChild(
         html5.ext.Button(translate("Login"),
                          callback=self.showLoginWindow))
     setInterval = html5.window.setInterval
     self.interval = setInterval(self.checkForSuspendResume,
                                 self.checkIntervall)
     self.hideMessage()
Exemplo n.º 2
0
    def invoke(self):
        self.iconnav.removeAllChildren()

        newBtn = html5.A()
        newBtn["href"] = "https://www.viur.is"
        newBtn["target"] = "_blank"
        newBtn.addClass("btn")
        svg = embedsvg.get("icons-ribbon")
        if svg:
            newBtn.element.innerHTML = svg + newBtn.element.innerHTML
        newBtn.appendChild(translate("vi.topbar.newbtn"))
        #self.iconnav.appendChild(newBtn)

        newMarker = html5.Span()
        newMarker.addClass("marker")
        newMarker.appendChild(translate("vi.topbar.new"))
        newBtn.appendChild(newMarker)

        for icon in conf["toplevelactions"]:
            widget = toplevelActionSelector.select(icon)
            # register log Button as Loghandler
            if widget == LogButton:
                conf["mainWindow"].logWdg = widget()
                self.iconnav.appendChild(conf["mainWindow"].logWdg)
            elif widget:
                self.iconnav.appendChild(widget())
Exemplo n.º 3
0
    def onClick(self, sender=None):
        i = html5.ext.InputDialog(translate("Directory Name"),
                                  successHandler=self.createDir,
                                  title=translate("Create directory"),
                                  successLbl=translate("Create"))

        i.addClass("create directory")
Exemplo n.º 4
0
	def onClick(self, sender=None):
		if self.parent().parent().modified:
			html5.ext.YesNoDialog(translate("vi.action.edit.refresh.question"),
		                            translate("vi.action.edit.refresh.title"),
		                            yesCallback=self.performReload)
		else:
			self.performReload()
Exemplo n.º 5
0
    def onClick(self, sender=None):
        selection = self.parent().parent().getCurrentSelection()
        if not selection:
            return

        html5.ext.YesNoDialog(translate(self.txtQuestion,
                                        count=len(selection)),
                              title=translate("Mark payed"),
                              yesCallback=self.doMarkPayed)
Exemplo n.º 6
0
 def onClick(self, event):
     html5.ext.YesNoDialog(
         translate(
             "Möchten Sie {vi.name} wirklich beenden?\n"
             "Alle nicht gespeicherten Einträge gehen dabei verloren!",
             **conf),
         title=translate("Logout"),
         yesCallback=lambda *args, **kwargs: self.logout())
     event.stopPropagation()
     event.preventDefault()
Exemplo n.º 7
0
    def __init__(self, summernote=None, boneName="", *args, **kwargs):
        if summernote is None:
            summernote = self

        super(TextInsertImageAction, self).__init__(translate("Insert Image"),
                                                    *args, **kwargs)
        self["class"] = "icon text image viur-insert-image-btn"
        self["title"] = translate("Insert Image")
        self["style"]["display"] = "none"
        self.element.setAttribute("data-bonename", boneName)
        self.summernote = summernote
Exemplo n.º 8
0
 def onClick(self, sender=None):
     selection = self.parent().parent().getCurrentSelection()
     if not selection:
         return
     d = html5.ext.YesNoDialog(translate("Delete {amt} Entries?",
                                         amt=len(selection)),
                               title=translate("Delete them?"),
                               yesCallback=self.doDelete,
                               yesLabel=translate("Delete"),
                               noLabel=translate("Keep"))
     d.deleteList = [x["key"] for x in selection]
     d.addClass("delete")
Exemplo n.º 9
0
    def showErrorMsg(self, req=None, code=None):
        """
			Removes all currently visible elements and displayes an error message
		"""
        self.actionbar["style"]["display"] = "none"
        self.form["style"]["display"] = "none"
        errorDiv = html5.Div()
        errorDiv["class"].append("error_msg")
        if code and (code == 401 or code == 403):
            txt = translate("Access denied!")
        else:
            txt = translate("An unknown error occurred!")
        errorDiv["class"].append("error_code_%s" % (code or 0))
        errorDiv.appendChild(html5.TextNode(txt))
        self.appendChild(errorDiv)
Exemplo n.º 10
0
    def handleInitialHash(self, pathList, params):
        assert self.canHandleInitialHash(pathList, params)
        if pathList[1] == "list":
            wdg = displayDelegateSelector.select(self.moduleName,
                                                 self.moduleInfo)
            assert wdg is not None, "Got no handler for %s" % self.moduleName
            node = None
            if len(pathList) >= 3 and pathList[2]:
                node = pathList[2]
            self.addWidget(wdg(self.moduleName, node=node))
            self.focus()

        elif pathList[1] in ["edit", "clone"] and len(pathList) > 2:
            pane = Pane(translate("Edit"),
                        closeable=True,
                        iconURL="icons-edit",
                        iconClasses=[
                            "module_%s" % self.moduleName, "apptype_hierarchy",
                            "action_edit"
                        ])
            edwg = EditWidget(self.moduleName,
                              EditWidget.appHierarchy,
                              key=pathList[2],
                              hashArgs=(params or None),
                              clone=pathList[1] == "clone")
            pane.addWidget(edwg)
            conf["mainWindow"].addPane(pane, parentPane=self)
            pane.focus()
Exemplo n.º 11
0
	def __init__(self, preview, *args, **kwargs):
		super(FileImagePopup, self).__init__(title=preview.currentFile.get("name", translate("Unnamed Image")), className="image-viewer", *args, **kwargs)
		self.sinkEvent("onClick")
		self.preview = preview

		img = html5.Img()
		img["src"] = utils.getImagePreview(preview.currentFile, size=None)
		self.popupBody.appendChild(img)

		btn = html5.ext.Button(translate("Download"), self.onDownloadBtnClick)
		btn.addClass("btn--download")
		self.popupFoot.appendChild(btn)

		btn = html5.ext.Button(translate("Close"), self.onClick)
		btn.addClass("btn--close")
		self.popupFoot.appendChild(btn)
Exemplo n.º 12
0
 def __init__(self, *args, **kwargs):
     super(SelectFieldsAction, self).__init__(translate("Select fields"),
                                              icon="icons-list",
                                              *args,
                                              **kwargs)
     self["class"] = "bar-item btn btn--small btn--selectfields"
     self["disabled"] = self.isDisabled = True
Exemplo n.º 13
0
 def deletedFailed(self, req=None, code=None):
     conf["mainWindow"].log(
         "error",
         translate("Eintrag konnte nicht gelöscht werden (status: %s)" %
                   code),
         modul=self.parent().parent().module,
         action="delete")
Exemplo n.º 14
0
 def __init__(self, *args, **kwargs):
     super(SelectInvertAction, self).__init__(translate("Invert selection"),
                                              icon="icons-select-invert",
                                              *args,
                                              **kwargs)
     self["class"] = "bar-item btn btn--small btn--selectinvert"
     self["disabled"] = self.isDisabled = True
Exemplo n.º 15
0
 def __init__(self, *args, **kwargs):
     super(UnSelectAllAction, self).__init__(translate("Unselect all"),
                                             icon="icons-select-remove",
                                             *args,
                                             **kwargs)
     self["class"] = "bar-item btn btn--small btn--unselectall"
     self["disabled"] = self.isDisabled = True
Exemplo n.º 16
0
    def onClick(self, sender=None):
        selection = self.parent().parent().currentSelectedElements
        if not selection:
            return

        for s in selection:
            if isinstance(s, self.parent().parent().nodeWidget):
                i = html5.ext.InputDialog(translate("Directory Name"),
                                          successHandler=self.editDir,
                                          value=s.data["name"])
                i.dirKey = s.data["key"]
                return

            pane = Pane("Edit",
                        closeable=True,
                        iconClasses=[
                            "modul_%s" % self.parent().parent().module,
                            "apptype_tree", "action_edit"
                        ])
            conf["mainWindow"].stackPane(pane, focus=True)
            skelType = "leaf"
            edwg = EditWidget(self.parent().parent().module,
                              EditWidget.appTree,
                              key=s.data["key"],
                              skelType=skelType)
            pane.addWidget(edwg)
Exemplo n.º 17
0
    def __init__(self,
                 widget,
                 selection,
                 encoding=None,
                 language=None,
                 separator=None,
                 lineSeparator=None,
                 *args,
                 **kwargs):
        super(ExportCsv, self).__init__()

        if encoding is None or encoding not in ["utf-8", "iso-8859-15"]:
            encoding = "utf-8"

        if language is None or language not in conf["server"].keys():
            language = conf["currentLanguage"]

        self.widget = widget
        self.module = widget.module
        self.params = self.widget.getFilter().copy()
        self.params["limit"] = 99
        self.data = []
        self.structure = None
        self.separator = separator or ";"
        self.lineSeparator = lineSeparator or "\n"
        self.encoding = encoding
        self.lang = language

        conf["mainWindow"].log("progress", self, icon="icons-download-file")
        self.parent().addClass("is-new")
        self.parent().addClass("log-progress")
        self.appendChild(html5.TextNode(translate("CSV-Export")))

        DeferredCall(self.nextChunk)
Exemplo n.º 18
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")
Exemplo n.º 19
0
    def setPayedSucceeded(self, response):
        self.done += 1

        if self.done + self.failed == self.total:
            conf["mainWindow"].log("success",
                                   translate(self.txtSuccess, count=self.done))
            NetworkService.notifyChange(self.parent().parent().module)
Exemplo n.º 20
0
    def onSelectionActivated(self, table, selection):
        if (not self.parent().parent().selectionCallback
                and len(selection) == 1
                and isinstance(selection[0],
                               self.parent().parent().leafWidget)):

            pane = Pane(translate("Edit"),
                        iconURL="icons-edit",
                        closeable=True,
                        iconClasses=[
                            "module_%s" % self.parent().parent().module,
                            "apptype_tree", "action_edit"
                        ])
            conf["mainWindow"].stackPane(pane)

            if isinstance(selection[0], self.parent().parent().nodeWidget):
                skelType = "node"

            elif isinstance(selection[0], self.parent().parent().leafWidget):
                skelType = "leaf"

            else:
                raise ValueError("Unknown selection type: %s" %
                                 str(type(selection[0])))

            edwg = EditWidget(self.parent().parent().module,
                              EditWidget.appTree,
                              key=selection[0].data["key"],
                              skelType=skelType)
            pane.addWidget(edwg)
            pane.focus()
Exemplo n.º 21
0
 def onMkDir(self, req):
     dirName = req.dirName
     conf["mainWindow"].log(
         "success",
         translate("Directory \"{name}\" created.",
                   icon="icons-add-folder",
                   name=dirName))
Exemplo n.º 22
0
    def showErrorMsg(self, req=None, code=None):
        """
			Removes all currently visible elements and displayes an error message
		"""
        self.actionBar["style"]["display"] = "none"
        self.table["style"]["display"] = "none"
        errorDiv = html5.Div()
        errorDiv.addClass(
            "popup popup--center popup--local msg msg--error is-active error_msg"
        )
        if code and (code == 401 or code == 403):
            txt = translate("Access denied!")
        else:
            txt = translate("An unknown error occurred!")
        errorDiv.addClass("error_code_%s" % (code or 0))
        errorDiv.appendChild(html5.TextNode(txt))
        self.appendChild(errorDiv)
Exemplo n.º 23
0
    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)
Exemplo n.º 24
0
 def emptyList(self):
     self.moreEntries.hide()
     self.clearSuggestionList()
     emptyMessage = html5.Li()
     emptyMessage.addClass("item has-hover item--small")
     emptyMessage["data"]["value"] = None
     emptyMessage.appendChild(html5.TextNode(translate("No Item")))
     self.suggestionList.appendChild(emptyMessage)
Exemplo n.º 25
0
 def __init__(self, *args, **kwargs):
     super(DeleteAction, self).__init__(translate("Delete"),
                                        icon="icons-delete",
                                        *args,
                                        **kwargs)
     self["class"] = "bar-item btn btn--small btn--delete"
     self["disabled"] = True
     self.isDisabled = True
Exemplo n.º 26
0
 def __init__(self, *args, **kwargs):
     super(EditAction, self).__init__(translate("Edit"),
                                      icon="icons-edit",
                                      *args,
                                      **kwargs)
     self["class"] = "bar-item btn btn--small btn--edit"
     self["disabled"] = True
     self.isDisabled = True
Exemplo n.º 27
0
 def __init__(self, *args, **kwargs):
     super(Search, self).__init__(*args, **kwargs)
     self.startSearchEvent = EventDispatcher("startSearch")
     self.addClass("vi-search")
     self.searchLbl = html5.H2()
     self.searchLbl.appendChild(html5.TextNode(
         translate("Fulltext search")))
     self.searchLbl.addClass("vi-search-label")
     self.appendChild(self.searchLbl)
     self.searchInput = html5.ignite.Input()
     self.searchInput["type"] = "text"
     self.appendChild(self.searchInput)
     self.btn = html5.ext.Button(translate("Search"),
                                 callback=self.doSearch)
     self.appendChild(self.btn)
     self.sinkEvent("onKeyDown")
     self.last_search = ""
Exemplo n.º 28
0
	def setActiveTask(self):
		task = self.getSelectedTask()
		if not task:
			return 0
		self.descr.removeAllChildren()
		self.descr.appendChild(
			html5.TextNode(
				task.get( "descr" ) or translate( "vi.tasks.no-description" ) ) )
Exemplo n.º 29
0
 def __init__(self, *args, **kwargs):
     super(DownloadAction, self).__init__(translate("Download"),
                                          icon="icons-download-file",
                                          *args,
                                          **kwargs)
     self["class"] = "bar-item btn btn--small btn--download"
     self["disabled"] = True
     self.isDisabled = True
Exemplo n.º 30
0
 def __init__(self, *args, **kwargs):
     super(ListSelectFilterAction,
           self).__init__(translate("Select Filter"),
                          icon="icons-search",
                          *args,
                          **kwargs)
     self["class"] = "bar-item btn btn--small btn--selectfilter"
     self.urls = None
     self.filterSelector = None