Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js index 8bb3016..44fbdef 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/GridController.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.GridController = function(args) { | 26 | Clipperz.PM.UI.Web.Controllers.GridController = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args); | 29 | Clipperz.PM.UI.Web.Controllers.GridController.superclass.constructor.call(this, args); |
32 | 30 | ||
33 | this._grid = null; | 31 | this._grid = null; |
34 | this._user = null; | 32 | this._user = null; |
35 | this._sortedColumnManager = null; | 33 | this._sortedColumnManager = null; |
36 | this._cachedObjects = null; | 34 | this._cachedObjects = null; |
37 | this._filterController = args.filterController || null; | 35 | this._filterController = args.filterController || null; |
38 | 36 | ||
39 | this._deferredDisplaySelectedRowsInvocation = null; | 37 | this._deferredDisplaySelectedRowsInvocation = null; |
40 | 38 | ||
41 | return this; | 39 | return this; |
42 | }; | 40 | }; |
43 | 41 | ||
44 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, { | 42 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.GridController, Object, { |
45 | 43 | ||
46 | 'toString': function() { | 44 | 'toString': function() { |
47 | return "Clipperz.PM.UI.Web.Controllers.GridController"; | 45 | return "Clipperz.PM.UI.Web.Controllers.GridController"; |
48 | }, | 46 | }, |
49 | 47 | ||
50 | //----------------------------------------------------------------------------- | 48 | //----------------------------------------------------------------------------- |
51 | 49 | ||
52 | 'createGrid': function () { | 50 | 'createGrid': function () { |
53 | throw Clipperz.Base.exception.AbstractMethod; | 51 | throw Clipperz.Base.exception.AbstractMethod; |
54 | }, | 52 | }, |
55 | 53 | ||
56 | 'setupWithGrid': function (aGrid) { | 54 | 'setupWithGrid': function (aGrid) { |
57 | this._grid = aGrid; | 55 | this._grid = aGrid; |
58 | 56 | ||
59 | if (this._grid != null) { | 57 | if (this._grid != null) { |
60 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { | 58 | MochiKit.Iter.forEach(this.columnsManagers(), function (aColumnManager) { |
61 | if (aColumnManager.isSortable()) { | 59 | if (aColumnManager.isSortable()) { |
62 | if (aColumnManager.isSorted()) { | 60 | if (aColumnManager.isSorted()) { |
63 | this.setSortedColumnManager(aColumnManager); | 61 | this.setSortedColumnManager(aColumnManager); |
64 | } | 62 | } |
65 | MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort'); | 63 | MochiKit.Signal.connect(aColumnManager, 'sort', this, 'handleColumnManagerSort'); |
66 | } | 64 | } |
67 | MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow'); | 65 | MochiKit.Signal.connect(aColumnManager, 'selectRow', this, 'handleColumnManagerSelectRow'); |
68 | MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow'); | 66 | MochiKit.Signal.connect(aColumnManager, 'unselectRow', this, 'handleColumnManagerUnselectRow'); |
69 | }, this); | 67 | }, this); |
70 | } | 68 | } |
71 | }, | 69 | }, |
72 | 70 | ||
73 | 'grid': function() { | 71 | 'grid': function() { |
74 | if (this._grid == null) { | 72 | if (this._grid == null) { |
75 | this.setupWithGrid(this.createGrid()); | 73 | this.setupWithGrid(this.createGrid()); |
76 | } | 74 | } |
77 | 75 | ||
78 | return this._grid; | 76 | return this._grid; |
79 | }, | 77 | }, |
80 | 78 | ||
81 | 'filterController': function () { | 79 | 'filterController': function () { |
82 | //Clipperz.log('GridController.filterController >>>', this._filterController); | 80 | //Clipperz.log('GridController.filterController >>>', this._filterController); |
83 | if (this._filterController == null) { | 81 | if (this._filterController == null) { |
84 | this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); | 82 | this._filterController = new Clipperz.PM.UI.Web.Controllers.FilterController(); |
85 | } | 83 | } |
86 | //Clipperz.log('GridController.filterController <<<', this._filterController); | 84 | //Clipperz.log('GridController.filterController <<<', this._filterController); |
87 | return this._filterController; | 85 | return this._filterController; |
88 | }, | 86 | }, |
89 | 87 | ||
90 | //----------------------------------------------------------------------------- | 88 | //----------------------------------------------------------------------------- |
91 | 89 | ||
92 | 'columnsManagers': function () { | 90 | 'columnsManagers': function () { |
93 | return this.grid().columnsManagers(); | 91 | return this.grid().columnsManagers(); |
94 | }, | 92 | }, |
95 | 93 | ||
96 | 'columnManagerWithName': function (aName) { | 94 | 'columnManagerWithName': function (aName) { |
97 | varmanagers; | 95 | varmanagers; |
98 | var result; | 96 | var result; |
99 | 97 | ||
100 | managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers()); | 98 | managers = MochiKit.Base.filter(function (aManager) { return aManager.name() == aName; } , this.columnsManagers()); |
101 | 99 | ||
102 | if (managers.length == 1) { | 100 | if (managers.length == 1) { |
103 | result = managers[0]; | 101 | result = managers[0]; |
104 | } else if (managers.length == 0) { | 102 | } else if (managers.length == 0) { |
105 | result = null; | 103 | result = null; |
106 | } else { | 104 | } else { |
107 | throw "WTF!!!"; | 105 | throw "WTF!!!"; |
108 | } | 106 | } |
109 | 107 | ||
110 | return result; | 108 | return result; |
111 | }, | 109 | }, |
112 | 110 | ||
113 | 'sortedColumnManager': function () { | 111 | 'sortedColumnManager': function () { |
114 | return this._sortedColumnManager; | 112 | return this._sortedColumnManager; |
115 | }, | 113 | }, |
116 | 114 | ||
117 | 'setSortedColumnManager': function(aValue) { | 115 | 'setSortedColumnManager': function(aValue) { |
118 | if (aValue.sorted() != 'UNSORTED') { | 116 | if (aValue.sorted() != 'UNSORTED') { |