Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js index eec83b0..5341878 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js | |||
@@ -1,181 +1,178 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components'); |
30 | 27 | ||
31 | Clipperz.PM.UI.iPhone.Components.LoginForm = function(args) { | 28 | Clipperz.PM.UI.iPhone.Components.LoginForm = function(args) { |
32 | args = args || {}; | 29 | args = args || {}; |
33 | 30 | ||
34 | Clipperz.PM.UI.iPhone.Components.LoginForm.superclass.constructor.apply(this, arguments); | 31 | Clipperz.PM.UI.iPhone.Components.LoginForm.superclass.constructor.apply(this, arguments); |
35 | 32 | ||
36 | return this; | 33 | return this; |
37 | } | 34 | } |
38 | 35 | ||
39 | //============================================================================= | 36 | //============================================================================= |
40 | 37 | ||
41 | Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | 38 | Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { |
42 | 39 | ||
43 | //------------------------------------------------------------------------- | 40 | //------------------------------------------------------------------------- |
44 | 41 | ||
45 | 'toString': function () { | 42 | 'toString': function () { |
46 | return "Clipperz.PM.UI.iPhone.Components.LoginForm component"; | 43 | return "Clipperz.PM.UI.iPhone.Components.LoginForm component"; |
47 | }, | 44 | }, |
48 | 45 | ||
49 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
50 | 47 | ||
51 | 'focusOnUsername': function () { | 48 | 'focusOnUsername': function () { |
52 | this.getElement('username').focus(); | 49 | this.getElement('username').focus(); |
53 | }, | 50 | }, |
54 | 51 | ||
55 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
56 | 53 | ||
57 | 'username': function () { | 54 | 'username': function () { |
58 | return this.getElement('username').value; | 55 | return this.getElement('username').value; |
59 | }, | 56 | }, |
60 | 57 | ||
61 | 'passphrase': function () { | 58 | 'passphrase': function () { |
62 | return this.getElement('passphrase').value; | 59 | return this.getElement('passphrase').value; |
63 | }, | 60 | }, |
64 | 61 | ||
65 | //------------------------------------------------------------------------- | 62 | //------------------------------------------------------------------------- |
66 | 63 | ||
67 | 'renderSelf': function(/*aContainer, aPosition*/) { | 64 | 'renderSelf': function(/*aContainer, aPosition*/) { |
68 | this.append(this.element(), [ | 65 | this.append(this.element(), [ |
69 | {tag:'div', cls:'toolbar iPhoneClipperzToolbar', children:[ | 66 | {tag:'div', cls:'toolbar iPhoneClipperzToolbar', children:[ |
70 | {tag:'h1', id:'pageTitle', html:'Clipperz'}, | 67 | {tag:'h1', id:'pageTitle', html:'Clipperz'}, |
71 | {tag:'a', id:'backButton', cls:'button', href:'#', html:"back"} | 68 | {tag:'a', id:'backButton', cls:'button', href:'#', html:"back"} |
72 | ]}, | 69 | ]}, |
73 | {tag:'form', title:'Theaters', cls:'panel toolbarlessPanel loginForm', id:this.getId('loginFormPanel'), children:[ | 70 | {tag:'form', title:'Theaters', cls:'panel toolbarlessPanel loginForm', id:this.getId('loginFormPanel'), children:[ |
74 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | 71 | {tag:'fieldset', id:this.getId('fieldset'), children:[ |
75 | {tag:'div', cls:'row', children:[ | 72 | {tag:'div', cls:'row', children:[ |
76 | {tag:'label', html:"username"}, | 73 | {tag:'label', html:"username"}, |
77 | {tag:'input', type:'text', name:'username', value:"", autocorrect:'off', autocapitalize:'off', id:this.getId('username')} | 74 | {tag:'input', type:'text', name:'username', value:"", autocorrect:'off', autocapitalize:'off', id:this.getId('username')} |
78 | ]}, | 75 | ]}, |
79 | {tag:'div', cls:'row', children:[ | 76 | {tag:'div', cls:'row', children:[ |
80 | {tag:'label', html:"passphrase"}, | 77 | {tag:'label', html:"passphrase"}, |
81 | {tag:'input', type:'password', name:'passphrase', value:"", id:this.getId('passphrase')} | 78 | {tag:'input', type:'password', name:'passphrase', value:"", id:this.getId('passphrase')} |
82 | ]} | 79 | ]} |
83 | ]}, | 80 | ]}, |
84 | {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Login", id:this.getId('submit')} | 81 | {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Login", id:this.getId('submit')} |
85 | ]}, | 82 | ]}, |
86 | {tag:'div', cls:'panel toolbarlessPanel loginProgressPanel', id:this.getId('loginProgressPanel'), children:[ | 83 | {tag:'div', cls:'panel toolbarlessPanel loginProgressPanel', id:this.getId('loginProgressPanel'), children:[ |
87 | {tag:'div', id:this.getId('progressBar')} //, | 84 | {tag:'div', id:this.getId('progressBar')} //, |
88 | // {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Cancel", id:this.getId('cancel')} | 85 | // {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Cancel", id:this.getId('cancel')} |
89 | ]}, | 86 | ]}, |
90 | {tag:'div', cls:'panel loginErrorPanel', id:this.getId('loginErrorPanel'), children:[ | 87 | {tag:'div', cls:'panel loginErrorPanel', id:this.getId('loginErrorPanel'), children:[ |
91 | {tag:'div', cls:'errorMessage', id:this.getId('errorMessageBox'), children:[ | 88 | {tag:'div', cls:'errorMessage', id:this.getId('errorMessageBox'), children:[ |
92 | {tag:'h2', id:this.getId('errorMessage'), html:"Login failed"} | 89 | {tag:'h2', id:this.getId('errorMessage'), html:"Login failed"} |
93 | ]} | 90 | ]} |
94 | ]} | 91 | ]} |
95 | ]); | 92 | ]); |
96 | 93 | ||
97 | MochiKit.Signal.connect(this.getElement('submit'), 'onclick',this, 'submitHandler'); | 94 | MochiKit.Signal.connect(this.getElement('submit'), 'onclick',this, 'submitHandler'); |
98 | MochiKit.Signal.connect(this.getElement('loginFormPanel'), 'onsubmit',this, 'submitHandler'); | 95 | MochiKit.Signal.connect(this.getElement('loginFormPanel'), 'onsubmit',this, 'submitHandler'); |
99 | 96 | ||
100 | // MochiKit.Signal.connect(this.getElement('cancel'), 'onclick',this, 'cancelHandler'); | 97 | // MochiKit.Signal.connect(this.getElement('cancel'), 'onclick',this, 'cancelHandler'); |
101 | MochiKit.Signal.connect('backButton', 'onclick',this, 'backHandler'); | 98 | MochiKit.Signal.connect('backButton', 'onclick',this, 'backHandler'); |
102 | 99 | ||
103 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | 100 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); |
104 | 101 | ||
105 | // MochiKit.Style.hideElement(this.getElement('errorMessage')); | 102 | // MochiKit.Style.hideElement(this.getElement('errorMessage')); |
106 | 103 | ||
107 | this.showLoginForm(); | 104 | this.showLoginForm(); |
108 | // MochiKit.Async.callLater(0.2, MochiKit.Base.method(this, 'focusOnUsername')); | 105 | // MochiKit.Async.callLater(0.2, MochiKit.Base.method(this, 'focusOnUsername')); |
109 | }, | 106 | }, |
110 | 107 | ||
111 | //------------------------------------------------------------------------- | 108 | //------------------------------------------------------------------------- |
112 | 109 | ||
113 | 'showLoginForm': function () { | 110 | 'showLoginForm': function () { |
114 | MochiKit.Style.showElement(this.getElement('loginFormPanel')); | 111 | MochiKit.Style.showElement(this.getElement('loginFormPanel')); |
115 | MochiKit.Style.hideElement(this.getElement('loginProgressPanel')); | 112 | MochiKit.Style.hideElement(this.getElement('loginProgressPanel')); |
116 | MochiKit.Style.hideElement(this.getElement('loginErrorPanel')); | 113 | MochiKit.Style.hideElement(this.getElement('loginErrorPanel')); |
117 | MochiKit.Style.hideElement('backButton'); | 114 | MochiKit.Style.hideElement('backButton'); |
118 | }, | 115 | }, |
119 | 116 | ||
120 | 'slideInLoginForm': function () { | 117 | 'slideInLoginForm': function () { |
121 | varoffset; | 118 | varoffset; |
122 | 119 | ||
123 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | 120 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); |
124 | 121 | ||
125 | MochiKit.Style.showElement(this.getElement('loginFormPanel')); | 122 | MochiKit.Style.showElement(this.getElement('loginFormPanel')); |
126 | MochiKit.Style.setElementPosition(this.getElement('loginFormPanel'), {x:-offset, y:0}); | 123 | MochiKit.Style.setElementPosition(this.getElement('loginFormPanel'), {x:-offset, y:0}); |
127 | 124 | ||
128 | new MochiKit.Visual.Sequence([ | 125 | new MochiKit.Visual.Sequence([ |
129 | new MochiKit.Visual.Parallel([ | 126 | new MochiKit.Visual.Parallel([ |
130 | new MochiKit.Visual.Move(this.getElement('loginErrorPanel'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 127 | new MochiKit.Visual.Move(this.getElement('loginErrorPanel'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
131 | new MochiKit.Visual.Move(this.getElement('loginFormPanel'), {x:0, y:0, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), | 128 | new MochiKit.Visual.Move(this.getElement('loginFormPanel'), {x:0, y:0, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), |
132 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | 129 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) |
133 | ], {duration:0.5, sync:true}), | 130 | ], {duration:0.5, sync:true}), |
134 | MochiKit.Visual.fade(this.getElement('loginErrorPanel'), {duration:0, sync:true}) | 131 | MochiKit.Visual.fade(this.getElement('loginErrorPanel'), {duration:0, sync:true}) |
135 | ], {}) | 132 | ], {}) |
136 | }, | 133 | }, |
137 | 134 | ||
138 | 'showLoginProgress': function () { | 135 | 'showLoginProgress': function () { |
139 | MochiKit.Style.hideElement(this.getElement('loginFormPanel')); | 136 | MochiKit.Style.hideElement(this.getElement('loginFormPanel')); |
140 | MochiKit.Style.showElement(this.getElement('loginProgressPanel')); | 137 | MochiKit.Style.showElement(this.getElement('loginProgressPanel')); |
141 | }, | 138 | }, |
142 | 139 | ||
143 | 'showLoginError': function (anError) { | 140 | 'showLoginError': function (anError) { |
144 | this.getElement('errorMessage').innerHTML = "Login error"; | 141 | this.getElement('errorMessage').innerHTML = "Login error"; |
145 | 142 | ||
146 | MochiKit.Style.showElement('backButton'); | 143 | MochiKit.Style.showElement('backButton'); |
147 | MochiKit.Style.hideElement(this.getElement('loginProgressPanel')); | 144 | MochiKit.Style.hideElement(this.getElement('loginProgressPanel')); |
148 | MochiKit.Style.showElement(this.getElement('loginErrorPanel')); | 145 | MochiKit.Style.showElement(this.getElement('loginErrorPanel')); |
149 | MochiKit.Style.setElementPosition(this.getElement('loginErrorPanel'), {x:0, y:45}); | 146 | MochiKit.Style.setElementPosition(this.getElement('loginErrorPanel'), {x:0, y:45}); |
150 | }, | 147 | }, |
151 | 148 | ||
152 | //------------------------------------------------------------------------- | 149 | //------------------------------------------------------------------------- |
153 | /* | 150 | /* |
154 | 'disableCancelButton': function () { | 151 | 'disableCancelButton': function () { |
155 | MochiKit.DOM.hideElement(this.getElement('cancel')); | 152 | MochiKit.DOM.hideElement(this.getElement('cancel')); |
156 | }, | 153 | }, |
157 | */ | 154 | */ |
158 | //------------------------------------------------------------------------- | 155 | //------------------------------------------------------------------------- |
159 | 156 | ||
160 | 'submitHandler': function (anEvent) { | 157 | 'submitHandler': function (anEvent) { |
161 | anEvent.preventDefault(); | 158 | anEvent.preventDefault(); |
162 | 159 | ||
163 | MochiKit.Signal.signal(this, 'doLogin', {'username':this.username(), 'passphrase':this.passphrase()}); | 160 | MochiKit.Signal.signal(this, 'doLogin', {'username':this.username(), 'passphrase':this.passphrase()}); |
164 | }, | 161 | }, |
165 | 162 | ||
166 | 'cancelHandler': function (anEvent) { | 163 | 'cancelHandler': function (anEvent) { |
167 | anEvent.preventDefault(); | 164 | anEvent.preventDefault(); |
168 | 165 | ||
169 | //console.log("CANCEL"); | 166 | //console.log("CANCEL"); |
170 | }, | 167 | }, |
171 | 168 | ||
172 | 'backHandler': function (anEvent) { | 169 | 'backHandler': function (anEvent) { |
173 | anEvent.preventDefault(); | 170 | anEvent.preventDefault(); |
174 | 171 | ||
175 | this.slideInLoginForm(); | 172 | this.slideInLoginForm(); |
176 | }, | 173 | }, |
177 | 174 | ||
178 | //------------------------------------------------------------------------- | 175 | //------------------------------------------------------------------------- |
179 | 176 | ||
180 | __syntaxFix__: "syntax fix" | 177 | __syntaxFix__: "syntax fix" |
181 | }); | 178 | }); |