Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js index fbc5929..341fde9 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Common/Controllers/TabPanelController.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.Common.Controllers'); | 26 | Clipperz.Base.module('Clipperz.PM.UI.Common.Controllers'); |
30 | 27 | ||
31 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { | 28 | Clipperz.PM.UI.Common.Controllers.TabPanelController = function(args) { |
32 | args = args || {}; | 29 | args = args || {}; |
33 | 30 | ||
34 | this._component = args.component; | 31 | this._component = args.component; |
35 | this._configuration = args.configuration; | 32 | this._configuration = args.configuration; |
36 | this._isEnabled = args.enabled || true; | 33 | this._isEnabled = args.enabled || true; |
37 | 34 | ||
38 | this._selectedTab = null; | 35 | this._selectedTab = null; |
39 | return this; | 36 | return this; |
40 | } | 37 | } |
41 | 38 | ||
42 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.TabPanelController.prototype, { | 39 | MochiKit.Base.update(Clipperz.PM.UI.Common.Controllers.TabPanelController.prototype, { |
43 | 40 | ||
44 | 'toString': function() { | 41 | 'toString': function() { |
45 | return "Clipperz.PM.UI.Common.Controllers.TabPanelController"; | 42 | return "Clipperz.PM.UI.Common.Controllers.TabPanelController"; |
46 | }, | 43 | }, |
47 | 44 | ||
48 | //----------------------------------------------------------------------------- | 45 | //----------------------------------------------------------------------------- |
49 | 46 | ||
50 | 'component': function() { | 47 | 'component': function() { |
51 | return this._component; | 48 | return this._component; |
52 | }, | 49 | }, |
53 | 50 | ||
54 | 'configuration': function() { | 51 | 'configuration': function() { |
55 | return this._configuration; | 52 | return this._configuration; |
56 | }, | 53 | }, |
57 | 54 | ||
58 | //----------------------------------------------------------------------------- | 55 | //----------------------------------------------------------------------------- |
59 | 56 | ||
60 | 'getElement': function(anElementID) { | 57 | 'getElement': function(anElementID) { |
61 | return this.component().getElement(anElementID); | 58 | return this.component().getElement(anElementID); |
62 | }, | 59 | }, |
63 | 60 | ||
64 | 'tabForTabElement': function(anElement) { | 61 | 'tabForTabElement': function(anElement) { |
65 | varresult; | 62 | varresult; |
66 | 63 | ||
67 | for (result in this.configuration()) { | 64 | for (result in this.configuration()) { |
68 | if (this.getElement(this.configuration()[result]['tab']) == anElement) { | 65 | if (this.getElement(this.configuration()[result]['tab']) == anElement) { |
69 | break; | 66 | break; |
70 | } | 67 | } |
71 | } | 68 | } |
72 | 69 | ||
73 | return result; | 70 | return result; |
74 | }, | 71 | }, |
75 | 72 | ||
76 | //----------------------------------------------------------------------------- | 73 | //----------------------------------------------------------------------------- |
77 | 74 | ||
78 | 'setupTab': function(aConfiguration) { | 75 | 'setupTab': function(aConfiguration) { |
79 | vartabElement; | 76 | vartabElement; |
80 | 77 | ||
81 | tabElement = this.getElement(aConfiguration['tab']); | 78 | tabElement = this.getElement(aConfiguration['tab']); |
82 | 79 | ||
83 | MochiKit.DOM.removeElementClass(tabElement, 'selected'); | 80 | MochiKit.DOM.removeElementClass(tabElement, 'selected'); |
84 | MochiKit.Signal.connect(tabElement, 'onclick', this, 'handleTabClick') | 81 | MochiKit.Signal.connect(tabElement, 'onclick', this, 'handleTabClick') |
85 | }, | 82 | }, |
86 | 83 | ||
87 | 'setupPanel': function(aConfiguration) { | 84 | 'setupPanel': function(aConfiguration) { |
88 | this.hidePanel(aConfiguration['panel']); | 85 | this.hidePanel(aConfiguration['panel']); |
89 | }, | 86 | }, |
90 | 87 | ||
91 | 'setup': function(args) { | 88 | 'setup': function(args) { |
92 | args = args || {}; | 89 | args = args || {}; |
93 | 90 | ||
94 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupTab'),MochiKit.Base.values(this.configuration())); | 91 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupTab'),MochiKit.Base.values(this.configuration())); |
95 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupPanel'),MochiKit.Base.values(this.configuration())); | 92 | MochiKit.Base.map(MochiKit.Base.method(this, 'setupPanel'),MochiKit.Base.values(this.configuration())); |
96 | this.selectTab(args.selected); | 93 | this.selectTab(args.selected); |
97 | }, | 94 | }, |
98 | 95 | ||
99 | //----------------------------------------------------------------------------- | 96 | //----------------------------------------------------------------------------- |
100 | 97 | ||
101 | 'hidePanel': function(aPanel) { | 98 | 'hidePanel': function(aPanel) { |
102 | MochiKit.DOM.removeElementClass(this.getElement(aPanel), 'selected'); | 99 | MochiKit.DOM.removeElementClass(this.getElement(aPanel), 'selected'); |
103 | }, | 100 | }, |
104 | 101 | ||
105 | 'selectTab': function(aTab) { | 102 | 'selectTab': function(aTab) { |
106 | if ((aTab != this.selectedTab()) && (this.isEnabled())) { | 103 | if ((aTab != this.selectedTab()) && (this.isEnabled())) { |
107 | if (this.selectedTab() != null) { | 104 | if (this.selectedTab() != null) { |
108 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['tab']),'selected'); | 105 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['tab']),'selected'); |
109 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['panel']),'selected'); | 106 | MochiKit.DOM.removeElementClass(this.getElement(this.configuration()[this.selectedTab()]['panel']),'selected'); |
110 | } | 107 | } |
111 | 108 | ||
112 | if (aTab != null) { | 109 | if (aTab != null) { |
113 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['tab']),'selected'); | 110 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['tab']),'selected'); |
114 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['panel']),'selected'); | 111 | MochiKit.DOM.addElementClass(this.getElement(this.configuration()[aTab]['panel']),'selected'); |
115 | } | 112 | } |
116 | 113 | ||
117 | this.setSelectedTab(aTab); | 114 | this.setSelectedTab(aTab); |
118 | MochiKit.Signal.signal(this, 'tabSelected', aTab); | 115 | MochiKit.Signal.signal(this, 'tabSelected', aTab); |
119 | } | 116 | } |
120 | }, | 117 | }, |