Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/iPhone/Components/CardList.js | 201 |
1 files changed, 0 insertions, 201 deletions
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 | }); | ||