check_configure_kerio_buisness_mail.tpl 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <style>
  2. .has-error { background-color: #f003 !important; }
  3. .has-success { background-color: #0f03 !important; }
  4. </style>
  5. <script>
  6. function checkDomain (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. } else {
  17. console.log(this.responseText);
  18. $(customFields[0]).addClass('has-error');
  19. $(customFields[0]).removeClass('has-success');
  20. $("#hint").text('Domain ' + $(customFields[0]).val() + ' nicht verfügbar!');
  21. $("#btnCompleteProductConfig").prop("enabled",false);
  22. }
  23. }
  24. };
  25. xhttp.open("GET", "modules/servers/kerioEmail/kerioDomainAvailable.php?domain=" + domain + '&pid=' + pid, true);
  26. xhttp.send();
  27. };
  28. jQuery(document).ready(function(){
  29. customFields = $("*[id^='customfield']");
  30. checkBoxHelper = $("*[class^='iCheck-helper']");
  31. checkBox = $("*[id^='iCheck-customfield']")
  32. $("#btnCompleteProductConfig").prop("disabled",true);
  33. $(customFields[0]).val(''); // domain
  34. $(checkBox[0]).removeClass('checked'); // checkbox
  35. $(customFields[0]).blur(function () {
  36. checkDomain( $(customFields[0]).val().trim(), {$productinfo['pid']});
  37. });
  38. $(customFields[0]).on('input', function () {
  39. setTimeout(function () {
  40. checkDomain( $(customFields[0]).val().trim(), {$productinfo['pid']});
  41. }, 1);
  42. });
  43. $(customFields[0]).focus(function () {
  44. $(customFields[0]).addClass('has-success');
  45. $(customFields[0]).removeClass('has-error');
  46. $(customFields[0]).css('background-color', '');
  47. });
  48. $(checkBoxHelper[0]).click(function () {
  49. setTimeout(function () {
  50. if ($(checkBox[0]).hasClass('checked')) {
  51. $("#btnCompleteProductConfig").prop("enabled",false);
  52. } else {
  53. $("#btnCompleteProductConfig").prop("enabled",true);
  54. }
  55. checkDomain( $(customFields[0]).val().trim(), {$productinfo['pid']});
  56. }, 1);
  57. });
  58. });
  59. </script>