Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Mobile') (more/less context) (ignore whitespace changes)
4 files changed, 1302 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js new file mode 100644 index 0000000..32dfa63 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js | |||
@@ -0,0 +1,299 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | Clipperz.PM.UI.Mobile.Components.CardDetail.superclass.constructor.apply(this, arguments); | ||
32 | |||
33 | //this._cardReference = null; | ||
34 | |||
35 | return this; | ||
36 | } | ||
37 | |||
38 | //============================================================================= | ||
39 | |||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
41 | |||
42 | //------------------------------------------------------------------------- | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.Mobile.Components.CardDetail component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | /* | ||
50 | 'cardReference': function () { | ||
51 | return this._cardReference; | ||
52 | }, | ||
53 | |||
54 | 'setCardReference': function (aValue) { | ||
55 | this._cardReference = aValue; | ||
56 | }, | ||
57 | */ | ||
58 | //------------------------------------------------------------------------- | ||
59 | |||
60 | 'renderSelf': function () { | ||
61 | console.log("CardDetail.renderSelf"); | ||
62 | this.append(this.element(), {tag:'div', cls:'cardDetail', children:[ | ||
63 | {tag:'div', cls:'toolbar', children:[ | ||
64 | {tag:'a', href:'#', cls:'back', html:"List"}, | ||
65 | {tag:'h1', id:this.getId('cardTitle'), html:"…"} | ||
66 | ]}, | ||
67 | {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[ | ||
68 | ]} | ||
69 | ]}); | ||
70 | }, | ||
71 | /* | ||
72 | 'renderSelf': function() { | ||
73 | this.append(this.element(), [ | ||
74 | {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[ | ||
75 | {tag:'div', id:this.getId('progressBar')} //, | ||
76 | ]} | ||
77 | ]); | ||
78 | |||
79 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | ||
80 | MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0); | ||
81 | }, | ||
82 | */ | ||
83 | |||
84 | 'setTitle': function (aValue) { | ||
85 | this.getElement('cardTitle').innerHTML = aValue; | ||
86 | }, | ||
87 | |||
88 | 'fieldListElement': function () { | ||
89 | varresult; | ||
90 | |||
91 | result = this.getElement('fieldList'); | ||
92 | if (result == null) { | ||
93 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('fieldList')}); | ||
94 | } | ||
95 | |||
96 | return result; | ||
97 | }, | ||
98 | |||
99 | 'renderFieldValues': function (someFieldValues) { | ||
100 | varfieldClass; | ||
101 | |||
102 | if ((someFieldValues['actionType'] != 'NONE') || (someFieldValues['label'] != '') && (someFieldValues['value'] != '')) { | ||
103 | if (someFieldValues['isHidden'] == true) { | ||
104 | fieldClass = 'password'; | ||
105 | } else { | ||
106 | fieldClass = ''; | ||
107 | } | ||
108 | |||
109 | this.append(this.fieldListElement(), {tag:'li', cls:'cardField', children:[ | ||
110 | {tag:'a', href:'#', cls:fieldClass, html:someFieldValues['value'], children:[ | ||
111 | {tag:'small', cls:'label', html:someFieldValues['label']} | ||
112 | ]} | ||
113 | ]}) | ||
114 | } | ||
115 | }, | ||
116 | |||
117 | 'addField': function (aField) { | ||
118 | var deferredResult; | ||
119 | varfieldValues; | ||
120 | |||
121 | fieldValues = {}; | ||
122 | deferredResult = new Clipperz.Async.Deferred("CardDetail.addField", {trace:false}); | ||
123 | deferredResult.addMethod(aField, 'label'); | ||
124 | deferredResult.addCallback(function (aValue) { fieldValues['label'] = aValue; }); | ||
125 | deferredResult.addMethod(aField, 'value'); | ||
126 | deferredResult.addCallback(function (aValue) { fieldValues['value'] = aValue; }); | ||
127 | deferredResult.addMethod(aField, 'actionType'); | ||
128 | deferredResult.addCallback(function (aValue) { fieldValues['actionType'] = aValue; }); | ||
129 | deferredResult.addMethod(aField, 'isHidden'); | ||
130 | deferredResult.addCallback(function (aValue) { fieldValues['isHidden'] = aValue; }); | ||
131 | deferredResult.addMethod(this, 'renderFieldValues', fieldValues); | ||
132 | deferredResult.callback(); | ||
133 | |||
134 | return deferredResult; | ||
135 | }, | ||
136 | |||
137 | //------------------------------------------------------------------------- | ||
138 | |||
139 | 'directLoginElement': function () { | ||
140 | varresult; | ||
141 | |||
142 | result = this.getElement('directLoginList'); | ||
143 | if (result == null) { | ||
144 | this.append(this.getElement('cardDetails'), {tag:'h2', html:"Direct login"}); | ||
145 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('directLoginList')}); | ||
146 | } | ||
147 | |||
148 | return result; | ||
149 | }, | ||
150 | |||
151 | 'addDirectLogin': function (aDirectLogin) { | ||
152 | this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[ | ||
153 | {tag:'a', href:'#', html:"direct login", children:[ | ||
154 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]} | ||
155 | ]} | ||
156 | ]}) | ||
157 | |||
158 | console.log("ADD DIRECT LOGIN", aDirectLogin); | ||
159 | }, | ||
160 | |||
161 | //========================================================================= | ||
162 | |||
163 | 'showCard': function (aCard) { | ||
164 | var deferredResult; | ||
165 | |||
166 | // this.render(); | ||
167 | |||
168 | console.log("CardDetail.showCard", aCard); | ||
169 | deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false}); | ||
170 | deferredResult.addMethod(aCard, 'label'); | ||
171 | deferredResult.addMethod(this, 'setTitle'); | ||
172 | |||
173 | deferredResult.addMethod(aCard, 'fields'); | ||
174 | deferredResult.addCallback(MochiKit.Base.values); | ||
175 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField')); | ||
176 | |||
177 | deferredResult.addMethod(aCard, 'directLogins'); | ||
178 | deferredResult.addCallback(MochiKit.Base.values); | ||
179 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addDirectLogin')); | ||
180 | |||
181 | |||
182 | deferredResult.callback(); | ||
183 | |||
184 | return deferredResult; | ||
185 | // return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [ | ||
186 | // MochiKit.Base.method(this.record(), 'hasPendingChanges'), | ||
187 | // MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'), | ||
188 | // | ||
189 | // MochiKit.Base.method(this.record(), 'label'), | ||
190 | // MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'), | ||
191 | // MochiKit.Base.method(this.record(), 'notes'), | ||
192 | // MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'), | ||
193 | // | ||
194 | // MochiKit.Base.method(this.record(), 'fields'), | ||
195 | // MochiKit.Base.values, | ||
196 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithField')), | ||
197 | // | ||
198 | // MochiKit.Base.method(this.record(), 'directLogins'), | ||
199 | // MochiKit.Base.values, | ||
200 | // MochiKit.Base.partial(MochiKit.Base.map, MochiKit.Base.method(this, 'addCardDialogComponentWithDirectLogin')), | ||
201 | // | ||
202 | // MochiKit.Base.method(this.cardDialogComponent(), 'resetNewFieldInputs'), | ||
203 | // MochiKit.Base.noop | ||
204 | // ], {trace:false}); | ||
205 | |||
206 | }, | ||
207 | |||
208 | //========================================================================= | ||
209 | |||
210 | 'showCardDetails': function (someData) { | ||
211 | this.element().innerHTML = ''; | ||
212 | this.append(this.element(), [ | ||
213 | {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) { | ||
214 | return {tag:'div', cls:'row', children:[ | ||
215 | {tag:'label', html:aFieldData['label']}, | ||
216 | // {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), html:aFieldData['value']} | ||
217 | {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), children:[ | ||
218 | {tag:'div', children:[{tag:'p', html:aFieldData['value']}]} | ||
219 | ]} | ||
220 | // {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), value:aFieldData['value'], disabled:true} | ||
221 | |||
222 | ]} | ||
223 | }, someData['fields'])} | ||
224 | ]); | ||
225 | |||
226 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) { | ||
227 | MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); }) | ||
228 | }, this)); | ||
229 | |||
230 | if (someData['directLogins'].length > 0) { | ||
231 | this.append(this.element(), [ | ||
232 | {tag:'h2', html:"Direct logins"}, | ||
233 | {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) { | ||
234 | return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[ | ||
235 | {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']}, | ||
236 | // {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']} | ||
237 | {tag:'span', cls:'directLogin', html:aDirectLoginData['label']} | ||
238 | ]} | ||
239 | }, someData['directLogins'])} | ||
240 | ]); | ||
241 | |||
242 | MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) { | ||
243 | MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler'); | ||
244 | }, this), | ||
245 | MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row']) | ||
246 | ) | ||
247 | }; | ||
248 | |||
249 | if (someData['notes'] != '') { | ||
250 | this.append(this.element(), [ | ||
251 | {tag:'h2', html:"Notes"}, | ||
252 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | ||
253 | {tag:'div', cls:'row notes', children:[ | ||
254 | {tag:'span', html:someData['notes']} | ||
255 | ]} | ||
256 | ]} | ||
257 | ]); | ||
258 | }; | ||
259 | |||
260 | return true; | ||
261 | }, | ||
262 | |||
263 | //------------------------------------------------------------------------- | ||
264 | /* | ||
265 | 'toggleClickHandler': function (anEvent) { | ||
266 | varnextState; | ||
267 | varfieldValue; | ||
268 | |||
269 | //console.log("TOGGLE"); | ||
270 | anEvent.preventDefault; | ||
271 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; | ||
272 | |||
273 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); | ||
274 | if (nextState) { | ||
275 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); | ||
276 | } else { | ||
277 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); | ||
278 | } | ||
279 | |||
280 | MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState); | ||
281 | }, | ||
282 | * / | ||
283 | //========================================================================= | ||
284 | /* | ||
285 | 'directLoginClickHandler': function (anEvent) { | ||
286 | anEvent.preventDefault(); | ||
287 | |||
288 | if (/(directLogin_)/.test(anEvent.src().id)) { | ||
289 | var directLoginReference; | ||
290 | |||
291 | directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2]; | ||
292 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference}); | ||
293 | } | ||
294 | }, | ||
295 | */ | ||
296 | //========================================================================= | ||
297 | |||
298 | __syntaxFix__: "syntax fix" | ||
299 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js new file mode 100644 index 0000000..a4aa212 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js | |||
@@ -0,0 +1,254 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.Mobile.Components.CardList = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments); | ||
32 | |||
33 | this._cardDetail = null; | ||
34 | |||
35 | return this; | ||
36 | } | ||
37 | |||
38 | //============================================================================= | ||
39 | |||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
41 | |||
42 | //------------------------------------------------------------------------- | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.Mobile.Components.CardList component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'renderSelf': function () { | ||
51 | this.append(this.element(), {tag:'div', cls:'cardList', children:[ | ||
52 | {tag:'div', cls:'toolbar', children:[ | ||
53 | {tag:'h1', html:"clipperz"}, | ||
54 | // {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')}, | ||
55 | {tag:'a', href:'#', id:'settings', cls:'button', html:"*"} | ||
56 | ]}, | ||
57 | {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[ | ||
58 | {tag:'ul', cls:'rounded', id:this.getId('list'), children:[ | ||
59 | {tag:'li', html:'loading'} | ||
60 | ]} | ||
61 | ]} | ||
62 | ]}); | ||
63 | |||
64 | MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler'); | ||
65 | MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart',this, 'cardSelectionHandler'); | ||
66 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler'); | ||
67 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler'); | ||
68 | // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler'); | ||
69 | |||
70 | // MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler'); | ||
71 | // MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler'); | ||
72 | |||
73 | // MochiKit.Style.hideElement('backButton'); | ||
74 | // MochiKit.Style.hideElement(this.getElement('cardDetail')); | ||
75 | }, | ||
76 | |||
77 | 'showCards': function (someCards) { | ||
78 | varcardListElement; | ||
79 | if (this.isFullyRendered() == false) { | ||
80 | this.render(); | ||
81 | }; | ||
82 | |||
83 | cardListElement = this.getElement('list') | ||
84 | |||
85 | cardInfo = { | ||
86 | '_rowObject': MochiKit.Async.succeed, | ||
87 | '_reference': MochiKit.Base.methodcaller('reference'), | ||
88 | '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), | ||
89 | 'label': MochiKit.Base.methodcaller('label'), | ||
90 | 'favicon': MochiKit.Base.methodcaller('favicon') | ||
91 | }; | ||
92 | |||
93 | //console.log("someCards", someCards); | ||
94 | deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); | ||
95 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); | ||
96 | deferredResult.addCallback(Clipperz.Async.collectAll); | ||
97 | deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); | ||
98 | deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); | ||
99 | // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); | ||
100 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); | ||
101 | deferredResult.callback(someCards); | ||
102 | }, | ||
103 | |||
104 | 'appendCardToList': function (aCardListElement, aCardInfo) { | ||
105 | //console.log("appendCardToList", aCardInfo); | ||
106 | this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ | ||
107 | {tag:'a', href:'#', html:aCardInfo['label'], children:[ | ||
108 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} | ||
109 | ]} | ||
110 | ]}); | ||
111 | }, | ||
112 | |||
113 | 'cardSelectionHandler': function (anEvent) { | ||
114 | var listElement; | ||
115 | varcardReference; | ||
116 | |||
117 | anEvent.preventDefault(); | ||
118 | |||
119 | listElement = anEvent.target(); | ||
120 | if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { | ||
121 | listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); | ||
122 | } | ||
123 | cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); | ||
124 | console.log("###", listElement, cardReference); | ||
125 | //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected | ||
126 | MochiKit.Signal.signal(this, 'selectedCard', cardReference); | ||
127 | }, | ||
128 | |||
129 | //------------------------------------------------------------------------- | ||
130 | /* | ||
131 | 'searchHandler': function (anEvent) { | ||
132 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN | ||
133 | anEvent.preventDefault(); | ||
134 | } else { | ||
135 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { | ||
136 | anEvent.target().value = ""; | ||
137 | } | ||
138 | |||
139 | if (anEvent.type() == 'keyup') { | ||
140 | MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value); | ||
141 | } | ||
142 | } | ||
143 | }, | ||
144 | |||
145 | //------------------------------------------------------------------------- | ||
146 | |||
147 | 'update': function (someObjects) { | ||
148 | varcardListPanel; | ||
149 | var i,c; | ||
150 | |||
151 | cardListPanel = this.getElement('cardListPanel'); | ||
152 | cardListPanel.innerHTML = ''; | ||
153 | |||
154 | c = someObjects.length; | ||
155 | |||
156 | for (i=0; i<c; i++) { | ||
157 | this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[ | ||
158 | {tag:'img', src:(someObjects[i]['favicon'] ? someObjects[i]['favicon'] : 'data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=')}, | ||
159 | {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']} | ||
160 | ]}) | ||
161 | |||
162 | MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler'); | ||
163 | } | ||
164 | |||
165 | }, | ||
166 | |||
167 | 'cardListClickHandler': function (anEvent) { | ||
168 | anEvent.preventDefault(); | ||
169 | |||
170 | if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { | ||
171 | var cardListReference; | ||
172 | |||
173 | cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; | ||
174 | //console.log("Showing detail for card named", cardListReference); | ||
175 | MochiKit.Signal.signal(this, 'selectedCard', cardListReference); | ||
176 | } | ||
177 | }, | ||
178 | |||
179 | //========================================================================= | ||
180 | |||
181 | 'cardDetail': function (someData) { | ||
182 | if (this._cardDetail == null) { | ||
183 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:this.getElement('cardDetail')}); | ||
184 | } | ||
185 | |||
186 | return this._cardDetail; | ||
187 | }, | ||
188 | |||
189 | //------------------------------------------------------------------------- | ||
190 | |||
191 | 'removeCardDetail': function () { | ||
192 | if (this._cardDetail != null) { | ||
193 | this._cardDetail.remove(); | ||
194 | this._cardDetail = null; | ||
195 | } | ||
196 | }, | ||
197 | |||
198 | //========================================================================= | ||
199 | |||
200 | 'showCard': function (someData) { | ||
201 | vardeferredResult; | ||
202 | varoffset; | ||
203 | |||
204 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | ||
205 | this.cardDetail().render(); | ||
206 | this.cardDetail().setCardReference(someData['_reference']); | ||
207 | MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset}); | ||
208 | new MochiKit.Visual.Sequence([ | ||
209 | // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}), | ||
210 | new MochiKit.Visual.Parallel([ | ||
211 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
212 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
213 | // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}), | ||
214 | MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | ||
215 | ], {duration:1, sync:true}), | ||
216 | MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true}) | ||
217 | ], {}) | ||
218 | |||
219 | MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title']; | ||
220 | |||
221 | return true; | ||
222 | }, | ||
223 | |||
224 | //------------------------------------------------------------------------- | ||
225 | |||
226 | 'showCardDetails': function (someData) { | ||
227 | return this.cardDetail().showCardDetails(someData); | ||
228 | }, | ||
229 | |||
230 | //========================================================================= | ||
231 | |||
232 | 'backButtonClickHandler': function (anEvent) { | ||
233 | varoffset; | ||
234 | |||
235 | anEvent.preventDefault(); | ||
236 | |||
237 | MochiKit.DOM.getElement('pageTitle').innerHTML = "cards"; | ||
238 | |||
239 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | ||
240 | MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset}); | ||
241 | MochiKit.DOM.showElement(this.getElement('cardList')); | ||
242 | |||
243 | new MochiKit.Visual.Parallel([ | ||
244 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
245 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
246 | MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
247 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | ||
248 | ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')}) | ||
249 | |||
250 | }, | ||
251 | */ | ||
252 | //========================================================================= | ||
253 | __syntaxFix__: "syntax fix" | ||
254 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js new file mode 100644 index 0000000..eafcdbc --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js | |||
@@ -0,0 +1,356 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | this._pin = ''; | ||
32 | |||
33 | this._message = null; | ||
34 | this._steps = 0; | ||
35 | this._actualSteps = 0; | ||
36 | |||
37 | this._callback = null; | ||
38 | this._errorCallback = null; | ||
39 | |||
40 | this._mode = 'CREDENTIALS'; | ||
41 | |||
42 | Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments); | ||
43 | |||
44 | return this; | ||
45 | } | ||
46 | |||
47 | //============================================================================= | ||
48 | |||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
50 | |||
51 | //------------------------------------------------------------------------- | ||
52 | |||
53 | 'toString': function () { | ||
54 | return "Clipperz.PM.UI.Mobile.Components.LoginForm component"; | ||
55 | }, | ||
56 | |||
57 | //------------------------------------------------------------------------- | ||
58 | |||
59 | 'callback': function () { | ||
60 | return this._callback; | ||
61 | }, | ||
62 | |||
63 | 'errorCallback': function () { | ||
64 | return this._errorCallback; | ||
65 | }, | ||
66 | |||
67 | //------------------------------------------------------------------------- | ||
68 | |||
69 | 'mode': function () { | ||
70 | return this._mode; | ||
71 | }, | ||
72 | |||
73 | 'setMode': function (aValue) { | ||
74 | this._mode = aValue; | ||
75 | }, | ||
76 | |||
77 | //.......................................................................... | ||
78 | |||
79 | 'pin': function () { | ||
80 | return this._pin; | ||
81 | }, | ||
82 | |||
83 | 'setPin': function (aValue) { | ||
84 | this._pin = aValue; | ||
85 | }, | ||
86 | |||
87 | //.......................................................................... | ||
88 | |||
89 | 'username': function () { | ||
90 | return this._username; | ||
91 | }, | ||
92 | |||
93 | 'setUsername': function (aValue) { | ||
94 | this._username = aValue; | ||
95 | }, | ||
96 | |||
97 | //.......................................................................... | ||
98 | |||
99 | 'passphrase': function () { | ||
100 | return this._passphrase; | ||
101 | }, | ||
102 | |||
103 | 'setPassphrase': function (aValue) { | ||
104 | this._passphrase = aValue; | ||
105 | }, | ||
106 | |||
107 | //------------------------------------------------------------------------- | ||
108 | |||
109 | 'message': function () { | ||
110 | return this._message; | ||
111 | }, | ||
112 | |||
113 | '_setMessage': function (aValue) { | ||
114 | this._message = aValue; | ||
115 | |||
116 | if (aValue == null) { | ||
117 | MochiKit.Style.hideElement(this.getElement('credentialsMessage')); | ||
118 | } else { | ||
119 | this.getElement('message').innerHTML = aValue; | ||
120 | MochiKit.Style.showElement(this.getElement('credentialsMessage')); | ||
121 | } | ||
122 | }, | ||
123 | |||
124 | 'setMessage': function (aValue) { | ||
125 | this._setMessage(aValue); | ||
126 | MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error'); | ||
127 | }, | ||
128 | |||
129 | 'setErrorMessage': function (aValue) { | ||
130 | this._setMessage(aValue); | ||
131 | MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error'); | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | |||
136 | 'setCallbacks': function (args) { | ||
137 | this._callback = args['callback']; | ||
138 | this._errorCallback = args['errorCallback']; | ||
139 | }, | ||
140 | |||
141 | 'showErrors': function (args) { | ||
142 | //console.log("LoginForm.showErrors", args); | ||
143 | if (args['previousFailedAttempt'] == 'LOGIN') { | ||
144 | this.setErrorMessage("Wrong credentials"); | ||
145 | } else if (args['previousFailedAttempt'] == 'PIN') { | ||
146 | if (args['failedAttempts'] == -1) { | ||
147 | this.setErrorMessage("Wrong PIN - Resetted"); | ||
148 | } else { | ||
149 | this.setErrorMessage("Wrong PIN"); | ||
150 | } | ||
151 | } else { | ||
152 | this.setMessage(null); | ||
153 | } | ||
154 | }, | ||
155 | |||
156 | 'updateWithArgs': function (args) { | ||
157 | this.renderIfNeeded(); | ||
158 | this.setCallbacks(args); | ||
159 | this.showErrors(args); | ||
160 | this.updateRendering(); | ||
161 | }, | ||
162 | |||
163 | 'showPinLogin': function (args) { | ||
164 | this.setPin(''); | ||
165 | this.setMode('PIN'); | ||
166 | this.updateWithArgs(args); | ||
167 | |||
168 | // $(this.getAnchor('PIN')).focus(); | ||
169 | this.getElement('PIN').focus(); | ||
170 | }, | ||
171 | |||
172 | 'showCredentialsLogin': function (args) { | ||
173 | this.setMode('CREDENTIALS'); | ||
174 | this.updateWithArgs(args); | ||
175 | |||
176 | if (this.getElement('usernameField').value.length == 0) { | ||
177 | // $(this.getAnchor('usernameField')).focus(); | ||
178 | this.getElement('usernameField').focus(); | ||
179 | } else { | ||
180 | // $(this.getAnchor('passphraseField')).focus(); | ||
181 | this.getElement('passphraseField').focus(); | ||
182 | this.getElement('passphraseField').select(); | ||
183 | } | ||
184 | }, | ||
185 | |||
186 | //------------------------------------------------------------------------- | ||
187 | |||
188 | 'renderIfNeeded': function () { | ||
189 | if (this.isFullyRendered() == false) { | ||
190 | this.render(); | ||
191 | }; | ||
192 | this.updateRendering(); | ||
193 | }, | ||
194 | |||
195 | 'updateRendering': function () { | ||
196 | MochiKit.Style.showElement(this.getElement('credentialsBody')); | ||
197 | MochiKit.Style.hideElement(this.getElement('validating')); | ||
198 | |||
199 | // this.hideAllPanes(); | ||
200 | MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div')); | ||
201 | if (this.mode() == 'CREDENTIALS') { | ||
202 | selectedPanel = this.getElement('credentials') | ||
203 | } else if (this.mode() == 'PIN') { | ||
204 | selectedPanel = this.getElement('pin') | ||
205 | // this.updatePinDisplay(); | ||
206 | } else { | ||
207 | throw 'Unhandled login form mode'; | ||
208 | } | ||
209 | MochiKit.Style.showElement(selectedPanel); | ||
210 | |||
211 | MochiKit.Style.hideElement(this.getElement('validating')); | ||
212 | }, | ||
213 | |||
214 | 'renderSelf': function() { | ||
215 | var selectedPanel; | ||
216 | this.append(this.element(), {tag:'div', id:'login', children:[ | ||
217 | {tag:'div', cls:'toolbar', children:[ | ||
218 | {tag:'h1', html:"clipperz"} | ||
219 | ]}, | ||
220 | {tag:'div', cls:'scroll', children:[ | ||
221 | //================================================================== | ||
222 | {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[ | ||
223 | {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"} | ||
224 | ]}, | ||
225 | //================================================================== | ||
226 | {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[ | ||
227 | //-------------------------------------------------------------- | ||
228 | {tag:'div', cls:'pin', id:this.getId('pin'), children:[ | ||
229 | {tag:'form', cls:'scroll', id:this.getId('pinForm'), children:[ | ||
230 | {tag:'ul', cls:'edit rounded', children:[ | ||
231 | {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]}, | ||
232 | ]}, | ||
233 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"} | ||
234 | ]} | ||
235 | ]}, | ||
236 | //-------------------------------------------------------------- | ||
237 | {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[ | ||
238 | {tag:'form', cls:'scroll', id:this.getId('credentialsForm'), children:[ | ||
239 | {tag:'ul', cls:'edit rounded', children:[ | ||
240 | {tag:'li', children:[{tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') }]}, | ||
241 | {tag:'li', children:[{tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/placeholder:"passphrase", id:this.getId('passphraseField') }]} | ||
242 | ]}, | ||
243 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('credentialsSubmitButton'), html:"Login"} | ||
244 | // {tag:'input', type:'submit', cls:'greenButton', id:this.getId('credentialsSubmitButton'), value:"Login"} | ||
245 | |||
246 | ]} | ||
247 | ]}, | ||
248 | //-------------------------------------------------------------- | ||
249 | ]}, | ||
250 | //================================================================== | ||
251 | {tag:'div', cls:'validating', id:this.getId('validating'), children:[ | ||
252 | {tag:'div', cls:'loading', children:[ | ||
253 | {tag:'div', cls:'spinner', children:[ | ||
254 | {tag:'div', cls:'bar01'}, | ||
255 | {tag:'div', cls:'bar02'}, | ||
256 | {tag:'div', cls:'bar03'}, | ||
257 | {tag:'div', cls:'bar04'}, | ||
258 | {tag:'div', cls:'bar05'}, | ||
259 | {tag:'div', cls:'bar06'}, | ||
260 | {tag:'div', cls:'bar07'}, | ||
261 | {tag:'div', cls:'bar08'}, | ||
262 | {tag:'div', cls:'bar09'}, | ||
263 | {tag:'div', cls:'bar10'}, | ||
264 | {tag:'div', cls:'bar11'}, | ||
265 | {tag:'div', cls:'bar12'} | ||
266 | ]} | ||
267 | ]}, | ||
268 | {tag:'div', id:this.getId('loadingMessage')}, | ||
269 | {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"} | ||
270 | ]} | ||
271 | //================================================================== | ||
272 | ]} | ||
273 | ]}); | ||
274 | |||
275 | MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler'); | ||
276 | MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler'); | ||
277 | |||
278 | MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler'); | ||
279 | MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler'); | ||
280 | |||
281 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); | ||
282 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); | ||
283 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); | ||
284 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); | ||
285 | }, | ||
286 | |||
287 | //------------------------------------------------------------------------- | ||
288 | |||
289 | 'submitPinHandler': function (anEvent) { | ||
290 | varpin; | ||
291 | |||
292 | this.setMessage(null); | ||
293 | pin = this.getElement('PIN').value; | ||
294 | // $(this.getAnchor('PIN')).blur(); | ||
295 | this.getElement('PIN').blur(); | ||
296 | |||
297 | credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); | ||
298 | this.loginWithCredentials(credentials); | ||
299 | }, | ||
300 | |||
301 | 'submitCredentialsHandler': function (anEvent) { | ||
302 | //console.log("submitCredentialsHandler"); | ||
303 | varcredentials; | ||
304 | |||
305 | this.setMessage(null); | ||
306 | |||
307 | credentials = {}; | ||
308 | credentials['username'] = this.getElement('usernameField').value; | ||
309 | credentials['passphrase'] = this.getElement('passphraseField').value; | ||
310 | // $(this.getAnchor('passphraseField')).blur(); | ||
311 | this.getElement('passphraseField').blur(); | ||
312 | |||
313 | this.loginWithCredentials(credentials); | ||
314 | }, | ||
315 | |||
316 | //------------------------------------------------------------------------- | ||
317 | |||
318 | 'loginWithCredentials': function (someCredentials) { | ||
319 | varargs; | ||
320 | |||
321 | args = {}; | ||
322 | args['credentials'] = someCredentials; | ||
323 | args['errorCallback'] = this.errorCallback(); | ||
324 | |||
325 | MochiKit.Style.hideElement(this.getElement('credentialsBody')); | ||
326 | MochiKit.Style.showElement(this.getElement('validating')); | ||
327 | |||
328 | MochiKit.Async.callLater(0.1, this.callback(), args); | ||
329 | }, | ||
330 | |||
331 | //------------------------------------------------------------------------- | ||
332 | |||
333 | 'initProgressHandle': function (anEvent) { | ||
334 | //console.log("** initProgressHandle", anEvent); | ||
335 | this._steps = anEvent['steps']; | ||
336 | this._actualSteps = 0; | ||
337 | }, | ||
338 | |||
339 | 'updateProgressHandle': function (anEvent) { | ||
340 | //console.log("** updateProgressHandle", anEvent); | ||
341 | this._steps += anEvent['extraSteps']; | ||
342 | }, | ||
343 | |||
344 | 'advanceProgressHandle': function (anEvent) { | ||
345 | //console.log("** advanceProgressHandle", anEvent); | ||
346 | this._actualSteps ++; | ||
347 | //console.log("STEPS: " + this._actualSteps + "/" + this._steps); | ||
348 | }, | ||
349 | |||
350 | 'progressDoneHandle': function (anEvent) { | ||
351 | //console.log("** progressDoneHandle", anEvent); | ||
352 | }, | ||
353 | |||
354 | //------------------------------------------------------------------------- | ||
355 | __syntaxFix__: "syntax fix" | ||
356 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js new file mode 100644 index 0000000..12a61f7 --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js | |||
@@ -0,0 +1,393 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers'); | ||
27 | |||
28 | Clipperz.PM.UI.Mobile.Controllers.MainController = function() { | ||
29 | this._jQTouch = null; | ||
30 | this._user = null; | ||
31 | this._proxy = null; | ||
32 | this._loginForm = null; | ||
33 | this._cardList = null; | ||
34 | this._cardDetail= null; | ||
35 | |||
36 | return this; | ||
37 | } | ||
38 | |||
39 | MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, { | ||
40 | |||
41 | 'toString': function () { | ||
42 | return "Clipperz.PM.UI.Mobile.Controllers.MainController"; | ||
43 | }, | ||
44 | |||
45 | //------------------------------------------------------------------------- | ||
46 | |||
47 | 'user': function () { | ||
48 | return this._user; | ||
49 | }, | ||
50 | |||
51 | 'setUser': function (aValue) { | ||
52 | this._user = aValue; | ||
53 | }, | ||
54 | |||
55 | //------------------------------------------------------------------------- | ||
56 | |||
57 | 'jQTouch': function () { | ||
58 | return this._jQTouch; | ||
59 | }, | ||
60 | |||
61 | 'setJQTouch': function (aValue) { | ||
62 | this._jQTouch = aValue; | ||
63 | }, | ||
64 | |||
65 | //========================================================================= | ||
66 | |||
67 | 'run': function () { | ||
68 | console.log("MainController.run"); | ||
69 | |||
70 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin')); | ||
71 | Clipperz.DOM.Helper.overwrite(MochiKit.DOM.currentDocument().body, {tag:'div', id:'jqt', children:[ | ||
72 | {tag:'div', id:'loginForm'}, | ||
73 | {tag:'div', id:'cardList'}, | ||
74 | {tag:'div', id:'cardDetail'}, | ||
75 | {tag:'div', id:'preferences'} | ||
76 | ]}); | ||
77 | |||
78 | this.showLoginForm(); | ||
79 | |||
80 | this.initjQTouch(); | ||
81 | |||
82 | |||
83 | // this.showAddToHomeScreenBaloon(); | ||
84 | // this.selectInitialProxy(); | ||
85 | }, | ||
86 | |||
87 | 'initjQTouch': function () { | ||
88 | var jqt; | ||
89 | |||
90 | jqt = new $.jQTouch({ | ||
91 | icon: 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAIAAAAAvxIqAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAKJGNVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4A4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcLgIuxoVH1sNfIcHeNwfa6/9zdVappwMknkJsVz19HvFpgJSpO64PIN5G+fAp30Hc8TziHS4miFhheJbjLMMzHB8POFPqKGKWi6TXtSriJcT9MzH5bAzzHIK1I08t6hq6zHpRdu2aYdJYuk9Q/881bzZa8Xrx6fLmJo/iu4/VXnfH1BB/rmu5ScQvI77m+BkmfxXxvcZcJY14L0DymZp7pML5yTcW61PvIN6JuGr4halQvmjNlCa4bXJ5zj6qhpxrujeKPYMXEd+q00KR5yNAlWZzrF+Ie+uNsdC/MO4tTOZafhbroyXuR3Df08bLiHsQf+ja6gTPWVimZl7l/oUrjl8OcxDWLbNU5D6JRL2gxkDu16fGuC054OMhclsyXTOOFEL+kmMGs4i5kfNuQ62EnBuam8tzP+Q+tSqhz9SuqpZlvR1EfBiOJTSgYMMM7jpYsAEyqJCHDL4dcFFTAwNMlFDUUpQYiadhDmXteeWAw3HEmA2s15k1RmnP4RHuhBybdBOF7MfnICmSQ2SYjIBM3iRvkcMki9IRcnDTthyLz2Ld2fTzPjTQK+Mdg8y5nkZfFO+se9LQr3/09xZr+5GcaSufeAfAww60mAPx+q8u/bAr8rFCLrx7s+vqEkw8qb+p26n11Aruq6m1iJH6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/a0v7By/WdHU0RlbvWJJI85GkoimGAP5ZG7XLf2nndU//tVu0xjHya24CpPcXcfae+D48cSU5cuWVotuy7RUiR1NXvfQ4+ccp8Izn4phW8a7vcqWldOYfoERgqGqTrnta4/3vrn3ICqUdL8MrsZKFwBnz51/9VBm+oL1cxuMjKt+8zfifE/Fxr6GQl8kmvHNXD9HSP7a57pv/NvtHd3dw82N/SGBy75P/cmW//rA6qv1xAwwSf2fn77z3ttXXBP/FGiccTXW2L1/p5vABCYwgQlMYAL/2fH/AdkCEQl+/Ar/AAAAAElFTkSuQmCCCg==', | ||
92 | // icon4: 'jqtouch4.png', | ||
93 | // startupScreen: null, //Pass a string path to a 320px x 460px startup screen for full screen apps. | ||
94 | statusBar: 'black-translucent', //Styles the status bar when running as a fullscreen app. Other options are `default`, `black`, and `black-translucent`. | ||
95 | // addGlossToIcon: true, //Set to 'false' to prevent automatic glossy button effect on icon. | ||
96 | preloadImages: false, //Pass an array of image paths to load them before page loads. Ex: `['images/link_over.png', 'images/link_select.png']` | ||
97 | fixedViewport: true, //Removes the user's ability to scale the page. Ensures the site behaves more like an application. | ||
98 | // fullScreen: true, //The website will become a fullscreen application when saved to a user's home screen. Set to `false` to disable. | ||
99 | // fullScreenClass: 'fullscreen' //Adds a class to the `<body>` when running in full-screen mode, to allow for easy detection and styling. Set to `false` to disable. | ||
100 | // themeSelectionSelector: '#jqt #themes ul', //??? | ||
101 | |||
102 | // useAnimations: true, //Set to `false` to disable all animations. | ||
103 | // useFastTouch: true, //Removes ~350ms onClick delay when tapping a link (use in conjunction with the .tap() event) **Experimental** | ||
104 | // useTouchScroll: true, //Adds support for iOS5 scrolling. Set to false to disable. **Experimental** | ||
105 | |||
106 | cacheGetRequests: false, //Automatically caches GET requests, so subsequent taps reference the pre-loaded views. (default: true) | ||
107 | |||
108 | // backSelector: '.back, .cancel, .goback', //A CSS selector for back links/buttons. When clicked, the page history goes back one, automatically reversing whichever entrance animation was used. | ||
109 | |||
110 | // cubeSelector: '.cube', //Link selector for a cube animation. | ||
111 | // dissolveSelector: '.dissolve', //Link selector for a dissolve animation. | ||
112 | // fadeSelector: '.fade', //Link selector for a fade animation. | ||
113 | // flipSelector: '.flip', //Link selector for a 3d flip animation. | ||
114 | formSelector: null, //Sets which forms are automatically submitted via Ajax. (default: 'form') | ||
115 | // popSelector: '.pop', //Link selector for a pop animation. (default: '.pop') | ||
116 | // slideSelector: 'body > * > ul li a', //Link selector for the default slide-left transition. By default applies to all links within an unordered list. Accepts any jQuery-capable selector `'li > a, a:not(.dontslide)'`, etc. (default: 'body > * > ul li a') | ||
117 | // slideupSelector: '.slideup', //Link selector for a slide up animation. (default: '.slideup') | ||
118 | // submitSelector: '.submit', //Selector which, when clicked, will submit its parent form (and close keyboard if open). (default: '.submit') | ||
119 | // swapSelector: '.swap', //Link selector for 3d swap animation. (default: '.swap') | ||
120 | // touchSelector: 'a, .touch', //Selector for items which are automatically given expanded touch events. This makes ordinary links more responsive and provides trigger events like `swipe` (default: 'a, .touch') | ||
121 | |||
122 | debug: false | ||
123 | }); | ||
124 | |||
125 | this.setJQTouch(jqt); | ||
126 | }, | ||
127 | |||
128 | //========================================================================= | ||
129 | |||
130 | 'showAddToHomeScreenBaloon': function () { | ||
131 | console.log(">>> showAddToHomeScreenBaloon"); | ||
132 | }, | ||
133 | |||
134 | //------------------------------------------------------------------------- | ||
135 | |||
136 | 'selectInitialProxy': function () { | ||
137 | //console.log(">>> selectInitialProxy"); | ||
138 | if (this.isOnline()) { | ||
139 | //console.log("--- selectInitialProxy: using default proxy"); | ||
140 | this._proxy = Clipperz.PM.Proxy.defaultProxy; | ||
141 | } else { | ||
142 | if (this.hasLocalData()) { | ||
143 | //console.log("--- selectInitialProxy: using local cache proxy"); | ||
144 | this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false}); | ||
145 | } else { | ||
146 | this.showOfflineError(); | ||
147 | } | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | //------------------------------------------------------------------------- | ||
152 | |||
153 | 'showLoginForm': function (args) { | ||
154 | args = args || {}; | ||
155 | |||
156 | args['callback'] = MochiKit.Base.method(this, 'doLogin'); | ||
157 | |||
158 | if (Clipperz.PM.PIN.isSet()) { | ||
159 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedPinLogin'); | ||
160 | this.loginForm().showPinLogin(args); | ||
161 | } else { | ||
162 | args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin'); | ||
163 | this.loginForm().showCredentialsLogin(args); | ||
164 | } | ||
165 | }, | ||
166 | |||
167 | //......................................................................... | ||
168 | |||
169 | 'handleFailedCredentialsLogin': function () { | ||
170 | console.log("LOGIN FAILED"); | ||
171 | this.showLoginForm({'previousFailedAttempt':'LOGIN'}); | ||
172 | }, | ||
173 | |||
174 | //......................................................................... | ||
175 | |||
176 | 'handleFailedPinLogin': function () { | ||
177 | varfailedAttempts; | ||
178 | varstatus; | ||
179 | |||
180 | failedAttempts = Clipperz.PM.PIN.recordFailedAttempt(); | ||
181 | this.showLoginForm({'previousFailedAttempt':'PIN', 'failedAttempts': failedAttempts}); | ||
182 | }, | ||
183 | |||
184 | //------------------------------------------------------------------------- | ||
185 | |||
186 | 'doLogin': function (someArgs) { | ||
187 | var deferredResult; | ||
188 | var credentials; | ||
189 | var errorCallback; | ||
190 | var user; | ||
191 | var getPassphraseDelegate; | ||
192 | |||
193 | //console.log(">>> MainController.doLogin", someArgs); | ||
194 | credentials = someArgs['credentials']; | ||
195 | errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop; | ||
196 | |||
197 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase); | ||
198 | user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate}); | ||
199 | |||
200 | deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false}); | ||
201 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); | ||
202 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | ||
203 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); | ||
204 | deferredResult.addMethod(user, 'login'); | ||
205 | deferredResult.addCallbacks( | ||
206 | MochiKit.Base.method(this, 'processSuccessfulLogin', user), | ||
207 | errorCallback | ||
208 | ); | ||
209 | deferredResult.callback(); | ||
210 | |||
211 | return deferredResult; | ||
212 | }, | ||
213 | |||
214 | //.......................................................................... | ||
215 | |||
216 | 'processSuccessfulLogin': function (aUser) { | ||
217 | var deferredResult; | ||
218 | |||
219 | deferredResult = new Clipperz.Async.Deferred('MainController.processSuccessfulLogin', {trace:false}); | ||
220 | deferredResult.addMethod(Clipperz.PM.PIN, 'resetFailedAttemptCount'); | ||
221 | // deferredResult.addMethod(this, 'removeLoginForm'); | ||
222 | deferredResult.addMethod(this, 'setUser', aUser); | ||
223 | deferredResult.addMethod(this, 'setupApplication'); | ||
224 | deferredResult.addMethod(this, 'runApplication'); | ||
225 | deferredResult.callback(); | ||
226 | |||
227 | return deferredResult; | ||
228 | }, | ||
229 | |||
230 | //------------------------------------------------------------------------- | ||
231 | |||
232 | 'setupApplication': function () { | ||
233 | vardeferredResult; | ||
234 | |||
235 | console.log(">>> setupApplication"); | ||
236 | deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false}); | ||
237 | deferredResult.addMethod(this, 'welcomeFirstTimeUser'); | ||
238 | deferredResult.addMethod(this, 'showPaymentReminder'); | ||
239 | deferredResult.addMethod(this, 'copyDataLocally'); | ||
240 | deferredResult.callback(arguments); | ||
241 | |||
242 | return deferredResult; | ||
243 | }, | ||
244 | |||
245 | |||
246 | //.......................................................................... | ||
247 | |||
248 | 'isFirstTimeUser': function () { | ||
249 | return false; | ||
250 | }, | ||
251 | |||
252 | 'welcomeFirstTimeUser': function () { | ||
253 | vardeferredResult; | ||
254 | |||
255 | deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false}); | ||
256 | |||
257 | if (this.isFirstTimeUser()) { | ||
258 | deferredResult.addCallback(function () { console.log("--> welcome"); }); | ||
259 | } | ||
260 | deferredResult.callback(); | ||
261 | |||
262 | return deferredResult; | ||
263 | }, | ||
264 | |||
265 | //.......................................................................... | ||
266 | |||
267 | 'shouldShowPaymentReminder': function () { | ||
268 | return true; | ||
269 | }, | ||
270 | |||
271 | 'showPaymentReminder': function () { | ||
272 | vardeferredResult; | ||
273 | |||
274 | deferredResult = new Clipperz.Async.Deferred('MainController.showPaymentReminder', {trace:false}); | ||
275 | |||
276 | if (this.shouldShowPaymentReminder()) { | ||
277 | deferredResult.addCallback(function () { console.log("--> payment reminder"); }); | ||
278 | } | ||
279 | deferredResult.callback(); | ||
280 | |||
281 | return deferredResult; | ||
282 | }, | ||
283 | |||
284 | //.......................................................................... | ||
285 | |||
286 | 'canCopyDataLocally': function () { | ||
287 | return false; | ||
288 | }, | ||
289 | |||
290 | 'copyDataLocally': function () { | ||
291 | vardeferredResult; | ||
292 | |||
293 | deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false}); | ||
294 | |||
295 | if (this.canCopyDataLocally()) { | ||
296 | deferredResult.addCallback(function () { console.log("--> copy data locally"); }); | ||
297 | } | ||
298 | deferredResult.callback(); | ||
299 | |||
300 | return deferredResult; | ||
301 | |||
302 | }, | ||
303 | |||
304 | //------------------------------------------------------------------------- | ||
305 | |||
306 | 'runApplication': function () { | ||
307 | var deferredResult; | ||
308 | |||
309 | //console.log(">>> runApplication"); | ||
310 | deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:true}); | ||
311 | deferredResult.addMethod(this.user(), 'getRecords'); | ||
312 | deferredResult.addMethod(this, 'showCards'); | ||
313 | deferredResult.callback(); | ||
314 | |||
315 | return deferredResult; | ||
316 | }, | ||
317 | |||
318 | //========================================================================= | ||
319 | |||
320 | 'showOfflineError': function (anException) { | ||
321 | alert("Error: " + anException); | ||
322 | throw anException; | ||
323 | }, | ||
324 | |||
325 | //========================================================================= | ||
326 | |||
327 | 'isOnline': function() { | ||
328 | return navigator.onLine; | ||
329 | }, | ||
330 | |||
331 | 'hasLocalData': function() { | ||
332 | return false; | ||
333 | }, | ||
334 | |||
335 | //========================================================================= | ||
336 | |||
337 | 'loginForm': function() { | ||
338 | if (this._loginForm == null) { | ||
339 | this._loginForm = new Clipperz.PM.UI.Mobile.Components.LoginForm({element:MochiKit.DOM.getElement('loginForm')}); | ||
340 | } | ||
341 | |||
342 | return this._loginForm; | ||
343 | }, | ||
344 | |||
345 | 'removeLoginForm': function () { | ||
346 | if (this._loginForm != null) { | ||
347 | this._loginForm.remove(); | ||
348 | this._loginForm = null; | ||
349 | } | ||
350 | }, | ||
351 | |||
352 | //------------------------------------------------------------------------- | ||
353 | |||
354 | 'cardList': function () { | ||
355 | if (this._cardList == null) { | ||
356 | this._cardList = new Clipperz.PM.UI.Mobile.Components.CardList({element:MochiKit.DOM.getElement('cardList')}); | ||
357 | MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler'); | ||
358 | } | ||
359 | |||
360 | return this._cardList; | ||
361 | }, | ||
362 | |||
363 | 'showCards': function (someCards) { | ||
364 | this.cardList().showCards(someCards); | ||
365 | this.jQTouch().goTo('#cardList', 'slideleft'); | ||
366 | }, | ||
367 | |||
368 | //------------------------------------------------------------------------- | ||
369 | |||
370 | 'cardDetail': function () { | ||
371 | if (this._cardDetail == null) { | ||
372 | this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')}); | ||
373 | } | ||
374 | |||
375 | return this._cardDetail; | ||
376 | }, | ||
377 | |||
378 | 'selectCardHandler': function (aCardReference) { | ||
379 | var deferredResult; | ||
380 | |||
381 | deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true}); | ||
382 | deferredResult.addMethod(this.cardDetail(), 'render'); | ||
383 | deferredResult.addMethod(this.jQTouch(), 'goTo', '#cardDetail', 'slideleft'); | ||
384 | deferredResult.addMethod(this.user(), 'getRecord', aCardReference); | ||
385 | deferredResult.addMethod(this.cardDetail(), 'showCard'); | ||
386 | deferredResult.callback(); | ||
387 | |||
388 | return deferredResult; | ||
389 | }, | ||
390 | |||
391 | //========================================================================= | ||
392 | __syntaxFix__: "syntax fix" | ||
393 | }); | ||