includes/clientside/static/messagebox.js
changeset 628 ab6f55abb17e
parent 582 a38876c0793c
child 652 26ce2694d43f
equal deleted inserted replaced
627:460e483987ab 628:ab6f55abb17e
   378     setTimeout(function()
   378     setTimeout(function()
   379       {
   379       {
   380         domObjChangeOpac(100, wrapper);
   380         domObjChangeOpac(100, wrapper);
   381       }, 40);
   381       }, 40);
   382   }
   382   }
       
   383   
       
   384   return wrapper;
   383 }
   385 }
   384 
   386 
   385 /**
   387 /**
   386  * For a given element, loops through the element and all of its ancestors looking for a miniPrompt div, and returns it. Returns false on failure.
   388  * For a given element, loops through the element and all of its ancestors looking for a miniPrompt div, and returns it. Returns false on failure.
   387  * @param object:HTMLElement Child node to scan
   389  * @param object:HTMLElement Child node to scan
   475  </code>
   477  </code>
   476  */
   478  */
   477 
   479 
   478 function miniPromptMessage(parms)
   480 function miniPromptMessage(parms)
   479 {
   481 {
   480   if ( !parms.title || !parms.message || !parms.buttons )
   482   if ( ( !parms.title && !parms.message ) || !parms.buttons )
   481     return false;
   483     return false;
   482   
   484   
   483   return miniPrompt(function(parent)
   485   return miniPrompt(function(parent)
   484     {
   486     {
   485       try
   487       try
   486       {
   488       {
   487         var h3 = document.createElement('h3');
   489         if ( parms.title )
   488         h3.appendChild(document.createTextNode(parms.title));
       
   489         var body = document.createElement('p');
       
   490         var message = parms.message.split(unescape('%0A'));
       
   491         for ( var i = 0; i < message.length; i++ )
       
   492         {
   490         {
   493           body.appendChild(document.createTextNode(message[i]));
   491           var h3 = document.createElement('h3');
   494           if ( i + 1 < message.length )
   492           h3.appendChild(document.createTextNode(parms.title));
   495             body.appendChild(document.createElement('br'));
   493         }
       
   494         if ( parms.message )
       
   495         {
       
   496           var body = document.createElement('p');
       
   497           var message = parms.message.split(unescape('%0A'));
       
   498           for ( var i = 0; i < message.length; i++ )
       
   499           {
       
   500             body.appendChild(document.createTextNode(message[i]));
       
   501             if ( i + 1 < message.length )
       
   502               body.appendChild(document.createElement('br'));
       
   503           }
   496         }
   504         }
   497         
   505         
   498         parent.style.textAlign = 'center';
   506         parent.style.textAlign = 'center';
   499         
   507         
   500         parent.appendChild(h3);
   508         if ( parms.title )
   501         parent.appendChild(body);
   509           parent.appendChild(h3);
       
   510         if ( parms.message )
       
   511           parent.appendChild(body);
   502         parent.appendChild(document.createElement('br'));
   512         parent.appendChild(document.createElement('br'));
   503         
   513         
   504         // construct buttons
   514         // construct buttons
   505         for ( var i = 0; i < parms.buttons.length; i++ )
   515         for ( var i = 0; i < parms.buttons.length; i++ )
   506         {
   516         {