author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
commit | ef68436ac04da078ffdcacd7e1f785473a303d45 (patch) (unidiff) | |
tree | c403752d66a2c4775f00affd4fa8431b29c5b68c /frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js | |
parent | 597ecfbc0249d83e1b856cbd558340c01237a360 (diff) | |
download | clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.zip clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.gz clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.bz2 |
First version of the newly restructured repository
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js new file mode 100644 index 0000000..39a1ccb --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/TabSidePanel.js | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
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 | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | 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 | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); | ||
30 | |||
31 | Clipperz.PM.UI.Web.Components.TabSidePanel = function(args) { | ||
32 | args = args || {}; | ||
33 | Clipperz.PM.UI.Web.Components.TabSidePanel.superclass.constructor.call(this, args); | ||
34 | |||
35 | this._element = args.element || null; | ||
36 | |||
37 | this._slots = { | ||
38 | }; | ||
39 | |||
40 | return this; | ||
41 | } | ||
42 | |||
43 | //============================================================================= | ||
44 | |||
45 | Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.TabSidePanel, Clipperz.PM.UI.Common.Components.BaseComponent, { | ||
46 | |||
47 | //------------------------------------------------------------------------- | ||
48 | |||
49 | 'toString': function () { | ||
50 | return "Clipperz.PM.UI.Web.Components.TabSidePanel component"; | ||
51 | }, | ||
52 | |||
53 | //------------------------------------------------------------------------- | ||
54 | |||
55 | 'deselectAllTabs': function() { | ||
56 | var tabListItems; | ||
57 | |||
58 | tabListItems = [ | ||
59 | 'cardsLI', | ||
60 | // 'directLoginLI', | ||
61 | 'accountLI', | ||
62 | 'dataLI', | ||
63 | 'toolsLI' | ||
64 | ]; | ||
65 | |||
66 | //Clipperz.log("=== TabSidePanel.tabSelected anEvent.src().id", anEvent.src().id); | ||
67 | for (var i in tabListItems) { | ||
68 | //Clipperz.log("=== TabSidePanel.tabSelected aTabListItem", tabListItems[i]); | ||
69 | MochiKit.DOM.removeElementClass(this.getId(tabListItems[i]), 'selected'); | ||
70 | } | ||
71 | }, | ||
72 | |||
73 | 'selectTab': function(aTabName) { | ||
74 | this.deselectAllTabs(); | ||
75 | MochiKit.DOM.addElementClass(this.getId(this.listItemIdForTabNamed(aTabName)), 'selected'); | ||
76 | MochiKit.Signal.signal(this, 'tabSelected', aTabName); | ||
77 | }, | ||
78 | |||
79 | 'tabNameForAnchorId': function(anId) { | ||
80 | var result; | ||
81 | |||
82 | switch(anId) { | ||
83 | case 'cards_tabSidePanel': | ||
84 | result = 'cards'; | ||
85 | break; | ||
86 | // case 'directLogins_tabSidePanel': | ||
87 | // result = 'directLogins'; | ||
88 | // break; | ||
89 | case 'account_tabSidePanel': | ||
90 | result = 'account'; | ||
91 | break; | ||
92 | case 'data_tabSidePanel': | ||
93 | result = 'data'; | ||
94 | break; | ||
95 | case 'tools_tabSidePanel': | ||
96 | result = 'tools'; | ||
97 | break; | ||
98 | } | ||
99 | |||
100 | return result; | ||
101 | }, | ||
102 | |||
103 | 'listItemIdForTabNamed': function(aTabName) { | ||
104 | var result; | ||
105 | |||
106 | switch (aTabName) { | ||
107 | case 'cards': | ||
108 | result = 'cardsLI'; | ||
109 | break; | ||
110 | // case 'directLogins': | ||
111 | // result = 'directLoginLI'; | ||
112 | // break; | ||
113 | case 'account': | ||
114 | result = 'accountLI'; | ||
115 | break; | ||
116 | case 'data': | ||
117 | result = 'dataLI'; | ||
118 | break; | ||
119 | case 'tools': | ||
120 | result = 'toolsLI'; | ||
121 | break; | ||
122 | } | ||
123 | |||
124 | return result; | ||
125 | }, | ||
126 | |||
127 | 'tabSelected': function (anEvent) { | ||
128 | this.selectTab(this.tabNameForAnchorId(anEvent.src().id)); | ||
129 | // anEvent.stop(); | ||
130 | anEvent.preventDefault(); | ||
131 | }, | ||
132 | |||
133 | //------------------------------------------------------------------------- | ||
134 | |||
135 | 'addCard': function (anEvent) { | ||
136 | anEvent.stop(); | ||
137 | MochiKit.Signal.signal(this, 'addCard', anEvent.src()); | ||
138 | }, | ||
139 | |||
140 | //------------------------------------------------------------------------- | ||
141 | |||
142 | 'renderSelf': function(/*aContainer, aPosition*/) { | ||
143 | this.append(this.element(), [ | ||
144 | {tag:'div', cls:'header'}, | ||
145 | {tag:'div', cls:'body', children:[ | ||
146 | {tag:'ul', cls:'mainTabs', children:[ | ||
147 | {tag:'li', id:this.getId('cardsLI'), cls:'cards', children:[ | ||
148 | {tag:'a', id:'cards_tabSidePanel', href:'#', html:"cards"}, | ||
149 | {tag:'div', cls:'selectionHighlighter', children:[ | ||
150 | {tag:'img', src:'./images/old/main/tabs/selectionHighligher.png'}, | ||
151 | {tag:'a', id:this.getId('addCardA'), cls:'add', href:'#', children:[ | ||
152 | {tag:'span', html:"add"}, | ||
153 | {tag:'h3', html:"+"} | ||
154 | ]} | ||
155 | ]} | ||
156 | ]} | ||
157 | ]}, | ||
158 | {tag:'ul', cls:'otherTabs', children:[ | ||
159 | {tag:'li', id:this.getId('accountLI'), children:[ | ||
160 | {tag:'a', id:'account_tabSidePanel', href:'#', html:"account"}, | ||
161 | {tag:'div', cls:'selectionHighlighter', children:[ | ||
162 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | ||
163 | ]} | ||
164 | ]}, | ||
165 | {tag:'li', id:this.getId('dataLI'), children:[ | ||
166 | {tag:'a', id:'data_tabSidePanel', href:'#', html:"data"}, | ||
167 | {tag:'div', cls:'selectionHighlighter', children:[ | ||
168 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | ||
169 | ]} | ||
170 | ]}, | ||
171 | {tag:'li', id:this.getId('toolsLI'), children:[ | ||
172 | {tag:'a', id:'tools_tabSidePanel', href:'#', html:"tools"}, | ||
173 | {tag:'div', cls:'selectionHighlighter', children:[ | ||
174 | {tag:'img', src:'./images/old/main/tabs/selectionHighligherGray.png'} | ||
175 | ]} | ||
176 | ]} | ||
177 | ]} | ||
178 | ]}, | ||
179 | {tag:'div', cls:'footer'} | ||
180 | ]); | ||
181 | |||
182 | MochiKit.Signal.connect('cards_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
183 | // MochiKit.Signal.connect('directLogins_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
184 | MochiKit.Signal.connect('account_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
185 | MochiKit.Signal.connect('data_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
186 | MochiKit.Signal.connect('tools_tabSidePanel', 'onclick', this, 'tabSelected'); | ||
187 | MochiKit.Signal.connect(this.getId('addCardA'), 'onclick', this, 'addCard'); | ||
188 | }, | ||
189 | |||
190 | //------------------------------------------------------------------------- | ||
191 | |||
192 | __syntaxFix__: "syntax fix" | ||
193 | }); | ||