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
if(nofade)
+ − 10
{
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 11
changeOpac(70, 'specialLayer_darkener');
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 12
document.getElementById('specialLayer_darkener').style.display = 'block';
1
+ − 13
}
+ − 14
else
+ − 15
{
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 16
document.getElementById('specialLayer_darkener').style.display = 'block';
1
+ − 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
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
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;
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 100
var mb_previously_had_darkener = false;
1
+ − 101
+ − 102
function messagebox(type, title, message)
+ − 103
{
+ − 104
var y = getScrollOffset();
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 105
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 106
// Prevent multiple instances
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 107
if ( document.getElementById('messageBox') )
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 108
return;
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 109
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 110
if ( document.getElementById('specialLayer_darkener') )
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 111
if ( document.getElementById('specialLayer_darkener').style.display == 'block' )
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 112
mb_previously_had_darkener = true;
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 113
if ( !mb_previously_had_darkener )
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 114
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
diff
changeset
+ − 115
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
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
diff
changeset
+ − 117
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
diff
changeset
+ − 118
}
1
+ − 119
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
diff
changeset
+ − 120
master_div.style.zIndex = '6';
1
+ − 121
var mydiv = document.createElement('div');
+ − 122
mydiv.style.width = '400px';
+ − 123
mydiv.style.height = '200px';
+ − 124
w = getWidth();
+ − 125
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
diff
changeset
+ − 126
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
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
diff
changeset
+ − 128
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
diff
changeset
+ − 129
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
diff
changeset
+ − 130
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
diff
changeset
+ − 131
}
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
diff
changeset
+ − 132
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
diff
changeset
+ − 133
{
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
diff
changeset
+ − 134
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
diff
changeset
+ − 135
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
diff
changeset
+ − 136
}
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
diff
changeset
+ − 137
z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ();
1
+ − 138
mydiv.style.backgroundColor = '#FFFFFF';
+ − 139
mydiv.style.padding = '10px';
+ − 140
mydiv.style.marginBottom = '1px';
+ − 141
mydiv.id = 'messageBox';
+ − 142
mydiv.style.overflow = 'auto';
+ − 143
+ − 144
var buttondiv = document.createElement('div');
+ − 145
buttondiv.style.width = '400px';
+ − 146
w = getWidth();
+ − 147
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
diff
changeset
+ − 148
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
diff
changeset
+ − 149
{
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
diff
changeset
+ − 150
//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
diff
changeset
+ − 151
//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
diff
changeset
+ − 152
}
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
diff
changeset
+ − 153
//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
diff
changeset
+ − 154
z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ();
1
+ − 155
buttondiv.style.backgroundColor = '#C0C0C0';
+ − 156
buttondiv.style.padding = '10px';
+ − 157
buttondiv.style.textAlign = 'right';
+ − 158
buttondiv.style.verticalAlign = 'middle';
+ − 159
buttondiv.id = 'messageBoxButtons';
+ − 160
+ − 161
this.clickHandler = function() { messagebox_click(this, mb_current_obj); };
+ − 162
38
+ − 163
if( ( type & MB_ICONINFORMATION || type & MB_ICONSTOP || type & MB_ICONQUESTION || type & MB_ICONEXCLAMATION ) && !(type & MB_ICONLOCK) )
1
+ − 164
{
+ − 165
mydiv.style.paddingLeft = '50px';
+ − 166
mydiv.style.width = '360px';
+ − 167
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
diff
changeset
+ − 168
mydiv.style.backgroundPosition = '8px 8px';
1
+ − 169
}
38
+ − 170
else if ( type & MB_ICONLOCK )
+ − 171
{
+ − 172
mydiv.style.paddingLeft = '50px';
+ − 173
mydiv.style.width = '360px';
+ − 174
mydiv.style.backgroundRepeat = 'no-repeat';
+ − 175
}
1
+ − 176
+ − 177
if(type & MB_ICONINFORMATION)
+ − 178
{
+ − 179
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/info.png\')';
+ − 180
}
+ − 181
+ − 182
if(type & MB_ICONQUESTION)
+ − 183
{
+ − 184
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/question.png\')';
+ − 185
}
+ − 186
+ − 187
if(type & MB_ICONSTOP)
+ − 188
{
+ − 189
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/error.png\')';
+ − 190
}
+ − 191
+ − 192
if(type & MB_ICONEXCLAMATION)
+ − 193
{
+ − 194
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/warning.png\')';
+ − 195
}
+ − 196
+ − 197
if(type & MB_ICONLOCK)
+ − 198
{
+ − 199
mydiv.style.backgroundImage = 'url(\''+scriptPath+'/images/lock.png\')';
+ − 200
}
+ − 201
+ − 202
if(type & MB_OK)
+ − 203
{
+ − 204
btn = document.createElement('input');
+ − 205
btn.type = 'button';
215
+ − 206
btn.value = $lang.get('etc_ok');
+ − 207
btn._GenericName = 'OK';
1
+ − 208
btn.onclick = this.clickHandler;
+ − 209
btn.style.margin = '0 3px';
+ − 210
buttondiv.appendChild(btn);
+ − 211
}
+ − 212
+ − 213
if(type & MB_OKCANCEL)
+ − 214
{
+ − 215
btn = document.createElement('input');
+ − 216
btn.type = 'button';
215
+ − 217
btn.value = $lang.get('etc_ok');
+ − 218
btn._GenericName = 'OK';
1
+ − 219
btn.onclick = this.clickHandler;
+ − 220
btn.style.margin = '0 3px';
+ − 221
buttondiv.appendChild(btn);
+ − 222
+ − 223
btn = document.createElement('input');
+ − 224
btn.type = 'button';
215
+ − 225
btn.value = $lang.get('etc_cancel');
+ − 226
btn._GenericName = 'Cancel';
1
+ − 227
btn.onclick = this.clickHandler;
+ − 228
btn.style.margin = '0 3px';
+ − 229
buttondiv.appendChild(btn);
+ − 230
}
+ − 231
+ − 232
if(type & MB_YESNO)
+ − 233
{
+ − 234
btn = document.createElement('input');
+ − 235
btn.type = 'button';
215
+ − 236
btn.value = $lang.get('etc_yes');
+ − 237
btn._GenericName = 'Yes';
1
+ − 238
btn.onclick = this.clickHandler;
+ − 239
btn.style.margin = '0 3px';
+ − 240
buttondiv.appendChild(btn);
+ − 241
+ − 242
btn = document.createElement('input');
+ − 243
btn.type = 'button';
215
+ − 244
btn.value = $lang.get('etc_no');
+ − 245
btn._GenericName = 'No';
1
+ − 246
btn.onclick = this.clickHandler;
+ − 247
btn.style.margin = '0 3px';
+ − 248
buttondiv.appendChild(btn);
+ − 249
}
+ − 250
+ − 251
if(type & MB_YESNOCANCEL)
+ − 252
{
+ − 253
btn = document.createElement('input');
+ − 254
btn.type = 'button';
215
+ − 255
btn.value = $lang.get('etc_yes');
+ − 256
btn._GenericName = 'Yes';
1
+ − 257
btn.onclick = this.clickHandler;
+ − 258
btn.style.margin = '0 3px';
+ − 259
buttondiv.appendChild(btn);
+ − 260
+ − 261
btn = document.createElement('input');
+ − 262
btn.type = 'button';
215
+ − 263
btn.value = $lang.get('etc_no');
+ − 264
btn._GenericName = 'No';
1
+ − 265
btn.onclick = this.clickHandler;
+ − 266
btn.style.margin = '0 3px';
+ − 267
buttondiv.appendChild(btn);
+ − 268
+ − 269
btn = document.createElement('input');
+ − 270
btn.type = 'button';
215
+ − 271
btn.value = $lang.get('etc_cancel');
+ − 272
btn._GenericName = 'Cancel';
1
+ − 273
btn.onclick = this.clickHandler;
+ − 274
btn.style.margin = '0 3px';
+ − 275
buttondiv.appendChild(btn);
+ − 276
}
+ − 277
+ − 278
heading = document.createElement('h2');
+ − 279
heading.innerHTML = title;
+ − 280
heading.style.color = '#50A0D0';
+ − 281
heading.style.fontFamily = 'trebuchet ms, verdana, arial, helvetica, sans-serif';
+ − 282
heading.style.fontSize = '12pt';
+ − 283
heading.style.fontWeight = 'lighter';
+ − 284
heading.style.textTransform = 'lowercase';
+ − 285
heading.style.marginTop = '0';
+ − 286
mydiv.appendChild(heading);
+ − 287
+ − 288
var text = document.createElement('div');
+ − 289
text.innerHTML = String(message);
+ − 290
this.text_area = text;
+ − 291
mydiv.appendChild(text);
+ − 292
+ − 293
this.updateContent = function(text)
+ − 294
{
+ − 295
this.text_area.innerHTML = text;
+ − 296
};
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
diff
changeset
+ − 297
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
diff
changeset
+ − 298
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
diff
changeset
+ − 299
{
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
diff
changeset
+ − 300
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
diff
changeset
+ − 301
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
diff
changeset
+ − 302
mbdiv.parentNode.removeChild(mbdiv);
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 303
if ( !mb_previously_had_darkener )
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 304
enlighten(true);
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
diff
changeset
+ − 305
};
1
+ − 306
+ − 307
//domObjChangeOpac(0, mydiv);
+ − 308
//domObjChangeOpac(0, master_div);
+ − 309
+ − 310
body = document.getElementsByTagName('body');
+ − 311
body = body[0];
+ − 312
master_div.appendChild(mydiv);
+ − 313
master_div.appendChild(buttondiv);
+ − 314
+ − 315
body.appendChild(master_div);
+ − 316
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
diff
changeset
+ − 317
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
diff
changeset
+ − 318
setTimeout('mb_runFlyIn();', 100);
1
+ − 319
+ − 320
this.onclick = new Array();
+ − 321
this.onbeforeclick = new Array();
+ − 322
mb_current_obj = this;
+ − 323
}
+ − 324
+ − 325
function mb_runFlyIn()
+ − 326
{
+ − 327
var mydiv = document.getElementById('messageBox');
+ − 328
var maindiv = mydiv.parentNode;
+ − 329
fly_in_top(maindiv, true, false);
+ − 330
}
+ − 331
+ − 332
function messagebox_click(obj, mb)
+ − 333
{
215
+ − 334
val = ( typeof ( obj._GenericName ) == 'string' ) ? obj._GenericName : obj.value;
1
+ − 335
if(typeof mb.onbeforeclick[val] == 'function')
+ − 336
{
+ − 337
var o = mb.onbeforeclick[val];
+ − 338
var resp = o();
+ − 339
if ( resp )
+ − 340
return false;
+ − 341
o = false;
+ − 342
}
+ − 343
+ − 344
var mydiv = document.getElementById('messageBox');
+ − 345
var maindiv = mydiv.parentNode;
+ − 346
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
diff
changeset
+ − 347
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
diff
changeset
+ − 348
{
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
diff
changeset
+ − 349
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
diff
changeset
+ − 350
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
diff
changeset
+ − 351
mbdiv.parentNode.removeChild(mbdiv);
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 352
if ( !mb_previously_had_darkener )
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 353
enlighten(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
diff
changeset
+ − 354
}
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
diff
changeset
+ − 355
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
diff
changeset
+ − 356
{
824821224153
Added a new Javascript variable, aclDisableTransitionFX, that will switch off effects on message boxes and the ACL editor when set to true
Dan
diff
changeset
+ − 357
var to = fly_out_top(maindiv, true, false);
473
518bc2b214f1
Added modal dialog support for page editor; added customizability for breadcrumbs (thanks to Manoj for idea)
Dan
diff
changeset
+ − 358
setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); if ( !mb_previously_had_darkener ) enlighten(true);", to);
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
diff
changeset
+ − 359
}
1
+ − 360
if(typeof mb.onclick[val] == 'function')
+ − 361
{
+ − 362
o = mb.onclick[val];
+ − 363
o();
+ − 364
o = false;
+ − 365
}
+ − 366
}
+ − 367
+ − 368
function testMessageBox()
+ − 369
{
+ − 370
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');
+ − 371
mb.onclick['OK'] = function()
+ − 372
{
+ − 373
alert('You clicked OK!');
+ − 374
}
+ − 375
mb.onbeforeclick['Cancel'] = function()
+ − 376
{
+ − 377
alert('You clicked Cancel!');
+ − 378
}
+ − 379
}
+ − 380
+ − 381
// Function to fade classes info-box, warning-box, error-box, etc.
+ − 382
+ − 383
function fadeInfoBoxes()
+ − 384
{
+ − 385
var divs = new Array();
+ − 386
d = document.getElementsByTagName('div');
+ − 387
j = 0;
+ − 388
for(var i in d)
+ − 389
{
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
diff
changeset
+ − 390
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
diff
changeset
+ − 391
continue;
1
+ − 392
if ( !d[i].tagName )
+ − 393
continue;
+ − 394
if(d[i].className=='info-box' || d[i].className=='error-box' || d[i].className=='warning-box' || d[i].className=='question-box')
+ − 395
{
+ − 396
divs[j] = d[i];
+ − 397
j++;
+ − 398
}
+ − 399
}
+ − 400
if(divs.length < 1) return;
+ − 401
for(i in divs)
+ − 402
{
+ − 403
if(!divs[i].id) divs[i].id = 'autofade_'+Math.floor(Math.random() * 100000);
+ − 404
switch(divs[i].className)
+ − 405
{
+ − 406
case 'info-box':
+ − 407
default:
+ − 408
from = '#3333FF';
+ − 409
break;
+ − 410
case 'error-box':
+ − 411
from = '#FF3333';
+ − 412
break;
+ − 413
case 'warning-box':
+ − 414
from = '#FFFF33';
+ − 415
break;
+ − 416
case 'question-box':
+ − 417
from = '#33FF33';
+ − 418
break;
+ − 419
}
+ − 420
Fat.fade_element(divs[i].id,30,2000,from,Fat.get_bgcolor(divs[i].id));
+ − 421
}
+ − 422
}
+ − 423
+ − 424
// Alpha fades
+ − 425
+ − 426
function opacity(id, opacStart, opacEnd, millisec) {
+ − 427
//speed for each frame
+ − 428
var speed = Math.round(millisec / 100);
+ − 429
var timer = 0;
+ − 430
+ − 431
//determine the direction for the blending, if start and end are the same nothing happens
+ − 432
if(opacStart > opacEnd) {
+ − 433
for(i = opacStart; i >= opacEnd; i--) {
+ − 434
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
+ − 435
timer++;
+ − 436
}
+ − 437
} else if(opacStart < opacEnd) {
+ − 438
for(i = opacStart; i <= opacEnd; i++)
+ − 439
{
+ − 440
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
+ − 441
timer++;
+ − 442
}
+ − 443
}
+ − 444
}
+ − 445
53
+ − 446
var opacityDOMCache = new Object();
+ − 447
function domOpacity(obj, opacStart, opacEnd, millisec) {
+ − 448
//speed for each frame
+ − 449
var speed = Math.round(millisec / 100);
+ − 450
var timer = 0;
+ − 451
+ − 452
// unique ID for this animation
+ − 453
var uniqid = Math.floor(Math.random() * 1000000);
+ − 454
opacityDOMCache[uniqid] = obj;
+ − 455
+ − 456
//determine the direction for the blending, if start and end are the same nothing happens
+ − 457
if(opacStart > opacEnd) {
+ − 458
for(i = opacStart; i >= opacEnd; i--) {
+ − 459
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed));
+ − 460
timer++;
+ − 461
}
+ − 462
} else if(opacStart < opacEnd) {
+ − 463
for(i = opacStart; i <= opacEnd; i++)
+ − 464
{
+ − 465
setTimeout("var obj = opacityDOMCache["+uniqid+"]; domObjChangeOpac(" + i + ",obj)",(timer * speed));
+ − 466
timer++;
+ − 467
}
+ − 468
}
+ − 469
setTimeout("delete(opacityDOMCache["+uniqid+"]);",(timer * speed));
+ − 470
}
+ − 471
1
+ − 472
//change the opacity for different browsers
+ − 473
function changeOpac(opacity, id) {
+ − 474
var object = document.getElementById(id).style;
+ − 475
object.opacity = (opacity / 100);
+ − 476
object.MozOpacity = (opacity / 100);
+ − 477
object.KhtmlOpacity = (opacity / 100);
+ − 478
object.filter = "alpha(opacity=" + opacity + ")";
+ − 479
}
+ − 480
+ − 481
function mb_logout()
+ − 482
{
210
2b283402e4e4
Added language export to JSON page and localization for Javascript using $lang.get(). Localized AJAX login interface.
Dan
diff
changeset
+ − 483
var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body'));
1
+ − 484
mb.onclick['Yes'] = function()
+ − 485
{
+ − 486
window.location = makeUrlNS('Special', 'Logout/' + title);
+ − 487
}
+ − 488
}
+ − 489