author | Dan |
Tue, 29 Jan 2008 16:19:51 -0500 | |
changeset 387 | 92664d2efab8 |
parent 326 | ab66d6d1f1f4 |
child 419 | b8b4e38825db |
permissions | -rw-r--r-- |
1 | 1 |
// Message box system |
2 |
||
3 |
function darken(nofade) |
|
4 |
{ |
|
5 |
if(IE) |
|
6 |
nofade = true; |
|
7 |
if(document.getElementById('specialLayer_darkener')) |
|
8 |
{ |
|
9 |
document.getElementById('specialLayer_darkener').style.display = 'block'; |
|
10 |
if(nofade) |
|
11 |
{ |
|
12 |
document.getElementById('specialLayer_darkener').style.opacity = '0.7'; |
|
13 |
document.getElementById('specialLayer_darkener').style.filter = 'alpha(opacity=70)'; |
|
14 |
} |
|
15 |
else |
|
16 |
{ |
|
17 |
opacity('specialLayer_darkener', 0, 70, 1000); |
|
18 |
} |
|
19 |
} else { |
|
20 |
w = getWidth(); |
|
21 |
h = getHeight(); |
|
22 |
var thediv = document.createElement('div'); |
|
23 |
if(IE) |
|
24 |
thediv.style.position = 'absolute'; |
|
25 |
else |
|
26 |
thediv.style.position = 'fixed'; |
|
27 |
thediv.style.top = '0px'; |
|
28 |
thediv.style.left = '0px'; |
|
29 |
thediv.style.opacity = '0'; |
|
30 |
thediv.style.filter = 'alpha(opacity=0)'; |
|
31 |
thediv.style.backgroundColor = '#000000'; |
|
32 |
thediv.style.width = '100%'; |
|
33 |
thediv.style.height = '100%'; |
|
34 |
thediv.zIndex = getHighestZ() + 5; |
|
35 |
thediv.id = 'specialLayer_darkener'; |
|
36 |
if(nofade) |
|
37 |
{ |
|
38 |
thediv.style.opacity = '0.7'; |
|
39 |
thediv.style.filter = 'alpha(opacity=70)'; |
|
40 |
body = document.getElementsByTagName('body'); |
|
41 |
body = body[0]; |
|
42 |
body.appendChild(thediv); |
|
43 |
} else { |
|
44 |
body = document.getElementsByTagName('body'); |
|
45 |
body = body[0]; |
|
46 |
body.appendChild(thediv); |
|
47 |
opacity('specialLayer_darkener', 0, 70, 1000); |
|
48 |
} |
|
49 |
} |
|
50 |
} |
|
51 |
||
52 |
function enlighten(nofade) |
|
53 |
{ |
|
54 |
if(IE) |
|
55 |
nofade = true; |
|
56 |
if(document.getElementById('specialLayer_darkener')) |
|
57 |
{ |
|
58 |
if(nofade) |
|
59 |
{ |
|
60 |
document.getElementById('specialLayer_darkener').style.display = 'none'; |
|
61 |
} |
|
62 |
opacity('specialLayer_darkener', 70, 0, 1000); |
|
63 |
setTimeout("document.getElementById('specialLayer_darkener').style.display = 'none';", 1000); |
|
64 |
} |
|
65 |
} |
|
66 |
||
67 |
/** |
|
68 |
* The ultimate message box framework for Javascript |
|
69 |
* Syntax is (almost) identical to the MessageBox command in NSIS |
|
70 |
* @param int type - a bitfield consisting of the MB_* constants |
|
71 |
* @param string title - the blue text at the top of the window |
|
72 |
* @param string text - HTML for the body of the message box |
|
73 |
* Properties: |
|
74 |
* onclick - an array of functions to be called on button click events |
|
75 |
* NOTE: key names are to be strings, and they must be the value of the input, CaSe-SeNsItIvE |
|
76 |
* onbeforeclick - same as onclick but called before the messagebox div is destroyed |
|
320
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
77 |
* Methods: |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
78 |
* destroy: kills the running message box |
1 | 79 |
* Example: |
80 |
* var my_message = new messagebox(MB_OK|MB_ICONSTOP, 'Error logging in', 'The username and/or password is incorrect. Please check the username and retype your password'); |
|
81 |
* my_message.onclick['OK'] = function() { |
|
82 |
* document.getElementById('password').value = ''; |
|
83 |
* }; |
|
84 |
* Deps: |
|
85 |
* Modern browser that supports DOM |
|
86 |
* darken() and enlighten() (above) |
|
87 |
* opacity() - required for darken() and enlighten() |
|
88 |
* MB_* constants are defined in enano-lib-basic.js |
|
89 |
*/ |
|
90 |
||
91 |
var mb_current_obj; |
|
92 |
||
93 |
function messagebox(type, title, message) |
|
94 |
{ |
|
95 |
var y = getScrollOffset(); |
|
96 |
if(document.getElementById('messageBox')) return; |
|
97 |
darken(true); |
|
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
98 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
99 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
100 |
document.getElementById('specialLayer_darkener').style.zIndex = '5'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
101 |
} |
1 | 102 |
var master_div = document.createElement('div'); |
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
103 |
master_div.style.zIndex = '6'; |
1 | 104 |
var mydiv = document.createElement('div'); |
105 |
mydiv.style.width = '400px'; |
|
106 |
mydiv.style.height = '200px'; |
|
107 |
w = getWidth(); |
|
108 |
h = getHeight(); |
|
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
109 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
110 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
111 |
master_div.style.left = ((w / 2) - 200)+'px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
112 |
master_div.style.top = ((h / 2) + y - 120)+'px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
113 |
master_div.style.position = 'absolute'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
114 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
115 |
else |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
116 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
117 |
master_div.style.top = '-10000px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
118 |
master_div.style.position = ( IE ) ? 'absolute' : 'fixed'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
119 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
120 |
z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ(); |
1 | 121 |
mydiv.style.backgroundColor = '#FFFFFF'; |
122 |
mydiv.style.padding = '10px'; |
|
123 |
mydiv.style.marginBottom = '1px'; |
|
124 |
mydiv.id = 'messageBox'; |
|
125 |
mydiv.style.overflow = 'auto'; |
|
126 |
||
127 |
var buttondiv = document.createElement('div'); |
|
128 |
buttondiv.style.width = '400px'; |
|
129 |
w = getWidth(); |
|
130 |
h = getHeight(); |
|
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
131 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
132 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
133 |
//buttondiv.style.left = ((w / 2) - 200)+'px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
134 |
//buttondiv.style.top = ((h / 2) + y + 101)+'px'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
135 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
136 |
//buttondiv.style.position = ( IE ) ? 'absolute' : 'fixed'; |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
137 |
z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ(); |
1 | 138 |
buttondiv.style.backgroundColor = '#C0C0C0'; |
139 |
buttondiv.style.padding = '10px'; |
|
140 |
buttondiv.style.textAlign = 'right'; |
|
141 |
buttondiv.style.verticalAlign = 'middle'; |
|
142 |
buttondiv.id = 'messageBoxButtons'; |
|
143 |
||
144 |
this.clickHandler = function() { messagebox_click(this, mb_current_obj); }; |
|
145 |
||
38 | 146 |
if( ( type & MB_ICONINFORMATION || type & MB_ICONSTOP || type & MB_ICONQUESTION || type & MB_ICONEXCLAMATION ) && !(type & MB_ICONLOCK) ) |
1 | 147 |
{ |
148 |
mydiv.style.paddingLeft = '50px'; |
|
149 |
mydiv.style.width = '360px'; |
|
150 |
mydiv.style.backgroundRepeat = 'no-repeat'; |
|
32
4d87aad3c4c0
Finished everything on the TODO list (yay!); several CSS cleanups; tons more changes in this commit - see the patch for details
Dan
parents:
1
diff
changeset
|
151 |
mydiv.style.backgroundPosition = '8px 8px'; |
1 | 152 |
} |
38 | 153 |
else if ( type & MB_ICONLOCK ) |
154 |
{ |
|
155 |
mydiv.style.paddingLeft = '50px'; |
|
156 |
mydiv.style.width = '360px'; |
|
157 |
mydiv.style.backgroundRepeat = 'no-repeat'; |
|
158 |
} |
|
1 | 159 |
|
160 |
if(type & MB_ICONINFORMATION) |
|
161 |
{ |
|
162 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/info.png\')'; |
|
163 |
} |
|
164 |
||
165 |
if(type & MB_ICONQUESTION) |
|
166 |
{ |
|
167 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/question.png\')'; |
|
168 |
} |
|
169 |
||
170 |
if(type & MB_ICONSTOP) |
|
171 |
{ |
|
172 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/error.png\')'; |
|
173 |
} |
|
174 |
||
175 |
if(type & MB_ICONEXCLAMATION) |
|
176 |
{ |
|
177 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/warning.png\')'; |
|
178 |
} |
|
179 |
||
180 |
if(type & MB_ICONLOCK) |
|
181 |
{ |
|
182 |
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/lock.png\')'; |
|
183 |
} |
|
184 |
||
185 |
if(type & MB_OK) |
|
186 |
{ |
|
187 |
btn = document.createElement('input'); |
|
188 |
btn.type = 'button'; |
|
215 | 189 |
btn.value = $lang.get('etc_ok'); |
190 |
btn._GenericName = 'OK'; |
|
1 | 191 |
btn.onclick = this.clickHandler; |
192 |
btn.style.margin = '0 3px'; |
|
193 |
buttondiv.appendChild(btn); |
|
194 |
} |
|
195 |
||
196 |
if(type & MB_OKCANCEL) |
|
197 |
{ |
|
198 |
btn = document.createElement('input'); |
|
199 |
btn.type = 'button'; |
|
215 | 200 |
btn.value = $lang.get('etc_ok'); |
201 |
btn._GenericName = 'OK'; |
|
1 | 202 |
btn.onclick = this.clickHandler; |
203 |
btn.style.margin = '0 3px'; |
|
204 |
buttondiv.appendChild(btn); |
|
205 |
||
206 |
btn = document.createElement('input'); |
|
207 |
btn.type = 'button'; |
|
215 | 208 |
btn.value = $lang.get('etc_cancel'); |
209 |
btn._GenericName = 'Cancel'; |
|
1 | 210 |
btn.onclick = this.clickHandler; |
211 |
btn.style.margin = '0 3px'; |
|
212 |
buttondiv.appendChild(btn); |
|
213 |
} |
|
214 |
||
215 |
if(type & MB_YESNO) |
|
216 |
{ |
|
217 |
btn = document.createElement('input'); |
|
218 |
btn.type = 'button'; |
|
215 | 219 |
btn.value = $lang.get('etc_yes'); |
220 |
btn._GenericName = 'Yes'; |
|
1 | 221 |
btn.onclick = this.clickHandler; |
222 |
btn.style.margin = '0 3px'; |
|
223 |
buttondiv.appendChild(btn); |
|
224 |
||
225 |
btn = document.createElement('input'); |
|
226 |
btn.type = 'button'; |
|
215 | 227 |
btn.value = $lang.get('etc_no'); |
228 |
btn._GenericName = 'No'; |
|
1 | 229 |
btn.onclick = this.clickHandler; |
230 |
btn.style.margin = '0 3px'; |
|
231 |
buttondiv.appendChild(btn); |
|
232 |
} |
|
233 |
||
234 |
if(type & MB_YESNOCANCEL) |
|
235 |
{ |
|
236 |
btn = document.createElement('input'); |
|
237 |
btn.type = 'button'; |
|
215 | 238 |
btn.value = $lang.get('etc_yes'); |
239 |
btn._GenericName = 'Yes'; |
|
1 | 240 |
btn.onclick = this.clickHandler; |
241 |
btn.style.margin = '0 3px'; |
|
242 |
buttondiv.appendChild(btn); |
|
243 |
||
244 |
btn = document.createElement('input'); |
|
245 |
btn.type = 'button'; |
|
215 | 246 |
btn.value = $lang.get('etc_no'); |
247 |
btn._GenericName = 'No'; |
|
1 | 248 |
btn.onclick = this.clickHandler; |
249 |
btn.style.margin = '0 3px'; |
|
250 |
buttondiv.appendChild(btn); |
|
251 |
||
252 |
btn = document.createElement('input'); |
|
253 |
btn.type = 'button'; |
|
215 | 254 |
btn.value = $lang.get('etc_cancel'); |
255 |
btn._GenericName = 'Cancel'; |
|
1 | 256 |
btn.onclick = this.clickHandler; |
257 |
btn.style.margin = '0 3px'; |
|
258 |
buttondiv.appendChild(btn); |
|
259 |
} |
|
260 |
||
261 |
heading = document.createElement('h2'); |
|
262 |
heading.innerHTML = title; |
|
263 |
heading.style.color = '#50A0D0'; |
|
264 |
heading.style.fontFamily = 'trebuchet ms, verdana, arial, helvetica, sans-serif'; |
|
265 |
heading.style.fontSize = '12pt'; |
|
266 |
heading.style.fontWeight = 'lighter'; |
|
267 |
heading.style.textTransform = 'lowercase'; |
|
268 |
heading.style.marginTop = '0'; |
|
269 |
mydiv.appendChild(heading); |
|
270 |
||
271 |
var text = document.createElement('div'); |
|
272 |
text.innerHTML = String(message); |
|
273 |
this.text_area = text; |
|
274 |
mydiv.appendChild(text); |
|
275 |
||
276 |
this.updateContent = function(text) |
|
277 |
{ |
|
278 |
this.text_area.innerHTML = text; |
|
279 |
}; |
|
320
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
280 |
|
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
281 |
this.destroy = function() |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
282 |
{ |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
283 |
var mbdiv = document.getElementById('messageBox'); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
284 |
mbdiv.parentNode.removeChild(mbdiv.nextSibling); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
285 |
mbdiv.parentNode.removeChild(mbdiv); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
286 |
enlighten(true); |
112debff64bd
SURPRISE! Preliminary PostgreSQL support added. The required schema file is not present in this commit and will be included at a later date. No installer support is implemented. Also in this commit: several fixes including <!-- SYSMSG ... --> was broken in template compiler; set fixed width on included images to prevent the thumbnail box from getting huge; added a much more friendly interface to AJAX responses that are invalid JSON
Dan
parents:
151
diff
changeset
|
287 |
}; |
1 | 288 |
|
289 |
//domObjChangeOpac(0, mydiv); |
|
290 |
//domObjChangeOpac(0, master_div); |
|
291 |
||
292 |
body = document.getElementsByTagName('body'); |
|
293 |
body = body[0]; |
|
294 |
master_div.appendChild(mydiv); |
|
295 |
master_div.appendChild(buttondiv); |
|
296 |
||
297 |
body.appendChild(master_div); |
|
298 |
||
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
299 |
if ( !aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
300 |
setTimeout('mb_runFlyIn();', 100); |
1 | 301 |
|
302 |
this.onclick = new Array(); |
|
303 |
this.onbeforeclick = new Array(); |
|
304 |
mb_current_obj = this; |
|
305 |
} |
|
306 |
||
307 |
function mb_runFlyIn() |
|
308 |
{ |
|
309 |
var mydiv = document.getElementById('messageBox'); |
|
310 |
var maindiv = mydiv.parentNode; |
|
311 |
fly_in_top(maindiv, true, false); |
|
312 |
} |
|
313 |
||
314 |
function messagebox_click(obj, mb) |
|
315 |
{ |
|
215 | 316 |
val = ( typeof ( obj._GenericName ) == 'string' ) ? obj._GenericName : obj.value; |
1 | 317 |
if(typeof mb.onbeforeclick[val] == 'function') |
318 |
{ |
|
319 |
var o = mb.onbeforeclick[val]; |
|
320 |
var resp = o(); |
|
321 |
if ( resp ) |
|
322 |
return false; |
|
323 |
o = false; |
|
324 |
} |
|
325 |
||
326 |
var mydiv = document.getElementById('messageBox'); |
|
327 |
var maindiv = mydiv.parentNode; |
|
328 |
||
151
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
329 |
if ( aclDisableTransitionFX ) |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
330 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
331 |
var mbdiv = document.getElementById('messageBox'); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
332 |
mbdiv.parentNode.removeChild(mbdiv.nextSibling); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
333 |
mbdiv.parentNode.removeChild(mbdiv); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
334 |
enlighten(true); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
335 |
} |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
336 |
else |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
337 |
{ |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
338 |
var to = fly_out_top(maindiv, true, false); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
339 |
setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); enlighten(true);", to); |
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
parents:
53
diff
changeset
|
340 |
} |
1 | 341 |
if(typeof mb.onclick[val] == 'function') |
342 |
{ |
|
343 |
o = mb.onclick[val]; |
|
344 |
o(); |
|
345 |
o = false; |
|
346 |
} |
|
347 |
} |
|
348 |
||
349 |
function testMessageBox() |
|
350 |
{ |
|
351 |
mb = new messagebox(MB_OKCANCEL|MB_ICONINFORMATION, 'Javascripted dynamic message boxes', 'This is soooooo coool, now if only document.createElement() worked in IE!<br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text<br /><br /><br /><br /><br />this is some more text'); |
|
352 |
mb.onclick['OK'] = function() |
|
353 |
{ |
|
354 |
alert('You clicked OK!'); |
|
355 |
} |
|
356 |
mb.onbeforeclick['Cancel'] = function() |
|
357 |
{ |
|
358 |
alert('You clicked Cancel!'); |
|
359 |
} |
|
360 |
} |
|
361 |
||
362 |
// Function to fade classes info-box, warning-box, error-box, etc. |
|
363 |
||
364 |
function fadeInfoBoxes() |
|
365 |
{ |
|
366 |
var divs = new Array(); |
|
367 |
d = document.getElementsByTagName('div'); |
|
368 |
j = 0; |
|
369 |
for(var i in d) |
|
370 |
{ |
|
371 |
if ( !d[i].tagName ) |
|
372 |
continue; |
|
373 |
if(d[i].className=='info-box' || d[i].className=='error-box' || d[i].className=='warning-box' || d[i].className=='question-box') |
|
374 |
{ |
|
375 |
divs[j] = d[i]; |
|
376 |
j++; |
|
377 |
} |
|
378 |
} |
|
379 |
if(divs.length < 1) return; |
|
380 |
for(i in divs) |
|
381 |
{ |
|
382 |
if(!divs[i].id) divs[i].id = 'autofade_'+Math.floor(Math.random() * 100000); |
|
383 |
switch(divs[i].className) |
|
384 |
{ |
|
385 |
case 'info-box': |
|
386 |
default: |
|
387 |
from = '#3333FF'; |
|
388 |
break; |
|
389 |
case 'error-box': |
|
390 |
from = '#FF3333'; |
|
391 |
break; |
|
392 |
case 'warning-box': |
|
393 |
from = '#FFFF33'; |
|
394 |
break; |
|
395 |
case 'question-box': |
|
396 |
from = '#33FF33'; |
|
397 |
break; |
|
398 |
} |
|
399 |
Fat.fade_element(divs[i].id,30,2000,from,Fat.get_bgcolor(divs[i].id)); |
|
400 |
} |
|
401 |
} |
|
402 |
||
403 |
// Alpha fades |
|
404 |
||
405 |
function opacity(id, opacStart, opacEnd, millisec) { |
|
406 |
//speed for each frame |
|
407 |
var speed = Math.round(millisec / 100); |
|
408 |
var timer = 0; |
|
409 |
||
410 |
//determine the direction for the blending, if start and end are the same nothing happens |
|
411 |
if(opacStart > opacEnd) { |
|
412 |
for(i = opacStart; i >= opacEnd; i--) { |
|
413 |
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); |
|
414 |
timer++; |
|
415 |
} |
|
416 |
} else if(opacStart < opacEnd) { |
|
417 |
for(i = opacStart; i <= opacEnd; i++) |
|
418 |
{ |
|
419 |
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); |
|
420 |
timer++; |
|
421 |
} |
|
422 |
} |
|
423 |
} |
|
424 |
||
53 | 425 |
var opacityDOMCache = new Object(); |
426 |
function domOpacity(obj, opacStart, opacEnd, millisec) { |
|
427 |
//speed for each frame |
|
428 |
var speed = Math.round(millisec / 100); |
|
429 |
var timer = 0; |
|
430 |
||
431 |
// unique ID for this animation |
|
432 |
var uniqid = Math.floor(Math.random() * 1000000); |
|
433 |
opacityDOMCache[uniqid] = obj; |
|
434 |
||
435 |
//determine the direction for the blending, if start and end are the same nothing happens |
|
436 |
if(opacStart > opacEnd) { |
|
437 |
for(i = opacStart; i >= opacEnd; i--) { |
|
438 |
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
439 |
timer++; |
|
440 |
} |
|
441 |
} else if(opacStart < opacEnd) { |
|
442 |
for(i = opacStart; i <= opacEnd; i++) |
|
443 |
{ |
|
444 |
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed)); |
|
445 |
timer++; |
|
446 |
} |
|
447 |
} |
|
448 |
setTimeout("delete(opacityDOMCache["+uniqid+"]);",(timer * speed)); |
|
449 |
} |
|
450 |
||
1 | 451 |
//change the opacity for different browsers |
452 |
function changeOpac(opacity, id) { |
|
453 |
var object = document.getElementById(id).style; |
|
454 |
object.opacity = (opacity / 100); |
|
455 |
object.MozOpacity = (opacity / 100); |
|
456 |
object.KhtmlOpacity = (opacity / 100); |
|
457 |
object.filter = "alpha(opacity=" + opacity + ")"; |
|
458 |
} |
|
459 |
||
460 |
function mb_logout() |
|
461 |
{ |
|
210
2b283402e4e4
Added language export to JSON page and localization for Javascript using $lang.get(). Localized AJAX login interface.
Dan
parents:
151
diff
changeset
|
462 |
var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body')); |
1 | 463 |
mb.onclick['Yes'] = function() |
464 |
{ |
|
465 |
window.location = makeUrlNS('Special', 'Logout/' + title); |
|
466 |
} |
|
467 |
} |
|
468 |