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