Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js index 391c379..41e32a0 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/ColumnManager.js | |||
@@ -1,150 +1,148 @@ | |||
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.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); |
27 | 25 | ||
28 | //############################################################################# | 26 | //############################################################################# |
29 | 27 | ||
30 | Clipperz.PM.UI.Web.Components.ColumnManager = function(args) { | 28 | Clipperz.PM.UI.Web.Components.ColumnManager = function(args) { |
31 | args = args || {}; | 29 | args = args || {}; |
32 | Clipperz.PM.UI.Web.Components.ColumnManager.superclass.constructor.call(this, args); | 30 | Clipperz.PM.UI.Web.Components.ColumnManager.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | this._name = args.name || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._name = args.name || Clipperz.Base.exception.raise('MandatoryParameter'); |
35 | this._selector = args.selector|| Clipperz.Base.exception.raise('MandatoryParameter');; | 33 | this._selector = args.selector|| Clipperz.Base.exception.raise('MandatoryParameter');; |
36 | this._label = args.label || null; | 34 | this._label = args.label || null; |
37 | this._isSortable = args.sortable|| false; | 35 | this._isSortable = args.sortable|| false; |
38 | this._comparator = args.comparator|| null; | 36 | this._comparator = args.comparator|| null; |
39 | this._sorted = args.sorted || 'UNSORTED'; //'ASCENDING' | 'DESCENDING' | 'UNSORTED' | 37 | this._sorted = args.sorted || 'UNSORTED'; //'ASCENDING' | 'DESCENDING' | 'UNSORTED' |
40 | this._cssClass = args.cssClass|| ''; | 38 | this._cssClass = args.cssClass|| ''; |
41 | 39 | ||
42 | this._signalIdentifiers = []; | 40 | this._signalIdentifiers = []; |
43 | 41 | ||
44 | return this; | 42 | return this; |
45 | } | 43 | } |
46 | 44 | ||
47 | //============================================================================= | 45 | //============================================================================= |
48 | 46 | ||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ColumnManager, Clipperz.PM.UI.Common.Components.BaseComponent, { | 47 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.ColumnManager, Clipperz.PM.UI.Common.Components.BaseComponent, { |
50 | 48 | ||
51 | 'toString': function () { | 49 | 'toString': function () { |
52 | return "Clipperz.PM.UI.Web.Components.ColumnManager - " + this._name; | 50 | return "Clipperz.PM.UI.Web.Components.ColumnManager - " + this._name; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | 'name': function () { | 53 | 'name': function () { |
56 | return this._name; | 54 | return this._name; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | 'label': function () { | 57 | 'label': function () { |
60 | return this._label; | 58 | return this._label; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | 'selector': function () { | 61 | 'selector': function () { |
64 | return this._selector; | 62 | return this._selector; |
65 | }, | 63 | }, |
66 | 64 | ||
67 | 'comparator': function() { | 65 | 'comparator': function() { |
68 | return this._comparator; | 66 | return this._comparator; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | 'cssClass': function() { | 69 | 'cssClass': function() { |
72 | return this._cssClass; | 70 | return this._cssClass; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | 74 | ||
77 | 'isSortable': function () { | 75 | 'isSortable': function () { |
78 | return this._isSortable; | 76 | return this._isSortable; |
79 | }, | 77 | }, |
80 | 78 | ||
81 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
82 | 80 | ||
83 | 'sorted': function () { | 81 | 'sorted': function () { |
84 | return this._sorted; | 82 | return this._sorted; |
85 | }, | 83 | }, |
86 | 84 | ||
87 | 'isSorted': function () { | 85 | 'isSorted': function () { |
88 | return (this.sorted() != 'UNSORTED'); | 86 | return (this.sorted() != 'UNSORTED'); |
89 | }, | 87 | }, |
90 | 88 | ||
91 | 'setSorted': function(aValue) { | 89 | 'setSorted': function(aValue) { |
92 | this._sorted = aValue; | 90 | this._sorted = aValue; |
93 | this.updateSortIcon(); | 91 | this.updateSortIcon(); |
94 | }, | 92 | }, |
95 | 93 | ||
96 | //------------------------------------------------------------------------- | 94 | //------------------------------------------------------------------------- |
97 | 95 | ||
98 | 'signalIdentifiers': function () { | 96 | 'signalIdentifiers': function () { |
99 | return this._signalIdentifiers; | 97 | return this._signalIdentifiers; |
100 | }, | 98 | }, |
101 | 99 | ||
102 | 'resetSignalIdentifiers': function () { | 100 | 'resetSignalIdentifiers': function () { |
103 | this._signalIdentifiers = []; | 101 | this._signalIdentifiers = []; |
104 | }, | 102 | }, |
105 | 103 | ||
106 | //------------------------------------------------------------------------- | 104 | //------------------------------------------------------------------------- |
107 | 105 | ||
108 | 'disconnectRowsSignals': function () { | 106 | 'disconnectRowsSignals': function () { |
109 | MochiKit.Base.map(MochiKit.Signal.disconnect, this.signalIdentifiers()); | 107 | MochiKit.Base.map(MochiKit.Signal.disconnect, this.signalIdentifiers()); |
110 | this.resetSignalIdentifiers(); | 108 | this.resetSignalIdentifiers(); |
111 | }, | 109 | }, |
112 | 110 | ||
113 | 'connectEvent': function () { | 111 | 'connectEvent': function () { |
114 | var ident; | 112 | var ident; |
115 | 113 | ||
116 | ident = MochiKit.Signal.connect.apply(null, arguments); | 114 | ident = MochiKit.Signal.connect.apply(null, arguments); |
117 | this.signalIdentifiers().push(ident); | 115 | this.signalIdentifiers().push(ident); |
118 | }, | 116 | }, |
119 | 117 | ||
120 | //------------------------------------------------------------------------- | 118 | //------------------------------------------------------------------------- |
121 | 119 | ||
122 | 'renderHeader': function(aTRElement) { | 120 | 'renderHeader': function(aTRElement) { |
123 | varthElement; | 121 | varthElement; |
124 | 122 | ||
125 | thElement = Clipperz.DOM.Helper.append(aTRElement, {tag:'th', cls:(this.cssClass() + 'TH'), id:this.getId('sortLink'), children:[ | 123 | thElement = Clipperz.DOM.Helper.append(aTRElement, {tag:'th', cls:(this.cssClass() + 'TH'), id:this.getId('sortLink'), children:[ |
126 | {tag:'span', html:this.label() ? this.label() : ' '} | 124 | {tag:'span', html:this.label() ? this.label() : ' '} |
127 | ]}); | 125 | ]}); |
128 | 126 | ||
129 | if (this.isSortable()) { | 127 | if (this.isSortable()) { |
130 | Clipperz.DOM.Helper.append(thElement, {tag:'span', cls:'sortable', children:[ | 128 | Clipperz.DOM.Helper.append(thElement, {tag:'span', cls:'sortable', children:[ |
131 | {tag:'a', href:'#'/*, id:this.getId('sortLink')*/, html:' '} | 129 | {tag:'a', href:'#'/*, id:this.getId('sortLink')*/, html:' '} |
132 | ]}); | 130 | ]}); |
133 | 131 | ||
134 | MochiKit.DOM.addElementClass(thElement, 'sortable'); | 132 | MochiKit.DOM.addElementClass(thElement, 'sortable'); |
135 | MochiKit.Signal.connect(thElement, 'onclick', this, 'handleClickOnSortingCriteria'); | 133 | MochiKit.Signal.connect(thElement, 'onclick', this, 'handleClickOnSortingCriteria'); |
136 | }; | 134 | }; |
137 | 135 | ||
138 | this.updateSortIcon(); | 136 | this.updateSortIcon(); |
139 | }, | 137 | }, |
140 | 138 | ||
141 | //------------------------------------------------------------------------- | 139 | //------------------------------------------------------------------------- |
142 | 140 | ||
143 | 'toggleSorting': function () { | 141 | 'toggleSorting': function () { |
144 | var result; | 142 | var result; |
145 | switch (this.sorted()) { | 143 | switch (this.sorted()) { |
146 | case 'UNSORTED': | 144 | case 'UNSORTED': |
147 | result = 'ASCENDING'; | 145 | result = 'ASCENDING'; |
148 | break; | 146 | break; |
149 | case 'ASCENDING': | 147 | case 'ASCENDING': |
150 | result = 'DESCENDING'; | 148 | result = 'DESCENDING'; |