host_form.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**
  2. * Pop-up testing connection with database.
  3. */
  4. function opencnxpopup(webroot) {
  5. // Inputted data.
  6. var dbhost = document.getElementById('id_vdbhost').value;
  7. var dblogin = document.getElementById('id_vdbuser').value;
  8. var dbpass = document.getElementById('id_vdbpassword').value;
  9. // PHP file linked the pop-up, and name.
  10. var url = webroot+"/plugin/vchamilo/views/manage.testcnx.php" + "?" + "vdbhost=" + dbhost + "&" + "vdblogin=" + dblogin
  11. + "&" + "vdbpass=" + dbpass;
  12. // Pop-up's options.
  13. var options = "width=500,height=300,toolbar=no,menubar=no,location=no,scrollbars=no,status=no";
  14. // Opening the pop-up (title not working in Firefox).
  15. var windowobj = window.open(url, '', options);
  16. }
  17. /**
  18. * Pop-up testing connection with database.
  19. */
  20. function opendatapathpopup(webroot) {
  21. // Input data.
  22. var datapath = document.getElementById('id_vdatapath').value;
  23. // PHP file linked the pop-up, and name.
  24. var url = webroot + "/plugin/vchamilo/views/manage.testdatapath.php?dataroot=" + escape(datapath);
  25. // Pop-up's options.
  26. var options = "width=500,height=300,toolbar=no,menubar=no,location=no,scrollbars=no,status=no";
  27. // Opening the pop-up (title not working in Firefox).
  28. var windowobj = window.open(url, '', options);
  29. // Needed to be valid in IE.
  30. // windowobj.document.title = vchamilo_testdatapath;
  31. }
  32. /**
  33. * Activates/desactivates services selection.
  34. */
  35. function switcherServices(mnetnewsubnetwork) {
  36. // Retrieve 'select' elements from form.
  37. var mnetenabled = document.getElementById('id_mnetenabled');
  38. var multimnet = document.getElementById('id_multimnet');
  39. var services = document.getElementById('id_services');
  40. // Default values for services.
  41. var mnetfreedefault = '0';
  42. var defaultservices = 'default';
  43. var subnetworkservices = 'subnetwork';
  44. // Do the actions.
  45. if (multimnet.value == mnetfreedefault
  46. || multimnet.value == mnetnewsubnetwork) {
  47. services.value = defaultservices;
  48. services.disabled = true;
  49. } else {
  50. services.disabled = false;
  51. services.value = subnetworkservices;
  52. }
  53. }
  54. function syncSchema(){
  55. var originelement = document.getElementById("id_shortname");
  56. var syncedelement2 = document.getElementById("id_vdbname");
  57. var syncedelement3 = document.getElementById("id_vdatapath");
  58. var syncedelement4 = document.getElementById("id_vhostname");
  59. syncedelement2.value = syncedelement2.value.replace(/<%%INSTANCE%%>/g, originelement.value);
  60. syncedelement3.value = syncedelement3.value.replace(/<%%INSTANCE%%>/g, originelement.value);
  61. syncedelement4.value = syncedelement4.value.replace(/<%%INSTANCE%%>/g, originelement.value);
  62. }
  63. function onLoadInit(){
  64. var originelement = document.getElementById("id_shortname");
  65. originelement.onchange = syncSchema;
  66. }