check_configure_kerio_buisness_mail.tpl 2.8 KB

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