コード例 #1
0
ファイル: login.py プロジェクト: direclown/osiris-sps
    def onInit(self):
        osiris.IPortalPage.onInit(self)

        self.username = osiris.HtmlTextBox()
        self.username.css = "os_input_full"
        self.username.id = "username"

        self.password = osiris.HtmlTextBox()
        self.password.id = "password"
        self.password.css = "os_input_full"
        self.password.password = True

        self.savePassword = osiris.HtmlCheckBox()
        self.savePassword.id = "savePassword"

        self.cmdLogin = osiris.IdeButton(
            self.getText("portal.pages.login.actions.login"))
        self.cmdLogin.id = "login"
        self.cmdLogin.isDefault = True
        osiris.events.connect(self.cmdLogin.eventClick, self.onLogin)

        self.cmdCancel = osiris.IdeButton(
            self.getText("common.actions.cancel"))
        self.cmdCancel.id = "cancel"
        osiris.events.connect(self.cmdCancel.eventClick, self.onCancel)
コード例 #2
0
ファイル: isis.py プロジェクト: direclown/osiris-sps
    def onInit(self):
        osiris.IMainPage.onInit(self)

        document = osiris.XMLDocument()
        self.root = document.create("isis")
        template = osiris.HtmlXSLControl()
        template.stylesheet = self.loadStylesheet(
            os.path.join(os.path.dirname(__file__), "isis.xsl"))
        template.document = document

        if (self.ajax):
            self.controls.add(template)
        else:
            self.getArea(osiris.pageAreaContent).controls.add(template)

        self.act = self.session.request.getUrlParam("act")
        if (self.act == ""):
            self.act = "home"

        self.root.setAttributeString("action", self.act)

        if (self.act == "home"):

            #osiris.events.connect(self.events.get("onAdd"), self.onAdd)
            #osiris.events.connect(self.events.get("onEdit"), self.onEdit)
            osiris.events.connect(self.events.get("onRemove"), self.onRemove)
        elif ((self.act == "add") or (self.act == "edit")):

            self.saveCommand = osiris.IdeButton(
                self.getText("common.actions.save"))
            self.saveCommand.id = "save"
            self.saveCommand.iconHref = self.skin.getImageUrl(
                "icons/16x16/save.png")
            osiris.events.connect(self.saveCommand.eventClick, self.onSave)
            template.addChildParam(self.saveCommand)

            self.cboPortal = osiris.HtmlComboBox()
            self.cboPortal.id = "portal"
            self.cboPortal.size = 40
            template.addChildParam(self.cboPortal)

            self.txtName = osiris.HtmlTextBox()
            self.txtName.id = "name"
            self.txtName.size = 40
            template.addChildParam(self.txtName)

            self.txtUrl = osiris.HtmlTextBox()
            self.txtUrl.id = "url"
            self.txtUrl.size = 40
            template.addChildParam(self.txtUrl)

            self.txtPassword = osiris.HtmlTextBox()
            self.txtPassword.id = "password"
            self.txtPassword.size = 40
            template.addChildParam(self.txtPassword)

            self.chkEnabled = osiris.IdePickerBool()
            self.chkEnabled.id = "enabled"
            template.addChildParam(self.chkEnabled)
コード例 #3
0
	def onInit(self):
		osiris.ExtensionsModuleEditor.onInit(self)
		
		self.txtWidth = osiris.HtmlTextBox()
		self.txtWidth.id = "width"
		
		self.txtHeight = osiris.HtmlTextBox()
		self.txtHeight.id = "height"
		
		self.txtNumber = osiris.HtmlTextBox()
		self.txtNumber.id = "number"
コード例 #4
0
ファイル: peers.py プロジェクト: direclown/osiris-sps
    def onLoad(self):
        osiris.IPortalPage.onLoad(self)

        self.act = self.session.request.getUrlParam("act")
        if (self.act == ""):
            self.act = "home"

        self.document = osiris.XMLDocument()
        self.root = self.document.create(self.act)
        template = osiris.HtmlXSLControl()
        template.stylesheet = self.loadStylesheet(
            os.path.join(os.path.dirname(__file__), "peers.xsl"))
        template.document = self.document

        self.document.root.setAttributeString("page_url", self.request.rawUrl)

        if (self.act == "home"):

            self.addPeerIP = osiris.HtmlTextBox()
            self.addPeerIP.id = "addPeerIP"
            self.addPeerIP.css = "os_input_full"
            template.addChildParam(self.addPeerIP)

            self.addPeerPort = osiris.HtmlTextBox()
            self.addPeerPort.id = "addPeerPort"
            self.addPeerPort.css = "os_input_full"
            template.addChildParam(self.addPeerPort)

            self.addPeerCommand = osiris.IdeButton(
                self.getText("common.actions.add"))
            self.addPeerCommand.id = "addPeerCommand"
            osiris.events.connect(self.addPeerCommand.eventClick,
                                  self.onAddPeer)
            template.addChildParam(self.addPeerCommand)

        #if(self.act == "your"):
        #
        #	client = osiris.Engine.instance().createHttpClient()
        #
        #	url = "check.php?port=" + str(osiris.Options.instance().getServerPort()) + "&output=xml";
        #	if(osiris.Options.instance().getOptionBool("p2p.enable") == False):
        #		url += "&notest";
        #	client.perform(osiris.HttpUrl(osiris.Options.instance().getIsisLink(url)))
        #	#osiris.LogManager.instance().log(osiris.Options.instance().getIsisLink(url))
        #	self.document.parseBuffer(client.response.content.content)
        #	self.document.root.setAttributeBool("p2p_enabled",osiris.Options.instance().getOptionBool("p2p.enable"))

        if (self.ajax):
            self.controls.add(template)
        else:
            self.getArea(osiris.pageAreaContent).controls.add(template)
コード例 #5
0
	def onInit(self):
		osiris.IMainPage.onInit(self)		
		
		self.document = osiris.XMLDocument()
		self.document.create("mcp")
		
		template = osiris.HtmlXSLControl()
		template.stylesheet = self.loadStylesheet(os.path.join(os.path.dirname(__file__), "mcp.xsl"))
		template.document = self.document		
		self.getArea(osiris.pageAreaContent).controls.add(template)
		
		if(self.getMcpMode()):
			if(osiris.Options.instance().getWebMcpPassword() != ""):
				self.cmdLogout = osiris.IdeButton(self.getText("main.pages.mcp.action.logout"))
				self.cmdLogout.id = "logout"
				self.cmdLogout.isDefault = True
				osiris.events.connect(self.cmdLogout.eventClick, self.onLogout)
				template.addChildParam(self.cmdLogout)
		else:
			self.txtPassword = osiris.HtmlTextBox()
			self.txtPassword.id = "password"
			self.txtPassword.password = True
			template.addChildParam(self.txtPassword)
		
			self.cmdLogin = osiris.IdeButton(self.getText("main.pages.mcp.action.login"))
			self.cmdLogin.id = "login"
			self.cmdLogin.isDefault = True
			osiris.events.connect(self.cmdLogin.eventClick, self.onLogin)			
			template.addChildParam(self.cmdLogin)
コード例 #6
0
    def onPreRender(self):
        osiris.IMainPage.onPreRender(self)

        document = osiris.XMLDocument()
        root = document.create("skinpreview")
        template = osiris.HtmlXSLControl()
        template.stylesheet = self.loadStylesheet(
            os.path.join(os.path.dirname(__file__), "skinpreview.xsl"))
        template.document = document

        if (self.ajax):
            self.controls.add(template)
        else:
            self.getArea(osiris.pageAreaContent).controls.add(template)

        self.saveCommand = osiris.IdeButton(
            self.getText("common.actions.save"))
        self.saveCommand.id = "save"
        self.saveCommand.iconHref = self.skin.getImageUrl(
            "icons/16x16/save.png")
        template.addChildParam(self.saveCommand)

        self.chkBoolean = osiris.IdePickerBool()
        self.chkBoolean.id = "boolean"
        template.addChildParam(self.chkBoolean)

        self.txtText = osiris.HtmlTextBox()
        self.txtText.id = "text"
        self.txtText.size = 60
        self.txtText.value = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
        template.addChildParam(self.txtText)
コード例 #7
0
ファイル: login_main.py プロジェクト: direclown/osiris-sps
    def onInit(self):
        osiris.IMainPage.onInit(self)

        self.userid = self.session.request.getUrlParam("id")
        if ((self.userid == None) or (self.userid == "")):
            self.redirect("home")
            return

        #self.username = osiris.HtmlTextBox()
        #self.username.css = "os_input_full"
        #self.username.id = "username"

        self.password = osiris.HtmlTextBox()
        self.password.id = "password"
        self.password.size = 20
        self.password.password = True

        self.savePassword = osiris.HtmlCheckBox()
        self.savePassword.id = "savePassword"

        self.cmdLogin = osiris.IdeButton(
            self.getText("main.pages.login.actions.login"))
        self.cmdLogin.id = "login"
        self.cmdLogin.isDefault = True
        osiris.events.connect(self.cmdLogin.eventClick, self.onLogin)
コード例 #8
0
ファイル: subscribe.py プロジェクト: direclown/osiris-sps
    def getDriverOptionControl(self, driver, option):
        optionControl = None
        if option.key in self.driverOptionsControls:
            optionControl = self.driverOptionsControls[option.key]
        else:
            optionControl = osiris.HtmlTextBox()
            optionControl.id = driver + option.key
            self.driverOptionsControls[option.key] = optionControl

        return optionControl
コード例 #9
0
ファイル: register_main.py プロジェクト: direclown/osiris-sps
	def onInit(self):
		osiris.IMainPage.onInit(self)	
		
		#self.portal = self.getPortalFromUrl()
		#if self.portal == None:
		#	self.redirect("home")
		#	return		
		
		self.username = osiris.HtmlTextBox()
		self.username.css = "os_input_full"
		self.username.id = "username"
		
		self.password = osiris.HtmlTextBox()
		self.password.id = "password"
		self.password.attributes.set("data-os-otype","password")
		self.password.attributes.set("data-os-login","page_username")
		self.password.css = "os_input_full"		
		self.password.password = True

		self.passwordChecker = osiris.HtmlTextBox()
		self.passwordChecker.id = "passwordChecker"
		self.passwordChecker.css = "os_input_full"
		self.passwordChecker.password = True
		
		self.secretQuestion = osiris.HtmlTextBox()
		self.secretQuestion.id = "secretQuestion"	
		self.secretQuestion.css = "os_input_full"

		self.secretResponse = osiris.HtmlTextBox()
		self.secretResponse.id = "secretResponse"
		self.secretResponse.css = "os_input_full"
		self.secretResponse.password = True

		self.secretResponseChecker = osiris.HtmlTextBox()
		self.secretResponseChecker.id = "secretResponseChecker"
		self.secretResponseChecker.password = True
		
		self.savePassword = osiris.HtmlCheckBox()
		self.savePassword.id = "savePassword"
		
		self.cmdRegister = osiris.IdeButton(self.getText("portal.pages.register.actions.register"))
		self.cmdRegister.id = "register"
		self.cmdRegister.isDefault = True
		osiris.events.connect(self.cmdRegister.eventClick, self.onRegister)
				
		self.cmdCancel = osiris.IdeButton(self.getText("common.actions.cancel"))
		self.cmdCancel.id = "cancel"
		osiris.events.connect(self.cmdCancel.eventClick, self.onCancel)		
コード例 #10
0
	def onLoad(self):	
		osiris.IMainPage.onLoad(self)
		
		if(self.sessionAccount.isLogged() == False):
			self.redirect("home")
			return
		
		self.act = self.session.request.getUrlParam("act")
		if(self.act == ""):
			self.act = "home"		
				
		self.document = osiris.XMLDocument()
		self.root = self.document.create(self.act)
		template = osiris.HtmlXSLControl()
		template.stylesheet = self.loadStylesheet(os.path.join(os.path.dirname(__file__), "account.xsl"))
		template.document = self.document
				
		self.saveCommand = osiris.IdeButton(self.getText("common.actions.save"))
		self.saveCommand.id = "saveCommand"
		self.saveCommand.iconHref = self.skin.getImageUrl("icons/16x16/save.png")
		osiris.events.connect(self.saveCommand.eventClick, self.onSave)
		template.addChildParam(self.saveCommand)
		
		self.txtName = osiris.HtmlTextBox()
		self.txtName.id = "name"
		self.txtName.size = 40
		template.addChildParam(self.txtName)

		self.txtPassword = osiris.HtmlTextBox()
		self.txtPassword.id = "password"
		self.txtPassword.size = 40
		self.txtPassword.setPassword(True)
		template.addChildParam(self.txtPassword)
		
		self.skinPicker = osiris.IdePickerSkin()
		self.skinPicker.id = "skin"		
		self.skinPicker.setShowSystem(True)
		template.addChildParam(self.skinPicker)


		self.languagePicker = osiris.IdePickerCulture()
		self.languagePicker.id = "language"		
		self.languagePicker.setShowSystem(True)
		template.addChildParam(self.languagePicker)
				
		osiris.events.connect(self.events.get("onAccountExport"), self.onAccountExport)
		self.document.root.attributes.set("export_href",self.getEventCommand("onAccountExport"))		

		osiris.events.connect(self.events.get("onAccountRemove"), self.onAccountRemove)
		self.document.root.attributes.set("remove_href",self.getEventCommand("onAccountRemove"))		

		
		
		if(self.postBack == False):
			self.txtName.value = self.getSessionAccount().account.name
			self.txtPassword.value = self.getSessionAccount().account.getRealPassword()
			self.skinPicker.value = self.getSessionAccount().account.skinID.getString()
			self.languagePicker.value = self.getSessionAccount().language;
						
		if(self.ajax):
			self.controls.add(template)
		else:
			self.getArea(osiris.pageAreaContent).controls.add(template)		
コード例 #11
0
    def onLoad(self):
        osiris.IPortalPage.onLoad(self)

        osiris.events.connect(self.events.get("onPortalRemove"),
                              self.onPortalRemove)

        document = osiris.XMLDocument()
        self.root = document.create("info")
        template = osiris.HtmlXSLControl()
        template.stylesheet = self.loadStylesheet(
            os.path.join(os.path.dirname(__file__), "info.xsl"))
        template.document = document

        if (self.ajax):
            self.controls.add(template)
        else:
            self.getArea(osiris.pageAreaContent).controls.add(template)

        node = self.root

        node.setAttributeString("mode", self.request.getUrlParam("mode"))

        if (self.act == "home"):

            if (self.sessionAccount.isLogged()):
                #self.showMessage("logged")
                self.isUserOfPov = (self.sessionAccount.userID.getString() ==
                                    self.portal.povID.getString())
                self.root.setAttributeBool("isUserOfPov", self.isUserOfPov)

                self.povOfUser = osiris.PortalsSystem.instance().getPortal(
                    self.portal.portalID,
                    self.sessionAccount.userID.getString())
                self.root.setAttributeBool("povOfUserExists",
                                           (self.povOfUser != None))

            nodeActions = node.nodes.add("actions")

            nodeAction = nodeActions.nodes.add("action")
            nodeAction.attributes.set("name", "home")
            nodeAction.attributes.set("href", self.portal.getLink("view"))

            if (self.sessionAccount.isLogged()):
                if (self.isUserOfPov):
                    nodeAction = nodeActions.nodes.add("action")
                    nodeAction.attributes.set("name", "acp")
                    nodeAction.attributes.set("href",
                                              self.portal.getLink("acp"))
                elif (self.povOfUser == None):
                    params = {}
                    params["mode"] = "fork"
                    params["name"] = self.portal.name
                    params["id"] = self.portal.portalID.toWide()
                    nodeAction = nodeActions.nodes.add("action")
                    nodeAction.attributes.set("name", "fork")
                    nodeAction.attributes.set("prefix", "main.pages.subscribe")
                    nodeAction.attributes.set(
                        "href",
                        osiris.PortalsSystem.instance().getMainLink(
                            "subscribe", params))

            #nodeAction = nodeActions.nodes.add("action")
            #nodeAction.attributes.set("name", "info")
            #nodeAction.attributes.set("href", self.portal.getLink("info"))

            #nodeAction = nodeActions.nodes.add("action")
            #nodeAction.attributes.set("name", "accounts")
            #nodeAction.attributes.set("href", osiris.PortalsSystem.instance().getMainLink("accounts?portal=" + self.portal.getFullPovID()))

            nodeAction = nodeActions.nodes.add("action")
            nodeAction.attributes.set("name", "settings")
            nodeAction.attributes.set(
                "href",
                osiris.PortalsSystem.instance().getMainLink(
                    "settings?portal=" + self.portal.getFullPovID()))

            #nodeAction = nodeActions.nodes.add("action")
            #nodeAction.attributes.set("name", "invite")
            #nodeAction.attributes.set("call", self.portal.getLink("invite?mode=dialog"))

            nodeAction = nodeActions.nodes.add("action")
            nodeAction.attributes.set("name", "remove")
            #nodeAction.attributes.set("href", osiris.PortalsSystem.instance().getMainLink("removeportal?portal=" + self.portal.getFullPovID()))
            nodeAction.attributes.set("prefix", "portal.pages.info")
            nodeAction.attributes.set(
                "href",
                self.getEventCommand("onPortalRemove",
                                     self.portal.getFullPovID()))
            nodeAction.attributes.set("confirm", "true")

            # Details

            node.attributes.set("id", self.portal.portalID.string)
            node.attributes.set("pov", self.portal.povID.string)
            node.attributes.set("name", self.portal.name)
            if self.portal.optionsShared.portalDescription != "":
                node.attributes.set(
                    "description", self.portal.optionsShared.portalDescription)

            #node.setAttributeString("machine_id", osiris.Engine.instance().getMachineID())
            #node.setAttributeString("align_hash", self.portal.options.getAlignHash().getString())
            #node.setAttributeString("acceptable_hash", self.portal.optionsShared.getAcceptableHash())

            nodeIsisEndpoints = node.nodes.add("isis")
            isisEndpoints = self.portal.options.isisEndpoints
            osiris.events.connect(self.events.get("onIsisRemove"),
                                  self.onIsisRemove)
            for isisEndpointID in isisEndpoints.keys():
                isisEndpoint = isisEndpoints[isisEndpointID]
                nodeIsis = nodeIsisEndpoints.nodes.add("isis")

                nodeIsis.attributes.set("name", isisEndpoint.getName())
                nodeIsis.attributes.set("url", isisEndpoint.url.toString())
                nodeIsis.attributes.set("enabled", isisEndpoint.enabled)
                nodeIsis.attributes.set("last_event",
                                        isisEndpoint.getLastEvent())

                nodeIsis.attributes.set(
                    "edit_href",
                    self.portal.getLink("info") + "?act=isis_edit&id=" +
                    str(isisEndpointID))
                nodeIsis.attributes.set(
                    "remove_href",
                    self.getEventCommand("onIsisRemove", str(isisEndpointID)))
            nodeIsisEndpoints.attributes.set(
                "add_href",
                self.portal.getLink("info") + "?act=isis_add")

            node.attributes.set(
                "exchangeEnabled",
                "true" if self.portal.options.exchangeEnabled else "false")

            if (osiris.Options.instance().getWebMcpPassword() != ""):
                node.attributes.set(
                    "publicEnabled",
                    "true" if self.portal.options.publicEnabled else "false")
                node.attributes.set(
                    "default", "true" if
                    (osiris.Options.instance().getWebDefaultPortal()
                     == self.portal.getFullPovID().toUTF16()) else "false")

            node.attributes.set("lastObjectDate",
                                self.portal.options.lastObjectDate.toXML())
            node.attributes.set("lastExchangeDate",
                                self.portal.options.lastExchangeDate.toXML())
            node.attributes.set(
                "lastDownloadedObjectDate",
                self.portal.options.lastDownloadedObjectDate.toXML())
            node.attributes.set(
                "lastUploadedObjectDate",
                self.portal.options.lastUploadedObjectDate.toXML())
            node.attributes.set(
                "lastOptimizationDate",
                self.portal.options.lastOptimizationDate.toXML())
            node.attributes.set("lastSyncDate",
                                self.portal.options.lastSyncDate.toXML())

            node.setAttributeUint32("nodesSameAlign",
                                    self.portal.nodesSameAlign)
            node.setAttributeUint32("nodesSamePortalPov",
                                    self.portal.nodesSamePortalPov)

            # Invite
            self.root.setAttributeString("subscribe_href",
                                         self.portal.generateInviteLink(False))
            self.root.setAttributeString("isis_subscribe_href",
                                         self.portal.generateInviteLink(True))
            self.root.setAttributeString("export_href",
                                         self.portal.generateExportLink())

            # Settings
            self.saveCommand = osiris.IdeButton(
                self.getText("common.actions.save"))
            self.saveCommand.id = "save"
            self.saveCommand.iconHref = self.skin.getImageUrl(
                "icons/16x16/save.png")
            osiris.events.connect(self.saveCommand.eventClick, self.onSave)
            template.addChildParam(self.saveCommand)

            self.chkExchange = osiris.IdePickerBool()
            self.chkExchange.id = "exchange"
            template.addChildParam(self.chkExchange)

            self.txtPassword = osiris.HtmlTextBox()
            self.txtPassword.id = "password"
            self.txtPassword.size = 20
            template.addChildParam(self.txtPassword)

            self.cboSync = osiris.HtmlComboBox()
            self.cboSync.id = "sync"
            template.addChildParam(self.cboSync)
            self.cboSync.addOption(
                self.getText("portal.pages.info.settings.sync.none"), "")
            subscribedPortals = osiris.PortalsSystem.instance().portals
            for portal2 in subscribedPortals:
                #osiris.LogManager.instance().log(portal2.getPovName() + "," + self.portal.getPortalID().getString() + "-" + portal2.getPortalID().getString())
                if (self.portal.getPortalID().getString() ==
                        portal2.getPortalID().getString()):
                    if (self.portal.getPovID().getString() !=
                            portal2.getPovID().getString()):
                        self.cboSync.addOption(portal2.getPovName(),
                                               portal2.getFullPovID())

            if (self.postBack == False):
                self.chkExchange.check = self.portal.options.getExchangeEnabled(
                )
                self.txtPassword.value = self.portal.options.getPassword()
                self.cboSync.value = self.portal.getSync()
        elif ((self.act == "isis_add") or (self.act == "isis_edit")):
            self.saveCommand = osiris.IdeButton(
                self.getText("common.actions.save"))
            self.saveCommand.id = "save"
            self.saveCommand.iconHref = self.skin.getImageUrl(
                "icons/16x16/save.png")
            osiris.events.connect(self.saveCommand.eventClick, self.onIsisSave)
            template.addChildParam(self.saveCommand)

            self.txtName = osiris.HtmlTextBox()
            self.txtName.id = "name"
            self.txtName.size = 40
            template.addChildParam(self.txtName)

            self.txtUrl = osiris.HtmlTextBox()
            self.txtUrl.id = "url"
            self.txtUrl.size = 40
            template.addChildParam(self.txtUrl)

            self.txtPassword = osiris.HtmlTextBox()
            self.txtPassword.id = "password"
            self.txtPassword.size = 40
            template.addChildParam(self.txtPassword)

            self.chkEnabled = osiris.IdePickerBool()
            self.chkEnabled.id = "enabled"
            template.addChildParam(self.chkEnabled)
コード例 #12
0
    def onInit(self):
        osiris.IMainPage.onInit(self)

        document = osiris.XMLDocument()
        self.root = document.create("accounts")
        template = osiris.HtmlXSLControl()
        template.stylesheet = self.loadStylesheet(
            os.path.join(os.path.dirname(__file__), "accounts.xsl"))
        template.document = document

        if (self.ajax):
            self.controls.add(template)
        else:
            self.getArea(osiris.pageAreaContent).controls.add(template)

        self.act = self.session.request.getUrlParam("act")
        if (self.act == ""):
            self.act = "home"

        self.root.setAttributeString("action", self.act)

        if (self.act == "home"):

            osiris.events.connect(self.events.get("onExport"), self.onExport)
            osiris.events.connect(self.events.get("onRemove"), self.onRemove)

            nodeActions = self.root.nodes.add("actions")

            actionRegisterParams = {}
            actionRegisterParams["act"] = "register"
            actionRegister = nodeActions.nodes.add("action")
            actionRegister.attributes.set("name", "register")
            actionRegister.attributes.set(
                "href",
                osiris.PortalsSystem.instance().getMainLink(
                    "accounts", actionRegisterParams))

            actionImportParams = {}
            actionImportParams["act"] = "import"
            actionImport = nodeActions.nodes.add("action")
            actionImport.attributes.set("name", "import")
            actionImport.attributes.set(
                "href",
                osiris.PortalsSystem.instance().getMainLink(
                    "accounts", actionImportParams))

        if (self.act == "login"):
            self.userid = self.session.request.getUrlParam("id")
            if ((self.userid == None) or (self.userid == "")):
                self.redirect("accounts")
                return

            account = osiris.IdeAccountsManager.instance().getByID(self.userid)
            if (account == None):
                return

            savedPassword = account.getRealPassword()
            if (savedPassword != ""):
                if (self.loginAccountWithID(self.userid, savedPassword)):
                    self.redirect("home")

            self.txtPassword = osiris.HtmlTextBox()
            self.txtPassword.id = "password"
            self.txtPassword.size = 20
            self.txtPassword.getAttributes().set("data-os-otype", "string")
            self.txtPassword.getAttributes().set("data-os-submit",
                                                 "page-login")
            self.txtPassword.password = True
            template.addChildParam(self.txtPassword)

            self.chkSavePassword = osiris.IdePickerBool()
            self.chkSavePassword.id = "savePassword"
            template.addChildParam(self.chkSavePassword)

            self.cmdLogin = osiris.IdeButton(
                self.getText("main.pages.accounts.enter"))
            self.cmdLogin.id = "login"
            self.cmdLogin.isDefault = True
            osiris.events.connect(self.cmdLogin.eventClick, self.onLogin)
            template.addChildParam(self.cmdLogin)

        if (self.act == "register"):
            self.txtName = osiris.HtmlTextBox()
            self.txtName.id = "name"
            self.txtName.size = 20
            template.addChildParam(self.txtName)

            self.txtPassword = osiris.HtmlTextBox()
            self.txtPassword.id = "password"
            self.txtPassword.size = 20
            self.txtPassword.attributes.set("data-os-otype", "password")
            self.txtPassword.attributes.set("data-os-login", "page_name")
            self.txtPassword.password = True
            template.addChildParam(self.txtPassword)

            self.txtPasswordChecker = osiris.HtmlTextBox()
            self.txtPasswordChecker.id = "passwordChecker"
            self.txtPasswordChecker.size = 20
            self.txtPasswordChecker.password = True
            template.addChildParam(self.txtPasswordChecker)

            #self.secretQuestion = osiris.HtmlTextBox()
            #self.secretQuestion.id = "secretQuestion"
            #self.secretQuestion.css = "os_input_full"

            #self.secretResponse = osiris.HtmlTextBox()
            #self.secretResponse.id = "secretResponse"
            #self.secretResponse.css = "os_input_full"
            #self.secretResponse.password = True

            #self.secretResponseChecker = osiris.HtmlTextBox()
            #self.secretResponseChecker.id = "secretResponseChecker"
            #self.secretResponseChecker.password = True

            self.chkSavePassword = osiris.IdePickerBool()
            self.chkSavePassword.id = "savePassword"
            template.addChildParam(self.chkSavePassword)

            self.cmdRegister = osiris.IdeButton(
                self.getText("common.actions.create"))
            self.cmdRegister.id = "register"
            self.cmdRegister.isDefault = True
            osiris.events.connect(self.cmdRegister.eventClick, self.onRegister)
            template.addChildParam(self.cmdRegister)

        if (self.act == "import"):

            self.txtFile = osiris.HtmlFileBrowser()
            self.txtFile.id = "file"
            self.txtFile.size = 20
            template.addChildParam(self.txtFile)

            self.cmdImport = osiris.IdeButton(
                self.getText("main.pages.accounts.import"))
            self.cmdImport.id = "import"
            self.cmdImport.isDefault = True
            osiris.events.connect(self.cmdImport.eventClick, self.onImport)
            template.addChildParam(self.cmdImport)
コード例 #13
0
ファイル: myuser.py プロジェクト: direclown/osiris-sps
    def onLoad(self):
        osiris.IPortalPage.onLoad(self)

        self.act = self.session.request.getUrlParam("act")
        if (self.act == ""):
            self.act = "home"

        self.document = osiris.XMLDocument()
        self.root = self.document.create(self.act)
        template = osiris.HtmlXSLControl()
        template.stylesheet = self.loadStylesheet(
            os.path.join(os.path.dirname(__file__), "acp.xsl"))
        template.document = self.document

        #self.document.root.setAttributeString("page_url",self.request.rawUrl);

        osiris.LogManager.instance().log(
            self.sessionAccount.userID.getString())
        osiris.LogManager.instance().log(self.portal.povID.getString())

        if (self.sessionAccount.userID.getString() ==
                self.portal.povID.getString()):
            osiris.LogManager.instance().log("kkk")

        isGuest = self.sessionAccount.isPortalGuest(self.database)
        self.root.setAttributeBool("isGuest", isGuest)

        self.root.setAttributeString(
            "stabilization_stats_href",
            self.portal.getLink("stabilization_stats"))
        self.root.setAttributeString("trash_href",
                                     self.portal.getLink("trash"))

        if (isGuest == False):
            # Hack, to fix: senza le getString le rileva diversi sempre...
            isUserOfPov = (self.sessionAccount.isPortalGuest(self.database)
                           == False and self.sessionAccount.userID.getString()
                           == self.portal.povID.getString())
            self.root.setAttributeBool("isUserOfPov", isUserOfPov)

            povOfUser = osiris.PortalsSystem.instance().getPortal(
                self.portal.portalID, self.sessionAccount.userID.getString())
            self.root.setAttributeBool("povOfUserExists", (povOfUser != None))

            povOfUserHref = ""
            if (povOfUser != None):
                povOfUserHref = povOfUser.getLink("acp")
            else:
                params = {}
                params["mode"] = "fork"
                params["name"] = self.portal.optionsShared.portalName
                params["id"] = self.portal.portalID.toWide()
                povOfUserHref = osiris.PortalsSystem.instance().getMainLink(
                    "subscribe", params)

            self.root.setAttributeString("povOfUserHref", povOfUserHref)

        if (self.act == "home"):

            self.saveCommand = osiris.IdeButton(
                self.getText("common.actions.save"))
            self.saveCommand.id = "saveCommand"
            self.saveCommand.iconHref = self.skin.getImageUrl(
                "icons/16x16/save.png")
            osiris.events.connect(self.saveCommand.eventClick, self.onSave)
            template.addChildParam(self.saveCommand)

            self.portalName = osiris.HtmlTextBox()
            self.portalName.id = "portalName"
            self.portalName.css = "os_input_full"
            self.portalName.getAttributes().set("data-os-otype", "string")
            self.portalName.getAttributes().set("data-os-minchars", "5")
            self.portalName.getAttributes().set("data-os-submit",
                                                "page-saveCommand")
            template.addChildParam(self.portalName)

            self.portalDescription = osiris.HtmlTextBox()
            self.portalDescription.id = "portalDescription"
            self.portalDescription.css = "os_input_full"
            template.addChildParam(self.portalDescription)

            self.authorsReputationThreshold = osiris.HtmlComboBox()
            self.authorsReputationThreshold.id = "authorsReputationThreshold"
            template.addChildParam(self.authorsReputationThreshold)
            self.authorsReputationThreshold.addOption(
                self.getText("reputation.threshold.all"), "0")
            self.authorsReputationThreshold.addOption(
                self.getText("reputation.threshold.negative"), "1")
            self.authorsReputationThreshold.addOption(
                self.getText("reputation.threshold.not_negative"), "2")
            self.authorsReputationThreshold.addOption(
                self.getText("reputation.threshold.positive"), "3")

            self.editorsReputationThreshold = osiris.HtmlComboBox()
            self.editorsReputationThreshold.id = "editorsReputationThreshold"
            template.addChildParam(self.editorsReputationThreshold)
            self.editorsReputationThreshold.addOption(
                self.getText("reputation.threshold.all"), "0")
            self.editorsReputationThreshold.addOption(
                self.getText("reputation.threshold.negative"), "1")
            self.editorsReputationThreshold.addOption(
                self.getText("reputation.threshold.not_negative"), "2")
            self.editorsReputationThreshold.addOption(
                self.getText("reputation.threshold.positive"), "3")

            self.txtPovWhiteList = osiris.HtmlTextBox()
            self.txtPovWhiteList.id = "povWhiteList"
            self.txtPovWhiteList.css = "os_input_full"
            template.addChildParam(self.txtPovWhiteList)

            self.txtPovBlackList = osiris.HtmlTextBox()
            self.txtPovBlackList.id = "povBlackList"
            self.txtPovBlackList.css = "os_input_full"
            template.addChildParam(self.txtPovBlackList)

            # Layout

            self.layoutComponent = osiris.IdePickerComponent()
            self.layoutComponent.id = "layoutComponent"
            self.layoutComponent.css = "os_input_full"
            template.addChildParam(self.layoutComponent)

            #self.registerTerms = osiris.IdeOMLEditor()
            #self.registerTerms.id = "registerTerms"
            #self.registerTerms.css = "os_input_full"
            #template.addChildParam(self.registerTerms)

            self.layoutTileImage = osiris.IdePickerObject()
            self.layoutTileImage.id = "layoutTileImage"
            template.addChildParam(self.layoutTileImage)

            self.layoutTileColorBackground = osiris.IdePickerColor()
            self.layoutTileColorBackground.id = "layoutTileColorBackground"
            template.addChildParam(self.layoutTileColorBackground)

            self.layoutTileColorForeground = osiris.IdePickerColor()
            self.layoutTileColorForeground.id = "layoutTileColorForeground"
            template.addChildParam(self.layoutTileColorForeground)

            self.layoutSkinParams = osiris.IdeOMLEditor()
            self.layoutSkinParams.id = "layoutSkinParams"
            self.layoutSkinParams.css = "os_input_full"
            template.addChildParam(self.layoutSkinParams)

            self.layoutCss = osiris.IdeOMLEditor()
            self.layoutCss.id = "layoutCss"
            self.layoutCss.css = "os_input_full"
            template.addChildParam(self.layoutCss)

            self.layoutHeader = osiris.IdePickerBool()
            self.layoutHeader.id = "layoutHeader"
            template.addChildParam(self.layoutHeader)

            # Rules

            self.objectsMaxSize = osiris.IdePickerNumber()
            self.objectsMaxSize.id = "objectsMaxSize"
            template.addChildParam(self.objectsMaxSize)

            self.badWords = osiris.HtmlTextBox()
            self.badWords.id = "badWords"
            self.badWords.css = "os_input_full"
            template.addChildParam(self.badWords)

            # Rules ex

            self.allowObjectInFuture = osiris.IdePickerBool()
            self.allowObjectInFuture.id = "allowObjectInFuture"
            template.addChildParam(self.allowObjectInFuture)

            self.allowObjectUnsigned = osiris.IdePickerBool()
            self.allowObjectUnsigned.id = "allowObjectUnsigned"
            template.addChildParam(self.allowObjectUnsigned)

            self.objectsPhysicalRemove = osiris.IdePickerBool()
            self.objectsPhysicalRemove.id = "objectsPhysicalRemove"
            template.addChildParam(self.objectsPhysicalRemove)

            self.objectsPhysicalRemoveDays = osiris.IdePickerNumber()
            self.objectsPhysicalRemoveDays.id = "objectsPhysicalRemoveDays"
            template.addChildParam(self.objectsPhysicalRemoveDays)

            if (self.postBack == False):

                # Main
                self.portalName.value = self.portal.name
                self.portalDescription.value = self.portal.optionsShared.portalDescription
                self.authorsReputationThreshold.value = self.portal.optionsShared.authorsReputationThreshold
                self.editorsReputationThreshold.value = self.portal.optionsShared.editorsReputationThreshold
                self.txtPovWhiteList.value = self.portal.optionsShared.povWhiteList
                self.txtPovBlackList.value = self.portal.optionsShared.povBlackList

                # Layout

                self.layoutComponent.value = self.portal.optionsShared.layoutComponent
                #self.registerTerms.value = self.portal.optionsShared.registerTerms
                self.layoutTileImage.value = self.portal.optionsShared.layoutTileImage
                self.layoutTileColorBackground.value = self.portal.optionsShared.layoutTileColorBackground
                self.layoutTileColorForeground.value = self.portal.optionsShared.layoutTileColorForeground
                self.layoutSkinParams.value = self.portal.optionsShared.layoutSkinParams
                self.layoutCss.value = self.portal.optionsShared.layoutCss
                self.layoutHeader.check = self.portal.optionsShared.layoutHeader

                # Rules

                self.objectsMaxSize.value = self.portal.optionsShared.objectsMaxSize
                self.badWords.value = self.portal.optionsShared.badWords

                # Rules Ex

                self.allowObjectInFuture.check = self.portal.optionsShared.allowObjectInFuture
                self.allowObjectUnsigned.check = self.portal.optionsShared.allowObjectUnsigned
                self.objectsPhysicalRemove.check = self.portal.optionsShared.objectsPhysicalRemove
                self.objectsPhysicalRemoveDays.value = self.portal.optionsShared.objectsPhysicalRemoveDays

        if (self.ajax):
            self.controls.add(template)
        else:
            self.getArea(osiris.pageAreaContent).controls.add(template)
コード例 #14
0
ファイル: subscribe.py プロジェクト: direclown/osiris-sps
    def onInit(self):
        osiris.IMainPage.onInit(self)

        document = osiris.XMLDocument()
        root = document.create("subscribe")
        template = osiris.HtmlXSLControl()
        template.stylesheet = self.loadStylesheet(
            os.path.join(os.path.dirname(__file__), "subscribe.xsl"))
        template.document = document

        self.mode = self.request.getUrlParam("mode")
        document.root.setAttributeString("mode", self.mode)

        self.valid = True

        self.accountRequired = False

        if (self.mode != 'subscribe'):
            self.accountRequired = True

        if (self.accountRequired):
            if (self.sessionAccount.isLogged() == False):
                self.showError(self.getText("errors.account_required"))
                self.valid = False
                return

        if ((self.mode != 'subscribe') and (self.mode != 'create')
                and (self.mode != 'self') and (self.mode != 'fork')):
            self.showError(self.getText("errors.invalid_params"))
            self.valid = False
            return

        self.portalName = osiris.HtmlTextBox()
        self.portalName.id = "name"
        self.portalName.size = 40
        self.portalName.getAttributes().set("data-os-otype", "string")
        self.portalName.getAttributes().set("data-os-minchars", "5")
        self.portalName.getAttributes().set("data-os-submit", "page-subscribe")
        template.addChildParam(self.portalName)

        self.portalPassword = osiris.HtmlTextBox()
        self.portalPassword.id = "password"
        self.portalPassword.size = 40
        self.portalPassword.password = True
        self.portalPassword.attributes.set("data-os-otype", "password")
        self.portalPassword.attributes.set("data-os-login", "page-name")
        template.addChildParam(self.portalPassword)

        self.portalEnableExchange = osiris.IdePickerBool()
        self.portalEnableExchange.id = "enableExchange"
        template.addChildParam(self.portalEnableExchange)

        self.portalId = osiris.HtmlTextBox()
        self.portalId.id = "id"
        self.portalId.size = 40
        self.portalId.getAttributes().set("data-os-otype", "string")
        self.portalId.getAttributes().set("data-os-minchars", "40")
        template.addChildParam(self.portalId)

        self.portalPov = osiris.HtmlTextBox()
        self.portalPov.id = "pov"
        self.portalPov.size = 40
        self.portalPov.getAttributes().set("data-os-otype", "string")
        self.portalPov.getAttributes().set("data-os-minchars", "40")
        template.addChildParam(self.portalPov)

        self.databaseDriver = osiris.HtmlComboBox()
        self.databaseDriver.id = "databaseDriver"
        self.databaseDriver.autoPostBack = True
        template.addChildParam(self.databaseDriver)
        drivers = osiris.DatabasesSystem.instance().drivers
        for driver in drivers:
            self.databaseDriver.addOption(driver.description, driver.name)
        self.databaseDriver.value = osiris.DatabasesSystem.instance(
        ).defaultDriver.name

        subscribeLabel = "create"
        if (self.mode == "subscribe"):
            subscribeLabel = "subscribe"

        self.cmdSubscribe = osiris.IdeButton(
            self.getText("main.pages.subscribe.action." + subscribeLabel))
        self.cmdSubscribe.id = "subscribe"
        self.cmdSubscribe.iconHref = self.skin.getImageUrl(
            "icons/16x16/save.png")
        self.cmdSubscribe.isDefault = True
        osiris.events.connect(self.cmdSubscribe.eventClick, self.onSubscribe)
        template.addChildParam(self.cmdSubscribe)

        self.getArea(osiris.pageAreaContent).controls.add(template)

        if (self.mode == 'self'):
            self.portalName.value = self.sessionAccount.account.name
            self.portalId.value = self.sessionAccount.userID.toAscii()
            self.portalPov.value = self.sessionAccount.userID.toAscii()
        elif (self.mode == 'fork'):
            self.portalName.value = self.getText(
                "main.pages.subscribe.fork_of"
            ) + " " + self.request.getUrlParam("name")
            self.portalId.value = self.request.getUrlParam("id")
            self.portalPov.value = self.sessionAccount.userID.toAscii()
        elif (self.mode == 'create'):
            self.portalPov.value = self.sessionAccount.userID.toAscii()