Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js index b1a34b2..f58f0b8 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js | |||
@@ -1,120 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
30 | 27 | ||
31 | Clipperz.PM.UI.Web.Controllers.CardsController = function() { | 28 | Clipperz.PM.UI.Web.Controllers.CardsController = function() { |
32 | Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); | 29 | Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); |
33 | 30 | ||
34 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard'); | 31 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard'); |
35 | 32 | ||
36 | return this; | 33 | return this; |
37 | } | 34 | } |
38 | 35 | ||
39 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, { | 36 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, { |
40 | 37 | ||
41 | 'toString': function() { | 38 | 'toString': function() { |
42 | return "Clipperz.PM.UI.Web.Controllers.CardsController"; | 39 | return "Clipperz.PM.UI.Web.Controllers.CardsController"; |
43 | }, | 40 | }, |
44 | 41 | ||
45 | 'createGrid': function () { | 42 | 'createGrid': function () { |
46 | var grid; | 43 | var grid; |
47 | 44 | ||
48 | grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ | 45 | grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ |
49 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ | 46 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ |
50 | 'name': 'Cards.favicon', | 47 | 'name': 'Cards.favicon', |
51 | 'selector': MochiKit.Base.methodcaller('favicon'), | 48 | 'selector': MochiKit.Base.methodcaller('favicon'), |
52 | 'cssClass': 'favicon' | 49 | 'cssClass': 'favicon' |
53 | }), | 50 | }), |
54 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ | 51 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ |
55 | 'name': 'Cards.title', | 52 | 'name': 'Cards.title', |
56 | 'selector': MochiKit.Base.methodcaller('label'), | 53 | 'selector': MochiKit.Base.methodcaller('label'), |
57 | 'label': 'title', | 54 | 'label': 'title', |
58 | 'cssClass': 'title', | 55 | 'cssClass': 'title', |
59 | 'comparator': Clipperz.Base.caseInsensitiveCompare, | 56 | 'comparator': Clipperz.Base.caseInsensitiveCompare, |
60 | 'sortable': true, | 57 | 'sortable': true, |
61 | 'sorted': 'ASCENDING', | 58 | 'sorted': 'ASCENDING', |
62 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})} | 59 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})} |
63 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') | 60 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') |
64 | }), | 61 | }), |
65 | new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({ | 62 | new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({ |
66 | 'name': 'Cards.directLogins', | 63 | 'name': 'Cards.directLogins', |
67 | 'selector': MochiKit.Base.methodcaller('directLoginReferences'), | 64 | 'selector': MochiKit.Base.methodcaller('directLoginReferences'), |
68 | 'label': 'direct logins', | 65 | 'label': 'direct logins', |
69 | 'cssClass': 'directLogin' | 66 | 'cssClass': 'directLogin' |
70 | }), | 67 | }), |
71 | new Clipperz.PM.UI.Web.Components.DateColumnManager({ | 68 | new Clipperz.PM.UI.Web.Components.DateColumnManager({ |
72 | 'name': 'Cards.latestUpdate', | 69 | 'name': 'Cards.latestUpdate', |
73 | 'selector': MochiKit.Base.methodcaller('updateDate'), | 70 | 'selector': MochiKit.Base.methodcaller('updateDate'), |
74 | 'label': 'latest update', | 71 | 'label': 'latest update', |
75 | 'cssClass': 'latestUpdate', | 72 | 'cssClass': 'latestUpdate', |
76 | 'format': 'd-m-Y', | 73 | 'format': 'd-m-Y', |
77 | 'comparator': MochiKit.Base.compare, | 74 | 'comparator': MochiKit.Base.compare, |
78 | 'sortable': true, | 75 | 'sortable': true, |
79 | 'sorted': 'UNSORTED' | 76 | 'sorted': 'UNSORTED' |
80 | }), | 77 | }), |
81 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ | 78 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ |
82 | 'name': 'Cards.delete', | 79 | 'name': 'Cards.delete', |
83 | 'selector': MochiKit.Base.noop, | 80 | 'selector': MochiKit.Base.noop, |
84 | 'cssClass': 'delete', | 81 | 'cssClass': 'delete', |
85 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})} | 82 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})} |
86 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard') | 83 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard') |
87 | }) | 84 | }) |
88 | ]}); | 85 | ]}); |
89 | 86 | ||
90 | grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot'); | 87 | grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot'); |
91 | 88 | ||
92 | return grid; | 89 | return grid; |
93 | }, | 90 | }, |
94 | 91 | ||
95 | //----------------------------------------------------------------------------- | 92 | //----------------------------------------------------------------------------- |
96 | 93 | ||
97 | 'getRows': function () { | 94 | 'getRows': function () { |
98 | //TODO relying on user() in GridController, bad code smell :| | 95 | //TODO relying on user() in GridController, bad code smell :| |
99 | return this.user().getRecords(); | 96 | return this.user().getRecords(); |
100 | }, | 97 | }, |
101 | 98 | ||
102 | //============================================================================= | 99 | //============================================================================= |
103 | 100 | ||
104 | 'displayEmptyContent': function () { | 101 | 'displayEmptyContent': function () { |
105 | varemptyGridComponent; | 102 | varemptyGridComponent; |
106 | 103 | ||
107 | emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent(); | 104 | emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent(); |
108 | 105 | ||
109 | return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [ | 106 | return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [ |
110 | MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent), | 107 | MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent), |
111 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this) | 108 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this) |
112 | ], {trace:false}); | 109 | ], {trace:false}); |
113 | }, | 110 | }, |
114 | 111 | ||
115 | 'displaySelectedRows': function (aFilter) { | 112 | 'displaySelectedRows': function (aFilter) { |
116 | this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup(); | 113 | this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup(); |
117 | 114 | ||
118 | return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments); | 115 | return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments); |
119 | }, | 116 | }, |
120 | 117 | ||