Diffstat (limited to 'frontend/beta/js/Clipperz/YUI/Drawer.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/Drawer.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/frontend/beta/js/Clipperz/YUI/Drawer.js b/frontend/beta/js/Clipperz/YUI/Drawer.js index 394912e..508bfe5 100644 --- a/frontend/beta/js/Clipperz/YUI/Drawer.js +++ b/frontend/beta/js/Clipperz/YUI/Drawer.js | |||
@@ -1,238 +1,235 @@ | |||
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 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
30 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } | 27 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
31 | 28 | ||
32 | 29 | ||
33 | Clipperz.YUI.Drawer = function(anElement, aRegion) { | 30 | Clipperz.YUI.Drawer = function(anElement, aRegion) { |
34 | this._status = 'slideIn'; | 31 | this._status = 'slideIn'; |
35 | 32 | ||
36 | this._element = YAHOO.ext.Element.get(anElement); | 33 | this._element = YAHOO.ext.Element.get(anElement); |
37 | this._region = aRegion || null; | 34 | this._region = aRegion || null; |
38 | 35 | ||
39 | this._collapsedElement = this.element().getChildrenByClassName("drawer-collapsed")[0]; | 36 | this._collapsedElement = this.element().getChildrenByClassName("drawer-collapsed")[0]; |
40 | this._contentElement = this.element().getChildrenByClassName("drawer-content")[0]; | 37 | this._contentElement = this.element().getChildrenByClassName("drawer-content")[0]; |
41 | 38 | ||
42 | 39 | ||
43 | this._wholeCollapedElement = this.enhanceCollapsedElement(); | 40 | this._wholeCollapedElement = this.enhanceCollapsedElement(); |
44 | this._wholeCollapedElement.setWidth(this.region().element().getWidth()); | 41 | this._wholeCollapedElement.setWidth(this.region().element().getWidth()); |
45 | this._wholeCollapedElement.setHeight(this.region().element().getHeight()); | 42 | this._wholeCollapedElement.setHeight(this.region().element().getHeight()); |
46 | 43 | ||
47 | this._contentWrapper = this.enhanceContentElement(); | 44 | this._contentWrapper = this.enhanceContentElement(); |
48 | this._contentElementActor = new YAHOO.ext.Actor(this.contentWrapper().dom); | 45 | this._contentElementActor = new YAHOO.ext.Actor(this.contentWrapper().dom); |
49 | this.contentElementActor().hide(); | 46 | this.contentElementActor().hide(); |
50 | 47 | ||
51 | this._contentWidth = 200; | 48 | this._contentWidth = 200; |
52 | }; | 49 | }; |
53 | 50 | ||
54 | YAHOO.extendX(Clipperz.YUI.Drawer, YAHOO.ext.util.Observable, { | 51 | YAHOO.extendX(Clipperz.YUI.Drawer, YAHOO.ext.util.Observable, { |
55 | 52 | ||
56 | 'element': function() { | 53 | 'element': function() { |
57 | return this._element; | 54 | return this._element; |
58 | }, | 55 | }, |
59 | 56 | ||
60 | //----------------------------------------------------- | 57 | //----------------------------------------------------- |
61 | 58 | ||
62 | 'status': function() { | 59 | 'status': function() { |
63 | return this._status; | 60 | return this._status; |
64 | }, | 61 | }, |
65 | 62 | ||
66 | 'setStatus': function(aValue) { | 63 | 'setStatus': function(aValue) { |
67 | this._status = aValue; | 64 | this._status = aValue; |
68 | }, | 65 | }, |
69 | 66 | ||
70 | //----------------------------------------------------- | 67 | //----------------------------------------------------- |
71 | 68 | ||
72 | 'collapsedElement': function() { | 69 | 'collapsedElement': function() { |
73 | return this._collapsedElement; | 70 | return this._collapsedElement; |
74 | }, | 71 | }, |
75 | 72 | ||
76 | //----------------------------------------------------- | 73 | //----------------------------------------------------- |
77 | 74 | ||
78 | 'contentElement': function() { | 75 | 'contentElement': function() { |
79 | return this._contentElement; | 76 | return this._contentElement; |
80 | }, | 77 | }, |
81 | 78 | ||
82 | //----------------------------------------------------- | 79 | //----------------------------------------------------- |
83 | 80 | ||
84 | 'contentElementActor': function() { | 81 | 'contentElementActor': function() { |
85 | return this._contentElementActor; | 82 | return this._contentElementActor; |
86 | }, | 83 | }, |
87 | 84 | ||
88 | //----------------------------------------------------- | 85 | //----------------------------------------------------- |
89 | 86 | ||
90 | 'contentWrapper': function() { | 87 | 'contentWrapper': function() { |
91 | return this._contentWrapper; | 88 | return this._contentWrapper; |
92 | }, | 89 | }, |
93 | 90 | ||
94 | //----------------------------------------------------- | 91 | //----------------------------------------------------- |
95 | 92 | ||
96 | 'contentWidth': function() { | 93 | 'contentWidth': function() { |
97 | return this._contentWidth; | 94 | return this._contentWidth; |
98 | }, | 95 | }, |
99 | 96 | ||
100 | //----------------------------------------------------- | 97 | //----------------------------------------------------- |
101 | 98 | ||
102 | 'region': function() { | 99 | 'region': function() { |
103 | return this._region; | 100 | return this._region; |
104 | }, | 101 | }, |
105 | 102 | ||
106 | //----------------------------------------------------- | 103 | //----------------------------------------------------- |
107 | 104 | ||
108 | 'enhanceCollapsedElement': function() { | 105 | 'enhanceCollapsedElement': function() { |
109 | varwrapper; | 106 | varwrapper; |
110 | var link; | 107 | var link; |
111 | 108 | ||
112 | wrapper = this.collapsedElement().wrap({tag:'div', cls:'drawer-collapsedElement-wrapper', children:[ | 109 | wrapper = this.collapsedElement().wrap({tag:'div', cls:'drawer-collapsedElement-wrapper', children:[ |
113 | {tag:'div', cls:'drawer-pin-button', children:[ | 110 | {tag:'div', cls:'drawer-pin-button', children:[ |
114 | {tag:'a', cls:'drawer-pin-button', href:"#", children:[ | 111 | {tag:'a', cls:'drawer-pin-button', href:"#", children:[ |
115 | {tag:'img', src:'./images/directLogins/drawer/mm-expand.gif'} | 112 | {tag:'img', src:'./images/directLogins/drawer/mm-expand.gif'} |
116 | ]} | 113 | ]} |
117 | ]} | 114 | ]} |
118 | ]}); | 115 | ]}); |
119 | 116 | ||
120 | link = wrapper.getChildrenByClassName('drawer-pin-button', 'a')[0]; | 117 | link = wrapper.getChildrenByClassName('drawer-pin-button', 'a')[0]; |
121 | MochiKit.Signal.connect(link.dom, 'onclick', this, 'pinDrawer'); | 118 | MochiKit.Signal.connect(link.dom, 'onclick', this, 'pinDrawer'); |
122 | 119 | ||
123 | this.collapsedElement().setHeight('100%'); | 120 | this.collapsedElement().setHeight('100%'); |
124 | this.collapsedElement().setStyle('cursor', 'pointer'); | 121 | this.collapsedElement().setStyle('cursor', 'pointer'); |
125 | MochiKit.Signal.connect(this.collapsedElement().dom, 'onclick', this, 'showDrawer'); | 122 | MochiKit.Signal.connect(this.collapsedElement().dom, 'onclick', this, 'showDrawer'); |
126 | 123 | ||
127 | return wrapper; | 124 | return wrapper; |
128 | }, | 125 | }, |
129 | 126 | ||
130 | //----------------------------------------------------- | 127 | //----------------------------------------------------- |
131 | 128 | ||
132 | 'enhanceContentElement': function() { | 129 | 'enhanceContentElement': function() { |
133 | var wrapper; | 130 | var wrapper; |
134 | 131 | ||
135 | wrapper = this.contentElement().wrap({tag:'div', cls:'drawer-content-wrapper', children:[ | 132 | wrapper = this.contentElement().wrap({tag:'div', cls:'drawer-content-wrapper', children:[ |
136 | {tag:'div', cls:'drawer-content-header', html:'direct login', style:'width:100%;'} | 133 | {tag:'div', cls:'drawer-content-header', html:'direct login', style:'width:100%;'} |
137 | ]}); | 134 | ]}); |
138 | 135 | ||
139 | MochiKit.Signal.connect(wrapper.dom, 'onclick', this, 'hideDrawer'); | 136 | MochiKit.Signal.connect(wrapper.dom, 'onclick', this, 'hideDrawer'); |
140 | return wrapper; | 137 | return wrapper; |
141 | }, | 138 | }, |
142 | 139 | ||
143 | //----------------------------------------------------- | 140 | //----------------------------------------------------- |
144 | 141 | ||
145 | 'pinDrawer': function() { | 142 | 'pinDrawer': function() { |
146 | alert("pin drawer"); | 143 | alert("pin drawer"); |
147 | }, | 144 | }, |
148 | 145 | ||
149 | //----------------------------------------------------- | 146 | //----------------------------------------------------- |
150 | 147 | ||
151 | 'showDrawer': function() { | 148 | 'showDrawer': function() { |
152 | if (this.status() == 'slideIn') { | 149 | if (this.status() == 'slideIn') { |
153 | var actor; | 150 | var actor; |
154 | 151 | ||
155 | this.setStatus('slidingOut'); | 152 | this.setStatus('slidingOut'); |
156 | actor = this.contentElementActor(); | 153 | actor = this.contentElementActor(); |
157 | actor.setHeight(this.region().element().getHeight()); | 154 | actor.setHeight(this.region().element().getHeight()); |
158 | 155 | ||
159 | actor.startCapture(true); | 156 | actor.startCapture(true); |
160 | actor.alignTo(this.element(), 'tr'); | 157 | actor.alignTo(this.element(), 'tr'); |
161 | actor.blindShow('left', this.contentWidth(), .35); | 158 | actor.blindShow('left', this.contentWidth(), .35); |
162 | actor.play(this.onSlideOut.createDelegate(this)); | 159 | actor.play(this.onSlideOut.createDelegate(this)); |
163 | } | 160 | } |
164 | }, | 161 | }, |
165 | 162 | ||
166 | //----------------------------------------------------- | 163 | //----------------------------------------------------- |
167 | 164 | ||
168 | 'onSlideOut': function() { | 165 | 'onSlideOut': function() { |
169 | this.setStatus('slideOut'); | 166 | this.setStatus('slideOut'); |
170 | MochiKit.Logging.logDebug(">>> onSlideOut"); | 167 | MochiKit.Logging.logDebug(">>> onSlideOut"); |
171 | // alert("done"); | 168 | // alert("done"); |
172 | }, | 169 | }, |
173 | 170 | ||
174 | //----------------------------------------------------- | 171 | //----------------------------------------------------- |
175 | /* | 172 | /* |
176 | 'showContentElement': function() { | 173 | 'showContentElement': function() { |
177 | var top, left, width, height; | 174 | var top, left, width, height; |
178 | 175 | ||
179 | MochiKit.Logging.logDebug(">>> showContentElement"); | 176 | MochiKit.Logging.logDebug(">>> showContentElement"); |
180 | 177 | ||
181 | 178 | ||
182 | top = this.element().getTop(true); | 179 | top = this.element().getTop(true); |
183 | left = this.element().getRight(); | 180 | left = this.element().getRight(); |
184 | width = this.contentWidth(); | 181 | width = this.contentWidth(); |
185 | height = this.element().getHeight(); | 182 | height = this.element().getHeight(); |
186 | 183 | ||
187 | this.contentWrapper().setStyle('position', 'absolute'); | 184 | this.contentWrapper().setStyle('position', 'absolute'); |
188 | this.contentWrapper().setStyle('overflow', 'none'); | 185 | this.contentWrapper().setStyle('overflow', 'none'); |
189 | this.contentWrapper().setStyle('visibility', 'visible'); | 186 | this.contentWrapper().setStyle('visibility', 'visible'); |
190 | this.contentWrapper().setStyle('z-index', '10'); | 187 | this.contentWrapper().setStyle('z-index', '10'); |
191 | 188 | ||
192 | this.contentWrapper().setLeft(left); | 189 | this.contentWrapper().setLeft(left); |
193 | this.contentWrapper().setTop(top); | 190 | this.contentWrapper().setTop(top); |
194 | this.contentWrapper().setHeight(height); | 191 | this.contentWrapper().setHeight(height); |
195 | this.contentWrapper().setWidth(width); | 192 | this.contentWrapper().setWidth(width); |
196 | 193 | ||
197 | this.contentWrapper().show(); | 194 | this.contentWrapper().show(); |
198 | }, | 195 | }, |
199 | */ | 196 | */ |
200 | //----------------------------------------------------- | 197 | //----------------------------------------------------- |
201 | 198 | ||
202 | 'hideDrawer': function() { | 199 | 'hideDrawer': function() { |
203 | if (this.status() == 'slideOut') { | 200 | if (this.status() == 'slideOut') { |
204 | var actor; | 201 | var actor; |
205 | 202 | ||
206 | this.setStatus('slidingIn'); | 203 | this.setStatus('slidingIn'); |
207 | 204 | ||
208 | actor = this.contentElementActor(); | 205 | actor = this.contentElementActor(); |
209 | actor.setHeight(this.region().element().getHeight()); | 206 | actor.setHeight(this.region().element().getHeight()); |
210 | 207 | ||
211 | actor.startCapture(true); | 208 | actor.startCapture(true); |
212 | actor.alignTo(this.element(), 'tr'); | 209 | actor.alignTo(this.element(), 'tr'); |
213 | actor.blindHide('left', .35); | 210 | actor.blindHide('left', .35); |
214 | actor.setVisible(false); | 211 | actor.setVisible(false); |
215 | actor.play(this.onSlideIn.createDelegate(this)); | 212 | actor.play(this.onSlideIn.createDelegate(this)); |
216 | } | 213 | } |
217 | }, | 214 | }, |
218 | 215 | ||
219 | //----------------------------------------------------- | 216 | //----------------------------------------------------- |
220 | 217 | ||
221 | 'onSlideIn': function() { | 218 | 'onSlideIn': function() { |
222 | this.setStatus('slideIn'); | 219 | this.setStatus('slideIn'); |
223 | MochiKit.Logging.logDebug(">>> onSlideIn"); | 220 | MochiKit.Logging.logDebug(">>> onSlideIn"); |
224 | // alert("done"); | 221 | // alert("done"); |
225 | }, | 222 | }, |
226 | 223 | ||
227 | //----------------------------------------------------- | 224 | //----------------------------------------------------- |
228 | 225 | ||
229 | 'hideContentElement': function() { | 226 | 'hideContentElement': function() { |
230 | this.contentWrapper().hide(); | 227 | this.contentWrapper().hide(); |
231 | }, | 228 | }, |
232 | 229 | ||
233 | //----------------------------------------------------- | 230 | //----------------------------------------------------- |
234 | //----------------------------------------------------- | 231 | //----------------------------------------------------- |
235 | 232 | ||
236 | //----------------------------------------------------- | 233 | //----------------------------------------------------- |
237 | __syntaxFix__: '__syntaxFix__' | 234 | __syntaxFix__: '__syntaxFix__' |
238 | }); \ No newline at end of file | 235 | }); \ No newline at end of file |