vlanmanagement.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. function vlanAcquire(element) {
  2. id = element.id;
  3. let modalContent = document.getElementById("content-cvmodal");
  4. let splited = id.split("_");
  5. let data = splited[1].split("/");
  6. let realm = data[0];
  7. let svlan = data[1];
  8. let cvlan = data[2];
  9. let xhr = new XMLHttpRequest();
  10. xhr.open("GET", "?module=vlanmanagement&action=ajax&realm_id=" + realm + "&svlan_id=" + svlan + "&cvlan_num=" + cvlan, true);
  11. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  12. xhr.send();
  13. xhr.onload = function () {
  14. let response = xhr.response;
  15. modalContent.innerHTML = response;
  16. modalOpen();
  17. };
  18. }
  19. function occupiedBySwitch(element) {
  20. id = element.id;
  21. let modalContent = document.getElementById("content-cvmodal");
  22. let splited = id.split("_");
  23. let data = splited[1].split("/");
  24. let realm = data[0];
  25. let svlan = data[1];
  26. let cvlan = data[2];
  27. let switchid = data[3];
  28. let xhr = new XMLHttpRequest();
  29. xhr.open("GET", "?module=vlanmanagement&action=ajaxswitch&realm_id=" + realm + "&svlan_id=" + svlan + "&cvlan_num=" + cvlan + "&switchid=" + switchid, true);
  30. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  31. xhr.send();
  32. xhr.onload = function () {
  33. let response = xhr.response;
  34. modalContent.innerHTML = response;
  35. modalOpen();
  36. };
  37. }
  38. function occupiedByCustomer(element) {
  39. id = element.id;
  40. let modalContent = document.getElementById("content-cvmodal");
  41. let splited = id.split("_");
  42. let data = splited[1].split("/");
  43. let realm = data[0];
  44. let svlan = data[1];
  45. let cvlan = data[2];
  46. let switchid = data[3];
  47. let xhr = new XMLHttpRequest();
  48. xhr.open("GET", "?module=vlanmanagement&action=ajaxcustomer&realm_id=" + realm + "&svlan_id=" + svlan + "&cvlan_num=" + cvlan + "&switchid=" + switchid, true);
  49. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  50. xhr.send();
  51. xhr.onload = function () {
  52. let response = xhr.response;
  53. modalContent.innerHTML = response;
  54. modalOpen();
  55. };
  56. }
  57. function occupiedByOltZte(element) {
  58. id = element.id;
  59. let modalContent = document.getElementById("content-cvmodal");
  60. let splited = id.split("_");
  61. let data = splited[1].split("/");
  62. let realm = data[0];
  63. let svlan = data[1];
  64. let cvlan = data[2];
  65. let switchid = data[3];
  66. let xhr = new XMLHttpRequest();
  67. xhr.open("GET", "?module=vlanmanagement&action=ajaxoltzte&realm_id=" + realm + "&svlan_id=" + svlan + "&cvlan_num=" + cvlan + "&switchid=" + switchid, true);
  68. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  69. xhr.send();
  70. xhr.onload = function () {
  71. let response = xhr.response;
  72. modalContent.innerHTML = response;
  73. modalOpen();
  74. };
  75. }
  76. function occupiedByOltNonZte(element) {
  77. id = element.id;
  78. let modalContent = document.getElementById("content-cvmodal");
  79. let splited = id.split("_");
  80. let data = splited[1].split("/");
  81. let realm = data[0];
  82. let svlan = data[1];
  83. let cvlan = data[2];
  84. let switchid = data[3];
  85. let xhr = new XMLHttpRequest();
  86. xhr.open("GET", "?module=vlanmanagement&action=ajaxoltnonzte&realm_id=" + realm + "&svlan_id=" + svlan + "&cvlan_num=" + cvlan + "&switchid=" + switchid, true);
  87. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  88. xhr.send();
  89. xhr.onload = function () {
  90. let response = xhr.response;
  91. modalContent.innerHTML = response;
  92. modalOpen();
  93. };
  94. }
  95. function realmEdit(element) {
  96. let modalContent = document.getElementById("content-cvmodal");
  97. let xhr = new XMLHttpRequest();
  98. xhr.open("POST", "?module=vlanmanagement&realms=true&action=ajaxedit", true);
  99. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  100. xhr.send("realm_encode=" + element.id);
  101. xhr.onload = function () {
  102. let response = xhr.response;
  103. modalContent.innerHTML = response;
  104. modalOpen();
  105. }
  106. }
  107. function svlanEdit(element) {
  108. let modalContent = document.getElementById("content-cvmodal");
  109. let xhr = new XMLHttpRequest();
  110. xhr.open("POST", "?module=vlanmanagement&svlan=true&action=ajaxedit", true);
  111. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  112. xhr.send("svlan_encode=" + element.id);
  113. xhr.onload = function () {
  114. let response = xhr.response;
  115. modalContent.innerHTML = response;
  116. modalOpen();
  117. }
  118. }
  119. function qinqEdit(element) {
  120. let modalContent = document.getElementById("content-cvmodal");
  121. let xhr = new XMLHttpRequest();
  122. xhr.open("POST", "?module=universalqinq&action=ajaxedit", true);
  123. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  124. xhr.send("universal_encode=" + element.id);
  125. xhr.onload = function () {
  126. let response = xhr.response;
  127. modalContent.innerHTML = response;
  128. modalOpen();
  129. }
  130. }
  131. function modalOpen() {
  132. $("#dialog-modal_cvmodal").dialog({
  133. autoOpen: true,
  134. width: 'auto',
  135. height: 'auto',
  136. modal: true,
  137. show: "drop",
  138. hide: "fold"
  139. });
  140. $("#opener_cvmodal").click(function () {
  141. $("#dialog-modal_cvmodal").dialog("open");
  142. return false;
  143. });
  144. }
  145. function loadQinqOptions(interface, swid) {
  146. let container = document.getElementById('qinqcontainer');
  147. let xhr = new XMLHttpRequest();
  148. let url2 = "?module=zteunreg&action=ajaxlogin&swid=" + swid + "&interface=" + interface;
  149. xhr.open("GET", url2, true);
  150. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  151. xhr.send();
  152. xhr.onload = function () {
  153. let response = xhr.response;
  154. let decoded = JSON.parse(response);
  155. container.innerHTML = decoded.result;
  156. };
  157. }
  158. function getQinqByLogin(login, interface, swid) {
  159. let container = document.getElementById('qinqcontainer');
  160. let xhr = new XMLHttpRequest();
  161. xhr.open("GET", "?module=zteunreg&action=ajaxlogin&login=" + login + "&interface=" + interface + "&swid=" + swid, true);
  162. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  163. xhr.send();
  164. xhr.onload = function () {
  165. let response = xhr.response;
  166. let decoded = JSON.parse(response);
  167. container.innerHTML = decoded.main;
  168. if (decoded.svlan != 'none') {
  169. let table = document.getElementById("qinqoptions");
  170. let newRow1 = table.insertRow(-1);
  171. let newCell1 = newRow1.insertCell(-1);
  172. newCell1.innerHTML = decoded.cell1;
  173. let newCell2 = newRow1.insertCell(-1);
  174. newCell2.innerHTML = decoded.cell2;
  175. let newRow2 = table.insertRow(-1);
  176. let newCell3 = newRow2.insertCell(-1);
  177. newCell3.innerHTML = decoded.cell3;
  178. let newCell4 = newRow2.insertCell(-1);
  179. newCell4.innerHTML = decoded.cell4;
  180. }
  181. };
  182. }
  183. function validateVlanUsernameForm(oltId, onuId, port, vlan, type, interface, interface_olt, snmp_index) {
  184. let formId = 'usernameForm---' + oltId + '---' + onuId + '---' + port;
  185. let usernameId = 'usernameInput---' + oltId + '---' + onuId + '---' + port;
  186. let container = document.getElementById(formId);
  187. let username = document.getElementById(usernameId).value;
  188. let modalContent = document.getElementById("content-cvmodal");
  189. let xhr = new XMLHttpRequest();
  190. xhr.open("GET", "/?module=vlanmanagement_onu_apply&ajax_username_validate=true&username=" + username + "&oltid=" + oltId + "&onuid=" + onuId + "&port=" + port + "&vlan=" + vlan + "&type=" + type + "&interface=" + interface + "&interface_olt=" + interface_olt + "&snmp_index=" + snmp_index, true);
  191. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  192. xhr.send();
  193. xhr.onload = function () {
  194. let response = xhr.response;
  195. modalContent.innerHTML = response;
  196. modalOpen();
  197. };
  198. return false;
  199. }
  200. $( "#Form_register_submit" ).click(function() {
  201. $(this).attr("disabled", "disabled");
  202. });