summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/BaseComponent.js249
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js25
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js142
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/Overlay.js136
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/Preferences.js77
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js159
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/CustomizeJQueryMobile.js50
7 files changed, 703 insertions, 135 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/BaseComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/BaseComponent.js
new file mode 100644
index 0000000..1e7b69f
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/BaseComponent.js
@@ -0,0 +1,249 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
25
26//#############################################################################
27
28var _Clipperz_PM_Components_base_id_ = 0;
29
30//#############################################################################
31
32Clipperz.PM.UI.Mobile.Components.BaseComponent = function(args) {
33 args = args || {};
34 Clipperz.PM.UI.Mobile.Components.BaseComponent.superclass.constructor.call(this, args);
35
36 this._element = args.element || null;
37 this._ids = {};
38
39 this._isFullyRendered = false;
40 //this._renderingWaitingQueue = [];
41
42 return this;
43}
44
45//=============================================================================
46
47//MochiKit.Base.update(Clipperz.PM.UI.Mobile.Components.BaseComponent, Object, {
48Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.BaseComponent, Object, {
49
50 'isClipperzPMComponent': true,
51
52 //-------------------------------------------------------------------------
53
54 'toString': function () {
55 return "Clipperz.PM.UI.Mobile.Components.BaseComponent component";
56 },
57
58 'componentId': function () {
59 return this.getId('_id_');
60 },
61
62 //-------------------------------------------------------------------------
63
64 'element': function() {
65 return MochiKit.DOM.getElement(this._element);
66 },
67
68 'setElement': function(aNode) {
69 this._element = aNode;
70 },
71
72 //-----------------------------------------------------
73
74 'displayElement': function() {
75 return this.element();
76 },
77
78 //-------------------------------------------------------------------------
79
80 'renderInNode': function(aDomNode) {
81 this.setElement(aDomNode);
82 this.render();
83 },
84
85 'render': function() {
86 this.clear();
87 this.renderSelf();
88 // this.renderComponents();
89 // if (this.shouldShowTranslationHints()) {
90 // this.renderTranslationHints();
91 // }
92 if (this.shouldShowElementWhileRendering()) {
93 MochiKit.Style.showElement(this.displayElement());
94 };
95
96 this._isFullyRendered = true;
97
98 // MochiKit.Iter.forEach(this.renderingWaitingQueue(), MochiKit.Base.methodcaller('callback'));
99 // this.resetRenderingWaitingQueue();
100 },
101
102 'renderSelf': function() {
103 throw Clipperz.Base.exception.AbstractMethod;
104 },
105
106 //'renderComponents': function() {
107 // varslotName;
108 //
109 // for (slotName in this.slotComponents()) {
110 // this.slotComponents()[slotName].renderInNode(this.elementForSlotNamed(slotName));
111 // }
112 //},
113
114 //.........................................................................
115
116 'shouldShowElementWhileRendering': function() {
117 return false;
118 },
119
120 //.........................................................................
121
122 'isFullyRendered': function () {
123 return this._isFullyRendered;
124 },
125
126 //.........................................................................
127/*
128 'renderingWaitingQueue': function () {
129 return this._renderingWaitingQueue;
130 },
131
132 'resetRenderingWaitingQueue': function () {
133 this._renderingWaitingQueue = [];
134 },
135
136 //.........................................................................
137
138 'waitUntilFullyRendered': function () {
139 var deferredResult;
140
141 if (this.isFullyRendered() == true) {
142 deferredResult = MochiKit.Async.succeed
143 } else {
144 deferredResult = new Clipperz.Async.Deferred("BaseComponent.waitUntilFullyRendered", {trace:false});
145 this.renderingWaitingQueue().push(deferredResult);
146 }
147
148 return deferredResult;
149 },
150*/
151 //-----------------------------------------------------
152/*
153 'update': function(args) {
154 throw Clipperz.Base.exception.AbstractMethod;
155 },
156
157 'updateSelf': function(args) {
158 throw Clipperz.Base.exception.AbstractMethod;
159 },
160
161 'updateComponents': function(args) {
162 throw Clipperz.Base.exception.AbstractMethod;
163 },
164*/
165 //-----------------------------------------------------
166/*
167 'refresh': function() {
168 throw Clipperz.Base.exception.AbstractMethod;
169 },
170
171 'refreshSelf': function() {
172 throw Clipperz.Base.exception.AbstractMethod;
173 },
174
175 'refreshComponents': function(args) {
176 throw Clipperz.Base.exception.AbstractMethod;
177 },
178*/
179 //-----------------------------------------------------
180
181 'clear': function() {
182 varslotName;
183 var componentId;
184
185 MochiKit.Signal.disconnectAllTo(this);
186
187 if (this.displayElement() != null) {
188 if (this.element() != this.displayElement()) {
189 MochiKit.DOM.removeElement(this.displayElement());
190 } else {
191 this.displayElement().innerHTML = "";
192 }
193 }
194 },
195
196 'remove': function() {
197 this.clear();
198 MochiKit.Signal.disconnectAll(this);
199 },
200
201 'append': function(aNode, aValue) {
202 return Clipperz.DOM.Helper.append(aNode, aValue);
203 },
204
205 'insertBefore': function (aNode, aValue) {
206 return Clipperz.DOM.Helper.insertBefore(aNode, aValue);
207 },
208
209 'insertAfter': function (aNode, aValue) {
210 return Clipperz.DOM.Helper.insertAfter(aNode, aValue);
211 },
212
213 //-------------------------------------------------------------------------
214
215 'getId': function(aValue) {
216 varresult;
217
218 if (typeof(aValue) != 'undefined') {
219 result = this._ids[aValue];
220
221 if (typeof(result) == 'undefined') {
222 _Clipperz_PM_Components_base_id_ ++;
223
224 result = "Clipperz_PM_Components_" + aValue + "_" + _Clipperz_PM_Components_base_id_;
225 this._ids[aValue] = result;
226 }
227 } else {
228 // result = Clipperz.PM.UI.Common.Components.BaseComponent.superclass.getId.call(this);
229 throw "call to BaseComponent.getId with an undefined value";
230 }
231
232 return result;
233 },
234
235 'getAnchor': function (aValue) {
236 return '#' + this.getId(aValue);
237 },
238
239 //-------------------------------------------------------------------------
240
241 'getElement': function(aValue) {
242 return Clipperz.DOM.get(this.getId(aValue));
243 },
244
245 //-------------------------------------------------------------------------
246
247 __syntaxFix__: "syntax fix"
248
249});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
index a0e4879..dbab41b 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
@@ -8,121 +8,142 @@ refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* 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
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); 24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
25 25
26Clipperz.PM.UI.Mobile.Components.CardList = function(args) { 26Clipperz.PM.UI.Mobile.Components.CardList = function(args) {
27 args = args || {}; 27 args = args || {};
28 28
29 Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments); 29 Clipperz.PM.UI.Mobile.Components.CardList.superclass.constructor.apply(this, arguments);
30 30
31 this._cardDetail = null; 31 this._cardDetail = null;
32 this.render();
32 33
33 return this; 34 return this;
34} 35}
35 36
36//============================================================================= 37//=============================================================================
37 38
38Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, { 39Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.Mobile.Components.BaseComponent, {
39 40
40 //------------------------------------------------------------------------- 41 //-------------------------------------------------------------------------
41 42
42 'toString': function () { 43 'toString': function () {
43 return "Clipperz.PM.UI.Mobile.Components.CardList component"; 44 return "Clipperz.PM.UI.Mobile.Components.CardList component";
44 }, 45 },
45 46
46 //------------------------------------------------------------------------- 47 //-------------------------------------------------------------------------
47 48
48 'renderSelf': function () { 49 'renderSelf': function () {
50 varheaderElement;
51
52 headerElement = MochiKit.Selector.findChildElements(this.element().parentNode, ['div[data-role=header]'])[0];
53 this.append(this.element(),
54 {tag:'div', /*cls:'scroll',*/ id:this.getId('listBox'), children:[
55 {tag:'ul', /*cls:'rounded',*/ id:this.getId('list'), children:[
56 {tag:'li', html:'loading'}
57 ]}
58 ]}
59 );
60
61 this.append(headerElement,
62 // {tag:'a', href:"#", 'data-icon':'gear', cls:'ui-btn-right', html:"Options" }
63 {tag:'a', href:"#", id:this.getId('preferences'), cls:'ui-btn-right', html:"options" }
64 );
65
66 MochiKit.Signal.connect(this.getElement('preferences'), 'onclick', MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'showPreferences'));
67
68/*
49 this.append(this.element(), {tag:'div', cls:'cardList', children:[ 69 this.append(this.element(), {tag:'div', cls:'cardList', children:[
50 {tag:'div', cls:'toolbar', children:[ 70 {tag:'div', cls:'toolbar', children:[
51 {tag:'h1', html:"clipperz"}, 71 {tag:'h1', html:"clipperz"},
52 // {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')}, 72 // {tag:'input', name:'search', type:'search', autocomplete:'off', placeholder:"search", id:this.getId('search')},
53 {tag:'a', href:'#', id:'settings', cls:'button', html:"*"} 73 {tag:'a', href:'#', id:'settings', cls:'button', html:"*"}
54 ]}, 74 ]},
55 {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[ 75 {tag:'div', cls:'scroll', id:this.getId('listBox'), children:[
56 {tag:'ul', cls:'rounded', id:this.getId('list'), children:[ 76 {tag:'ul', cls:'rounded', id:this.getId('list'), children:[
57 {tag:'li', html:'loading'} 77 {tag:'li', html:'loading'}
58 ]} 78 ]}
59 ]} 79 ]}
60 ]}); 80 ]});
61 81
62 MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler'); 82 MochiKit.Signal.connect(this.getElement('list'), 'onclick', this, 'cardSelectionHandler');
63 MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart',this, 'cardSelectionHandler'); 83 MochiKit.Signal.connect(this.getElement('list'), 'ontouchstart',this, 'cardSelectionHandler');
64 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler'); 84 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler');
65 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler'); 85 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler');
66 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler'); 86 // MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler');
67 87
68 // MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler'); 88 // MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler');
69 // MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler'); 89 // MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler');
70 90
71 // MochiKit.Style.hideElement('backButton'); 91 // MochiKit.Style.hideElement('backButton');
72 // MochiKit.Style.hideElement(this.getElement('cardDetail')); 92 // MochiKit.Style.hideElement(this.getElement('cardDetail'));
93*/
73 }, 94 },
74 95
75 'showCards': function (someCards) { 96 'showCards': function (someCards) {
76 varcardListElement; 97 varcardListElement;
77 if (this.isFullyRendered() == false) { 98 if (this.isFullyRendered() == false) {
78 this.render(); 99 this.render();
79 }; 100 };
80 101
81 cardListElement = this.getElement('list') 102 cardListElement = this.getElement('list')
82 103
83 cardInfo = { 104 cardInfo = {
84 '_rowObject': MochiKit.Async.succeed, 105 '_rowObject': MochiKit.Async.succeed,
85 '_reference': MochiKit.Base.methodcaller('reference'), 106 '_reference': MochiKit.Base.methodcaller('reference'),
86 '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), 107 '_searchableContent':MochiKit.Base.methodcaller('searchableContent'),
87 'label': MochiKit.Base.methodcaller('label'), 108 'label': MochiKit.Base.methodcaller('label'),
88 'favicon': MochiKit.Base.methodcaller('favicon') 109 'favicon': MochiKit.Base.methodcaller('favicon')
89 }; 110 };
90 111
91 deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); 112 deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false});
92 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); 113 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false}));
93 deferredResult.addCallback(Clipperz.Async.collectAll); 114 deferredResult.addCallback(Clipperz.Async.collectAll);
94 deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); 115 deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label')));
95 deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); 116 deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement);
96 // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); 117 // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading');
97 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); 118 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement));
98 deferredResult.callback(someCards); 119 deferredResult.callback(someCards);
99 }, 120 },
100 121
101 'appendCardToList': function (aCardListElement, aCardInfo) { 122 'appendCardToList': function (aCardListElement, aCardInfo) {
102 this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ 123 this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[
103 {tag:'a', href:'#', html:aCardInfo['label'], children:[ 124 {tag:'a', href:'#', html:aCardInfo['label'], children:[
104 {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} 125 // {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]}
105 ]} 126 ]}
106 ]}); 127 ]});
107 }, 128 },
108 129
109 'cardSelectionHandler': function (anEvent) { 130 'cardSelectionHandler': function (anEvent) {
110 var listElement; 131 var listElement;
111 varcardReference; 132 varcardReference;
112 133
113 anEvent.preventDefault(); 134 anEvent.preventDefault();
114 135
115 listElement = anEvent.target(); 136 listElement = anEvent.target();
116 if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { 137 if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) {
117 listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); 138 listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem');
118 } 139 }
119 cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); 140 cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference');
120 //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected 141 //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected
121 MochiKit.Signal.signal(this, 'selectedCard', cardReference); 142 MochiKit.Signal.signal(this, 'selectedCard', cardReference);
122 }, 143 },
123 144
124 //------------------------------------------------------------------------- 145 //-------------------------------------------------------------------------
125/* 146/*
126 'searchHandler': function (anEvent) { 147 'searchHandler': function (anEvent) {
127 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN 148 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN
128 anEvent.preventDefault(); 149 anEvent.preventDefault();
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js
index 3aeac0c..da864eb 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js
@@ -23,49 +23,50 @@ refer to http://www.clipperz.com.
23 23
24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); 24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
25 25
26Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { 26Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) {
27 args = args || {}; 27 args = args || {};
28 28
29 this._pin = ''; 29 this._pin = '';
30 30
31 this._message = null; 31 this._message = null;
32 this._steps = 0; 32 this._steps = 0;
33 this._actualSteps = 0; 33 this._actualSteps = 0;
34 34
35 this._callback = null; 35 this._callback = null;
36 this._errorCallback = null; 36 this._errorCallback = null;
37 37
38 this._mode = 'CREDENTIALS'; 38 this._mode = 'CREDENTIALS';
39 39
40 Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments); 40 Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments);
41 41
42 return this; 42 return this;
43} 43}
44 44
45//============================================================================= 45//=============================================================================
46 46
47Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { 47//Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, {
48Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Mobile.Components.BaseComponent, {
48 49
49 //------------------------------------------------------------------------- 50 //-------------------------------------------------------------------------
50 51
51 'toString': function () { 52 'toString': function () {
52 return "Clipperz.PM.UI.Mobile.Components.LoginForm component"; 53 return "Clipperz.PM.UI.Mobile.Components.LoginForm component";
53 }, 54 },
54 55
55 //------------------------------------------------------------------------- 56 //-------------------------------------------------------------------------
56 57
57 'callback': function () { 58 'callback': function () {
58 return this._callback; 59 return this._callback;
59 }, 60 },
60 61
61 'errorCallback': function () { 62 'errorCallback': function () {
62 return this._errorCallback; 63 return this._errorCallback;
63 }, 64 },
64 65
65 //------------------------------------------------------------------------- 66 //-------------------------------------------------------------------------
66 67
67 'mode': function () { 68 'mode': function () {
68 return this._mode; 69 return this._mode;
69 }, 70 },
70 71
71 'setMode': function (aValue) { 72 'setMode': function (aValue) {
@@ -90,257 +91,282 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.
90 91
91 'setUsername': function (aValue) { 92 'setUsername': function (aValue) {
92 this._username = aValue; 93 this._username = aValue;
93 }, 94 },
94 95
95 //.......................................................................... 96 //..........................................................................
96 97
97 'passphrase': function () { 98 'passphrase': function () {
98 return this._passphrase; 99 return this._passphrase;
99 }, 100 },
100 101
101 'setPassphrase': function (aValue) { 102 'setPassphrase': function (aValue) {
102 this._passphrase = aValue; 103 this._passphrase = aValue;
103 }, 104 },
104 105
105 //------------------------------------------------------------------------- 106 //-------------------------------------------------------------------------
106 107
107 'message': function () { 108 'message': function () {
108 return this._message; 109 return this._message;
109 }, 110 },
110 111
111 '_setMessage': function (aValue) { 112 '_setMessage': function (aValue) {
112 this._message = aValue; 113 this._message = aValue;
113 114
114 if (aValue == null) { 115 // if (aValue == null) {
115 MochiKit.Style.hideElement(this.getElement('credentialsMessage')); 116 // MochiKit.Style.hideElement(this.getElement('credentialsMessage'));
116 } else { 117 // } else {
117 this.getElement('message').innerHTML = aValue; 118 // this.getElement('message').innerHTML = aValue;
118 MochiKit.Style.showElement(this.getElement('credentialsMessage')); 119 // MochiKit.Style.showElement(this.getElement('credentialsMessage'));
119 } 120 // }
120 }, 121 },
121 122
122 'setMessage': function (aValue) { 123 'setMessage': function (aValue) {
123 this._setMessage(aValue); 124 this._setMessage(aValue);
124 MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error'); 125 // MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error');
125 }, 126 },
126 127
127 'setErrorMessage': function (aValue) { 128 'setErrorMessage': function (aValue) {
128 this._setMessage(aValue); 129 this._setMessage(aValue);
129 MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error'); 130 // MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error');
130 }, 131 },
131 132
132 //------------------------------------------------------------------------- 133 //-------------------------------------------------------------------------
133 134
134 'setCallbacks': function (args) { 135 'setCallbacks': function (args) {
135 this._callback = args['callback']; 136 this._callback = args['callback'];
136 this._errorCallback = args['errorCallback']; 137 this._errorCallback = args['errorCallback'];
137 }, 138 },
138 139
140 'show': function (args) {
141 this.updateWithArgs(args);
142
143 if (this.mode() == 'PIN') {
144 this.setPin('');
145 this.getElement('PIN').focus();
146 } else if (this.mode() == 'CREDENTIALS') {
147 if (this.getElement('usernameField').value.length == 0) {
148 this.getElement('usernameField').focus();
149 } else {
150 this.getElement('passphraseField').focus();
151 this.getElement('passphraseField').select();
152 }
153 }
154 },
155
139 'showErrors': function (args) { 156 'showErrors': function (args) {
140 if (args['previousFailedAttempt'] == 'LOGIN') { 157 if (args['previousFailedAttempt'] == 'LOGIN') {
158 $(this.getAnchor('credentialsSubmitButton')).button('enable');
141 this.setErrorMessage("Wrong credentials"); 159 this.setErrorMessage("Wrong credentials");
142 } else if (args['previousFailedAttempt'] == 'PIN') { 160 } else if (args['previousFailedAttempt'] == 'PIN') {
143 if (args['failedAttempts'] == -1) { 161 if (args['failedAttempts'] == -1) {
144 this.setErrorMessage("Wrong PIN - Resetted"); 162 this.setErrorMessage("Wrong PIN - Resetted");
145 } else { 163 } else {
146 this.setErrorMessage("Wrong PIN"); 164 this.setErrorMessage("Wrong PIN");
147 } 165 }
148 } else { 166 } else {
149 this.setMessage(null); 167 this.setMessage(null);
150 } 168 }
151 }, 169 },
152 170
153 'updateWithArgs': function (args) { 171 'updateWithArgs': function (args) {
154 this.renderIfNeeded(); 172 this.renderOnlyOnce();
155 this.setCallbacks(args); 173 this.setCallbacks(args);
156 this.showErrors(args); 174 this.showErrors(args);
157 this.updateRendering(); 175 // this.updateRendering();
158 },
159
160 'showPinLogin': function (args) {
161 this.setPin('');
162 this.setMode('PIN');
163 this.updateWithArgs(args);
164
165 // $(this.getAnchor('PIN')).focus();
166 this.getElement('PIN').focus();
167 },
168
169 'showCredentialsLogin': function (args) {
170 this.setMode('CREDENTIALS');
171 this.updateWithArgs(args);
172
173 if (this.getElement('usernameField').value.length == 0) {
174 // $(this.getAnchor('usernameField')).focus();
175 this.getElement('usernameField').focus();
176 } else {
177 // $(this.getAnchor('passphraseField')).focus();
178 this.getElement('passphraseField').focus();
179 this.getElement('passphraseField').select();
180 }
181 }, 176 },
182 177
183 //------------------------------------------------------------------------- 178 //-------------------------------------------------------------------------
184 179
185 'renderIfNeeded': function () { 180 'renderOnlyOnce': function () {
186 if (this.isFullyRendered() == false) { 181 if (this.isFullyRendered() == false) {
187 this.render(); 182 this.render();
188 }; 183 };
189 this.updateRendering(); 184 // this.updateRendering();
190 }, 185 },
191 186/*
192 'updateRendering': function () { 187 'updateRendering': function () {
193 MochiKit.Style.showElement(this.getElement('credentialsBody')); 188 MochiKit.Style.showElement(this.getElement('credentialsBody'));
194 MochiKit.Style.hideElement(this.getElement('validating')); 189 MochiKit.Style.hideElement(this.getElement('validating'));
195 190
196 // this.hideAllPanes(); 191 // this.hideAllPanes();
197 MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div')); 192 MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div'));
198 if (this.mode() == 'CREDENTIALS') { 193 if (this.mode() == 'CREDENTIALS') {
199 selectedPanel = this.getElement('credentials') 194 selectedPanel = this.getElement('credentials');
195 $(this.getAnchor('credentialsSubmitButton')).button('enable');
200 } else if (this.mode() == 'PIN') { 196 } else if (this.mode() == 'PIN') {
201 selectedPanel = this.getElement('pin') 197 selectedPanel = this.getElement('pin')
202 // this.updatePinDisplay(); 198 // this.updatePinDisplay();
203 } else { 199 } else {
204 throw 'Unhandled login form mode'; 200 throw 'Unhandled login form mode';
205 } 201 }
206 MochiKit.Style.showElement(selectedPanel);
207 202
203 MochiKit.Style.showElement(selectedPanel);
208 MochiKit.Style.hideElement(this.getElement('validating')); 204 MochiKit.Style.hideElement(this.getElement('validating'));
209 }, 205 },
210 206*/
211 'renderSelf': function() { 207/*
208 '_renderSelf': function() {
212 var selectedPanel; 209 var selectedPanel;
213 this.append(this.element(), {tag:'div', id:'login', children:[ 210 this.append(this.element(), {tag:'div', id:'login', children:[
214 {tag:'div', cls:'toolbar', children:[ 211 {tag:'div', cls:'toolbar text-center', children:[
215 {tag:'h1', html:"clipperz"} 212 {tag:'h1', cls:'clipperz', html:"clipperz"}
216 ]}, 213 ]},
217 {tag:'div', cls:'scroll', children:[ 214 {tag:'div', cls:'', children:[
218 //================================================================== 215 //==================================================================
219 {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[ 216 {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[
220 {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"} 217 {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"}
221 ]}, 218 ]},
222 //================================================================== 219 //==================================================================
223 {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[ 220 {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[
224 //-------------------------------------------------------------- 221 //--------------------------------------------------------------
225 {tag:'div', cls:'pin', id:this.getId('pin'), children:[ 222 {tag:'div', cls:'pin', id:this.getId('pin'), children:[
226 {tag:'form', cls:'scroll', id:this.getId('pinForm'), children:[ 223 {tag:'form', cls:'', id:this.getId('pinForm'), children:[
227 {tag:'ul', cls:'edit rounded', children:[ 224 {tag:'ul', cls:'edit rounded', children:[
228 {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]}, 225 {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]},
229 ]}, 226 ]},
230 {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"} 227 {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"}
231 ]} 228 ]}
232 ]}, 229 ]},
233 //-------------------------------------------------------------- 230 //--------------------------------------------------------------
234 {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[ 231 {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[
235 {tag:'form', cls:'scroll', id:this.getId('credentialsForm'), children:[ 232 {tag:'form', cls:'text-center', id:this.getId('credentialsForm'), children:[
236 {tag:'ul', cls:'edit rounded', children:[ 233 {tag:'fieldset', children:[
237 {tag:'li', children:[{tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') }]}, 234 // {tag:'legend', html:"Legend"},
238 {tag:'li', children:[{tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/placeholder:"passphrase", id:this.getId('passphraseField') }]} 235 {tag:'input', type:'email', name:'name', /*value:'joe',* / placeholder:"username", id:this.getId('usernameField') },
236 // {tag:'span', cls:'help-block', html:"Example of help text here"},
237 {tag:'input', type:'password', name:'passphrase', /*value:'clipperz',* /placeholder:"passphrase", id:this.getId('passphraseField') },
239 ]}, 238 ]},
240 {tag:'a', href:'#', cls:'greenButton', id:this.getId('credentialsSubmitButton'), html:"Login"}
241 // {tag:'input', type:'submit', cls:'greenButton', id:this.getId('credentialsSubmitButton'), value:"Login"}
242 239
240 {tag:'button', cls:'btn btn-primary btn-large', type:'submit', id:this.getId('credentialsSubmitButton'), html:"Login"}
243 ]} 241 ]}
244 ]}, 242 ]},
245 //-------------------------------------------------------------- 243 //--------------------------------------------------------------
246 ]}, 244 ]},
247 //================================================================== 245 //==================================================================
248 {tag:'div', cls:'validating', id:this.getId('validating'), children:[ 246 {tag:'div', cls:'validating', id:this.getId('validating'), children:[
249 {tag:'div', cls:'loading', children:[ 247 {tag:'div', cls:'loading', children:[
250 {tag:'div', cls:'spinner', children:[ 248 {tag:'div', cls:'spinner', children:[
251 {tag:'div', cls:'bar01'}, 249 {tag:'div', cls:'bar01'},
252 {tag:'div', cls:'bar02'}, 250 {tag:'div', cls:'bar02'},
253 {tag:'div', cls:'bar03'}, 251 {tag:'div', cls:'bar03'},
254 {tag:'div', cls:'bar04'}, 252 {tag:'div', cls:'bar04'},
255 {tag:'div', cls:'bar05'}, 253 {tag:'div', cls:'bar05'},
256 {tag:'div', cls:'bar06'}, 254 {tag:'div', cls:'bar06'},
257 {tag:'div', cls:'bar07'}, 255 {tag:'div', cls:'bar07'},
258 {tag:'div', cls:'bar08'}, 256 {tag:'div', cls:'bar08'},
259 {tag:'div', cls:'bar09'}, 257 {tag:'div', cls:'bar09'},
260 {tag:'div', cls:'bar10'}, 258 {tag:'div', cls:'bar10'},
261 {tag:'div', cls:'bar11'}, 259 {tag:'div', cls:'bar11'},
262 {tag:'div', cls:'bar12'} 260 {tag:'div', cls:'bar12'}
263 ]} 261 ]}
264 ]}, 262 ]},
265 {tag:'div', id:this.getId('loadingMessage')}, 263 {tag:'div', id:this.getId('loadingMessage')},
266 {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"} 264 {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"}
267 ]} 265 ]}
268 //================================================================== 266 //==================================================================
269 ]} 267 ]}
270 ]}); 268 ]});
271 269
272 MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler'); 270 MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler');
273 MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler'); 271 MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler');
274 272
275 MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler'); 273 MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler');
276 MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler'); 274 MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler');
277 275
278 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); 276 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle');
279 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); 277 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle');
280 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); 278 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle');
281 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); 279 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle');
282 }, 280 },
281*/
282 'renderSelf': function() {
283 if (this.isFullyRendered() == false) {
284 this.append(this.element(), //[
285 // {tag:'div', 'data-role':'header', children:[
286 // {tag:'h1', html:'clipperz'}
287 // ]},
288 // {tag:'div', 'data-role':'content', children:[
289 {tag:'form', id:this.getId('credentialsForm'), children:[
290 {tag:'div', 'data-role':'fieldcontain', cls:'ui-hide-label', children:[
291 {tag:'label', 'for':'name', cls:'ui-input-text', html:"username"},
292 {tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') },
293 {tag:'label', 'for':'passphrase', cls:'ui-input-text', html:"passphrase"},
294 {tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/placeholder:"passphrase", id:this.getId('passphraseField') }
295 ]},
296 {tag:'button', type:'submit', id:this.getId('credentialsSubmitButton'), html:"login"}
297 ]}
298 // ]}
299 // ]
300 );
301
302 MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler');
303 MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler');
304 }
305 },
283 306
284 //------------------------------------------------------------------------- 307 //-------------------------------------------------------------------------
285 308
286 'submitPinHandler': function (anEvent) { 309 'submitPinHandler': function (anEvent) {
287 varpin; 310 varpin;
288 311
289 this.setMessage(null); 312 this.setMessage(null);
290 pin = this.getElement('PIN').value; 313 pin = this.getElement('PIN').value;
291 // $(this.getAnchor('PIN')).blur(); 314 $(this.getAnchor('PIN')).blur();
292 this.getElement('PIN').blur(); 315 // this.getElement('PIN').blur();
293 316
294 credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); 317 credentials = Clipperz.PM.PIN.credentialsWithPIN(pin);
295 this.loginWithCredentials(credentials); 318 this.loginWithCredentials(credentials);
296 }, 319 },
297 320
298 'submitCredentialsHandler': function (anEvent) { 321 'submitCredentialsHandler': function (anEvent) {
299 varcredentials; 322 varcredentials;
300 323
301 this.setMessage(null); 324 anEvent.preventDefault();
325
326 // this.setMessage(null);
327 $(this.getAnchor('usernameField')).blur();
328 $(this.getAnchor('passphraseField')).blur();
329 $(this.getAnchor('credentialsSubmitButton')).button('disable');
302 330
303 credentials = {}; 331 credentials = {};
304 credentials['username'] = this.getElement('usernameField').value; 332 credentials['username'] = this.getElement('usernameField').value;
305 credentials['passphrase'] = this.getElement('passphraseField').value; 333 credentials['passphrase'] = this.getElement('passphraseField').value;
306 // $(this.getAnchor('passphraseField')).blur();
307 this.getElement('passphraseField').blur();
308 334
309 this.loginWithCredentials(credentials); 335 this.loginWithCredentials(credentials);
310 }, 336 },
311 337
312 //------------------------------------------------------------------------- 338 //-------------------------------------------------------------------------
313 339
314 'loginWithCredentials': function (someCredentials) { 340 'loginWithCredentials': function (someCredentials) {
315 varargs; 341 varargs;
316 342
317 args = {}; 343 args = {};
318 args['credentials'] = someCredentials; 344 args['credentials'] = someCredentials;
319 args['errorCallback'] = this.errorCallback(); 345 args['errorCallback'] = this.errorCallback();
320 346
321 MochiKit.Style.hideElement(this.getElement('credentialsBody')); 347 // MochiKit.Style.hideElement(this.getElement('credentialsBody'));
322 MochiKit.Style.showElement(this.getElement('validating')); 348 // MochiKit.Style.showElement(this.getElement('validating'));
323 349
324 MochiKit.Async.callLater(0.1, this.callback(), args); 350 MochiKit.Async.callLater(0.1, this.callback(), args);
325 }, 351 },
326 352
327 //------------------------------------------------------------------------- 353 //-------------------------------------------------------------------------
328 354
329 'initProgressHandle': function (anEvent) { 355 'initProgressHandle': function (anEvent) {
330 this._steps = anEvent['steps']; 356 this._steps = anEvent['steps'];
331 this._actualSteps = 0; 357 this._actualSteps = 0;
332 }, 358 },
333 359
334 'updateProgressHandle': function (anEvent) { 360 'updateProgressHandle': function (anEvent) {
335 this._steps += anEvent['extraSteps']; 361 this._steps += anEvent['extraSteps'];
336 }, 362 },
337 363
338 'advanceProgressHandle': function (anEvent) { 364 'advanceProgressHandle': function (anEvent) {
339 this._actualSteps ++; 365 this._actualSteps ++;
340 }, 366 },
341 367
342 'progressDoneHandle': function (anEvent) { 368 'progressDoneHandle': function (anEvent) {
343 }, 369 },
344 370
345 //------------------------------------------------------------------------- 371 //-------------------------------------------------------------------------
346 __syntaxFix__: "syntax fix" 372 __syntaxFix__: "syntax fix"
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/Overlay.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/Overlay.js
new file mode 100644
index 0000000..da08d0f
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/Overlay.js
@@ -0,0 +1,136 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
25
26Clipperz.PM.UI.Mobile.Components.Overlay = function(args) {
27 args = args || {};
28
29 this._defaultDelay = 2;
30
31 Clipperz.PM.UI.Mobile.Components.Overlay.superclass.constructor.apply(this, arguments);
32
33 this.render();
34 MochiKit.Style.hideElement(this.element());
35
36 return this;
37}
38
39//=============================================================================
40
41Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.Overlay, Clipperz.PM.UI.Mobile.Components.BaseComponent, {
42
43 //-------------------------------------------------------------------------
44
45 'toString': function () {
46 return "Clipperz.PM.UI.Mobile.Components.Overlay component";
47 },
48
49 //-------------------------------------------------------------------------
50
51 'show': function (aMessage) {
52 this.resetStatus();
53 this.setMessage(aMessage);
54 MochiKit.DOM.removeElementClass(this.element(), 'ios-overlay-hide');
55 MochiKit.DOM.addElementClass(this.element(), 'ios-overlay-show');
56 },
57
58 'done': function (aMessage, aDelayBeforeHiding) {
59 this.completed(this.showDoneIcon, aMessage, aDelayBeforeHiding);
60 },
61
62 'failed': function (aMessage, aDelayBeforeHiding) {
63 this.completed(this.showFailIcon, aMessage, aDelayBeforeHiding);
64 },
65
66 //-------------------------------------------------------------------------
67
68 'resetStatus': function () {
69 MochiKit.Style.showElement(this.element());
70 MochiKit.Style.showElement(this.getElement('spinner'));
71 MochiKit.Style.hideElement(this.getElement('done'));
72 MochiKit.Style.hideElement(this.getElement('failed'));
73 },
74
75 'setMessage': function (aMessage) {
76 if (typeof(aMessage) != 'undefined') {
77 this.getElement('title').innerHTML = aMessage;
78 }
79 },
80
81 'completed': function (aFunctionToShowResult, aMessage, aDelayBeforeHiding) {
82 var delay = aDelayBeforeHiding || this.defaultDelay();
83
84 this.hideSpinner();
85 MochiKit.Base.bind(aFunctionToShowResult, this)();
86 this.setMessage(aMessage);
87
88 MochiKit.Async.callLater(delay, MochiKit.Base.bind(this.hide, this))
89 },
90
91 'hide': function () {
92 MochiKit.DOM.removeElementClass(this.element(), 'ios-overlay-show');
93 MochiKit.DOM.addElementClass(this.element(), 'ios-overlay-hide');
94 MochiKit.Async.callLater(1, MochiKit.Style.hideElement, this.element());
95 },
96
97 'hideSpinner': function () {
98 MochiKit.Style.hideElement(this.getElement('spinner'));
99 },
100
101 'showDoneIcon': function () {
102 MochiKit.Style.showElement(this.getElement('done'));
103 },
104
105 'showFailIcon': function () {
106 MochiKit.Style.showElement(this.getElement('failed'));
107 },
108
109 //-------------------------------------------------------------------------
110
111 'defaultDelay': function () {
112 return this._defaultDelay;
113 },
114
115 //-------------------------------------------------------------------------
116
117 'renderSelf': function () {
118 this.setElement(Clipperz.DOM.Helper.append(MochiKit.DOM.currentDocument().body,
119 {tag:'div', id:'ui-ios-overlay', cls:'ui-ios-overlay', children:[
120 {tag:'div', cls:'spinner', id:this.getId('spinner'), children:[
121 {tag:'div', cls:'bar01'}, {tag:'div', cls:'bar02'}, {tag:'div', cls:'bar03'}, {tag:'div', cls:'bar04'}, {tag:'div', cls:'bar05'}, {tag:'div', cls:'bar06'}, {tag:'div', cls:'bar07'}, {tag:'div', cls:'bar08'}, {tag:'div', cls:'bar09'}, {tag:'div', cls:'bar10'}, {tag:'div', cls:'bar11'}, {tag:'div', cls:'bar12'}
122 ]},
123
124 // {tag:'span', cls:'icon', id:this.getId('done'), html:'&#xe000'},
125 {tag:'span', cls:'icon', id:this.getId('done'), html:'done'},
126 // {tag:'span', cls:'icon', id:this.getId('failed'), html:'&#xe001'},
127 {tag:'span', cls:'icon', id:this.getId('failed'), html:'failed'},
128
129 {tag:'span', cls:'title', id:this.getId('title'), html:""}
130 ]}
131 ));
132 },
133
134 //-------------------------------------------------------------------------
135 __syntaxFix__: "syntax fix"
136});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/Preferences.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/Preferences.js
new file mode 100644
index 0000000..839069a
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/Preferences.js
@@ -0,0 +1,77 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
25
26Clipperz.PM.UI.Mobile.Components.Preferences = function(args) {
27 args = args || {};
28
29 Clipperz.PM.UI.Mobile.Components.Preferences.superclass.constructor.apply(this, arguments);
30
31 this.render();
32
33 return this;
34}
35
36//=============================================================================
37
38Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.Preferences, Clipperz.PM.UI.Mobile.Components.BaseComponent, {
39
40 //-------------------------------------------------------------------------
41
42 'toString': function () {
43 return "Clipperz.PM.UI.Mobile.Components.Preferences component";
44 },
45
46 //-------------------------------------------------------------------------
47
48 'renderSelf': function () {
49 // varpageElement;
50 varheaderElement;
51 var titleElement;
52
53 // pageElement = this.element().parentNode;
54 // MochiKit.DOM.updateNodeAttributes(pageElement, {'data-add-back-btn': 'true'})
55 headerElement = MochiKit.Selector.findChildElements(this.element().parentNode, ['div[data-role=header]'])[0];
56 // headerElement.innerHTML = "Preferences";
57 titleElement = MochiKit.Selector.findChildElements(headerElement, ['h1'])[0];
58 titleElement.innerHTML = "Preferences";
59 this.append(this.element(),
60 {tag:'div', id:this.getId('listBox'), children:[
61 {tag:'h1', html:"Preferences"}
62 ]}
63 );
64
65 this.append(headerElement, [
66 //'data-direction':'reverse', 'data-rel':'back',
67 {tag:'a', href:"#", id:this.getId('back'), cls:'ui-btn-left', html:"back" },
68 {tag:'a', href:"#", id:this.getId('save'), cls:'ui-btn-right', html:"save" }
69 ]);
70
71 MochiKit.Signal.connect(this.getElement('back'), 'onclick', MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'back'));
72 MochiKit.Signal.connect(this.getElement('save'), 'onclick', MochiKit.Base.partial(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'savePreferences'));
73 },
74
75 //=========================================================================
76 __syntaxFix__: "syntax fix"
77});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js
index 9951f44..245874a 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Controllers/MainController.js
@@ -6,253 +6,220 @@ This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please 6For further information about its features and functionalities please
7refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* 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
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers'); 24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Controllers');
25 25
26Clipperz.PM.UI.Mobile.Controllers.MainController = function() { 26Clipperz.PM.UI.Mobile.Controllers.MainController = function() {
27 // this._jQTouch = null; 27 // this._jQTouch = null;
28 this._user = null; 28 this._user = null;
29 this._proxy = null; 29 this._proxy = null;
30 // this._overlay = null;
30 this._loginForm = null; 31 this._loginForm = null;
31 this._cardList = null; 32 this._cardList = null;
32 this._cardDetail= null; 33 this._cardDetail= null;
34 this._preferences= null;
33 35
34 return this; 36 return this;
35} 37}
36 38
37MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, { 39MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype, {
38 40
39 'toString': function () { 41 'toString': function () {
40 return "Clipperz.PM.UI.Mobile.Controllers.MainController"; 42 return "Clipperz.PM.UI.Mobile.Controllers.MainController";
41 }, 43 },
42 44
43 //------------------------------------------------------------------------- 45 //-------------------------------------------------------------------------
44 46
45 'user': function () { 47 'user': function () {
46 return this._user; 48 return this._user;
47 }, 49 },
48 50
49 'setUser': function (aValue) { 51 'setUser': function (aValue) {
50 this._user = aValue; 52 this._user = aValue;
51 }, 53 },
52 54
53 //-------------------------------------------------------------------------
54/*
55 'jQTouch': function () {
56 return this._jQTouch;
57 },
58
59 'setJQTouch': function (aValue) {
60 this._jQTouch = aValue;
61 },
62*/
63 //========================================================================= 55 //=========================================================================
64 56
65 'run': function () { 57 'run': function () {
66 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin')); 58 vardefaultPageStructure;
67 Clipperz.DOM.Helper.overwrite(MochiKit.DOM.currentDocument().body, {tag:'div', id:'jqt', children:[
68 {tag:'div', id:'loginForm'},
69 {tag:'div', id:'cardList'},
70 {tag:'div', id:'cardDetail'},
71 {tag:'div', id:'preferences'}
72 ]});
73 59
60 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin'));
61 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'showPreferences',MochiKit.Base.method(this, 'showPreferences'));
62
63 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'savePreferences',MochiKit.Base.method(this, 'savePreferences'));
64 MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'back', MochiKit.Base.method(this, 'back'));
65
66 defaultPageStructure = [
67 {tag:'div', 'data-role':'header', 'data-position':'fixed', children:[
68 {tag:'h1', html:'clipperz'}
69 ]},
70 {tag:'div', 'data-role':'content'}
71 ];
72 Clipperz.DOM.Helper.insertAfter(MochiKit.DOM.getElement('loadingPage'), [
73 {tag:'div', 'data-role':'page', id:'loginPage', children:defaultPageStructure},
74 {tag:'div', 'data-role':'page', id:'cardListPage', children:defaultPageStructure},
75 {tag:'div', 'data-role':'page', id:'cardDetailPage',children:defaultPageStructure},
76 {tag:'div', 'data-role':'page', id:'preferencesPage',children:defaultPageStructure}
77 ])
78 // $.mobile.initializePage();
74 this.showLoginForm(); 79 this.showLoginForm();
75
76 // this.initjQTouch();
77
78
79 // this.showAddToHomeScreenBaloon();
80 // this.selectInitialProxy();
81 }, 80 },
82/*
83 'initjQTouch': function () {
84 var jqt;
85
86 jqt = new $.jQTouch({
87 icon: 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAHIAAAByCAIAAAAAvxIqAAAD8GlDQ1BJQ0MgUHJvZmlsZQAAKJGNVd1v21QUP4lvXKQWP6Cxjg4Vi69VU1u5GxqtxgZJk6XpQhq5zdgqpMl1bhpT1za2021Vn/YCbwz4A4CyBx6QeEIaDMT2su0BtElTQRXVJKQ9dNpAaJP2gqpwrq9Tu13GuJGvfznndz7v0TVAx1ea45hJGWDe8l01n5GPn5iWO1YhCc9BJ/RAp6Z7TrpcL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SzuP9MszVy6aqVldluVEjYDh8CrNlAYKAkNMlzojiipnDvRO/u5jJ12nAhNMzl/oleuuXzU1nUzoloOmmsG+xHEphoOdLJZgnCjgD5z3tf3Nr1Mv7dhPojIDRajwyCuJw0dP7OmkhUtWTQpGLD2SsNRYRgkqtk8pinsYbAdHLjLbMS25+euPGT2XRu8cynD4RN/Cm5ZNVbqiCfKpqCoWWQZBONHFjp1llg0Z5K+d/Fp0ydf+/cjp06crVQEPlZ9+0dvb+7td56qmrVw0Q6X0qYzt9qXBmQj7Csv4Tvay3hQF/P5/293y0q5KTot0Xftwl7tx1Vw10xVNsoYqaJq3bAO6gYOd7HwfANIkJuoX/6i98YeP7zbSiSsWO1KMy2Qh28rs2HOsy565csnsoHPaMs1omqUtVPkgK+hLoLOXaRIO9c9+6JdnnUo0/2Ik4vE+0brhBl8mEUtnWEs9uISLEXScYHEdEigYCp1V277+ZPy1nW+P07+FG7+JmPRe55nfH8W8m9ZPr07YeiJlskiKSRyne5ltk6O2fuMJ58LFykx7KcPJsxfrpy++qSHSnzCFYLEEjp5ljoDCyF8/7YWLi/7m3w+eO3duPE7tYXynDff3x17YdU5qWr1kTg1Lnzcs9CWY7SDg9/3f/a0v7By/WdHU0RlbvWJJI85GkoimGAP5ZG7XLf2nndU//tVu0xjHya24CpPcXcfae+D48cSU5cuWVotuy7RUiR1NXvfQ4+ccp8Izn4phW8a7vcqWldOYfoERgqGqTrnta4/3vrn3ICqUdL8MrsZKFwBnz51/9VBm+oL1cxuMjKt+8zfifE/Fxr6GQl8kmvHNXD9HSP7a57pv/NvtHd3dw82N/SGBy75P/cmW//rA6qv1xAwwSf2fn77z3ttXXBP/FGiccTXW2L1/p5vABCYwgQlMYAL/2fH/AdkCEQl+/Ar/AAAAAElFTkSuQmCCCg==',
88 // icon4: 'jqtouch4.png',
89 // startupScreen: null, //Pass a string path to a 320px x 460px startup screen for full screen apps.
90 statusBar: 'black-translucent', //Styles the status bar when running as a fullscreen app. Other options are `default`, `black`, and `black-translucent`.
91 // addGlossToIcon: true, //Set to 'false' to prevent automatic glossy button effect on icon.
92 preloadImages: false, //Pass an array of image paths to load them before page loads. Ex: `['images/link_over.png', 'images/link_select.png']`
93 fixedViewport: true, //Removes the user's ability to scale the page. Ensures the site behaves more like an application.
94 // fullScreen: true, //The website will become a fullscreen application when saved to a user's home screen. Set to `false` to disable.
95 // 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.
96 // themeSelectionSelector: '#jqt #themes ul', //???
97
98 // useAnimations: true, //Set to `false` to disable all animations.
99 // useFastTouch: true, //Removes ~350ms onClick delay when tapping a link (use in conjunction with the .tap() event) **Experimental**
100 // useTouchScroll: true, //Adds support for iOS5 scrolling. Set to false to disable. **Experimental**
101
102 cacheGetRequests: false, //Automatically caches GET requests, so subsequent taps reference the pre-loaded views. (default: true)
103
104 // 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.
105
106 // cubeSelector: '.cube', //Link selector for a cube animation.
107 // dissolveSelector: '.dissolve', //Link selector for a dissolve animation.
108 // fadeSelector: '.fade', //Link selector for a fade animation.
109 // flipSelector: '.flip', //Link selector for a 3d flip animation.
110 formSelector: null, //Sets which forms are automatically submitted via Ajax. (default: 'form')
111 // popSelector: '.pop', //Link selector for a pop animation. (default: '.pop')
112 // 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 &gt; a, a:not(.dontslide)'`, etc. (default: 'body > * > ul li a')
113 // slideupSelector: '.slideup', //Link selector for a slide up animation. (default: '.slideup')
114 // submitSelector: '.submit', //Selector which, when clicked, will submit its parent form (and close keyboard if open). (default: '.submit')
115 // swapSelector: '.swap', //Link selector for 3d swap animation. (default: '.swap')
116 // 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')
117
118 debug: false
119 });
120 81
121 this.setJQTouch(jqt);
122 },
123*/
124 //========================================================================= 82 //=========================================================================
125 83
126 'showAddToHomeScreenBaloon': function () { 84 'showAddToHomeScreenBaloon': function () {
127 }, 85 },
128 86
129 //------------------------------------------------------------------------- 87 //-------------------------------------------------------------------------
130 88
131 'selectInitialProxy': function () { 89 'selectInitialProxy': function () {
132 if (this.isOnline()) { 90 if (this.isOnline()) {
133 this._proxy = Clipperz.PM.Proxy.defaultProxy; 91 this._proxy = Clipperz.PM.Proxy.defaultProxy;
134 } else { 92 } else {
135 if (this.hasLocalData()) { 93 if (this.hasLocalData()) {
136 this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false}); 94 this._proxy = new Clipperz.PM.Proxy.OfflineCache({'shouldPayTolls':false});
137 } else { 95 } else {
138 this.showOfflineError(); 96 this.showOfflineError();
139 } 97 }
140 } 98 }
141 }, 99 },
142 100
143 //------------------------------------------------------------------------- 101 //-------------------------------------------------------------------------
144 102
145 'showLoginForm': function (args) { 103 'showLoginForm': function (args) {
146 args = args || {}; 104 args = args || {};
147 105
148 args['callback'] = MochiKit.Base.method(this, 'doLogin'); 106 args['callback'] = MochiKit.Base.method(this, 'doLogin');
149 107
150 if (Clipperz.PM.PIN.isSet()) { 108 if (Clipperz.PM.PIN.isSet()) {
151 args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedPinLogin'); 109 args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedPinLogin');
152 this.loginForm().showPinLogin(args); 110 this.loginForm().setMode('PIN');
111 // this.loginForm().showPinLogin(args);
153 } else { 112 } else {
154 args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin'); 113 args['errorCallback'] = MochiKit.Base.method(this, 'handleFailedCredentialsLogin');
155 this.loginForm().showCredentialsLogin(args); 114 this.loginForm().setMode('CREDENTIALS');
115 //this.loginForm().showCredentialsLogin(args);
156 } 116 }
117 this.loginForm().show(args);
118
119 // MochiKit.Async.callLater(0.1, $.mobile.changePage, $('#loginPage'), {changeHash:false, showLoadMsg:false, role:'page', fromPage:$('#loadingPage'), 'data-transition':'slide'});
120 MochiKit.Async.callLater(0.1, $.mobile.changePage, $('#loginPage'));
157 }, 121 },
158 122
159 //......................................................................... 123 //.........................................................................
160 124
161 'handleFailedCredentialsLogin': function () { 125 'handleFailedCredentialsLogin': function () {
126 this.overlay().failed("Failed login", 1);
162 this.showLoginForm({'previousFailedAttempt':'LOGIN'}); 127 this.showLoginForm({'previousFailedAttempt':'LOGIN'});
163 }, 128 },
164 129
165 //......................................................................... 130 //.........................................................................
166 131
167 'handleFailedPinLogin': function () { 132 'handleFailedPinLogin': function () {
168 varfailedAttempts; 133 varfailedAttempts;
169 varstatus; 134 varstatus;
170 135
136 this.overlay().failed("Failed login", 1);
171 failedAttempts = Clipperz.PM.PIN.recordFailedAttempt(); 137 failedAttempts = Clipperz.PM.PIN.recordFailedAttempt();
172 this.showLoginForm({'previousFailedAttempt':'PIN', 'failedAttempts': failedAttempts}); 138 this.showLoginForm({'previousFailedAttempt':'PIN', 'failedAttempts': failedAttempts});
173 }, 139 },
174 140
175 //------------------------------------------------------------------------- 141 //-------------------------------------------------------------------------
176 142
177 'doLogin': function (someArgs) { 143 'doLogin': function (someArgs) {
178 var deferredResult; 144 var deferredResult;
179 var credentials; 145 var credentials;
180 var errorCallback; 146 var errorCallback;
181 var user; 147 var user;
182 var getPassphraseDelegate; 148 var getPassphraseDelegate;
183 149
184 credentials = someArgs['credentials']; 150 credentials = someArgs['credentials'];
185 errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop; 151 errorCallback = someArgs['errorCallback'] || MochiKit.Base.noop;
186 152
153 this.overlay().show("logging in");
187 getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase); 154 getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, credentials.passphrase);
188 user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate}); 155 user = new Clipperz.PM.DataModel.User({'username':credentials.username, 'getPassphraseFunction':getPassphraseDelegate});
189 156
190 deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false}); 157 deferredResult = new Clipperz.Async.Deferred('MainController.doLogin', {trace:false});
191 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); 158 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4});
192 deferredResult.addCallback(MochiKit.Async.wait, 0.1); 159 deferredResult.addCallback(MochiKit.Async.wait, 0.1);
193 deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); 160 deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection');
194 deferredResult.addMethod(user, 'login'); 161 deferredResult.addMethod(user, 'login');
195 deferredResult.addCallbacks( 162 deferredResult.addCallbacks(
196 MochiKit.Base.method(this, 'processSuccessfulLogin', user), 163 MochiKit.Base.method(this, 'processSuccessfulLogin', user),
197 errorCallback 164 errorCallback
198 ); 165 );
199 deferredResult.callback(); 166 deferredResult.callback();
200 167
201 return deferredResult; 168 return deferredResult;
202 }, 169 },
203 170
204 //.......................................................................... 171 //..........................................................................
205 172
206 'processSuccessfulLogin': function (aUser) { 173 'processSuccessfulLogin': function (aUser) {
207 var deferredResult; 174 var deferredResult;
208 175
209 deferredResult = new Clipperz.Async.Deferred('MainController.processSuccessfulLogin', {trace:false}); 176 deferredResult = new Clipperz.Async.Deferred('MainController.processSuccessfulLogin', {trace:false});
210 deferredResult.addMethod(Clipperz.PM.PIN, 'resetFailedAttemptCount'); 177 deferredResult.addMethod(Clipperz.PM.PIN, 'resetFailedAttemptCount');
178 deferredResult.addMethod(this.overlay(), 'done', "", 1);
211 // deferredResult.addMethod(this, 'removeLoginForm'); 179 // deferredResult.addMethod(this, 'removeLoginForm');
212 deferredResult.addMethod(this, 'setUser', aUser); 180 deferredResult.addMethod(this, 'setUser', aUser);
213 deferredResult.addMethod(this, 'setupApplication'); 181 deferredResult.addMethod(this, 'setupApplication');
214 deferredResult.addMethod(this, 'runApplication'); 182 deferredResult.addMethod(this, 'runApplication');
215 deferredResult.callback(); 183 deferredResult.callback();
216 184
217 return deferredResult; 185 return deferredResult;
218 }, 186 },
219 187
220 //------------------------------------------------------------------------- 188 //-------------------------------------------------------------------------
221 189
222 'setupApplication': function () { 190 'setupApplication': function () {
223 vardeferredResult; 191 vardeferredResult;
224 192
225 deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false}); 193 deferredResult = new Clipperz.Async.Deferred("MainController.setupApplication", {trace:false});
226 deferredResult.addMethod(this, 'welcomeFirstTimeUser'); 194 deferredResult.addMethod(this, 'welcomeFirstTimeUser');
227 deferredResult.addMethod(this, 'showPaymentReminder'); 195 deferredResult.addMethod(this, 'showPaymentReminder');
228 deferredResult.addMethod(this, 'copyDataLocally'); 196 deferredResult.addMethod(this, 'copyDataLocally');
229 deferredResult.callback(arguments); 197 deferredResult.callback(arguments);
230 198
231 return deferredResult; 199 return deferredResult;
232 }, 200 },
233 201
234
235 //.......................................................................... 202 //..........................................................................
236 203
237 'isFirstTimeUser': function () { 204 'isFirstTimeUser': function () {
238 return false; 205 return false;
239 }, 206 },
240 207
241 'welcomeFirstTimeUser': function () { 208 'welcomeFirstTimeUser': function () {
242 vardeferredResult; 209 vardeferredResult;
243 210
244 deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false}); 211 deferredResult = new Clipperz.Async.Deferred('MainController.welcomeFirstTimeUser', {trace:false});
245 212
246 if (this.isFirstTimeUser()) { 213 if (this.isFirstTimeUser()) {
247 deferredResult.addCallback(function () { Clipperz.log("--> welcome"); }); 214 deferredResult.addCallback(function () { Clipperz.log("--> welcome"); });
248 } 215 }
249 deferredResult.callback(); 216 deferredResult.callback();
250 217
251 return deferredResult; 218 return deferredResult;
252 }, 219 },
253 220
254 //.......................................................................... 221 //..........................................................................
255 222
256 'shouldShowPaymentReminder': function () { 223 'shouldShowPaymentReminder': function () {
257 return true; 224 return true;
258 }, 225 },
@@ -274,108 +241,150 @@ MochiKit.Base.update(Clipperz.PM.UI.Mobile.Controllers.MainController.prototype,
274 241
275 'canCopyDataLocally': function () { 242 'canCopyDataLocally': function () {
276 return false; 243 return false;
277 }, 244 },
278 245
279 'copyDataLocally': function () { 246 'copyDataLocally': function () {
280 vardeferredResult; 247 vardeferredResult;
281 248
282 deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false}); 249 deferredResult = new Clipperz.Async.Deferred('MainController.copyDataLocally', {trace:false});
283 250
284 if (this.canCopyDataLocally()) { 251 if (this.canCopyDataLocally()) {
285 deferredResult.addCallback(function () { Clipperz.log("--> copy data locally"); }); 252 deferredResult.addCallback(function () { Clipperz.log("--> copy data locally"); });
286 } 253 }
287 deferredResult.callback(); 254 deferredResult.callback();
288 255
289 return deferredResult; 256 return deferredResult;
290 257
291 }, 258 },
292 259
293 //------------------------------------------------------------------------- 260 //-------------------------------------------------------------------------
294 261
295 'runApplication': function () { 262 'runApplication': function () {
296 var deferredResult; 263 var deferredResult;
297 264
298 deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:true}); 265 deferredResult = new Clipperz.Async.Deferred('MainController.runApplication', {trace:false});
266 deferredResult.addMethod(this, 'showCardListPage');
267 deferredResult.addCallback(MochiKit.Async.wait, 0.5);
299 deferredResult.addMethod(this.user(), 'getRecords'); 268 deferredResult.addMethod(this.user(), 'getRecords');
300 deferredResult.addMethod(this, 'showCards'); 269 // deferredResult.addMethod(this, 'showCards');
270 deferredResult.addMethod(this.cardList(), 'showCards');
301 deferredResult.callback(); 271 deferredResult.callback();
302 272
303 return deferredResult; 273 return deferredResult;
304 }, 274 },
305 275
306 //========================================================================= 276 //=========================================================================
307 277
308 'showOfflineError': function (anException) { 278 'showOfflineError': function (anException) {
309 alert("Error: " + anException); 279 alert("Error: " + anException);
310 throw anException; 280 throw anException;
311 }, 281 },
312 282
313 //========================================================================= 283 //=========================================================================
314 284
315 'isOnline': function() { 285 'isOnline': function() {
316 return navigator.onLine; 286 return navigator.onLine;
317 }, 287 },
318 288
319 'hasLocalData': function() { 289 'hasLocalData': function() {
320 return false; 290 return false;
321 }, 291 },
322 292
323 //========================================================================= 293 //=========================================================================
324 294
295 'overlay': function () {
296 if (this._overlay == null) {
297 this._overlay = new Clipperz.PM.UI.Mobile.Components.Overlay();
298 }
299
300 return this._overlay;
301 },
302
303 //-------------------------------------------------------------------------
304
305 'contentElementForPage': function (aPageName) {
306 return MochiKit.Selector.findDocElements('#' + aPageName + ' div[data-role="content"]')[0];
307 },
308
325 'loginForm': function() { 309 'loginForm': function() {
326 if (this._loginForm == null) { 310 if (this._loginForm == null) {
327 this._loginForm = new Clipperz.PM.UI.Mobile.Components.LoginForm({element:MochiKit.DOM.getElement('loginForm')}); 311 this._loginForm = new Clipperz.PM.UI.Mobile.Components.LoginForm({element:this.contentElementForPage('loginPage')});
328 } 312 }
329 313
330 return this._loginForm; 314 return this._loginForm;
331 }, 315 },
332 316
333 'removeLoginForm': function () { 317 'removeLoginForm': function () {
334 if (this._loginForm != null) { 318 if (this._loginForm != null) {
335 this._loginForm.remove(); 319 this._loginForm.remove();
336 this._loginForm = null; 320 this._loginForm = null;
337 } 321 }
338 }, 322 },
339 323
340 //------------------------------------------------------------------------- 324 //-------------------------------------------------------------------------
341 325
342 'cardList': function () { 326 'cardList': function () {
343 if (this._cardList == null) { 327 if (this._cardList == null) {
344 this._cardList = new Clipperz.PM.UI.Mobile.Components.CardList({element:MochiKit.DOM.getElement('cardList')}); 328 this._cardList = new Clipperz.PM.UI.Mobile.Components.CardList({element:this.contentElementForPage('cardListPage')});
345 MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler'); 329 MochiKit.Signal.connect(this._cardList, 'selectedCard', this, 'selectCardHandler');
346 } 330 }
347 331
348 return this._cardList; 332 return this._cardList;
349 }, 333 },
350 334
351 'showCards': function (someCards) { 335 'showCardListPage': function (someCards) {
352 this.cardList().showCards(someCards); 336 // this.cardList().render();
353 // this.jQTouch().goTo('#cardList', 'slideleft'); 337 $.mobile.changePage($('#cardListPage'), {'transition':'flow'}); //slide, flow, pop
354 }, 338 },
355 339
356 //------------------------------------------------------------------------- 340 //-------------------------------------------------------------------------
357 341
358 'cardDetail': function () { 342 'cardDetail': function () {
359 if (this._cardDetail == null) { 343 if (this._cardDetail == null) {
360 this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')}); 344 this._cardDetail = new Clipperz.PM.UI.Mobile.Components.CardDetail({element:MochiKit.DOM.getElement('cardDetail')});
361 } 345 }
362 346
363 return this._cardDetail; 347 return this._cardDetail;
364 }, 348 },
365 349
366 'selectCardHandler': function (aCardReference) { 350 'selectCardHandler': function (aCardReference) {
367 var deferredResult; 351 var deferredResult;
368 352
369 deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true}); 353 deferredResult = new Clipperz.Async.Deferred("MainController.selectCardHandler", {trace:true});
370 deferredResult.addMethod(this.cardDetail(), 'render'); 354 deferredResult.addMethod(this.cardDetail(), 'render');
371 // deferredResult.addMethod(this.jQTouch(), 'goTo', '#cardDetail', 'slideleft');
372 deferredResult.addMethod(this.user(), 'getRecord', aCardReference); 355 deferredResult.addMethod(this.user(), 'getRecord', aCardReference);
373 deferredResult.addMethod(this.cardDetail(), 'showCard'); 356 deferredResult.addMethod(this.cardDetail(), 'showCard');
374 deferredResult.callback(); 357 deferredResult.callback();
375 358
376 return deferredResult; 359 return deferredResult;
377 }, 360 },
378 361
379 //========================================================================= 362 //=========================================================================
363
364 'preferences': function () {
365 if (this._preferences == null) {
366 this._preferences = new Clipperz.PM.UI.Mobile.Components.Preferences({element:this.contentElementForPage('preferencesPage')});
367 }
368
369 return this._preferences;
370 },
371
372 'showPreferences': function (anEvent) {
373//console.log("MainController.showPreferences", anEvent);
374 this.preferences();
375 // MochiKit.Async.callLater(0.1, $.mobile.changePage, $('#preferencesPage'), {transition:'flip'});
376 $.mobile.changePage($('#preferencesPage'), {transition:'flip'});
377 },
378
379 'savePreferences': function (anEvent) {
380console.log("MainController.savePreferences", anEvent);
381 },
382
383 'back': function (anEvent) {
384 // MochiKit.Async.callLater(0.1, $.mobile.changePage, $('#cardListPage'), {transition:'flip', reverse:true});
385 $.mobile.changePage($('#cardListPage'), {transition:'flip', reverse:true});
386 },
387
388 //=========================================================================
380 __syntaxFix__: "syntax fix" 389 __syntaxFix__: "syntax fix"
381}); 390});
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/CustomizeJQueryMobile.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/CustomizeJQueryMobile.js
new file mode 100644
index 0000000..68d8a5b
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/CustomizeJQueryMobile.js
@@ -0,0 +1,50 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24$(document).on("mobileinit", function() {
25 $.extend($.mobile, {
26 // activeBtnClass: 'ui-btn-active',
27 // activePageClass: 'ui-page-active',
28 ajaxEnabled: false,
29 // allowCrossDomainPages: false,
30 // autoInitializePage: true,
31 // buttonMarkup.hoverDelay: 200,
32 // defaultDialogTransition: 'pop',
33 // defaultPageTransition: 'fade,
34 // getMaxScrollForTransition: 3,
35 // gradeA: …,
36 // hashListeningEnabled: true,
37 ignoreContentEnabled: true,
38 // linkBindingEnabled: true,
39 // maxTransitionWidth: false,
40 // minScrollBack: 250,
41 // ns: '',
42 // pageLoadErrorMessage: "Error Loading Page",
43 // pageLoadErrorMessageTheme: 'e',
44 // phonegapNavigationEnabled: false,
45 // pushStateEnabled: true,
46 // subPageUrlKey: 'ui-page',
47 // transitionFallbacks.[transition]: 'fade',
48 __syntaxFix__: "syntax fix"
49 })
50});