Exemple #1
0
    def __init__(self, *args, **kwargs):
        super(LoginScreen, self).__init__(*args, **kwargs)
        self.addClass("vi-login")

        # --- Surrounding Dialog ---
        self.dialog = html5.Div()
        self.dialog.addClass("vi-login-dialog")
        self.appendChild(self.dialog)

        # --- Header ---
        header = html5.Div()
        header.addClass("vi-login-header")
        self.dialog.appendChild(header)

        # Login
        h1 = html5.H1()
        h1.addClass("vi-login-headline")
        h1.appendChild(html5.TextNode(translate("vi.login.title")))
        header.appendChild(h1)

        # Logo
        img = html5.Img()
        img.addClass("vi-login-logo")
        img["src"] = "login-logo.png"
        header.appendChild(img)

        # --- Dialog ---

        self.loginMethodSelector = html5.Ul()
        self.loginMethodSelector.addClass("vi-login-method")
        self.dialog.appendChild(self.loginMethodSelector)

        self.haveLoginHandlers = False
Exemple #2
0
    def addChildPane(self, pane):
        """
			Stack a pane under this one.
			It gets displayed as a subpane.
			:param pane: Another pane
			:type pane: pane
		"""
        assert pane != self, "A pane cannot be a child of itself"

        self.childPanes.append(pane)
        pane.parentPane = self

        if not self.childDomElem:
            self.childDomElem = html5.Ul()

            if self.collapseable and not pane.closeable:
                self.childDomElem.hide()
            else:
                self.childDomElem.show()

            self.appendChild(self.childDomElem)

            if self.closeable:
                self.closeBtn.hide()

        if pane.closeable and self.childDomElem.isHidden():
            self.childDomElem.show()

        self.childDomElem.appendChild(pane)
Exemple #3
0
    def render(self, data, field):
        if field in data.keys():
            result = html5.Ul()
            options = {k: v for k, v in self.skelStructure[field]["values"]}

            for i, fieldKey in enumerate(data[field]):
                if conf["maxMultiBoneEntries"] and i + 1 > conf[
                        "maxMultiBoneEntries"]:
                    ali = html5.Li()
                    ali.appendChild(
                        html5.TextNode(
                            translate("and {count} more",
                                      count=len(data[field]) -
                                      conf["maxMultiBoneEntries"])))
                    ali["class"].append("selectmulti_more_li")

                    result.appendChild(ali)
                    break

                ali = html5.Li()
                ali.appendChild(html5.TextNode(options.get(fieldKey,
                                                           fieldKey)))
                ali["Title"] = fieldKey

                result.appendChild(ali)

            return result

        return html5.Label(conf["empty_value"])
Exemple #4
0
    def __init__(self):
        #DOM.setAttribute( self.element, "class", "vi_topbar")
        super(TopBarWidget, self).__init__()

        self["class"] = "vi_topbar"
        anav = html5.Nav()
        anav["class"].append("iconnav")
        self.iconnav = html5.Ul()

        #self.logoContainer = html5.Div()
        #self.logoContainer["class"].append("logo")
        #self.appendChild( self.logoContainer )

        self.sinkEvent("onClick")

        self.modulH1 = html5.H1()
        self.modulH1._setClass("module")
        self.appendChild(self.modulH1)

        self.modulContainer = html5.Div()
        self.modulContainer["class"].append("currentmodul")
        self.appendChild(self.modulContainer)

        self.modulImg = html5.Label()
        self.modulContainer.appendChild(self.modulImg)

        self.moduleName = html5.Span()
        self.modulContainer.appendChild(self.moduleName)

        anav.appendChild(self.iconnav)
        self.appendChild(anav)

        DeferredCall(self.setTitle, _delay=500)
Exemple #5
0
    def addChildPane(self, pane):
        """
			Stack a pane under this one.
			It gets displayed as a subpane.
			@param pane: Another pane
			@type pane: pane
		"""
        assert pane != self, "A pane cannot be a child of itself"

        self.childPanes.append(pane)
        pane.parentPane = self

        if not self.childDomElem:
            self.childDomElem = html5.Ul()

            if self.collapseable and not pane.closeable:
                self.childDomElem["style"]["display"] = "none"
            else:
                self.childDomElem["style"]["display"] = "initial"

            self.appendChild(self.childDomElem)

            if self.closeable:
                self.closeBtn.hide()

        if (pane.closeable and "display" in self.childDomElem["style"]
                and self.childDomElem["style"]["display"] == "none"):
            self.childDomElem["style"]["display"] = "initial"

        self.childDomElem.appendChild(pane)
Exemple #6
0
    def __init__(self):
        super(Log, self).__init__()

        self["class"].append("vi_messenger")
        openLink = html5.ext.Button(translate("Open message center"),
                                    self.toggleMsgCenter)
        self.appendChild(openLink)

        self.logUL = html5.Ul()
        self.logUL["id"] = "statuslist"
        self.logUL["class"].append("statuslist")
        self.appendChild(self.logUL)

        versionDiv = html5.Div()
        versionDiv["class"].append("versiondiv")

        # Server name and version number
        name = conf["vi.viur"]
        if name:
            versionspan = html5.Span()
            versionspan.appendChild(
                "%s v%s" %
                (name, ".".join([str(x) for x in conf["server.version"]])))
            versionspan["class"].append("serverspan")
            versionDiv.appendChild(versionspan)

        # Vi name and version number
        name = conf["vi.name"]
        if name:
            versionspan = html5.Span()
            versionspan.appendChild(
                "%s v%s%s" %
                (name, ".".join([str(x) for x in conf["vi.version"]]),
                 ("-" + conf["vi.version.appendix"])
                 if conf["vi.version.appendix"] else ""))

            versionspan["class"].append("versionspan")
            versionDiv.appendChild(versionspan)

            #Try loading the revision and build date
            try:
                from version import builddate, revision

                revspan = html5.Span()
                revspan.appendChild(html5.TextNode("Rev %s" % revision))
                revspan["class"].append("revisionspan")

                datespan = html5.Span()
                datespan.appendChild(html5.TextNode("Built %s" % builddate))
                datespan["class"].append("datespan")

                versionDiv.appendChild(revspan)
                versionDiv.appendChild(datespan)

            except:
                pass

        if versionDiv.children():
            self.appendChild(versionDiv)
Exemple #7
0
	def __init__(self, listWdg, *args, **kwargs):
		if not listWdg._structure:
			return

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

		self["class"].append("selectfields")
		self.listWdg = listWdg
		self.checkboxes = []

		ul = html5.Ul()
		self.appendChild( ul )

		for key, bone in self.listWdg._structure:
			li = html5.Li()
			ul.appendChild( li )

			chkBox = html5.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)
			li.appendChild(lbl)

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

		self.appendChild( div )

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

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

		# Function for Commit
		self.cancelBtn = html5.ext.Button( translate( "Cancel" ), callback=self.doCancel)
		self.cancelBtn["class"].append("btn_no")

		self.applyBtn = html5.ext.Button( translate( "Apply" ), callback=self.doApply)
		self.applyBtn["class"].append("btn_yes")

		self.appendChild(self.applyBtn)
		self.appendChild(self.cancelBtn)
Exemple #8
0
    def onClick(self, event=None, *args, **kwargs):
        if not self.childDomElem:
            self.childDomElem = html5.Ul()
            self.childDomElem["style"]["display"] = "none"
            self.appendChild(self.childDomElem)

        if not self.childPanes:
            self.lock()
            DeferredCall(self.loadChildren, _delay=100)

        if self.isExpanded:
            self.collapse()
        else:
            self.expand()

        if event:
            event.stopPropagation()
Exemple #9
0
    def __init__(self, *args, **kwargs):
        super(AdminScreen, self).__init__(*args, **kwargs)

        self["id"] = "CoreWindow"
        conf["mainWindow"] = self

        self.topBar = TopBarWidget()
        self.appendChild(self.topBar)

        self.workSpace = html5.Div()
        self.workSpace["class"] = "vi_workspace"
        self.appendChild(self.workSpace)

        self.moduleMgr = html5.Div()
        self.moduleMgr["class"] = "vi_wm"
        self.appendChild(self.moduleMgr)

        self.moduleList = html5.Nav()
        self.moduleList["class"] = "vi_manager"
        self.moduleMgr.appendChild(self.moduleList)

        self.moduleListUl = html5.Ul()
        self.moduleListUl["class"] = "modullist"
        self.moduleList.appendChild(self.moduleListUl)

        self.viewport = html5.Div()
        self.viewport["class"] = "vi_viewer"
        self.workSpace.appendChild(self.viewport)

        self.logWdg = Log()
        self.appendChild(self.logWdg)

        self.currentPane = None
        self.nextPane = None  # Which pane gains focus once the deferred call fires
        self.panes = [
        ]  # List of known panes. The ordering represents the order in which the user visited them.

        self.userLoggedOutMsg = None

        # Register the error-handling for this iframe
        le = eval("window.top.logError")
        w = eval("window")
        w.onerror = le
        w = eval("window.top")
        w.onerror = le
Exemple #10
0
    def __init__(self,
                 module,
                 rootNode=None,
                 node=None,
                 selectMode=None,
                 *args,
                 **kwargs):
        """
			:param module: Name of the module we shall handle. Must be a list application!
			:type module: str
			:param rootNode: The rootNode we shall display. If None, we try to select one.
			:type rootNode: str or None
			:param node: The node we shall display at start. Must be a child of rootNode
			:type node: str or None
		"""
        super(TreeWidget, self).__init__()
        self.addClass("tree")

        self.module = module
        self.rootNode = rootNode
        self.node = node or rootNode
        self.actionBar = ActionBar(module, "tree")
        self.appendChild(self.actionBar)
        self.pathList = html5.Ul()
        self.pathList["class"].append("breadcrumb")
        self.appendChild(self.pathList)
        self.entryFrame = SelectionContainer(self.nodeWidget, self.leafWidget)
        self.appendChild(self.entryFrame)
        self.entryFrame.selectionActivatedEvent.register(self)
        self._batchSize = 99
        self._currentCursor = {"node": None, "leaf": None}
        self._currentRequests = []
        self.rootNodeChangedEvent = EventDispatcher("rootNodeChanged")
        self.nodeChangedEvent = EventDispatcher("nodeChanged")

        assert selectMode in [
            None, "single", "multi", "single.leaf", "single.node",
            "multi.leaf", "multi.node"
        ]
        self.selectMode = selectMode

        if self.rootNode:
            self.reloadData()
            self.rebuildPath()
        else:
            NetworkService.request(self.module,
                                   "listRootNodes",
                                   successHandler=self.onSetDefaultRootNode)

        self.sinkEvent("onClick")

        # Proxy some events and functions of the original table
        for f in [
                "selectionChangedEvent", "selectionActivatedEvent",
                "cursorMovedEvent", "getCurrentSelection",
                "selectionReturnEvent"
        ]:
            setattr(self, f, getattr(self.entryFrame, f))

        self.actionBar.setActions(self.defaultActions + (
            ["select", "close"] if self.selectMode else []))
Exemple #11
0
    def __init__(self, moduleName, boneName, readOnly, values, *args,
                 **kwargs):
        super(AccessMultiSelectBone, self).__init__(*args, **kwargs)
        self.boneName = boneName
        self.moduleName = moduleName
        self.readOnly = readOnly
        print(values)
        self.values = {k: v for k, v in values}

        self.modules = {}
        self.modulesbox = {}
        self.flags = {}

        self.sinkEvent("onClick")

        for value in self.values:
            module = self.parseskelaccess(value)

            if not module:
                self.flags[value] = None
            elif not module[0] in self.modules.keys():
                self.modules[module[0]] = {}

        # Render static / singleton flags first
        for flag in sorted(self.flags.keys()):
            label = html5.Label()

            checkbox = html5.Input()
            checkbox["type"] = "checkbox"
            checkbox["name"] = flag
            label.appendChild(checkbox)

            self.flags[flag] = checkbox

            span = html5.Span()
            span.appendChild(html5.TextNode(flag))
            label.appendChild(span)

            self.appendChild(label)

        # Render module access flags then
        for module in sorted(self.modules.keys()):
            label = html5.Label()

            span = html5.Span()
            span.appendChild(html5.TextNode(module))
            label.appendChild(span)

            ul = html5.Ul()

            checkbox = html5.Input()
            checkbox["type"] = "checkbox"
            checkbox["name"] = module
            self.modulesbox[module] = checkbox

            li = html5.Li()
            li.appendChild(checkbox)
            ul.appendChild(li)

            for state in self.states:
                li = html5.Li()
                li["class"] = ["access-state", state]

                # Some modules may not support all states
                if ("%s-%s" % (module, state)) not in self.values:
                    li["class"].append("disabled")

                ul.appendChild(li)

                self.modules[module][state] = li

            label.appendChild(ul)

            self.appendChild(label)
Exemple #12
0
 def __init__(self, *args, **kwargs):
     super(GroupPane, self).__init__(*args, **kwargs)
     self.childDomElem = html5.Ul()
     self.childDomElem["style"]["display"] = "none"
     self.appendChild(self.childDomElem)