includes/clientside/static/messagebox.js
changeset 1125 367768040a61
parent 1091 bb8e04f74819
child 1227 bdac73ed481e
equal deleted inserted replaced
1124:1e956881d362 1125:367768040a61
   231     };
   231     };
   232     
   232     
   233   this.destroy = function()
   233   this.destroy = function()
   234     {
   234     {
   235       var mbdiv = document.getElementById('messageBox');
   235       var mbdiv = document.getElementById('messageBox');
   236       mbdiv.parentNode.removeChild(mbdiv.nextSibling);
   236       mbdiv.parentNode.parentNode.removeChild(mbdiv.parentNode);
   237       mbdiv.parentNode.removeChild(mbdiv);
       
   238       if ( !mb_previously_had_darkener )
   237       if ( !mb_previously_had_darkener )
   239         enlighten(true);
   238         enlighten(true);
   240     };
   239     };
   241   
   240   
   242   //domObjChangeOpac(0, mydiv);
   241   //domObjChangeOpac(0, mydiv);
   290       enlighten(true);
   289       enlighten(true);
   291   }
   290   }
   292   else
   291   else
   293   {
   292   {
   294     var to = fly_out_top(maindiv, true, false);
   293     var to = fly_out_top(maindiv, true, false);
   295     setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.removeChild(mbdiv.nextSibling); mbdiv.parentNode.removeChild(mbdiv); if ( !mb_previously_had_darkener ) enlighten(true);", to);
   294     setTimeout("var mbdiv = document.getElementById('messageBox'); mbdiv.parentNode.parentNode.removeChild(mbdiv.parentNode); if ( !mb_previously_had_darkener ) enlighten(true);", to);
   296   }
   295   }
   297   if(typeof mb.onclick[val] == 'function')
   296   if(typeof mb.onclick[val] == 'function')
   298   {
   297   {
   299     (mb.onclick[val])();
   298     (mb.onclick[val])();
   300   }
   299   }
   576  * Identical to whiteOutElement(), but safe to call on miniPrompt divs.
   575  * Identical to whiteOutElement(), but safe to call on miniPrompt divs.
   577  */
   576  */
   578 
   577 
   579 function whiteOutMiniPrompt(el)
   578 function whiteOutMiniPrompt(el)
   580 {
   579 {
   581   var top = getScrollOffset();
   580   el = miniPromptGetParent(el);
   582   var left = ( getWidth() / 2 ) - ( 320 / 2);
       
   583   var width = 320;
   581   var width = 320;
   584   var height = $dynano(el).Height() - 58;
   582   var height = $dynano(el).Height() - 58;
       
   583   var topoffset = 27;
       
   584   
       
   585   var container = document.createElement('div');
       
   586   container.style.padding = topoffset + 'px 0 0 0';
       
   587 
       
   588   var top = getScrollOffset();
       
   589   var left = getWidth() / 2 - width / 2;
       
   590   
       
   591   // using fixed here allows modal windows to be blacked out
       
   592   container.style.position = 'absolute';
       
   593   container.style.top = ( top - topoffset ) + 'px';
       
   594   container.style.left = left + 'px';
       
   595   container.style.zIndex = 1000;
   585   
   596   
   586   var blackout = document.createElement('div');
   597   var blackout = document.createElement('div');
   587   // using fixed here allows modal windows to be blacked out
   598   blackout.style.backgroundColor = '#ffffff';
   588   blackout.style.position = ( el.style.position == 'fixed' ) ? 'fixed' : 'absolute';
       
   589   blackout.style.top = top + 'px';
       
   590   blackout.style.left = left + 'px';
       
   591   blackout.style.width = width + 'px';
   599   blackout.style.width = width + 'px';
   592   blackout.style.height = height + 'px';
   600   blackout.style.height = height + 'px';
   593   
       
   594   blackout.style.backgroundColor = '#FFFFFF';
       
   595   domObjChangeOpac(60, blackout);
   601   domObjChangeOpac(60, blackout);
   596   var background = ( $dynano(el).Height() < 48 ) ? 'url(' + scriptPath + '/images/loading.gif)' : 'url(' + scriptPath + '/includes/clientside/tinymce/themes/advanced/skins/default/img/progress.gif)';
   602   var background = ( $dynano(el).Height() < 48 ) ? 'url(' + scriptPath + '/images/loading.gif)' : 'url(' + scriptPath + '/includes/clientside/tinymce/themes/advanced/skins/default/img/progress.gif)';
   597   blackout.style.backgroundImage = background;
   603   blackout.style.backgroundImage = background;
   598   blackout.style.backgroundPosition = 'center center';
   604   blackout.style.backgroundPosition = 'center center';
   599   blackout.style.backgroundRepeat = 'no-repeat';
   605   blackout.style.backgroundRepeat = 'no-repeat';
   600   blackout.style.zIndex = '1000';
   606   blackout.isMiniPrompt = true;
   601   
   607   blackout.miniPromptObj = el;
       
   608   
       
   609   container.appendChild(blackout);
   602   var body = document.getElementsByTagName('body')[0];
   610   var body = document.getElementsByTagName('body')[0];
   603   body.appendChild(blackout);
   611   body.appendChild(container);
   604   
   612   
   605   return blackout;
   613   return blackout;
       
   614 }
       
   615 
       
   616 function whiteOutDestroyOnMiniPrompt(whitey)
       
   617 {
       
   618   var body = document.getElementsByTagName('body')[0];
       
   619   var parent = whitey.miniPromptObj;
       
   620   fly_out_top([parent, whitey.parentNode], true, true);
       
   621   setTimeout(function()
       
   622     {
       
   623       body.removeChild(parent);
       
   624       body.removeChild(whitey.parentNode);
       
   625     }, 1000 * FI_MULTIPLIER);
       
   626   enlighten(true, 'miniprompt_darkener');
   606 }
   627 }
   607 
   628 
   608 function testMPMessageBox()
   629 function testMPMessageBox()
   609 {
   630 {
   610   miniPromptMessage({
   631   miniPromptMessage({
   617         style: {
   638         style: {
   618           fontWeight: 'bold'
   639           fontWeight: 'bold'
   619         },
   640         },
   620         sprite: [ cdnPath + '/images/icons/abortretryignore-sprite.png', 16, 16, 0, 0 ],
   641         sprite: [ cdnPath + '/images/icons/abortretryignore-sprite.png', 16, 16, 0, 0 ],
   621         onclick: function() {
   642         onclick: function() {
   622           miniPromptDestroy(this);
   643           var w = whiteOutMiniPrompt(this);
       
   644           var me = this;
       
   645           setTimeout(function()
       
   646             {
       
   647               whiteOutReportSuccess(w, true);
       
   648               void(me);
       
   649               setTimeout(function()
       
   650                 {
       
   651                   miniPromptDestroy(me);
       
   652                 }, 1250);
       
   653             }, 500);
       
   654           return false;
   623         }
   655         }
   624       },
   656       },
   625       {
   657       {
   626         text: 'Retry',
   658         text: 'Retry',
   627         color: 'blue',
   659         color: 'blue',
   628         sprite: [ cdnPath + '/images/icons/abortretryignore-sprite.png', 16, 16, 0, 16 ],
   660         sprite: [ cdnPath + '/images/icons/abortretryignore-sprite.png', 16, 16, 0, 16 ],
   629         onclick: function() {
   661         onclick: function() {
   630           miniPromptDestroy(this);
   662           var w = whiteOutMiniPrompt(this);
       
   663           setTimeout(function()
       
   664             {
       
   665               whiteOutReportSuccess(w);
       
   666             }, 1500);
       
   667           return false;
   631         }
   668         }
   632       },
   669       },
   633       {
   670       {
   634         text: 'Ignore',
   671         text: 'Ignore',
   635         color: 'green',
   672         color: 'green',