summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
authorClipperz <info@clipperz.com>2013-01-31 13:42:04 (UTC)
committer Clipperz <info@clipperz.com>2013-01-31 13:42:04 (UTC)
commit07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff)
treef7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
parent767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff)
downloadclipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip
clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz
clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2
Updated Copyright claims
- updated reference dates; - removed reference to Community Edition; - normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js26
1 files changed, 10 insertions, 16 deletions
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 a4aa212..a0e4879 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/CardList.js
@@ -1,30 +1,28 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); 24Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components');
27 25
28Clipperz.PM.UI.Mobile.Components.CardList = function(args) { 26Clipperz.PM.UI.Mobile.Components.CardList = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
@@ -85,29 +83,27 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.C
85 cardInfo = { 83 cardInfo = {
86 '_rowObject': MochiKit.Async.succeed, 84 '_rowObject': MochiKit.Async.succeed,
87 '_reference': MochiKit.Base.methodcaller('reference'), 85 '_reference': MochiKit.Base.methodcaller('reference'),
88 '_searchableContent':MochiKit.Base.methodcaller('searchableContent'), 86 '_searchableContent':MochiKit.Base.methodcaller('searchableContent'),
89 'label': MochiKit.Base.methodcaller('label'), 87 'label': MochiKit.Base.methodcaller('label'),
90 'favicon': MochiKit.Base.methodcaller('favicon') 88 'favicon': MochiKit.Base.methodcaller('favicon')
91 }; 89 };
92 90
93//console.log("someCards", someCards);
94 deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false}); 91 deferredResult = new Clipperz.Async.Deferred("CardList.showCards", {trace:false});
95 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false})); 92 deferredResult.addCallback(MochiKit.Base.map, Clipperz.Async.collectResults("CardList.value - collectResults", cardInfo, {trace:false}));
96 deferredResult.addCallback(Clipperz.Async.collectAll); 93 deferredResult.addCallback(Clipperz.Async.collectAll);
97 deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label'))); 94 deferredResult.addCallback(MochiKit.Base.methodcaller('sort', Clipperz.Base.caseInsensitiveKeyComparator('label')));
98 deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement); 95 deferredResult.addCallbackPass(MochiKit.DOM.replaceChildNodes, cardListElement);
99 // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading'); 96 // deferredResult.addCallbackPass(MochiKit.DOM.removeElementClass, cardListElement, 'loading');
100 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement)); 97 deferredResult.addCallback(MochiKit.Base.map, MochiKit.Base.method(this, 'appendCardToList', cardListElement));
101 deferredResult.callback(someCards); 98 deferredResult.callback(someCards);
102 }, 99 },
103 100
104 'appendCardToList': function (aCardListElement, aCardInfo) { 101 'appendCardToList': function (aCardListElement, aCardInfo) {
105//console.log("appendCardToList", aCardInfo);
106 this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[ 102 this.append(aCardListElement, {tag:'li', cls:'cardListItem arrow', cardreference:aCardInfo['_reference'], children:[
107 {tag:'a', href:'#', html:aCardInfo['label'], children:[ 103 {tag:'a', href:'#', html:aCardInfo['label'], children:[
108 {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]} 104 {tag:'small', cls:'favicon', children:[{tag:'img', cls:'favicon', src:aCardInfo['favicon']}]}
109 ]} 105 ]}
110 ]}); 106 ]});
111 }, 107 },
112 108
113 'cardSelectionHandler': function (anEvent) { 109 'cardSelectionHandler': function (anEvent) {
@@ -116,17 +112,16 @@ Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.CardList, Clipperz.PM.UI.C
116 112
117 anEvent.preventDefault(); 113 anEvent.preventDefault();
118 114
119 listElement = anEvent.target(); 115 listElement = anEvent.target();
120 if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) { 116 if (MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') == null) {
121 listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem'); 117 listElement = MochiKit.DOM.getFirstParentByTagAndClassName(anEvent.target(), tagName='li', className='cardListItem');
122 } 118 }
123 cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference'); 119 cardReference = MochiKit.DOM.getNodeAttribute(listElement, 'cardreference');
124console.log("###", listElement, cardReference);
125 //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected 120 //TODO: Notify card with reference MochiKit.DOM.getNodeAttribute(listElement, 'cardreference') has been selected
126 MochiKit.Signal.signal(this, 'selectedCard', cardReference); 121 MochiKit.Signal.signal(this, 'selectedCard', cardReference);
127 }, 122 },
128 123
129 //------------------------------------------------------------------------- 124 //-------------------------------------------------------------------------
130/* 125/*
131 'searchHandler': function (anEvent) { 126 'searchHandler': function (anEvent) {
132 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN 127 if ((typeof(anEvent.key()) != 'undefined') && (anEvent.key().string == 'KEY_ENTER')) { //RETURN
@@ -166,17 +161,16 @@ console.log("###", listElement, cardReference);
166 161
167 'cardListClickHandler': function (anEvent) { 162 'cardListClickHandler': function (anEvent) {
168 anEvent.preventDefault(); 163 anEvent.preventDefault();
169 164
170 if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) { 165 if (/(cardListReference_|cardListItem_)/.test(anEvent.target().id)) {
171 var cardListReference; 166 var cardListReference;
172 167
173 cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2]; 168 cardListReference = anEvent.target().id.match(/(cardListReference_|cardListItem_)(.*)/)[2];
174//console.log("Showing detail for card named", cardListReference);
175 MochiKit.Signal.signal(this, 'selectedCard', cardListReference); 169 MochiKit.Signal.signal(this, 'selectedCard', cardListReference);
176 } 170 }
177 }, 171 },
178 172
179 //========================================================================= 173 //=========================================================================
180 174
181 'cardDetail': function (someData) { 175 'cardDetail': function (someData) {
182 if (this._cardDetail == null) { 176 if (this._cardDetail == null) {