Diffstat (limited to 'frontend/gamma/js/Clipperz/PM') (more/less context) (ignore whitespace changes)
4 files changed, 34 insertions, 61 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy.js b/frontend/gamma/js/Clipperz/PM/Proxy.js index 9817eac..190bffd 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy.js @@ -121,49 +121,49 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { //========================================================================= 'registration': function (someParameters) { return this.processMessage('registration', someParameters, 'REGISTER'); }, 'handshake': function (someParameters) { return this.processMessage('handshake', someParameters, 'CONNECT'); }, 'message': function (someParameters) { return this.processMessage('message', someParameters, 'MESSAGE'); }, 'logout': function (someParameters) { return this.processMessage('logout', someParameters, 'MESSAGE'); }, //========================================================================= 'processMessage': function (aFunctionName, someParameters, aRequestType) { var deferredResult; - deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:true}); + deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:false}); deferredResult.addMethod(this, 'payToll', aRequestType); deferredResult.addMethod(this, 'sendMessage', aFunctionName); deferredResult.addMethod(this, 'setTollCallback'); deferredResult.callback(someParameters); return deferredResult; }, //========================================================================= 'sendMessage': function () { throw Clipperz.Base.exception.AbstractMethod; }, //========================================================================= 'isReadOnly': function () { return false; }, //========================================================================= __syntaxFix__: "syntax fix" }); diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js index 095e8ed..8df7e0e 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Components/Tooltip.js @@ -81,131 +81,132 @@ Clipperz.Base.extend(Clipperz.PM.UI.Common.Components.Tooltip, Clipperz.PM.UI.Co 'setIsEnabled': function (aValue) { this._enabled = aValue; }, //------------------------------------------------------------------------- 'isVisible': function () { return this._isVisible; }, 'setIsVisible': function (aValue) { this._isVisible = aValue; }, //------------------------------------------------------------------------- 'renderSelf': function() { // this.append(this.element(), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ // this.append(MochiKit.DOM.currentDocument().body, {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ this.append(MochiKit.DOM.getElement('Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'), {tag:'div', id:this.getId('tooltip'), cls:'tooltip ' + this.position(), children:[ {tag:'div', id:this.getId('body'), cls:'tooltip_body', children:[ {tag:'div', cls:'tooltip_text', children:[ {tag:'span', html:this.text()} - ]}, - {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} + ]}//, +// {tag:'div', id:this.getId('footer'), cls:'tooltip_footer'} ]}, {tag:'div', id:this.getId('arrow'), cls:'tooltip_arrow'} ]}); this._boxDimensions = MochiKit.Style.getElementDimensions(this.getId('body')); // this._boxDimensions.h += MochiKit.Style.getElementDimensions(this.getId('footer')).h; MochiKit.Style.hideElement(this.displayElement()); MochiKit.Signal.connect(this.element(), 'onmouseenter', this, 'show'); MochiKit.Signal.connect(this.element(), 'onmouseleave', this, 'hide'); }, //----------------------------------------------------- 'displayElement': function() { return this.getElement('tooltip'); }, //------------------------------------------------------------------------- 'boxDimensions': function () { return this._boxDimensions; }, //------------------------------------------------------------------------- 'show': function () { var elementSizeAndPosition; var arrowPosition; var bodyPosition; if (this.isVisible() == false) { arrowPosition = {}; bodyPosition = {}; this.setIsVisible(true); elementSizeAndPosition = Clipperz.Style.getSizeAndPosition(this.element()); //console.log("ELEMENT SIZE AND POSITION", Clipperz.Base.serializeJSON(elementSizeAndPosition)); //console.log("BOX DIMENSIONS", Clipperz.Base.serializeJSON(this.boxDimensions())); switch (this.position()) { case 'ABOVE': //console.log("ABOVE"); - MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); +// MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); bodyPosition.y = elementSizeAndPosition.position.y - this.boxDimensions().h - 13; - arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); - arrowPosition.y = elementSizeAndPosition.position.y - 13; +// arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); +// arrowPosition.y = elementSizeAndPosition.position.y - 13; break; case 'BELOW': //console.log("BELOW"); - MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); +// MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:36, h:13}, 'px'); bodyPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - this.boxDimensions().w/2); bodyPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h + 13; - arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); - arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; +// arrowPosition.x = elementSizeAndPosition.position.x + (elementSizeAndPosition.dimensions.w/2 - 36/2); +// arrowPosition.y = elementSizeAndPosition.position.y + elementSizeAndPosition.dimensions.h; break; case 'LEFT': //console.log("LEFT"); - MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); +// MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); bodyPosition.x = elementSizeAndPosition.position.x - this.boxDimensions().w - 13; bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); - arrowPosition.x = elementSizeAndPosition.position.x -13; - arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); +// arrowPosition.x = elementSizeAndPosition.position.x -13; +// arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); break; case 'RIGHT': //console.log("RIGHT"); - MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); +// MochiKit.Style.setElementDimensions(this.getId('arrow'), {w:13, h:36}, 'px'); bodyPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w + 13; bodyPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - this.boxDimensions().h/2); - arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; - arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); +// arrowPosition.x = elementSizeAndPosition.position.x + elementSizeAndPosition.dimensions.w; +// arrowPosition.y = elementSizeAndPosition.position.y + (elementSizeAndPosition.dimensions.h/2 - 36/2); break; } //console.log("X: " + bodyPosition.x + ", Y: " + bodyPosition.y); - MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); - MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); + MochiKit.Style.setElementPosition(this.getId('tooltip'), bodyPosition); +// MochiKit.Style.setElementPosition(this.getId('body'), bodyPosition); +// MochiKit.Style.setElementPosition(this.getId('arrow'), arrowPosition); MochiKit.Visual.appear(this.displayElement(), {duration:0.4}); } }, 'hide': function () { if (this.isVisible() == true) { MochiKit.Visual.fade(this.displayElement(), {duration:0.4}); this.setIsVisible(false); } }, //------------------------------------------------------------------------- /* 'shouldRemoveElementWhenClearningUp': function () { return false; }, */ //------------------------------------------------------------------------- __syntaxFix__: "syntax fix" }); Clipperz.PM.UI.Common.Components.Tooltip.initTooltips = function () { Clipperz.DOM.Helper.insertBefore(MochiKit.DOM.currentDocument().body.childNodes[0], {tag:'div', id:'Clipperz_PM_UI_Common_Components_Tooltip_wrapperNode'}); } diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js index 389d876..a10ba4f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js @@ -44,66 +44,51 @@ Clipperz.PM.UI.Web.Components.LoginForm = function(args) { Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { //------------------------------------------------------------------------- 'toString': function () { return "Clipperz.PM.UI.Web.Components.LoginForm component"; }, 'autocomplete': function () { return this._autocomplete; }, //------------------------------------------------------------------------- 'renderSelf': function() { this.append(this.element(), {tag:'div', id:'loginBox', children:[ {tag:'div', cls:'header'}, {tag:'div', cls:'body', id:this.getId('body'), children:[ {tag:'div', id:this.getId('loginForm'), children:[ {tag:'div', children:[ {tag:'h4', html:'Login'}, // {tag:'form', cls:'loginForm', autocomplete:this.autocomplete(), children:[ {tag:'form', id:this.getId('form'), cls:'loginForm', children:[ {tag:'label', html:'username', 'for':this.getId('usernameField')}, - {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'/*, value:'joe'*/}, - {tag:'ul', id:this.getId('passwordOptions'), children:[ - {tag:'li', id:this.getId('passphraseOption'), children:[ - {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, - {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'/*, value:'clipperz'*/} - ]} // , -/* - {tag:'li', id:this.getId('otpOption'), children:[ - {tag:'label', html:'one-time password', 'for':this.getId('otpField_1')}, - {tag:'input', id:this.getId('otpField_1'), type:'text', cls:'otp', value:'abcd-efgh'}, - {tag:'input', id:this.getId('otpField_2'), type:'text', cls:'otp', value:'abcd-efgh'}, - {tag:'input', id:this.getId('otpField_3'), type:'text', cls:'otp', value:'abcd-efgh'}, - {tag:'input', id:this.getId('otpField_4'), type:'text', cls:'otp', value:'abcd-efgh'} - ]} -*/ - ]}, -// {tag:'input', id:this.getId('otpCheckbox'), type:'checkbox', cls:'checkbox'}, -// {tag:'label', html:'use a one-time passphrase', 'for':this.getId('otpCheckbox'), cls:'checkbox'}, + {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'}, + {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, + {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'}, {tag:'div', cls:'translations', children:[ {tag:'h4', html:'choose your language'}, {tag:'ul', children:[ {tag:'li', cls:'selected', html:'english'}, {tag:'li', html:'italiano'}, {tag:'li', html:'dutch'}, {tag:'li', html:'french'}, {tag:'li', html:'spanish'}, {tag:'li', html:'chinese'}, {tag:'li', html:'japanese'}, {tag:'li', html:'portugal'}, {tag:'li', html:'arabic'} ]} ]}, {tag:'input', id:this.getId('submitButton'), type:'submit', value:'login', cls:'submit'} ]} ]} ]} ]}, {tag:'div', cls:'footer'} ]}); @@ -140,61 +125,54 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Com //----------------------------------------------------------------------------- /* 'showPassphraseField': function() { this.showElement('passphraseOption'); this.hideElement('otpOption'); }, */ //----------------------------------------------------------------------------- 'focusOnPassphraseField': function () { this.getElement('passphraseField').focus(); this.getElement('passphraseField').select(); }, //----------------------------------------------------------------------------- /* 'showOTPFields': function() { this.hideElement('passphraseOption'); this.showElement('otpOption'); }, */ //------------------------------------------------------------------------- 'loginEventHandler': function(anEvent) { - var username; - var passphrase; -// var shouldUseOTP; -// var otp; +// var username; +// var passphrase; var signalArguments; anEvent.preventDefault(); - username = this.getElement('usernameField').value; - passphrase = this.getElement('passphraseField').value; -// otp = this.getElement('otpField_1').value + -// this.getElement('otpField_2').value + -// this.getElement('otpField_3').value + -// this.getElement('otpField_4').value; -// shouldUseOTP = this.getElement('otpCheckbox').checked; - - signalArguments = {username:username}; - -// if (shouldUseOTP) { -// signalArguments.otp = otp; -// } else { - signalArguments.passphrase = passphrase; -// } +// username = this.getElement('usernameField').value; +// passphrase = this.getElement('passphraseField').value; + +// signalArguments = {username:username}; +// signalArguments.passphrase = passphrase; + + signalArguments = { + 'username': this.getElement('usernameField').value, + 'passphrase': this.getElement('passphraseField').value + }; MochiKit.Signal.signal(this, 'doLogin', signalArguments); }, //------------------------------------------------------------------------- 'submitButtonElement': function() { return this.getElement('submitButton'); }, //------------------------------------------------------------------------- __syntaxFix__: "syntax fix" }); diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js index d0b378c..a57152d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js @@ -60,71 +60,65 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, { //----------------------------------------------------------------------------- 'run': function(args) { var slot; var loginPage; var loginForm; slot = args.slot; loginForm = new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']}); slot.setContent(this.loginPage()); this.loginPage().slotNamed('loginForm').setContent(loginForm); MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); }, //----------------------------------------------------------------------------- 'doLogin': function(aLoginForm, anEvent) { var deferredResult; var parameters; -// var shouldUseOTP; var loginProgress; var user; var getPassphraseDelegate; parameters = anEvent; -// shouldUseOTP = (typeof(parameters.passphrase) == 'undefined'); getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')}); loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress(); deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false}); deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate); deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()}); deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); -// if (shouldUseOTP == false) { - deferredResult.addMethod(user, 'login'); -// } else { -// deferredResult.addMethod(user, 'loginUsingOTP', parameters.username, parameters.otp); -// } + deferredResult.addMethod(user, 'login'); deferredResult.addCallback(function(aLoginProgress, res) { aLoginProgress.disableCancel(); return res; }, loginProgress); deferredResult.addCallback(function () { MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN', MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body})); }) deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm); deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress)); deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()})); deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField')); deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate)); deferredResult.callback(); MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel'); return deferredResult; }, //----------------------------------------------------------------------------- 'userLoggedIn': function(aUser) { //Clipperz.log(">>> LoginController.userLoggedIn"); |