check_configure_kerio_buisness_mail.tpl 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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-success');
  25. $(customFields[0]).removeClass('has-error');
  26. $("#hint").text('');
  27. if ($(checkBox[0]).hasClass('checked')) {
  28. $("#btnCompleteProductConfig").prop("disabled",false);
  29. } else {
  30. $("#btnCompleteProductConfig").prop("disabled",true);
  31. $("#hint").text('Ungültiger Doaminname!');
  32. }
  33. } else {
  34. console.log(this.responseText);
  35. $(customFields[0]).addClass('has-error');
  36. $(customFields[0]).removeClass('has-success');
  37. $("#hint").text('Domain ' + $(customFields[0]).val() + ' nicht verfügbar!');
  38. $("#btnCompleteProductConfig").prop("disabled",true);
  39. }
  40. }
  41. };
  42. xhttp.open("GET", "modules/servers/kerioEmail/kerioDomainAvailable.php?domain=" + domain + '&pid=' + pid, true);
  43. xhttp.send();
  44. };
  45. jQuery(document).ready(function(){
  46. customFields = $("*[id^='customfield']");
  47. checkBoxHelper = $("*[class^='iCheck-helper']");
  48. checkBox = $("*[id^='iCheck-customfield']")
  49. $("#btnCompleteProductConfig").prop("disabled",true);
  50. $(customFields[0]).val(''); // domain
  51. $(checkBox[0]).removeClass('checked'); // checkbox
  52. $(customFields[0]).blur(function () {
  53. checkInput( $(customFields[0]).val().trim(), {$productinfo['pid']});
  54. });
  55. $(customFields[0]).on('input', function () {
  56. setTimeout(function () {
  57. checkInput( $(customFields[0]).val().trim(), {$productinfo['pid']});
  58. }, 1);
  59. });
  60. $(checkBoxHelper[0]).click(function () {
  61. setTimeout(function () {
  62. checkInput( $(customFields[0]).val().trim(), {$productinfo['pid']});
  63. }, 1);
  64. });
  65. });
  66. </script>