includes/clientside/static/faders.js
changeset 229 97ae8e9d5e29
parent 215 94db56b8124f
child 326 ab66d6d1f1f4
equal deleted inserted replaced
147:d8156d18ac58 229:97ae8e9d5e29
    91 function messagebox(type, title, message)
    91 function messagebox(type, title, message)
    92 {
    92 {
    93   var y = getScrollOffset();
    93   var y = getScrollOffset();
    94   if(document.getElementById('messageBox')) return;
    94   if(document.getElementById('messageBox')) return;
    95   darken(true);
    95   darken(true);
       
    96   if ( aclDisableTransitionFX )
       
    97   {
       
    98     document.getElementById('specialLayer_darkener').style.zIndex = '5';
       
    99   }
    96   var master_div = document.createElement('div');
   100   var master_div = document.createElement('div');
       
   101   master_div.style.zIndex = '6';
    97   var mydiv = document.createElement('div');
   102   var mydiv = document.createElement('div');
    98   mydiv.style.width = '400px';
   103   mydiv.style.width = '400px';
    99   mydiv.style.height = '200px';
   104   mydiv.style.height = '200px';
   100   w = getWidth();
   105   w = getWidth();
   101   h = getHeight();
   106   h = getHeight();
   102   //master_div.style.left = (w / 2) - 200+'px';
   107   if ( aclDisableTransitionFX )
   103   //master_div.style.top = (h / 2) + y - 120+'px';
   108   {
   104   master_div.style.top = '-10000px';
   109     master_div.style.left = ((w / 2) - 200)+'px';
   105   master_div.style.position = ( IE ) ? 'absolute' : 'fixed';
   110     master_div.style.top = ((h / 2) + y - 120)+'px';
   106   z = getHighestZ(); // document.getElementById('specialLayer_darkener').style.zIndex;
   111     master_div.style.position = 'absolute';
   107   mydiv.style.zIndex = parseInt(z) + 1;
   112   }
       
   113   else
       
   114   {
       
   115     master_div.style.top = '-10000px';
       
   116     master_div.style.position = ( IE ) ? 'absolute' : 'fixed';
       
   117   }
       
   118   z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ();
   108   mydiv.style.backgroundColor = '#FFFFFF';
   119   mydiv.style.backgroundColor = '#FFFFFF';
   109   mydiv.style.padding = '10px';
   120   mydiv.style.padding = '10px';
   110   mydiv.style.marginBottom = '1px';
   121   mydiv.style.marginBottom = '1px';
   111   mydiv.id = 'messageBox';
   122   mydiv.id = 'messageBox';
   112   mydiv.style.overflow = 'auto';
   123   mydiv.style.overflow = 'auto';
   113   
   124   
   114   var buttondiv = document.createElement('div');
   125   var buttondiv = document.createElement('div');
   115   buttondiv.style.width = '400px';
   126   buttondiv.style.width = '400px';
   116   w = getWidth();
   127   w = getWidth();
   117   h = getHeight();
   128   h = getHeight();
   118   // buttondiv.style.left = (w / 2) - 200+'px';
   129   if ( aclDisableTransitionFX )
   119   // buttondiv.style.top = (h / 2) + y + 101+'px';
   130   {
   120   // buttondiv.style.position = ( IE ) ? 'absolute' : 'fixed';
   131     //buttondiv.style.left = ((w / 2) - 200)+'px';
   121   z = getHighestZ(); // document.getElementById('specialLayer_darkener').style.zIndex;
   132     //buttondiv.style.top = ((h / 2) + y + 101)+'px';
   122   buttondiv.style.zIndex = parseInt(z) + 1;
   133   }
       
   134   //buttondiv.style.position = ( IE ) ? 'absolute' : 'fixed';
       
   135   z = ( aclDisableTransitionFX ) ? document.getElementById('specialLayer_darkener').style.zIndex : getHighestZ();
   123   buttondiv.style.backgroundColor = '#C0C0C0';
   136   buttondiv.style.backgroundColor = '#C0C0C0';
   124   buttondiv.style.padding = '10px';
   137   buttondiv.style.padding = '10px';
   125   buttondiv.style.textAlign = 'right';
   138   buttondiv.style.textAlign = 'right';
   126   buttondiv.style.verticalAlign = 'middle';
   139   buttondiv.style.verticalAlign = 'middle';
   127   buttondiv.id = 'messageBoxButtons';
   140   buttondiv.id = 'messageBoxButtons';
   169   
   182   
   170   if(type & MB_OK)
   183   if(type & MB_OK)
   171   {
   184   {
   172     btn = document.createElement('input');
   185     btn = document.createElement('input');
   173     btn.type = 'button';
   186     btn.type = 'button';
   174     btn.value = 'OK';
   187     btn.value = $lang.get('etc_ok');
       
   188     btn._GenericName = 'OK';
   175     btn.onclick = this.clickHandler;
   189     btn.onclick = this.clickHandler;
   176     btn.style.margin = '0 3px';
   190     btn.style.margin = '0 3px';
   177     buttondiv.appendChild(btn);
   191     buttondiv.appendChild(btn);
   178   }
   192   }
   179   
   193   
   180   if(type & MB_OKCANCEL)
   194   if(type & MB_OKCANCEL)
   181   {
   195   {
   182     btn = document.createElement('input');
   196     btn = document.createElement('input');
   183     btn.type = 'button';
   197     btn.type = 'button';
   184     btn.value = 'OK';
   198     btn.value = $lang.get('etc_ok');
       
   199     btn._GenericName = 'OK';
   185     btn.onclick = this.clickHandler;
   200     btn.onclick = this.clickHandler;
   186     btn.style.margin = '0 3px';
   201     btn.style.margin = '0 3px';
   187     buttondiv.appendChild(btn);
   202     buttondiv.appendChild(btn);
   188     
   203     
   189     btn = document.createElement('input');
   204     btn = document.createElement('input');
   190     btn.type = 'button';
   205     btn.type = 'button';
   191     btn.value = 'Cancel';
   206     btn.value = $lang.get('etc_cancel');
       
   207     btn._GenericName = 'Cancel';
   192     btn.onclick = this.clickHandler;
   208     btn.onclick = this.clickHandler;
   193     btn.style.margin = '0 3px';
   209     btn.style.margin = '0 3px';
   194     buttondiv.appendChild(btn);
   210     buttondiv.appendChild(btn);
   195   }
   211   }
   196   
   212   
   197   if(type & MB_YESNO)
   213   if(type & MB_YESNO)
   198   {
   214   {
   199     btn = document.createElement('input');
   215     btn = document.createElement('input');
   200     btn.type = 'button';
   216     btn.type = 'button';
   201     btn.value = 'Yes';
   217     btn.value = $lang.get('etc_yes');
       
   218     btn._GenericName = 'Yes';
   202     btn.onclick = this.clickHandler;
   219     btn.onclick = this.clickHandler;
   203     btn.style.margin = '0 3px';
   220     btn.style.margin = '0 3px';
   204     buttondiv.appendChild(btn);
   221     buttondiv.appendChild(btn);
   205     
   222     
   206     btn = document.createElement('input');
   223     btn = document.createElement('input');
   207     btn.type = 'button';
   224     btn.type = 'button';
   208     btn.value = 'No';
   225     btn.value = $lang.get('etc_no');
       
   226     btn._GenericName = 'No';
   209     btn.onclick = this.clickHandler;
   227     btn.onclick = this.clickHandler;
   210     btn.style.margin = '0 3px';
   228     btn.style.margin = '0 3px';
   211     buttondiv.appendChild(btn);
   229     buttondiv.appendChild(btn);
   212   }
   230   }
   213   
   231   
   214   if(type & MB_YESNOCANCEL)
   232   if(type & MB_YESNOCANCEL)
   215   {
   233   {
   216     btn = document.createElement('input');
   234     btn = document.createElement('input');
   217     btn.type = 'button';
   235     btn.type = 'button';
   218     btn.value = 'Yes';
   236     btn.value = $lang.get('etc_yes');
       
   237     btn._GenericName = 'Yes';
   219     btn.onclick = this.clickHandler;
   238     btn.onclick = this.clickHandler;
   220     btn.style.margin = '0 3px';
   239     btn.style.margin = '0 3px';
   221     buttondiv.appendChild(btn);
   240     buttondiv.appendChild(btn);
   222     
   241     
   223     btn = document.createElement('input');
   242     btn = document.createElement('input');
   224     btn.type = 'button';
   243     btn.type = 'button';
   225     btn.value = 'No';
   244     btn.value = $lang.get('etc_no');
       
   245     btn._GenericName = 'No';
   226     btn.onclick = this.clickHandler;
   246     btn.onclick = this.clickHandler;
   227     btn.style.margin = '0 3px';
   247     btn.style.margin = '0 3px';
   228     buttondiv.appendChild(btn);
   248     buttondiv.appendChild(btn);
   229     
   249     
   230     btn = document.createElement('input');
   250     btn = document.createElement('input');
   231     btn.type = 'button';
   251     btn.type = 'button';
   232     btn.value = 'Cancel';
   252     btn.value = $lang.get('etc_cancel');
       
   253     btn._GenericName = 'Cancel';
   233     btn.onclick = this.clickHandler;
   254     btn.onclick = this.clickHandler;
   234     btn.style.margin = '0 3px';
   255     btn.style.margin = '0 3px';
   235     buttondiv.appendChild(btn);
   256     buttondiv.appendChild(btn);
   236   }
   257   }
   237   
   258   
   263   master_div.appendChild(mydiv);
   284   master_div.appendChild(mydiv);
   264   master_div.appendChild(buttondiv);
   285   master_div.appendChild(buttondiv);
   265   
   286   
   266   body.appendChild(master_div);
   287   body.appendChild(master_div);
   267   
   288   
   268   setTimeout('mb_runFlyIn();', 100);
   289   if ( !aclDisableTransitionFX )
       
   290     setTimeout('mb_runFlyIn();', 100);
   269   
   291   
   270   this.onclick = new Array();
   292   this.onclick = new Array();
   271   this.onbeforeclick = new Array();
   293   this.onbeforeclick = new Array();
   272   mb_current_obj = this;
   294   mb_current_obj = this;
   273 }
   295 }
   279   fly_in_top(maindiv, true, false);
   301   fly_in_top(maindiv, true, false);
   280 }
   302 }
   281 
   303 
   282 function messagebox_click(obj, mb)
   304 function messagebox_click(obj, mb)
   283 {
   305 {
   284   val = obj.value;
   306   val = ( typeof ( obj._GenericName ) == 'string' ) ? obj._GenericName : obj.value;
   285   if(typeof mb.onbeforeclick[val] == 'function')
   307   if(typeof mb.onbeforeclick[val] == 'function')
   286   {
   308   {
   287     var o = mb.onbeforeclick[val];
   309     var o = mb.onbeforeclick[val];
   288     var resp = o();
   310     var resp = o();
   289     if ( resp )
   311     if ( resp )
   291     o = false;
   313     o = false;
   292   }
   314   }
   293   
   315   
   294   var mydiv = document.getElementById('messageBox');
   316   var mydiv = document.getElementById('messageBox');
   295   var maindiv = mydiv.parentNode;
   317   var maindiv = mydiv.parentNode;
   296   var to = fly_out_top(maindiv, true, false);
   318   
   297   
   319   if ( aclDisableTransitionFX )
   298   setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); enlighten(true);", to);
   320   {
       
   321     var mbdiv = document.getElementById('messageBox');
       
   322     mbdiv.parentNode.removeChild(mbdiv.nextSibling);
       
   323     mbdiv.parentNode.removeChild(mbdiv);
       
   324     enlighten(true);
       
   325   }
       
   326   else
       
   327   {
       
   328     var to = fly_out_top(maindiv, true, false);
       
   329     setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); enlighten(true);", to);
       
   330   }
   299   if(typeof mb.onclick[val] == 'function')
   331   if(typeof mb.onclick[val] == 'function')
   300   {
   332   {
   301     o = mb.onclick[val];
   333     o = mb.onclick[val];
   302     o();
   334     o();
   303     o = false;
   335     o = false;
   415     object.filter = "alpha(opacity=" + opacity + ")";
   447     object.filter = "alpha(opacity=" + opacity + ")";
   416 }
   448 }
   417 
   449 
   418 function mb_logout()
   450 function mb_logout()
   419 {
   451 {
   420   var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, 'Are you sure you want to log out?', 'If you log out, you will no longer be able to access your user preferences, your private messages, or certain areas of this site until you log in again.');
   452   var mb = new messagebox(MB_YESNO|MB_ICONQUESTION, $lang.get('user_logout_confirm_title'), $lang.get('user_logout_confirm_body'));
   421   mb.onclick['Yes'] = function()
   453   mb.onclick['Yes'] = function()
   422     {
   454     {
   423       window.location = makeUrlNS('Special', 'Logout/' + title);
   455       window.location = makeUrlNS('Special', 'Logout/' + title);
   424     }
   456     }
   425 }
   457 }