From 07c63941ec6e8509ae311a23baacc06e851ad9b3 Mon Sep 17 00:00:00 2001 From: Piotr Zarzycki Date: Wed, 23 Aug 2023 11:48:45 +0200 Subject: [PATCH] Private Dir: Add password prompt to indicate whether password is set or non required - Fix issue with parsing whether Genesis dir is private (reference #35 ) --- .../classes/managers/ParseCentral.as | 2 +- .../interfaces/IGenesisEditDirView.as | 6 ++-- .../applications/MediatorGenesisEditDir.as | 29 +++++++++++++++++-- .../model/vo/GenesisDirVO.as | 12 ++++++-- .../view/applications/GenesisEditDirView.mxml | 24 ++++++++++----- 5 files changed, 57 insertions(+), 16 deletions(-) diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/classes/managers/ParseCentral.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/classes/managers/ParseCentral.as index bcc2733..6d31064 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/classes/managers/ParseCentral.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/classes/managers/ParseCentral.as @@ -279,7 +279,7 @@ package classes.managers for (var i:int = 0; i < viewEntryCount; i++) { var privateDir:Object = jsonData[i]; - var tmpVO:GenesisDirVO = new GenesisDirVO(privateDir.DominoUniversalID, privateDir["private"], privateDir.label, privateDir.url); + var tmpVO:GenesisDirVO = new GenesisDirVO(privateDir.DominoUniversalID, privateDir["private"] == "true", privateDir.label, privateDir.url); tmpArr.push(tmpVO); } diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/interfaces/IGenesisEditDirView.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/interfaces/IGenesisEditDirView.as index a91b651..c88122a 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/interfaces/IGenesisEditDirView.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/interfaces/IGenesisEditDirView.as @@ -13,12 +13,12 @@ package interfaces function get titleGenesisDir():String; function set titleGenesisDir(value:String):void; function get isPasswordDisabled():Boolean; + function set isPasswordDisabled(value:Boolean):void; function get passwordChange():IEventDispatcher; - + function set passwordPrompt(value:String):void; + function get labelText():String; function get urlText():String; function get passwordText():String; - - function togglePasswordChange():void } } \ No newline at end of file diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/applications/MediatorGenesisEditDir.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/applications/MediatorGenesisEditDir.as index 1dab795..942e2b0 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/applications/MediatorGenesisEditDir.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/mediator/applications/MediatorGenesisEditDir.as @@ -110,13 +110,38 @@ package mediator.applications private function onPasswordChangeClick(event:MouseEvent):void { - view.togglePasswordChange(); + view.isPasswordDisabled = false; + view.passwordPrompt = ""; } private function updateView():void { - this.view.titleGenesisDir = genesisDirsProxy.selectedDir.label ? "Edit Directory" : "Add Directory"; this.view.genesisDir = genesisDirsProxy.selectedDir; + + if (genesisDirsProxy.selectedDir.dominoUniversalID) + { + this.view.titleGenesisDir = "Edit Directory"; + this.view.isPasswordDisabled = true; + } + else + { + this.view.titleGenesisDir = "Add Directory"; + this.view.isPasswordDisabled = false; + } + + this.refreshPasswordInputPrompt(); + } + + private function refreshPasswordInputPrompt():void + { + if (genesisDirsProxy.selectedDir && genesisDirsProxy.selectedDir.isPrivate) + { + view.passwordPrompt = "Password set"; + } + else + { + view.passwordPrompt = "No password required"; + } } } } \ No newline at end of file diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/model/vo/GenesisDirVO.as b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/model/vo/GenesisDirVO.as index 521ca2a..2f95081 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/model/vo/GenesisDirVO.as +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/model/vo/GenesisDirVO.as @@ -20,12 +20,18 @@ package model.vo public function toRequestObject():Object { - return { + var requestObject:Object = { DominoUniversalID: this.dominoUniversalID, label: this.label, - url: this.url, - password: this.password + url: this.url + }; + + if (this.password) + { + requestObject.password = this.password; } + + return requestObject; } } } \ No newline at end of file diff --git a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/view/applications/GenesisEditDirView.mxml b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/view/applications/GenesisEditDirView.mxml index a8a8042..1f59178 100644 --- a/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/view/applications/GenesisEditDirView.mxml +++ b/Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/view/applications/GenesisEditDirView.mxml @@ -69,23 +69,32 @@ return this.passwordTextInput.text; } - + public function get isPasswordDisabled():Boolean { if (!this.passwordDisabled) return false; return this.passwordDisabled.disabled; } - - public function togglePasswordChange():void + + public function set isPasswordDisabled(value:Boolean):void { - this.passwordDisabled.disabled = !this.passwordDisabled.disabled; + if (!this.passwordDisabled) return; + + this.passwordDisabled.disabled = value; } - + public function get passwordChange():IEventDispatcher { return this.changePassword; } + + public function set passwordPrompt(value:String):void + { + if (!this.passwordPromptTextInput) return; + + this.passwordPromptTextInput.prompt = value; + } public function installationResult(message:String):void { @@ -147,10 +156,11 @@ text="{genesisDir.password}" percentWidth="100"> - + + - +