check_configure_kerio_buisness_mail.tpl 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <style>
  2. .has-error { background-color: #f003 !important; }
  3. .has-success { background-color: #0f03 !important; }
  4. </style>
  5. <script>
  6. function checkInput (domain, pid) {
  7. var xhttp = new XMLHttpRequest();
  8. var success = false;
  9. xhttp.onreadystatechange = function() {
  10. if (this.readyState == 4 && this.status == 200) {
  11. if( this.responseText.trim() == 'yes') {
  12. console.log(this.responseText);
  13. $(customFields[0]).addClass('has-success');
  14. $(customFields[0]).removeClass('has-error');
  15. $("#hint").text('');
  16. if ($(checkBox[0]).hasClass('checked')) {
  17. $("#btnCompleteProductConfig").prop("disabled",false);
  18. } else {
  19. $("#btnCompleteProductConfig").prop("disabled",true);
  20. $("#hint").text('Bitte akzeptieren Sie die erweiterten Nutzungsbedingungen!');
  21. }
  22. } else if ( this.responseText.trim() == 'invalid') {
  23. console.log(this.responseText);
  24. $(customFields[0]).addClass('has-error');
  25. $(customFields[0]).removeClass('has-success');
  26. $("#btnCompleteProductConfig").prop("disabled",true);
  27. $("#hint").text('Ungültiger Domainname!');
  28. } else {
  29. console.log(this.responseText);
  30. $(customFields[0]).addClass('has-error');
  31. $(customFields[0]).removeClass('has-success');
  32. $("#hint").text('Domain ' + $(customFields[0]).val() + ' nicht verfügbar!');
  33. $("#btnCompleteProductConfig").prop("disabled",true);
  34. }
  35. }
  36. };
  37. xhttp.open("GET", "modules/servers/kerioEmail/kerioDomainAvailable.php?domain=" + domain + '&pid=' + pid, true);
  38. xhttp.send();
  39. };
  40. jQuery(document).ready(function(){
  41. customFields = $("*[id^='customfield']");
  42. checkBoxHelper = $("*[class^='iCheck-helper']");
  43. checkBox = $("*[id^='iCheck-customfield']")
  44. $("#btnCompleteProductConfig").prop("disabled",true);
  45. $(customFields[0]).val(''); // domain
  46. $(checkBox[0]).removeClass('checked'); // checkbox
  47. $(customFields[0]).blur(function () {
  48. checkInput( $(customFields[0]).val().trim(), {$productinfo['pid']});
  49. });
  50. $(customFields[0]).on('input', function () {
  51. setTimeout(function () {
  52. checkInput( $(customFields[0]).val().trim(), {$productinfo['pid']});
  53. }, 1);
  54. });
  55. $(checkBoxHelper[0]).click(function () {
  56. setTimeout(function () {
  57. checkInput( $(customFields[0]).val().trim(), {$productinfo['pid']});
  58. }, 1);
  59. });
  60. });
  61. </script>