includes/clientside/static/ajax.js
changeset 1226 de56132c008d
parent 1125 367768040a61
child 1227 bdac73ed481e
equal deleted inserted replaced
1225:4c6da61e613e 1226:de56132c008d
  1722         thediv.style.position = 'absolute';
  1722         thediv.style.position = 'absolute';
  1723         thediv.style.top  = top  + 'px';
  1723         thediv.style.top  = top  + 'px';
  1724         thediv.style.display = 'none';
  1724         thediv.style.display = 'none';
  1725         thediv.style.zIndex = getHighestZ() + 2;
  1725         thediv.style.zIndex = getHighestZ() + 2;
  1726         thediv.id = 'mdgDynamic_rDnsInfoDiv_'+Math.floor(Math.random() * 1000000);
  1726         thediv.id = 'mdgDynamic_rDnsInfoDiv_'+Math.floor(Math.random() * 1000000);
       
  1727         // FIXME: l10n
  1727         thediv.innerHTML = '<b>Reverse DNS:</b><br />'+ajax.responseText+' <a href="#" onclick="elem = document.getElementById(\''+thediv.id+'\'); elem.innerHTML = \'\'; elem.style.display = \'none\';return false;">Close</a>';
  1728         thediv.innerHTML = '<b>Reverse DNS:</b><br />'+ajax.responseText+' <a href="#" onclick="elem = document.getElementById(\''+thediv.id+'\'); elem.innerHTML = \'\'; elem.style.display = \'none\';return false;">Close</a>';
  1728         var body = document.getElementsByTagName('body');
  1729         var body = document.getElementsByTagName('body');
  1729         body = body[0];
  1730         body = body[0];
  1730         bannerOff(rDnsBannerObj);
  1731         bannerOff(rDnsBannerObj);
  1731         body.appendChild(thediv);
  1732         body.appendChild(thediv);
  1738         fadeInfoBoxes();
  1739         fadeInfoBoxes();
  1739       }
  1740       }
  1740     });
  1741     });
  1741 }
  1742 }
  1742 
  1743 
       
  1744 window.ajaxGzipCheck = function()
       
  1745 {
       
  1746   var resultdiv = document.getElementById('gzip_check_result');
       
  1747   if ( !resultdiv )
       
  1748     return false;
       
  1749   
       
  1750   resultdiv.innerHTML = '<img alt="Loading..." src="' + cdnPath + '/images/loading.gif" />';
       
  1751   ajaxPost(makeUrlNS('Admin', 'GeneralConfig'), 'act=gzip_check', function(ajax)
       
  1752     {
       
  1753       if ( ajax.readyState == 4 && ajax.status == 200 )
       
  1754       {
       
  1755         resultdiv.innerHTML = '';
       
  1756         var response = String(ajax.responseText + '');
       
  1757         if ( !check_json_response(response) )
       
  1758         {
       
  1759           handle_invalid_json(response);
       
  1760           return false;
       
  1761         }
       
  1762         response = parseJSON(response);
       
  1763         if ( response.error )
       
  1764         {
       
  1765           resultdiv.innerHTML = '<div class="error-box-mini">' + response.error + '</div>';
       
  1766         }
       
  1767         else
       
  1768         {
       
  1769           // probably success.
       
  1770           resultdiv.innerHTML += response.server_does_it ?
       
  1771             '<div class="error-box-mini">' + $lang.get('acpgc_field_gzip_check_msg_server_does_it') + '</div>' :
       
  1772             '<div class="info-box-mini">' + $lang.get('acpgc_field_gzip_check_msg_server_good') + '</div>';
       
  1773           resultdiv.innerHTML += response.php_supports_gzip ?
       
  1774             '<div class="info-box-mini">' + $lang.get('acpgc_field_gzip_check_msg_php_good') + '</div>' :
       
  1775             '<div class="error-box-mini">' + $lang.get('acpgc_field_gzip_check_msg_php_bad') + '</div>';
       
  1776             
       
  1777           if ( response.php_supports_gzip && !response.server_does_it )
       
  1778           {
       
  1779             resultdiv.innerHTML += '<div class="success-box-mini">' + $lang.get('acpgc_field_gzip_check_msg_success') + '</div>';
       
  1780           }
       
  1781           else
       
  1782           {
       
  1783             resultdiv.innerHTML += '<div class="error-box-mini">' + $lang.get('acpgc_field_gzip_check_msg_failure') + '</div>';
       
  1784           }
       
  1785         }
       
  1786       }
       
  1787     });
       
  1788 }