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