Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js | 26 |
1 files changed, 10 insertions, 16 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 index 32dfa63..abf4758 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardDetail.js | |||
@@ -1,85 +1,82 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) { | 26 | Clipperz.PM.UI.Mobile.Components.CardDetail = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Mobile.Components.CardDetail.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Mobile.Components.CardDetail.superclass.constructor.apply(this, arguments); |
32 | 30 | ||
33 | //this._cardReference = null; | 31 | //this._cardReference = null; |
34 | 32 | ||
35 | return this; | 33 | return this; |
36 | } | 34 | } |
37 | 35 | ||
38 | //============================================================================= | 36 | //============================================================================= |
39 | 37 | ||
40 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, { | 38 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, { |
41 | 39 | ||
42 | //------------------------------------------------------------------------- | 40 | //------------------------------------------------------------------------- |
43 | 41 | ||
44 | 'toString': function () { | 42 | 'toString': function () { |
45 | return "Clipperz.PM.UI.Mobile.Components.CardDetail component"; | 43 | return "Clipperz.PM.UI.Mobile.Components.CardDetail component"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | /* | 47 | /* |
50 | 'cardReference': function () { | 48 | 'cardReference': function () { |
51 | return this._cardReference; | 49 | return this._cardReference; |
52 | }, | 50 | }, |
53 | 51 | ||
54 | 'setCardReference': function (aValue) { | 52 | 'setCardReference': function (aValue) { |
55 | this._cardReference = aValue; | 53 | this._cardReference = aValue; |
56 | }, | 54 | }, |
57 | */ | 55 | */ |
58 | //------------------------------------------------------------------------- | 56 | //------------------------------------------------------------------------- |
59 | 57 | ||
60 | 'renderSelf': function () { | 58 | 'renderSelf': function () { |
61 | console.log("CardDetail.renderSelf"); | ||
62 | this.append(this.element(), {tag:'div', cls:'cardDetail', children:[ | 59 | this.append(this.element(), {tag:'div', cls:'cardDetail', children:[ |
63 | {tag:'div', cls:'toolbar', children:[ | 60 | {tag:'div', cls:'toolbar', children:[ |
64 | {tag:'a', href:'#', cls:'back', html:"List"}, | 61 | {tag:'a', href:'#', cls:'back', html:"List"}, |
65 | {tag:'h1', id:this.getId('cardTitle'), html:"…"} | 62 | {tag:'h1', id:this.getId('cardTitle'), html:"…"} |
66 | ]}, | 63 | ]}, |
67 | {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[ | 64 | {tag:'div', cls:'scroll', id:this.getId('cardDetails'), children:[ |
68 | ]} | 65 | ]} |
69 | ]}); | 66 | ]}); |
70 | }, | 67 | }, |
71 | /* | 68 | /* |
72 | 'renderSelf': function() { | 69 | 'renderSelf': function() { |
73 | this.append(this.element(), [ | 70 | this.append(this.element(), [ |
74 | {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[ | 71 | {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[ |
75 | {tag:'div', id:this.getId('progressBar')} //, | 72 | {tag:'div', id:this.getId('progressBar')} //, |
76 | ]} | 73 | ]} |
77 | ]); | 74 | ]); |
78 | 75 | ||
79 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | 76 | 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); | 77 | MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0); |
81 | }, | 78 | }, |
82 | */ | 79 | */ |
83 | 80 | ||
84 | 'setTitle': function (aValue) { | 81 | 'setTitle': function (aValue) { |
85 | this.getElement('cardTitle').innerHTML = aValue; | 82 | this.getElement('cardTitle').innerHTML = aValue; |
@@ -134,59 +131,57 @@ console.log("CardDetail.renderSelf"); | |||
134 | return deferredResult; | 131 | return deferredResult; |
135 | }, | 132 | }, |
136 | 133 | ||
137 | //------------------------------------------------------------------------- | 134 | //------------------------------------------------------------------------- |
138 | 135 | ||
139 | 'directLoginElement': function () { | 136 | 'directLoginElement': function () { |
140 | varresult; | 137 | varresult; |
141 | 138 | ||
142 | result = this.getElement('directLoginList'); | 139 | result = this.getElement('directLoginList'); |
143 | if (result == null) { | 140 | if (result == null) { |
144 | this.append(this.getElement('cardDetails'), {tag:'h2', html:"Direct login"}); | 141 | 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')}); | 142 | result = this.append(this.getElement('cardDetails'), {tag:'ul', cls:'rounded', id:this.getId('directLoginList')}); |
146 | } | 143 | } |
147 | 144 | ||
148 | return result; | 145 | return result; |
149 | }, | 146 | }, |
150 | 147 | ||
151 | 'addDirectLogin': function (aDirectLogin) { | 148 | 'addDirectLogin': function (aDirectLogin) { |
152 | this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[ | 149 | this.append(this.directLoginElement(), {tag:'li', cls:'directLogin forward', children:[ |
153 | {tag:'a', href:'#', html:"direct login", children:[ | 150 | {tag:'a', href:'#', html:"direct login", children:[ |
154 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]} | 151 | {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:'http://www.clipperz.com/favicon.ico'}]} |
155 | ]} | 152 | ]} |
156 | ]}) | 153 | ]}) |
157 | 154 | ||
158 | console.log("ADD DIRECT LOGIN", aDirectLogin); | ||
159 | }, | 155 | }, |
160 | 156 | ||
161 | //========================================================================= | 157 | //========================================================================= |
162 | 158 | ||
163 | 'showCard': function (aCard) { | 159 | 'showCard': function (aCard) { |
164 | var deferredResult; | 160 | var deferredResult; |
165 | 161 | ||
166 | // this.render(); | 162 | // this.render(); |
167 | 163 | ||
168 | console.log("CardDetail.showCard", aCard); | ||
169 | deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false}); | 164 | deferredResult = new Clipperz.Async.Deferred("CardDetail.showCard", {trace:false}); |
170 | deferredResult.addMethod(aCard, 'label'); | 165 | deferredResult.addMethod(aCard, 'label'); |
171 | deferredResult.addMethod(this, 'setTitle'); | 166 | deferredResult.addMethod(this, 'setTitle'); |
172 | 167 | ||
173 | deferredResult.addMethod(aCard, 'fields'); | 168 | deferredResult.addMethod(aCard, 'fields'); |
174 | deferredResult.addCallback(MochiKit.Base.values); | 169 | deferredResult.addCallback(MochiKit.Base.values); |
175 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField')); | 170 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addField')); |
176 | 171 | ||
177 | deferredResult.addMethod(aCard, 'directLogins'); | 172 | deferredResult.addMethod(aCard, 'directLogins'); |
178 | deferredResult.addCallback(MochiKit.Base.values); | 173 | deferredResult.addCallback(MochiKit.Base.values); |
179 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addDirectLogin')); | 174 | deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'addDirectLogin')); |
180 | 175 | ||
181 | 176 | ||
182 | deferredResult.callback(); | 177 | deferredResult.callback(); |
183 | 178 | ||
184 | return deferredResult; | 179 | return deferredResult; |
185 | // return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [ | 180 | // return Clipperz.Async.callbacks("CardDialogController.updateComponentState", [ |
186 | // MochiKit.Base.method(this.record(), 'hasPendingChanges'), | 181 | // MochiKit.Base.method(this.record(), 'hasPendingChanges'), |
187 | // MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'), | 182 | // MochiKit.Base.method(this.cardDialogComponent(), 'setShouldEnableSaving'), |
188 | // | 183 | // |
189 | // MochiKit.Base.method(this.record(), 'label'), | 184 | // MochiKit.Base.method(this.record(), 'label'), |
190 | // MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'), | 185 | // MochiKit.Base.method(this.cardDialogComponent(), 'setTitle'), |
191 | // MochiKit.Base.method(this.record(), 'notes'), | 186 | // MochiKit.Base.method(this.record(), 'notes'), |
192 | // MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'), | 187 | // MochiKit.Base.method(this.cardDialogComponent(), 'setNotes'), |
@@ -245,49 +240,48 @@ console.log("CardDetail.showCard", aCard); | |||
245 | MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row']) | 240 | MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row']) |
246 | ) | 241 | ) |
247 | }; | 242 | }; |
248 | 243 | ||
249 | if (someData['notes'] != '') { | 244 | if (someData['notes'] != '') { |
250 | this.append(this.element(), [ | 245 | this.append(this.element(), [ |
251 | {tag:'h2', html:"Notes"}, | 246 | {tag:'h2', html:"Notes"}, |
252 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | 247 | {tag:'fieldset', id:this.getId('fieldset'), children:[ |
253 | {tag:'div', cls:'row notes', children:[ | 248 | {tag:'div', cls:'row notes', children:[ |
254 | {tag:'span', html:someData['notes']} | 249 | {tag:'span', html:someData['notes']} |
255 | ]} | 250 | ]} |
256 | ]} | 251 | ]} |
257 | ]); | 252 | ]); |
258 | }; | 253 | }; |
259 | 254 | ||
260 | return true; | 255 | return true; |
261 | }, | 256 | }, |
262 | 257 | ||
263 | //------------------------------------------------------------------------- | 258 | //------------------------------------------------------------------------- |
264 | /* | 259 | /* |
265 | 'toggleClickHandler': function (anEvent) { | 260 | 'toggleClickHandler': function (anEvent) { |
266 | varnextState; | 261 | varnextState; |
267 | varfieldValue; | 262 | varfieldValue; |
268 | 263 | ||
269 | //console.log("TOGGLE"); | ||
270 | anEvent.preventDefault; | 264 | anEvent.preventDefault; |
271 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; | 265 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; |
272 | 266 | ||
273 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); | 267 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); |
274 | if (nextState) { | 268 | if (nextState) { |
275 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); | 269 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); |
276 | } else { | 270 | } else { |
277 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); | 271 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); |
278 | } | 272 | } |
279 | 273 | ||
280 | MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState); | 274 | MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState); |
281 | }, | 275 | }, |
282 | * / | 276 | * / |
283 | //========================================================================= | 277 | //========================================================================= |
284 | /* | 278 | /* |
285 | 'directLoginClickHandler': function (anEvent) { | 279 | 'directLoginClickHandler': function (anEvent) { |
286 | anEvent.preventDefault(); | 280 | anEvent.preventDefault(); |
287 | 281 | ||
288 | if (/(directLogin_)/.test(anEvent.src().id)) { | 282 | if (/(directLogin_)/.test(anEvent.src().id)) { |
289 | var directLoginReference; | 283 | var directLoginReference; |
290 | 284 | ||
291 | directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2]; | 285 | directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2]; |
292 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference}); | 286 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference}); |
293 | } | 287 | } |