author | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
commit | 816fc35420a434b1d54ae5833d617608f7456048 (patch) (unidiff) | |
tree | 95b8caf354083593d7775e4dda6f4c556b44a2d9 /frontend/gamma/js/Clipperz/PM/UI/iPhone | |
parent | 267603e3aa3cf0029411e67ae14018b52344c296 (diff) | |
download | clipperz-816fc35420a434b1d54ae5833d617608f7456048.zip clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.gz clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.bz2 |
Updated version of /gamma
Tons of changes, included a new draft of the mobile version (still VERY rough)
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/iPhone') (more/less context) (ignore whitespace changes)
4 files changed, 0 insertions, 911 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js deleted file mode 100644 index 5380aa1..0000000 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardDetail.js +++ b/dev/null | |||
@@ -1,163 +0,0 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.iPhone.Components.CardDetail = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | Clipperz.PM.UI.iPhone.Components.CardDetail.superclass.constructor.apply(this, arguments); | ||
32 | |||
33 | this._cardReference = null; | ||
34 | |||
35 | return this; | ||
36 | } | ||
37 | |||
38 | //============================================================================= | ||
39 | |||
40 | Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardDetail, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
41 | |||
42 | //------------------------------------------------------------------------- | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.iPhone.Components.CardDetail component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'cardReference': function () { | ||
51 | return this._cardReference; | ||
52 | }, | ||
53 | |||
54 | 'setCardReference': function (aValue) { | ||
55 | this._cardReference = aValue; | ||
56 | }, | ||
57 | |||
58 | //------------------------------------------------------------------------- | ||
59 | |||
60 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
61 | this.append(this.element(), [ | ||
62 | {tag:'div', cls:'cardDetail', id:this.getId('cardDetail'), children:[ | ||
63 | {tag:'div', id:this.getId('progressBar')} //, | ||
64 | // {tag:'h1', cls:'loading', html:"loading"} | ||
65 | ]} | ||
66 | ]); | ||
67 | |||
68 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | ||
69 | MochiKit.Signal.signal(Clipperz.PM.UI.Common.Controllers.ProgressBarController.defaultController, 'updateProgress', 0); | ||
70 | }, | ||
71 | |||
72 | //========================================================================= | ||
73 | |||
74 | 'showCardDetails': function (someData) { | ||
75 | this.element().innerHTML = ''; | ||
76 | this.append(this.element(), [ | ||
77 | {tag:'fieldset', id:this.getId('fields'), children:MochiKit.Base.map(function (aFieldData) { | ||
78 | return {tag:'div', cls:'row', children:[ | ||
79 | {tag:'label', html:aFieldData['label']}, | ||
80 | // {tag:'span', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), html:aFieldData['value']} | ||
81 | {tag:'div', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), children:[ | ||
82 | {tag:'div', children:[{tag:'p', html:aFieldData['value']}]} | ||
83 | ]} | ||
84 | // {tag:'input', type:'text', cls:('fieldValue ' + (aFieldData['isHidden']? 'password' : 'text')), value:aFieldData['value'], disabled:true} | ||
85 | |||
86 | ]} | ||
87 | }, someData['fields'])} | ||
88 | ]); | ||
89 | |||
90 | MochiKit.Iter.forEach(MochiKit.Selector.findChildElements(this.element(), ['span.password']), MochiKit.Base.bind(function (aPasswordElement) { | ||
91 | MochiKit.Signal.connect(aPasswordElement, 'onclick', function (anEvent) { alert(MochiKit.DOM.scrapeText(anEvent.src())); }) | ||
92 | }, this)); | ||
93 | |||
94 | if (someData['directLogins'].length > 0) { | ||
95 | this.append(this.element(), [ | ||
96 | {tag:'h2', html:"Direct logins"}, | ||
97 | {tag:'fieldset', id:this.getId('directLogins'), children:MochiKit.Base.map(function (aDirectLoginData) { | ||
98 | return {tag:'div', cls:'row', id:('directLogin_' + aDirectLoginData['_reference']), children:[ | ||
99 | {tag:'img', cls:'favicon', src:aDirectLoginData['favicon']}, | ||
100 | // {tag:'input', cls:'directLogin', disabled:'disabled', type:'text', name:aDirectLoginData['label'], value:aDirectLoginData['label']} | ||
101 | {tag:'span', cls:'directLogin', html:aDirectLoginData['label']} | ||
102 | ]} | ||
103 | }, someData['directLogins'])} | ||
104 | ]); | ||
105 | |||
106 | MochiKit.Base.map(MochiKit.Base.bind(function (aRowNode) { | ||
107 | MochiKit.Signal.connect(aRowNode, 'onclick', this, 'directLoginClickHandler'); | ||
108 | }, this), | ||
109 | MochiKit.Selector.findChildElements(this.getElement('directLogins'), ['div.row']) | ||
110 | ) | ||
111 | }; | ||
112 | |||
113 | if (someData['notes'] != '') { | ||
114 | this.append(this.element(), [ | ||
115 | {tag:'h2', html:"Notes"}, | ||
116 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | ||
117 | {tag:'div', cls:'row notes', children:[ | ||
118 | {tag:'span', html:someData['notes']} | ||
119 | ]} | ||
120 | ]} | ||
121 | ]); | ||
122 | }; | ||
123 | |||
124 | return true; | ||
125 | }, | ||
126 | |||
127 | //------------------------------------------------------------------------- | ||
128 | /* | ||
129 | 'toggleClickHandler': function (anEvent) { | ||
130 | varnextState; | ||
131 | varfieldValue; | ||
132 | |||
133 | //console.log("TOGGLE"); | ||
134 | anEvent.preventDefault; | ||
135 | fieldValue = MochiKit.Selector.findChildElements(anEvent.src().parentNode.parentNode, ['span.password'])[0]; | ||
136 | |||
137 | nextState = (MochiKit.DOM.getNodeAttribute(anEvent.src(), 'toggled') != 'true'); | ||
138 | if (nextState) { | ||
139 | MochiKit.DOM.removeElementClass(fieldValue, 'clear'); | ||
140 | } else { | ||
141 | MochiKit.DOM.addElementClass(fieldValue, 'clear'); | ||
142 | } | ||
143 | |||
144 | MochiKit.DOM.setNodeAttribute(anEvent.src(), 'toggled', nextState); | ||
145 | }, | ||
146 | */ | ||
147 | //========================================================================= | ||
148 | |||
149 | 'directLoginClickHandler': function (anEvent) { | ||
150 | anEvent.preventDefault(); | ||
151 | |||
152 | if (/(directLogin_)/.test(anEvent.src().id)) { | ||
153 | var directLoginReference; | ||
154 | |||
155 | directLoginReference = anEvent.src().id.match(/(directLogin_)(.*)/)[2]; | ||
156 | MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', {cardReference:this.cardReference(), directLoginReference:directLoginReference}); | ||
157 | } | ||
158 | }, | ||
159 | |||
160 | //========================================================================= | ||
161 | |||
162 | __syntaxFix__: "syntax fix" | ||
163 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js deleted file mode 100644 index c3f2701..0000000 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js +++ b/dev/null | |||
@@ -1,201 +0,0 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.iPhone.Components.CardList = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | Clipperz.PM.UI.iPhone.Components.CardList.superclass.constructor.apply(this, arguments); | ||
32 | |||
33 | this._cardDetail = null; | ||
34 | |||
35 | return this; | ||
36 | } | ||
37 | |||
38 | //============================================================================= | ||
39 | |||
40 | Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.CardList, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
41 | |||
42 | //------------------------------------------------------------------------- | ||
43 | |||
44 | 'toString': function () { | ||
45 | return "Clipperz.PM.UI.iPhone.Components.CardList component"; | ||
46 | }, | ||
47 | |||
48 | //------------------------------------------------------------------------- | ||
49 | |||
50 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
51 | this.append(this.element(), [ | ||
52 | {tag:'div', cls:'toolbar', id:'toolbar', children:[ | ||
53 | {tag:'h1', id:'pageTitle', html:"cards"}, | ||
54 | {tag:'a', id:'backButton', cls:'button', href:'#', html:"cards"} | ||
55 | ]}, | ||
56 | {tag:'div', cls:'cardList', id:this.getId('cardList'), children:[ | ||
57 | {tag:'form', title:'search', cls:'panel cardListSearchForm', id:this.getId('cardListSearchForm'), children:[ | ||
58 | {tag:'input', type:'search', name:'search', value:"", placeholder:"search", id:this.getId('searchField')} | ||
59 | ]}, | ||
60 | {tag:'ul', cls:'panel cardListPanel', id:this.getId('cardListPanel'), children:[]} | ||
61 | ]}, | ||
62 | {tag:'div', cls:'panel cardDetailPanel', id:this.getId('cardDetail')} | ||
63 | ]); | ||
64 | |||
65 | MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onsubmit', this,'searchHandler'); | ||
66 | MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeydown', this,'searchHandler'); | ||
67 | MochiKit.Signal.connect(this.getElement('cardListSearchForm'), 'onkeyup', this,'searchHandler'); | ||
68 | |||
69 | MochiKit.Signal.connect(this.getElement('cardListPanel'), 'onclick', this,'cardListClickHandler'); | ||
70 | MochiKit.Signal.connect('backButton', 'onclick', this,'backButtonClickHandler'); | ||
71 | |||
72 | MochiKit.Style.hideElement('backButton'); | ||
73 | MochiKit.Style.hideElement(this.getElement('cardDetail')); | ||
74 | }, | ||
75 | |||
76 | //------------------------------------------------------------------------- | ||
77 | |||
78 | 'searchHandler': function (anEvent) { | ||
79 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN | ||
80 | anEvent.preventDefault(); | ||
81 | } else { | ||
82 | if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ESCAPE')) { | ||
83 | anEvent.target().value = ""; | ||
84 | } | ||
85 | |||
86 | if (anEvent.type() == 'keyup') { | ||
87 | MochiKit.Signal.signal(this, 'searchEvent', anEvent.target().value); | ||
88 | } | ||
89 | } | ||
90 | }, | ||
91 | |||
92 | //------------------------------------------------------------------------- | ||
93 | |||
94 | 'update': function (someObjects) { | ||
95 | varcardListPanel; | ||
96 | var i,c; | ||
97 | |||
98 | cardListPanel = this.getElement('cardListPanel'); | ||
99 | cardListPanel.innerHTML = ''; | ||
100 | |||
101 | c = someObjects.length; | ||
102 | |||
103 | for (i=0; i<c; i++) { | ||
104 | this.append(cardListPanel, {tag:'li', cls:'cardListItem', id:('cardListItem_' + someObjects[i]['_reference']), children:[ | ||
105 | {tag:'img', src:(someObjects[i]['favicon'] ? someObjects[i]['favicon'] : 'data:application/octet-stream;charset=utf-8;base64,AAABAAEAFxcAAAEAGAD8BgAAFgAAACgAAAAXAAAALgAAAAEAGAAAAAAAAAAAABIXAAASFwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////9zAC////////////////////////////////////////////////////////////////////////////////////////////9pAG////////////////////////////////////////////////////////////////////////////////////////////9rAC////////////////////////////////////////////////////////////////////////////////////////////9yAHP////////////////////////IyMizs7O6urrq6ur////////////Ozs6zs7Ozs7Pq6ur///////////////////////8AAAD////////////////////V1dWXl5eXl5eXl5elpaX4+Pj////Ozs6Xl5eXl5eXl5eenp7///////////////////////8AAAD////////////////////Ozs6Xl5eXl5eXl5eXl5fBwcHq6uqenp6Xl5eXl5eXl5eXl5f///////////////////////8AAAD////////////////////j4+OXl5eXl5eXl5eXl5eXl5elpaWXl5eXl5eXl5eXl5ezs7P///////////////////////8AAAD////////////////////////IyMiXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eenp7x8fH////////////////////////////////////////////////////4+PilpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5fOzs7////////////////////////////////////////////////////////q6uq6urqXl5eXl5eXl5eXl5eXl5eXl5eenp7V1dX4+Pj///////////////////////8AAAD////////////4+PjOzs6lpaWXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5e6urrj4+P///////////////8AAAD////////////BwcGXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fx8fH///////////8AAAD///////////+zs7OXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5fj4+P///////////8AAAD////////////IyMiXl5eXl5eXl5eXl5e6urqXl5eXl5eXl5eXl5esrKylpaWXl5eXl5eXl5eenp7x8fH///////////8AAAD////////////////Ozs7Ozs7V1dX4+Pj///+Xl5eXl5eXl5eXl5fOzs7////q6urOzs7Ozs7q6ur///////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD///////////////////////////////////+Xl5eXl5eXl5eXl5fOzs7///////////////////////////////////8AAAD////////////////////////////////////IyMiXl5eXl5eenp7x8fH///////////////////////////////////8AAAD////////////////////////////////////////j4+Pj4+Px8fH///////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAD///////////////////////////////////////////////////////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAo=')}, | ||
106 | {tag:'a', id:('cardListReference_' + someObjects[i]['_reference']), href:'#', html:someObjects[i]['label']} | ||
107 | ]}) | ||
108 | |||
109 | MochiKit.Signal.connect('cardListItem_' + someObjects[i]['_reference'], 'onclick', this, 'cardListClickHandler'); | ||
110 | } | ||
111 | |||
112 | }, | ||
113 | |||
114 | 'cardListClickHandler': function (anEvent) { | ||
115 | anEvent.preventDefault(); | ||
116 | |||
117 | if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { | ||
118 | var cardListReference; | ||
119 | |||
120 | cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; | ||
121 | //console.log("Showing detail for card named", cardListReference); | ||
122 | MochiKit.Signal.signal(this, 'selectedCard', cardListReference); | ||
123 | } | ||
124 | }, | ||
125 | |||
126 | //========================================================================= | ||
127 | |||
128 | 'cardDetail': function (someData) { | ||
129 | if (this._cardDetail == null) { | ||
130 | this._cardDetail = new Clipperz.PM.UI.iPhone.Components.CardDetail({element:this.getElement('cardDetail')}); | ||
131 | } | ||
132 | |||
133 | return this._cardDetail; | ||
134 | }, | ||
135 | |||
136 | //------------------------------------------------------------------------- | ||
137 | |||
138 | 'removeCardDetail': function () { | ||
139 | if (this._cardDetail != null) { | ||
140 | this._cardDetail.remove(); | ||
141 | this._cardDetail = null; | ||
142 | } | ||
143 | }, | ||
144 | |||
145 | //========================================================================= | ||
146 | |||
147 | 'showCard': function (someData) { | ||
148 | vardeferredResult; | ||
149 | varoffset; | ||
150 | |||
151 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | ||
152 | this.cardDetail().render(); | ||
153 | this.cardDetail().setCardReference(someData['_reference']); | ||
154 | MochiKit.Style.setElementPosition(this.cardDetail().element(), {x:offset}); | ||
155 | new MochiKit.Visual.Sequence([ | ||
156 | // new MochiKit.Visual.Move(this.cardDetail().element(), {x:offset, y:45, mode:'absolute', duration:0, sync:true}), | ||
157 | new MochiKit.Visual.Parallel([ | ||
158 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:-offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
159 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:0, y:45, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
160 | // new MochiKit.Visual.ScrollTo('toolbar', {sync:true}), | ||
161 | MochiKit.Visual.appear ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | ||
162 | ], {duration:1, sync:true}), | ||
163 | MochiKit.Visual.fade(this.getElement('cardList'), {duration:0, sync:true}) | ||
164 | ], {}) | ||
165 | |||
166 | MochiKit.DOM.getElement('pageTitle').innerHTML = someData['title']; | ||
167 | |||
168 | return true; | ||
169 | }, | ||
170 | |||
171 | //------------------------------------------------------------------------- | ||
172 | |||
173 | 'showCardDetails': function (someData) { | ||
174 | return this.cardDetail().showCardDetails(someData); | ||
175 | }, | ||
176 | |||
177 | //========================================================================= | ||
178 | |||
179 | 'backButtonClickHandler': function (anEvent) { | ||
180 | varoffset; | ||
181 | |||
182 | anEvent.preventDefault(); | ||
183 | |||
184 | MochiKit.DOM.getElement('pageTitle').innerHTML = "cards"; | ||
185 | |||
186 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | ||
187 | MochiKit.Style.setElementPosition(this.getElement('cardList'), {x:-offset}); | ||
188 | MochiKit.DOM.showElement(this.getElement('cardList')); | ||
189 | |||
190 | new MochiKit.Visual.Parallel([ | ||
191 | new MochiKit.Visual.Move(this.getElement('cardList'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
192 | new MochiKit.Visual.Move(this.getElement('cardDetail'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
193 | MochiKit.Visual.fade (this.getElement('cardDetail'), { transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
194 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | ||
195 | ], {duration:1, afterFinish:MochiKit.Base.method(this, 'removeCardDetail')}) | ||
196 | |||
197 | }, | ||
198 | |||
199 | //========================================================================= | ||
200 | __syntaxFix__: "syntax fix" | ||
201 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js deleted file mode 100644 index 5341878..0000000 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/LoginForm.js +++ b/dev/null | |||
@@ -1,178 +0,0 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Components'); | ||
27 | |||
28 | Clipperz.PM.UI.iPhone.Components.LoginForm = function(args) { | ||
29 | args = args || {}; | ||
30 | |||
31 | Clipperz.PM.UI.iPhone.Components.LoginForm.superclass.constructor.apply(this, arguments); | ||
32 | |||
33 | return this; | ||
34 | } | ||
35 | |||
36 | //============================================================================= | ||
37 | |||
38 | Clipperz.Base.extend(Clipperz.PM.UI.iPhone.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
39 | |||
40 | //------------------------------------------------------------------------- | ||
41 | |||
42 | 'toString': function () { | ||
43 | return "Clipperz.PM.UI.iPhone.Components.LoginForm component"; | ||
44 | }, | ||
45 | |||
46 | //------------------------------------------------------------------------- | ||
47 | |||
48 | 'focusOnUsername': function () { | ||
49 | this.getElement('username').focus(); | ||
50 | }, | ||
51 | |||
52 | //------------------------------------------------------------------------- | ||
53 | |||
54 | 'username': function () { | ||
55 | return this.getElement('username').value; | ||
56 | }, | ||
57 | |||
58 | 'passphrase': function () { | ||
59 | return this.getElement('passphrase').value; | ||
60 | }, | ||
61 | |||
62 | //------------------------------------------------------------------------- | ||
63 | |||
64 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
65 | this.append(this.element(), [ | ||
66 | {tag:'div', cls:'toolbar iPhoneClipperzToolbar', children:[ | ||
67 | {tag:'h1', id:'pageTitle', html:'Clipperz'}, | ||
68 | {tag:'a', id:'backButton', cls:'button', href:'#', html:"back"} | ||
69 | ]}, | ||
70 | {tag:'form', title:'Theaters', cls:'panel toolbarlessPanel loginForm', id:this.getId('loginFormPanel'), children:[ | ||
71 | {tag:'fieldset', id:this.getId('fieldset'), children:[ | ||
72 | {tag:'div', cls:'row', children:[ | ||
73 | {tag:'label', html:"username"}, | ||
74 | {tag:'input', type:'text', name:'username', value:"", autocorrect:'off', autocapitalize:'off', id:this.getId('username')} | ||
75 | ]}, | ||
76 | {tag:'div', cls:'row', children:[ | ||
77 | {tag:'label', html:"passphrase"}, | ||
78 | {tag:'input', type:'password', name:'passphrase', value:"", id:this.getId('passphrase')} | ||
79 | ]} | ||
80 | ]}, | ||
81 | {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Login", id:this.getId('submit')} | ||
82 | ]}, | ||
83 | {tag:'div', cls:'panel toolbarlessPanel loginProgressPanel', id:this.getId('loginProgressPanel'), children:[ | ||
84 | {tag:'div', id:this.getId('progressBar')} //, | ||
85 | // {tag:'a', cls:'whiteButton', type:'submit', href:'#', html:"Cancel", id:this.getId('cancel')} | ||
86 | ]}, | ||
87 | {tag:'div', cls:'panel loginErrorPanel', id:this.getId('loginErrorPanel'), children:[ | ||
88 | {tag:'div', cls:'errorMessage', id:this.getId('errorMessageBox'), children:[ | ||
89 | {tag:'h2', id:this.getId('errorMessage'), html:"Login failed"} | ||
90 | ]} | ||
91 | ]} | ||
92 | ]); | ||
93 | |||
94 | MochiKit.Signal.connect(this.getElement('submit'), 'onclick',this, 'submitHandler'); | ||
95 | MochiKit.Signal.connect(this.getElement('loginFormPanel'), 'onsubmit',this, 'submitHandler'); | ||
96 | |||
97 | // MochiKit.Signal.connect(this.getElement('cancel'), 'onclick',this, 'cancelHandler'); | ||
98 | MochiKit.Signal.connect('backButton', 'onclick',this, 'backHandler'); | ||
99 | |||
100 | this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':this.getElement('progressBar')})); | ||
101 | |||
102 | // MochiKit.Style.hideElement(this.getElement('errorMessage')); | ||
103 | |||
104 | this.showLoginForm(); | ||
105 | // MochiKit.Async.callLater(0.2, MochiKit.Base.method(this, 'focusOnUsername')); | ||
106 | }, | ||
107 | |||
108 | //------------------------------------------------------------------------- | ||
109 | |||
110 | 'showLoginForm': function () { | ||
111 | MochiKit.Style.showElement(this.getElement('loginFormPanel')); | ||
112 | MochiKit.Style.hideElement(this.getElement('loginProgressPanel')); | ||
113 | MochiKit.Style.hideElement(this.getElement('loginErrorPanel')); | ||
114 | MochiKit.Style.hideElement('backButton'); | ||
115 | }, | ||
116 | |||
117 | 'slideInLoginForm': function () { | ||
118 | varoffset; | ||
119 | |||
120 | offset = ((MochiKit.DOM.getNodeAttribute(MochiKit.DOM.currentDocument().body, 'orientation') == 'portrait') ? 320 : 480); | ||
121 | |||
122 | MochiKit.Style.showElement(this.getElement('loginFormPanel')); | ||
123 | MochiKit.Style.setElementPosition(this.getElement('loginFormPanel'), {x:-offset, y:0}); | ||
124 | |||
125 | new MochiKit.Visual.Sequence([ | ||
126 | new MochiKit.Visual.Parallel([ | ||
127 | new MochiKit.Visual.Move(this.getElement('loginErrorPanel'), {x:offset, y:0, mode:'relative',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
128 | new MochiKit.Visual.Move(this.getElement('loginFormPanel'), {x:0, y:0, mode:'absolute',transition:MochiKit.Visual.Transitions.linear, sync:true}), | ||
129 | MochiKit.Visual.fade ('backButton', { transition:MochiKit.Visual.Transitions.linear, sync:true}) | ||
130 | ], {duration:0.5, sync:true}), | ||
131 | MochiKit.Visual.fade(this.getElement('loginErrorPanel'), {duration:0, sync:true}) | ||
132 | ], {}) | ||
133 | }, | ||
134 | |||
135 | 'showLoginProgress': function () { | ||
136 | MochiKit.Style.hideElement(this.getElement('loginFormPanel')); | ||
137 | MochiKit.Style.showElement(this.getElement('loginProgressPanel')); | ||
138 | }, | ||
139 | |||
140 | 'showLoginError': function (anError) { | ||
141 | this.getElement('errorMessage').innerHTML = "Login error"; | ||
142 | |||
143 | MochiKit.Style.showElement('backButton'); | ||
144 | MochiKit.Style.hideElement(this.getElement('loginProgressPanel')); | ||
145 | MochiKit.Style.showElement(this.getElement('loginErrorPanel')); | ||
146 | MochiKit.Style.setElementPosition(this.getElement('loginErrorPanel'), {x:0, y:45}); | ||
147 | }, | ||
148 | |||
149 | //------------------------------------------------------------------------- | ||
150 | /* | ||
151 | 'disableCancelButton': function () { | ||
152 | MochiKit.DOM.hideElement(this.getElement('cancel')); | ||
153 | }, | ||
154 | */ | ||
155 | //------------------------------------------------------------------------- | ||
156 | |||
157 | 'submitHandler': function (anEvent) { | ||
158 | anEvent.preventDefault(); | ||
159 | |||
160 | MochiKit.Signal.signal(this, 'doLogin', {'username':this.username(), 'passphrase':this.passphrase()}); | ||
161 | }, | ||
162 | |||
163 | 'cancelHandler': function (anEvent) { | ||
164 | anEvent.preventDefault(); | ||
165 | |||
166 | //console.log("CANCEL"); | ||
167 | }, | ||
168 | |||
169 | 'backHandler': function (anEvent) { | ||
170 | anEvent.preventDefault(); | ||
171 | |||
172 | this.slideInLoginForm(); | ||
173 | }, | ||
174 | |||
175 | //------------------------------------------------------------------------- | ||
176 | |||
177 | __syntaxFix__: "syntax fix" | ||
178 | }); | ||
diff --git a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js b/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js deleted file mode 100644 index 3fcaae1..0000000 --- a/frontend/gamma/js/Clipperz/PM/UI/iPhone/Controllers/MainController.js +++ b/dev/null | |||
@@ -1,369 +0,0 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer to http://www.clipperz.com. | ||
9 | |||
10 | * Clipperz Community Edition is free software: you can redistribute | ||
11 | it and/or modify it under the terms of the GNU Affero General Public | ||
12 | License as published by the Free Software Foundation, either version | ||
13 | 3 of the License, or (at your option) any later version. | ||
14 | |||
15 | * Clipperz Community Edition is distributed in the hope that it will | ||
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
18 | See the GNU Affero General Public License for more details. | ||
19 | |||
20 | * You should have received a copy of the GNU Affero General Public | ||
21 | License along with Clipperz Community Edition. If not, see | ||
22 | <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | */ | ||
25 | |||
26 | Clipperz.Base.module('Clipperz.PM.UI.iPhone.Controllers'); | ||
27 | |||
28 | //Some parts of this controller have been derived from the iUI library. | ||
29 | |||
30 | Clipperz.PM.UI.iPhone.Controllers.MainController = function() { | ||
31 | this._loginForm = null; | ||
32 | this._cardList = null; | ||
33 | this._cachedValues =null; | ||
34 | this._user = null; | ||
35 | |||
36 | if (typeof window.onorientationchange == 'object') { | ||
37 | MochiKit.Signal.connect(window, 'onorientationchange', this, 'orientationChangeHandler'); | ||
38 | MochiKit.Async.callLater(0, MochiKit.Base.method(this, 'orientationChangeHandler')); | ||
39 | } else { | ||
40 | this.setOrientation('portrait'); | ||
41 | // this.setOrientation('landscape'); | ||
42 | } | ||
43 | |||
44 | this.addMetaTag('viewport', 'width=devicewidth; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;'); | ||
45 | this.addMetaTag('apple-mobile-web-app-capable', 'yes'); | ||
46 | this.addMetaTag('apple-mobile-web-app-status-bar-style', 'black'); | ||
47 | |||
48 | this.addLinkTag('apple-touch-icon', 'data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAAF8AAABfCAYAAACOTBv1AAAACXBIWXMAAAsTAAALEwEAmpwYAAAQC0lEQVR4nO2ce3wU1b3AvzOzz2TzBpKQhIS3CnLxgYoPqAgiQS8igiAqiFprtT571YpKUa9tvVgrVvhc7IXS4lUUvGgR5CWIoiAIYoQgJGDI+0k2yW42szNz7h8pGBHIPmazqeb7+UD4DHt+vzPfPTnnzJkzIwGCLqKCHO0K/JTpkh9FuuRHkS75UaRLfhTpkh9FuuRHkS75UaRLfhTpkh9FLNGuwKnIzc3l9WXLQAIhQILWvwQnjn3vUNtjkoQQ4kSZr77KY+TIkR1/EgHQKeWnp6eTkJiI0P2gqyeOnxD7T+ttxf/wp4SwOOnTp0/UzqM9OqV8oFXygSVIm3/xvePSKf59up/cWfO9z3c2OnmfH646qVMv2XZa+RKtrT8cWruoztv2O6384/15OLSODZ237Xda+W1nMKEiROe+U9Rp5ZtFJ+51Oq/8E/P7MOjE3oFOLL/1Iik8fUJoCF03pT6RoNPKF4Q/2zF0P0J0yQ8aM/pqoesIXQs/UITotPKFYRDuXMXQ/dDV8oNECIShgRGmOKFjGIY5dYoAnVK+QCB0DSNM+Ybmb/0SOylhy8/NzWXYsGFm1OU7hGhd0RThtdrW2Y758kdcdhGLX30h7Dhhr2ouWrSI9PQ0ykrLeHn+fBYsWIDX6w0zqsAwNOQwW77QtbBnTMdJSkzgkfvuZPqkXOJi7SAMLhl2Htt37gk5ZlgtPycnh7TU7oiGo6TH6zz/3DPUVpXz3qp3+Lch54YeWLR2OyLcbkcPf9wY/bNL2fjuMg7uWM09t11PnE1FaSwADB65746wYofV8ufMeQph6MhfvoT09atIWWORBt7GNaOv5urRWyktLeWll//MXxb/FZ/PF3BcgcDQVeRwux1DQxjBz1m7JSfx2IM/Z/J1Y3A5LUiShFK3G3vpWuw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OUdur6XA4WPDUbWRVr0D11CNbY5i3pzebPjNn7f9U9M7O5LWpyTSV5CFJYB08hbvmf0RpWUXEcp6JDunzT4Wmabz74ReIjBEMH9iNQwzhleWRbX317gbktCGcn6ZzICGX2597i4aGxojmbA8R7T/ZvTKF3W7rsHwDB/SL+jkDIqpbxH/qdMrX+f5U6JIfRbrkR5Eu+VGkS34U6ZIfRbrkR5Eu+VGkS34U6ZIfRbrkR5H/Bx8z6HmTXnicAAAAAElFTkSuQmCCCg=='); | ||
49 | //this.addLinkTag('apple-touch-startup-image', 'default.png'); | ||
50 | |||
51 | // if (!window.navigator.standalone)// not running as an installed app | ||
52 | |||
53 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'selectedDirectLogin', this, 'selectedDirectLoginHandler'); | ||
54 | |||
55 | MochiKit.DOM.addElementClass(document.body, 'iPhone'); | ||
56 | return this; | ||
57 | } | ||
58 | |||
59 | MochiKit.Base.update(Clipperz.PM.UI.iPhone.Controllers.MainController.prototype, { | ||
60 | |||
61 | 'toString': function () { | ||
62 | return "Clipperz.PM.UI.iPhone.Controllers.MainController"; | ||
63 | }, | ||
64 | |||
65 | //========================================================================= | ||
66 | |||
67 | 'user': function () { | ||
68 | return this._user; | ||
69 | }, | ||
70 | |||
71 | 'setUser': function (aValue) { | ||
72 | this._user = aValue; | ||
73 | }, | ||
74 | |||
75 | //========================================================================= | ||
76 | |||
77 | 'loginForm': function() { | ||
78 | if (this._loginForm == null) { | ||
79 | MochiKit.DOM.removeElement('mainDiv'); | ||
80 | this._loginForm = new Clipperz.PM.UI.iPhone.Components.LoginForm({element:MochiKit.DOM.currentDocument().body}); | ||
81 | MochiKit.Signal.connect(this._loginForm, 'doLogin', this, 'doLoginHandler') | ||
82 | } | ||
83 | |||
84 | return this._loginForm; | ||
85 | }, | ||
86 | |||
87 | 'removeLoginForm': function () { | ||
88 | if (this._loginForm != null) { | ||
89 | this._loginForm.remove(); | ||
90 | this._loginForm = null; | ||
91 | } | ||
92 | }, | ||
93 | |||
94 | //----------------------------------------------------------------------------- | ||
95 | |||
96 | 'cardList': function () { | ||
97 | if (this._cardList == null) { | ||
98 | this._cardList = new Clipperz.PM.UI.iPhone.Components.CardList({element:MochiKit.DOM.currentDocument().body}); | ||
99 | MochiKit.Signal.connect(this._cardList, 'searchEvent',this, 'searchEventHandler') | ||
100 | MochiKit.Signal.connect(this._cardList, 'selectedCard',this, 'selecetedCardHandler') | ||
101 | } | ||
102 | |||
103 | return this._cardList; | ||
104 | }, | ||
105 | |||
106 | //========================================================================= | ||
107 | |||
108 | 'currentWidth': function () { | ||
109 | return this._currentWidth; | ||
110 | }, | ||
111 | |||
112 | 'setCurrentWidth': function (aValue) { | ||
113 | this._currentWidth = aValue; | ||
114 | }, | ||
115 | |||
116 | //========================================================================= | ||
117 | |||
118 | 'orientationChangeHandler': function () { | ||
119 | switch(window.orientation) { | ||
120 | case 0: | ||
121 | this.setOrientation('portrait'); | ||
122 | break; | ||
123 | case 90: | ||
124 | case -90: | ||
125 | this.setOrientation('landscape'); | ||
126 | break; | ||
127 | } | ||
128 | }, | ||
129 | |||
130 | //------------------------------------------------------------------------- | ||
131 | |||
132 | 'setOrientation': function (anOrientation) { | ||
133 | document.body.setAttribute('orientation', anOrientation); | ||
134 | setTimeout(scrollTo, 100, 0, 1); | ||
135 | }, | ||
136 | |||
137 | //------------------------------------------------------------------------- | ||
138 | |||
139 | 'slidePages': function (fromPage, toPage, backwards) { | ||
140 | var axis; | ||
141 | var slideDone; | ||
142 | |||
143 | slideDone = function () { | ||
144 | // console.log("slideDone"); | ||
145 | if (!hasClass(toPage, "dialog")) { | ||
146 | fromPage.removeAttribute("selected"); | ||
147 | } | ||
148 | checkTimer = setInterval(checkOrientAndLocation, 300); | ||
149 | setTimeout(updatePage, 0, toPage, fromPage); | ||
150 | fromPage.removeEventListener('webkitTransitionEnd', slideDone, false); | ||
151 | } | ||
152 | |||
153 | axis = (backwards ? fromPage : toPage).getAttribute("axis"); | ||
154 | |||
155 | clearInterval(checkTimer); | ||
156 | |||
157 | if (canDoSlideAnim() && axis != 'y') { | ||
158 | slide2(fromPage, toPage, backwards, slideDone); | ||
159 | } else { | ||
160 | slide1(fromPage, toPage, backwards, axis, slideDone); | ||
161 | } | ||
162 | }, | ||
163 | |||
164 | //------------------------------------------------------------------------- | ||
165 | |||
166 | 'getCachedValues': function () { | ||
167 | var deferredResult; | ||
168 | |||
169 | if (this._cachedObjects != null) { | ||
170 | deferredResult = MochiKit.Async.succeed(this._cachedObjects); | ||
171 | } else { | ||
172 | deferredResult = new Clipperz.Async.Deferred("MainController.getCachedValues", {trace:false}); | ||
173 | deferredResult.addMethod(this.user(), 'getRecords'); | ||
174 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.getCachedValues - collectResults", { | ||
175 | '_rowObject': MochiKit.Async.succeed, | ||
176 | '_reference': MochiKit.Base.methodcaller('reference'), | ||
177 | 'label': MochiKit.Base.methodcaller('label'), | ||
178 | 'favicon': MochiKit.Base.methodcaller('favicon'), | ||
179 | '_searchableContent':MochiKit.Base.methodcaller('searchableContent') | ||
180 | }, {trace:false})); | ||
181 | deferredResult.addCallback(Clipperz.Async.collectAll); | ||
182 | deferredResult.addCallback(MochiKit.Base.bind(function (someRows) { | ||
183 | this._cachedObjects = someRows; | ||
184 | return this._cachedObjects; | ||
185 | }, this)); | ||
186 | deferredResult.callback(); | ||
187 | } | ||
188 | |||
189 | return deferredResult; | ||
190 | }, | ||
191 | //========================================================================= | ||
192 | |||
193 | 'run': function(shouldShowRegistrationForm) { | ||
194 | this.loginForm().render(); | ||
195 | MochiKit.Async.callLater(1, MochiKit.Base.method(this.loginForm(), 'focusOnUsername')); | ||
196 | }, | ||
197 | |||
198 | //========================================================================= | ||
199 | |||
200 | 'doLoginHandler': function (someArgs) { | ||
201 | var deferredResult; | ||
202 | varparameters; | ||
203 | varshouldUseOTP; | ||
204 | // var loginProgress; | ||
205 | varuser; | ||
206 | var getPassphraseDelegate; | ||
207 | |||
208 | parameters = someArgs; | ||
209 | shouldUseOTP = (typeof(parameters.passphrase) == 'undefined'); | ||
210 | |||
211 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); | ||
212 | user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':getPassphraseDelegate}); | ||
213 | |||
214 | deferredResult = new Clipperz.Async.Deferred("MainController.doLogin", {trace:false}); | ||
215 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); | ||
216 | deferredResult.addMethod(this.loginForm(), 'showLoginProgress'); | ||
217 | deferredResult.addCallback(MochiKit.Async.wait, 0.1); | ||
218 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); | ||
219 | deferredResult.addMethod(user, 'login'); | ||
220 | deferredResult.addMethod(this, 'setUser', user); | ||
221 | deferredResult.addMethod(user, 'getRecords'); | ||
222 | deferredResult.addMethod(this, 'removeLoginForm'); | ||
223 | deferredResult.addMethod(this.cardList(), 'render'); | ||
224 | deferredResult.addMethod(this, 'displaySelectedRecords', ''); | ||
225 | deferredResult.addErrback(MochiKit.Base.method(this.loginForm(), 'showLoginError')); | ||
226 | deferredResult.callback(); | ||
227 | |||
228 | return deferredResult; | ||
229 | }, | ||
230 | |||
231 | //========================================================================= | ||
232 | |||
233 | 'searchEventHandler': function (aValue) { | ||
234 | //console.log("searching for ... " + aValue); | ||
235 | return this.displaySelectedRecords(aValue); | ||
236 | }, | ||
237 | |||
238 | //========================================================================= | ||
239 | |||
240 | '_displaySelectedRows': function (aFilter, someRows) { | ||
241 | var result; | ||
242 | |||
243 | result = someRows; | ||
244 | |||
245 | if (aFilter != null) { | ||
246 | var filter; | ||
247 | varfilterRegExp; | ||
248 | |||
249 | filter = aFilter.replace(/[^A-Za-z0-9]/g, "\\$&"); | ||
250 | filterRegExp = new RegExp(filter, "i"); | ||
251 | result = MochiKit.Base.filter(function (aCachedResult) { return filterRegExp.test(aCachedResult['_searchableContent'])}, result); | ||
252 | } | ||
253 | |||
254 | |||
255 | result.sort(MochiKit.Base.partial(function (aKey, aComparator, aObject, bObject) { | ||
256 | return aComparator(aObject[aKey], bObject[aKey]); | ||
257 | }, 'label', Clipperz.Base.caseInsensitiveCompare)); | ||
258 | |||
259 | this.cardList().update(result); | ||
260 | }, | ||
261 | |||
262 | //------------------------------------------------------------------------- | ||
263 | |||
264 | 'displaySelectedRecords': function (aFilter) { | ||
265 | return Clipperz.Async.callbacks("MainController.displaySelectedrows", [ | ||
266 | MochiKit.Base.method(this, 'getCachedValues'), | ||
267 | MochiKit.Base.method(this, '_displaySelectedRows', aFilter) | ||
268 | ], {trace:false}); | ||
269 | }, | ||
270 | |||
271 | //========================================================================= | ||
272 | |||
273 | 'selecetedCardHandler': function (aRecordReference) { | ||
274 | vardeferredResult; | ||
275 | varrecordData; | ||
276 | |||
277 | recordData = {}; | ||
278 | //console.log("Showing detail for card with reference", aRecordReference); | ||
279 | deferredResult = new Clipperz.Async.Deferred("MainController.selectedCardHandler", {trace:false}); | ||
280 | deferredResult.addMethod(this.user(), 'getRecord', aRecordReference); | ||
281 | deferredResult.collectResults({ | ||
282 | '_reference':MochiKit.Base.methodcaller('reference'), | ||
283 | 'title': MochiKit.Base.methodcaller('label'), | ||
284 | 'favicon': MochiKit.Base.methodcaller('favicon') | ||
285 | }); | ||
286 | deferredResult.addCallback(function (someData) { | ||
287 | MochiKit.Base.update(recordData, someData); | ||
288 | }) | ||
289 | deferredResult.addMethod(this.cardList(), 'showCard', recordData); | ||
290 | |||
291 | deferredResult.addMethod(this.user(), 'getRecord', aRecordReference); | ||
292 | deferredResult.addMethodcaller('notes'); | ||
293 | deferredResult.addCallback(function (someNotes) { | ||
294 | recordData['notes'] = someNotes; | ||
295 | }) | ||
296 | |||
297 | deferredResult.addMethod(this.user(), 'getRecord', aRecordReference); | ||
298 | deferredResult.addMethodcaller('getCurrentRecordVersion'); | ||
299 | deferredResult.addMethodcaller('fields'); | ||
300 | deferredResult.addCallback(MochiKit.Base.values); | ||
301 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.selectedCardHandler - fields", { | ||
302 | 'label':MochiKit.Base.methodcaller('label'), | ||
303 | 'value':MochiKit.Base.methodcaller('value'), | ||
304 | 'isHidden':MochiKit.Base.methodcaller('isHidden') | ||
305 | }, {trace:false})); | ||
306 | deferredResult.addCallback(Clipperz.Async.collectAll); | ||
307 | deferredResult.addCallback(function (someData) { | ||
308 | recordData['fields'] = someData; | ||
309 | }); | ||
310 | |||
311 | deferredResult.addMethod(this.user(), 'getRecord', aRecordReference); | ||
312 | deferredResult.addMethodcaller('directLogins'); | ||
313 | deferredResult.addCallback(MochiKit.Base.values); | ||
314 | deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("MainController.selectedCardHandler - directLogins", { | ||
315 | 'label': MochiKit.Base.methodcaller('label'), | ||
316 | 'favicon': MochiKit.Base.methodcaller('favicon'), | ||
317 | '_reference':MochiKit.Base.methodcaller('reference') | ||
318 | }, {trace:false})); | ||
319 | deferredResult.addCallback(Clipperz.Async.collectAll); | ||
320 | deferredResult.addCallback(function (someData) { | ||
321 | recordData['directLogins'] = someData; | ||
322 | }); | ||
323 | |||
324 | deferredResult.addMethod(this.cardList(), 'showCardDetails', recordData); | ||
325 | deferredResult.callback(); | ||
326 | |||
327 | return deferredResult; | ||
328 | }, | ||
329 | |||
330 | //========================================================================= | ||
331 | |||
332 | 'selectedDirectLoginHandler': function (someData) { | ||
333 | vardeferredResult; | ||
334 | |||
335 | //console.log("<<< signal - directLogin"); | ||
336 | deferredResult = new Clipperz.Async.Deferred("MainController.selectedDirectLoginHandler", {trace:false}); | ||
337 | deferredResult.addMethod(this.user(), 'getRecord', someData['cardReference']); | ||
338 | deferredResult.addMethodcaller('directLogins'); | ||
339 | deferredResult.addCallback(MochiKit.Base.itemgetter(someData['directLoginReference'])); | ||
340 | // deferredResult.addMethodcaller('runDirectLogin'); | ||
341 | deferredResult.addCallback(Clipperz.PM.UI.Common.Controllers.DirectLoginRunner.openDirectLogin); | ||
342 | deferredResult.callback(); | ||
343 | |||
344 | return deferredResult; | ||
345 | }, | ||
346 | |||
347 | //========================================================================= | ||
348 | |||
349 | 'addMetaTag': function (aName, aContent) { | ||
350 | varmetaTag; | ||
351 | |||
352 | metaTag = document.createElement('meta'); | ||
353 | metaTag.name = aName; | ||
354 | metaTag.content = aContent; | ||
355 | document.getElementsByTagName('head')[0].appendChild(metaTag); | ||
356 | }, | ||
357 | |||
358 | 'addLinkTag': function (aRel, anHref) { | ||
359 | var linkTag; | ||
360 | |||
361 | linkTag = document.createElement('link'); | ||
362 | linkTag.rel = aRel; | ||
363 | linkTag.href = anHref; | ||
364 | document.getElementsByTagName('head')[0].appendChild(linkTag); | ||
365 | }, | ||
366 | |||
367 | //========================================================================= | ||
368 | __syntaxFix__: "syntax fix" | ||
369 | }); \ No newline at end of file | ||