summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js b/frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js
index b300ba6..d30f514 100644
--- a/frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js
+++ b/frontend/beta/js/Clipperz/PM/Components/TabPanel/TabPanelController.js
@@ -1,155 +1,153 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer 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
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
29if (typeof(Clipperz.PM.Components.TabPanel) == 'undefined') { Clipperz.PM.Components.TabPanel = {}; } 27if (typeof(Clipperz.PM.Components.TabPanel) == 'undefined') { Clipperz.PM.Components.TabPanel = {}; }
30 28
31Clipperz.PM.Components.TabPanel.TabPanelController = function(args) { 29Clipperz.PM.Components.TabPanel.TabPanelController = function(args) {
32 args = args || {}; 30 args = args || {};
33 31
34 Clipperz.PM.Components.TabPanel.TabPanelController.superclass.constructor.call(this); 32 Clipperz.PM.Components.TabPanel.TabPanelController.superclass.constructor.call(this);
35 33
36 this._name = args.name || 'undefined'; 34 this._name = args.name || 'undefined';
37 this._config = args.config; 35 this._config = args.config;
38 this._selectedTab = args.selectedTab || ((MochiKit.Base.keys(args.config).length > 0) ? MochiKit.Base.keys(args.config)[0] : null); 36 this._selectedTab = args.selectedTab || ((MochiKit.Base.keys(args.config).length > 0) ? MochiKit.Base.keys(args.config)[0] : null);
39 37
40 this._tabs = {}; 38 this._tabs = {};
41 this._panels = {}; 39 this._panels = {};
42 40
43 Clipperz.NotificationCenter.register(null, 'selectTab', this, 'handleSelectTabNotification'); 41 Clipperz.NotificationCenter.register(null, 'selectTab', this, 'handleSelectTabNotification');
44 return this; 42 return this;
45} 43}
46 44
47//============================================================================= 45//=============================================================================
48 46
49YAHOO.extendX(Clipperz.PM.Components.TabPanel.TabPanelController, YAHOO.ext.util.Observable, { 47YAHOO.extendX(Clipperz.PM.Components.TabPanel.TabPanelController, YAHOO.ext.util.Observable, {
50 48
51 //------------------------------------------------------------------------- 49 //-------------------------------------------------------------------------
52 50
53 'name': function() { 51 'name': function() {
54 return this._name; 52 return this._name;
55 }, 53 },
56 54
57 //------------------------------------------------------------------------- 55 //-------------------------------------------------------------------------
58 56
59 'tabs': function() { 57 'tabs': function() {
60 return this._tabs; 58 return this._tabs;
61 }, 59 },
62 60
63 //------------------------------------------------------------------------- 61 //-------------------------------------------------------------------------
64 62
65 'panels': function() { 63 'panels': function() {
66 return this._panels; 64 return this._panels;
67 }, 65 },
68 66
69 //------------------------------------------------------------------------- 67 //-------------------------------------------------------------------------
70 68
71 'config': function() { 69 'config': function() {
72 return this._config; 70 return this._config;
73 }, 71 },
74 72
75 //------------------------------------------------------------------------- 73 //-------------------------------------------------------------------------
76 74
77 'selectedTab': function() { 75 'selectedTab': function() {
78 return this._selectedTab; 76 return this._selectedTab;
79 }, 77 },
80 78
81 'setSelectedTab': function(aValue) { 79 'setSelectedTab': function(aValue) {
82 this._selectedTab = aValue; 80 this._selectedTab = aValue;
83 }, 81 },
84 82
85 //------------------------------------------------------------------------- 83 //-------------------------------------------------------------------------
86 84
87 'setUp': function() { 85 'setUp': function() {
88 vartabId; 86 vartabId;
89 87
90//MochiKit.Logging.logDebug(">>> TabPanelController.setUp - config: " + Clipperz.Base.serializeJSON(this.config())); 88//MochiKit.Logging.logDebug(">>> TabPanelController.setUp - config: " + Clipperz.Base.serializeJSON(this.config()));
91 for (tabId in this.config()) { 89 for (tabId in this.config()) {
92 vartabElement; 90 vartabElement;
93 varpanelElement; 91 varpanelElement;
94 92
95//MochiKit.Logging.logDebug("--- TabPanelController.setUp - tabId: " + tabId); 93//MochiKit.Logging.logDebug("--- TabPanelController.setUp - tabId: " + tabId);
96//MochiKit.Logging.logDebug("--- TabPanelController.setUp - panelId: " + this.config()[tabId]); 94//MochiKit.Logging.logDebug("--- TabPanelController.setUp - panelId: " + this.config()[tabId]);
97 tabElement = YAHOO.ext.Element.get(tabId); 95 tabElement = YAHOO.ext.Element.get(tabId);
98 tabElement.addClassOnOver("hover"); 96 tabElement.addClassOnOver("hover");
99 MochiKit.Signal.connect(tabId, 'onclick', this, 'selectTabHandler'); 97 MochiKit.Signal.connect(tabId, 'onclick', this, 'selectTabHandler');
100 98
101 panelElement = YAHOO.ext.Element.get(this.config()[tabId]); 99 panelElement = YAHOO.ext.Element.get(this.config()[tabId]);
102 100
103 this._tabs[tabId] = tabElement; 101 this._tabs[tabId] = tabElement;
104 this._panels[tabId] = panelElement; 102 this._panels[tabId] = panelElement;
105 103
106 if (tabId == this.selectedTab()) { 104 if (tabId == this.selectedTab()) {
107 tabElement.addClass('selectedTab'); 105 tabElement.addClass('selectedTab');
108 panelElement.addClass('selectedPanel'); 106 panelElement.addClass('selectedPanel');
109 } else { 107 } else {
110 panelElement.addClass('hiddenPanel'); 108 panelElement.addClass('hiddenPanel');
111 } 109 }
112 } 110 }
113//MochiKit.Logging.logDebug("<<< TabPanelController.setUp"); 111//MochiKit.Logging.logDebug("<<< TabPanelController.setUp");
114 }, 112 },
115 113
116 //------------------------------------------------------------------------- 114 //-------------------------------------------------------------------------
117 115
118 'selectTab': function(aTab) { 116 'selectTab': function(aTab) {
119 if (aTab != this.selectedTab()) { 117 if (aTab != this.selectedTab()) {
120 this.tabs()[this.selectedTab()].removeClass('selectedTab'); 118 this.tabs()[this.selectedTab()].removeClass('selectedTab');
121 this.panels()[this.selectedTab()].removeClass('selectedPanel').addClass('hiddenPanel'); 119 this.panels()[this.selectedTab()].removeClass('selectedPanel').addClass('hiddenPanel');
122 120
123 this.tabs()[aTab].addClass('selectedTab'); 121 this.tabs()[aTab].addClass('selectedTab');
124 this.panels()[aTab].addClass('selectedPanel').removeClass('hiddenPanel'); 122 this.panels()[aTab].addClass('selectedPanel').removeClass('hiddenPanel');
125 123
126 this.setSelectedTab(aTab); 124 this.setSelectedTab(aTab);
127 125
128 Clipperz.NotificationCenter.notify(this, 'tabSelected', aTab); 126 Clipperz.NotificationCenter.notify(this, 'tabSelected', aTab);
129 } 127 }
130 }, 128 },
131 129
132 //------------------------------------------------------------------------- 130 //-------------------------------------------------------------------------
133 131
134 'selectTabHandler': function(anEvent) { 132 'selectTabHandler': function(anEvent) {
135 this.selectTab(anEvent.src().id); 133 this.selectTab(anEvent.src().id);
136 }, 134 },
137 135
138 //------------------------------------------------------------------------- 136 //-------------------------------------------------------------------------
139 137
140 'handleSelectTabNotification': function(aNotificationEvent) { 138 'handleSelectTabNotification': function(aNotificationEvent) {
141 var parameters; 139 var parameters;
142 var splittedParamters; 140 var splittedParamters;
143 vartargetTabPanel; 141 vartargetTabPanel;
144 142
145 parameters = aNotificationEvent.parameters(); 143 parameters = aNotificationEvent.parameters();
146 splittedParamters = parameters.split('.'); 144 splittedParamters = parameters.split('.');
147 targetTabPanel = splittedParamters[0]; 145 targetTabPanel = splittedParamters[0];
148 if (targetTabPanel == this.name()) { 146 if (targetTabPanel == this.name()) {
149 this.selectTab(splittedParamters[1]) 147 this.selectTab(splittedParamters[1])
150 } 148 }
151 }, 149 },
152 150
153 //------------------------------------------------------------------------- 151 //-------------------------------------------------------------------------
154 __syntaxFix__: "syntax fix" 152 __syntaxFix__: "syntax fix"
155}); 153});