Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js | 22 |
1 files changed, 10 insertions, 12 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 f58f0b8..68b5b9f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/CardsController.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Web.Controllers.CardsController = function() { | 26 | Clipperz.PM.UI.Web.Controllers.CardsController = function() { |
29 | Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); | 27 | Clipperz.PM.UI.Web.Controllers.CardsController.superclass.constructor.apply(this, arguments); |
30 | 28 | ||
31 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard'); | 29 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'cardDialogComponentClosed', this, 'handleHideCard'); |
32 | 30 | ||
33 | return this; | 31 | return this; |
34 | } | 32 | } |
35 | 33 | ||
36 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, { | 34 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardsController, Clipperz.PM.UI.Web.Controllers.GridController, { |
37 | 35 | ||
38 | 'toString': function() { | 36 | 'toString': function() { |
39 | return "Clipperz.PM.UI.Web.Controllers.CardsController"; | 37 | return "Clipperz.PM.UI.Web.Controllers.CardsController"; |
40 | }, | 38 | }, |
41 | 39 | ||
42 | 'createGrid': function () { | 40 | 'createGrid': function () { |
43 | var grid; | 41 | var grid; |
44 | 42 | ||
45 | grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ | 43 | grid = new Clipperz.PM.UI.Web.Components.GridComponent({columnsManagers: [ |
46 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ | 44 | new Clipperz.PM.UI.Web.Components.FaviconColumnManager({ |
47 | 'name': 'Cards.favicon', | 45 | 'name': 'Cards.favicon', |
48 | 'selector': MochiKit.Base.methodcaller('favicon'), | 46 | 'selector': MochiKit.Base.methodcaller('favicon'), |
49 | 'cssClass': 'favicon' | 47 | 'cssClass': 'favicon' |
50 | }), | 48 | }), |
51 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ | 49 | new Clipperz.PM.UI.Web.Components.LinkColumnManager({ |
52 | 'name': 'Cards.title', | 50 | 'name': 'Cards.title', |
53 | 'selector': MochiKit.Base.methodcaller('label'), | 51 | 'selector': MochiKit.Base.methodcaller('label'), |
54 | 'label': 'title', | 52 | 'label': 'title', |
55 | 'cssClass': 'title', | 53 | 'cssClass': 'title', |
56 | 'comparator': Clipperz.Base.caseInsensitiveCompare, | 54 | 'comparator': Clipperz.Base.caseInsensitiveCompare, |
57 | 'sortable': true, | 55 | 'sortable': true, |
58 | 'sorted': 'ASCENDING', | 56 | 'sorted': 'ASCENDING', |
59 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})} | 57 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'editCard', {objectData:anObject, element:anEvent.src()})} |
60 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') | 58 | 'actionMethod': MochiKit.Base.method(this, 'handleShowCard') |
61 | }), | 59 | }), |
62 | new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({ | 60 | new Clipperz.PM.UI.Web.Components.DirectLoginsColumnManager({ |
63 | 'name': 'Cards.directLogins', | 61 | 'name': 'Cards.directLogins', |
64 | 'selector': MochiKit.Base.methodcaller('directLoginReferences'), | 62 | 'selector': MochiKit.Base.methodcaller('directLoginReferences'), |
65 | 'label': 'direct logins', | 63 | 'label': 'direct logins', |
66 | 'cssClass': 'directLogin' | 64 | 'cssClass': 'directLogin' |
67 | }), | 65 | }), |
68 | new Clipperz.PM.UI.Web.Components.DateColumnManager({ | 66 | new Clipperz.PM.UI.Web.Components.DateColumnManager({ |
69 | 'name': 'Cards.latestUpdate', | 67 | 'name': 'Cards.latestUpdate', |
70 | 'selector': MochiKit.Base.methodcaller('updateDate'), | 68 | 'selector': MochiKit.Base.methodcaller('updateDate'), |
71 | 'label': 'latest update', | 69 | 'label': 'latest update', |
72 | 'cssClass': 'latestUpdate', | 70 | 'cssClass': 'latestUpdate', |
73 | 'format': 'd-m-Y', | 71 | 'format': 'd-m-Y', |
74 | 'comparator': MochiKit.Base.compare, | 72 | 'comparator': MochiKit.Base.compare, |
75 | 'sortable': true, | 73 | 'sortable': true, |
76 | 'sorted': 'UNSORTED' | 74 | 'sorted': 'UNSORTED' |
77 | }), | 75 | }), |
78 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ | 76 | new Clipperz.PM.UI.Web.Components.DeleteObjectColumnManager({ |
79 | 'name': 'Cards.delete', | 77 | 'name': 'Cards.delete', |
80 | 'selector': MochiKit.Base.noop, | 78 | 'selector': MochiKit.Base.noop, |
81 | 'cssClass': 'delete', | 79 | 'cssClass': 'delete', |
82 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})} | 80 | // 'actionMethod': function(anObject, anEvent) { MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'deleteCard', {objectData:anObject, element:anEvent.src()})} |
83 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard') | 81 | 'actionMethod': MochiKit.Base.method(this, 'handleDeleteCard') |
84 | }) | 82 | }) |
85 | ]}); | 83 | ]}); |
86 | 84 | ||
87 | grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot'); | 85 | grid.setComponentForSlotNamed(new Clipperz.PM.UI.Web.Components.BookmarkletComponent(), 'headerSlot'); |
88 | 86 | ||
89 | return grid; | 87 | return grid; |
90 | }, | 88 | }, |
91 | 89 | ||
92 | //----------------------------------------------------------------------------- | 90 | //----------------------------------------------------------------------------- |
93 | 91 | ||
94 | 'getRows': function () { | 92 | 'getRows': function () { |
95 | //TODO relying on user() in GridController, bad code smell :| | 93 | //TODO relying on user() in GridController, bad code smell :| |
96 | return this.user().getRecords(); | 94 | return this.user().getRecords(); |
97 | }, | 95 | }, |
98 | 96 | ||
99 | //============================================================================= | 97 | //============================================================================= |
100 | 98 | ||
101 | 'displayEmptyContent': function () { | 99 | 'displayEmptyContent': function () { |
102 | varemptyGridComponent; | 100 | varemptyGridComponent; |
103 | 101 | ||
104 | emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent(); | 102 | emptyGridComponent = new Clipperz.PM.UI.Web.Components.CreateNewCardSplashComponent(); |
105 | 103 | ||
106 | return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [ | 104 | return Clipperz.Async.callbacks("CardsController.displayEmptyContent", [ |
107 | MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent), | 105 | MochiKit.Base.method(this.grid(), 'setNoRowsGridComponent', emptyGridComponent), |
108 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this) | 106 | MochiKit.Base.bind(Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displayEmptyContent, this) |
109 | ], {trace:false}); | 107 | ], {trace:false}); |
110 | }, | 108 | }, |
111 | 109 | ||
112 | 'displaySelectedRows': function (aFilter) { | 110 | 'displaySelectedRows': function (aFilter) { |
113 | this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup(); | 111 | this.columnManagerWithName('Cards.directLogins').hideDirectLoginListPopup(); |
114 | 112 | ||
115 | return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments); | 113 | return Clipperz.PM.UI.Web.Controllers.CardsController.superclass.displaySelectedRows.apply(this, arguments); |
116 | }, | 114 | }, |
117 | 115 | ||
118 | //============================================================================= | 116 | //============================================================================= |