Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

561 lines
17 KiB

  1. var g_dslmainImgDir="images/";
  2. var dslmain_fNeedsLogon = true;
  3. var L_StaticIpAddress_Text = "S<U>t</U>atic IP address:";
  4. var L_StaticIpAddress2_Text = "* S<U>t</U>atic IP address:";
  5. var L_SubnetMask_Text = "S<U>u</U>bnet mask:";
  6. var L_SubnetMask2_Text = "* S<U>u</U>bnet mask:";
  7. var L_Defaultgateway_Text = "D<U>e</U>fault gateway:";
  8. var L_Defaultgateway2_Text = "* D<U>e</U>fault gateway:";
  9. var L_YourUsername_Text = "Your <u>u</u>sername :";
  10. var L_YourUsername2_Text = "* Your <u>u</u>sername :";
  11. var L_PreferredDNS_Text = "<U>P</U>referred DNS:";
  12. var L_PreferredDNS2_Text = "* <U>P</U>referred DNS:";
  13. var L_AlternateDNS_Text = "<U>A</U>lternate DNS:";
  14. var L_AlternateDNS2_Text = "* <U>A</U>lternate DNS:";
  15. // pppoe settings
  16. //
  17. var dslmain_UserName = '';
  18. var dslmain_Password = '';
  19. var dslmain_ServiceName = '';
  20. // determine ip and dns addresses automatically?
  21. //
  22. var dslmain_fAutoIpAddress = true;
  23. var dslmain_fAutoDns = true;
  24. // static ip address and bytes
  25. //
  26. var dslmain_staticip = '';
  27. var dslmain_staticip_a = 0;
  28. var dslmain_staticip_b = 0;
  29. var dslmain_staticip_c = 0;
  30. var dslmain_staticip_d = 0;
  31. // subnet mask address and bytes
  32. //
  33. var dslmain_subnetmask = '';
  34. var dslmain_subnetmask_a = 0;
  35. var dslmain_subnetmask_b = 0;
  36. var dslmain_subnetmask_c = 0;
  37. var dslmain_subnetmask_d = 0;
  38. // default gateway address and bytes
  39. //
  40. var dslmain_defgateway = '';
  41. var dslmain_defgateway_a = 0;
  42. var dslmain_defgateway_b = 0;
  43. var dslmain_defgateway_c = 0;
  44. var dslmain_defgateway_d = 0;
  45. // preferred dns address and bytes
  46. //
  47. var dslmain_prefdns = '';
  48. var dslmain_prefdns_a = 0;
  49. var dslmain_prefdns_b = 0;
  50. var dslmain_prefdns_c = 0;
  51. var dslmain_prefdns_d = 0;
  52. // alternate dns address and bytes
  53. //
  54. var dslmain_altdns = '';
  55. var dslmain_altdns_a = 0;
  56. var dslmain_altdns_b = 0;
  57. var dslmain_altdns_c = 0;
  58. var dslmain_altdns_d = 0;
  59. ///////////////////////////////////////////////////////////
  60. // msobshel.htm - initialization
  61. ///////////////////////////////////////////////////////////
  62. ///////////////////////////////////////////////////////////
  63. // dslmain.htm
  64. ///////////////////////////////////////////////////////////
  65. function dslmainFirstPage_LoadMe()
  66. {
  67. InitFrameRef('External');
  68. g_FirstFocusElement = g.btnNext;
  69. InitNewButtons();
  70. g_FirstFocusElement.focus();
  71. g.dsltypeform.radioDSLYes.checked = true;
  72. }
  73. ///////////////////////////////////////////////////////////
  74. // dsllast.htm
  75. ///////////////////////////////////////////////////////////
  76. function dslmainLastPage_LoadMe()
  77. {
  78. InitFrameRef('External');
  79. g_FirstFocusElement = g.btnNext;
  80. InitNewButtons();
  81. g_FirstFocusElement.focus();
  82. g.Congrats_Title.innerText = g_Congrats_Type_Heading;
  83. g.Congrats_text01.innerText = g_Congrats_Type;
  84. }
  85. ///////////////////////////////////////////////////////////
  86. // dslmain scripts - enable/disable text boxes...
  87. ///////////////////////////////////////////////////////////
  88. // dsl_a.htm
  89. // ------------
  90. var g_UserEnteredInvalidDSLsetting = false;
  91. function dsl_pppoe_LoadMe()
  92. {
  93. InitFrameRef('External');
  94. g_FirstFocusElement = g.dsl_username;
  95. InitNewButtons();
  96. if (g_UserEnteredInvalidDSLsetting)
  97. {
  98. g.DSLmainErrorText01.style.visibility = "visible";
  99. g.DSLmainErrorText01.className = "text-error";
  100. g.dslusernamelocaltext.innerHTML = L_YourUsername2_Text;
  101. g.dslusernamelocaltext.className = "text-error";
  102. }
  103. g.dsl_username.value = dslmain_UserName;
  104. g.dsl_password.value = dslmain_Password;
  105. g.dsl_servicename.value = dslmain_ServiceName;
  106. g_FirstFocusElement.focus();
  107. }
  108. function dsl_pppoe_OnNext()
  109. {
  110. var fSuccess = pppoe_SaveData();
  111. if (fSuccess)
  112. {
  113. if (g_UserEnteredInvalidDSLsetting)
  114. {
  115. g_UserEnteredInvalidDSLsetting = false;
  116. g.DSLmainErrorText01.style.visibility = "hidden";
  117. }
  118. window.external.CreatePppoeConnectoid(dslmain_ServiceName,
  119. dslmain_fAutoIpAddress,
  120. dslmain_staticip_a,
  121. dslmain_staticip_b,
  122. dslmain_staticip_c,
  123. dslmain_staticip_d,
  124. dslmain_fAutoDns,
  125. dslmain_prefdns_a,
  126. dslmain_prefdns_b,
  127. dslmain_prefdns_c,
  128. dslmain_prefdns_d,
  129. dslmain_altdns_a,
  130. dslmain_altdns_b,
  131. dslmain_altdns_c,
  132. dslmain_altdns_d,
  133. dslmain_UserName,
  134. dslmain_Password
  135. );
  136. ResetConnectedToInternetEx();
  137. }
  138. return fSuccess;
  139. }
  140. function pppoe_SaveData()
  141. {
  142. var fSuccess = true;
  143. if ((g.dsl_username.value == null) || (g.dsl_username.value == ""))
  144. {
  145. g_UserEnteredInvalidDSLsetting = true;
  146. fSuccess = false;
  147. dslmain_UserName = '';
  148. }
  149. else
  150. {
  151. if (g_UserEnteredInvalidDSLsetting)
  152. {
  153. g.DSLmainErrorText01.style.visibility = "hidden";
  154. g.dslusernamelocaltext.innerHTML = L_YourUsername_Text;
  155. g.dslusernamelocaltext.className = "text-primary";
  156. }
  157. dslmain_UserName = g.dsl_username.value;
  158. }
  159. // Only required field is the username.
  160. if ((g.dsl_password.value == null) || (g.dsl_password.value == ""))
  161. {
  162. dslmain_Password = '';
  163. }
  164. else
  165. {
  166. dslmain_Password = g.dsl_password.value;
  167. }
  168. if ((g.dsl_servicename.value == null) || (g.dsl_servicename.value == ""))
  169. {
  170. dslmain_ServiceName = '';
  171. }
  172. else
  173. {
  174. dslmain_ServiceName = g.dsl_servicename.value;
  175. }
  176. dslmain_fAutoIpAddress = true;
  177. dslmain_staticip = '';
  178. dslmain_staticip_a = 0;
  179. dslmain_staticip_b = 0;
  180. dslmain_staticip_c = 0;
  181. dslmain_staticip_d = 0;
  182. dslmain_subnetmask = '';
  183. dslmain_subnetmask_a = 0;
  184. dslmain_subnetmask_b = 0;
  185. dslmain_subnetmask_c = 0;
  186. dslmain_subnetmask_d = 0;
  187. dslmain_defgateway = '';
  188. dslmain_defgateway_a = 0;
  189. dslmain_defgateway_b = 0;
  190. dslmain_defgateway_c = 0;
  191. dslmain_defgateway_d = 0;
  192. dslmain_fAutoDns = true;
  193. dslmain_prefdns = '';
  194. dslmain_prefdns_a = 0;
  195. dslmain_prefdns_b = 0;
  196. dslmain_prefdns_c = 0;
  197. dslmain_prefdns_d = 0;
  198. dslmain_altdns = '';
  199. dslmain_altdns_a = 0;
  200. dslmain_altdns_b = 0;
  201. dslmain_altdns_c = 0;
  202. dslmain_altdns_d = 0;
  203. return fSuccess;
  204. }
  205. // dsl_b.htm
  206. // ------------
  207. function dsl_broadband_LoadMe()
  208. {
  209. InitFrameRef('External');
  210. g_FirstFocusElement = g.btnNext;
  211. InitNewButtons();
  212. if (g_fFirewallRequired) // come from dslmain.htm
  213. {
  214. g.text_description_dsl_b1.style.display = "inline";
  215. }
  216. else // come from ics.htm
  217. {
  218. g.text_description_dsl_b2.style.display = "inline";
  219. }
  220. dsl_autoipClickHandler();
  221. dsl_autodnsClickHandler();
  222. g_FirstFocusElement.focus();
  223. }
  224. function dsl_broadband_OnNext()
  225. {
  226. var fDSLSuccess = dsl_SaveData();
  227. if (fDSLSuccess)
  228. {
  229. window.external.SetPreferredConnectionTcpipProperties(
  230. dslmain_fAutoIpAddress,
  231. dslmain_staticip_a,
  232. dslmain_staticip_b,
  233. dslmain_staticip_c,
  234. dslmain_staticip_d,
  235. dslmain_subnetmask_a,
  236. dslmain_subnetmask_b,
  237. dslmain_subnetmask_c,
  238. dslmain_subnetmask_d,
  239. dslmain_defgateway_a,
  240. dslmain_defgateway_b,
  241. dslmain_defgateway_c,
  242. dslmain_defgateway_d,
  243. dslmain_fAutoDns,
  244. dslmain_prefdns_a,
  245. dslmain_prefdns_b,
  246. dslmain_prefdns_c,
  247. dslmain_prefdns_d,
  248. dslmain_altdns_a,
  249. dslmain_altdns_b,
  250. dslmain_altdns_c,
  251. dslmain_altdns_d,
  252. g_fFirewallRequired
  253. );
  254. ResetConnectedToInternetEx();
  255. }
  256. return fDSLSuccess;
  257. }
  258. function dsl_SaveData()
  259. {
  260. var fSuccess = true;
  261. var ip_regex = new RegExp(g_ip_regex);
  262. // THESE CONTROLS * DON'T * EXIST ON ALL PAGES
  263. //
  264. dslmain_UserName = (null != g.dsl_username)
  265. ? g.dsl_username.value
  266. : '';
  267. dslmain_Password = (null != g.dsl_password)
  268. ? g.dsl_password.value
  269. : '';
  270. dslmain_ServiceName = (null != g.dsl_servicename)
  271. ? g.dsl_servicename.value
  272. : '';
  273. // THE REST OF THE CONTROLS EXIST ON EACH PAGE
  274. //
  275. // Validate and save ip address, subnet mask, and default gateway
  276. //
  277. if (g.dsl_autoip.checked)
  278. {
  279. dslmain_fAutoIpAddress = true;
  280. dslmain_staticip = '';
  281. dslmain_staticip_a = 0;
  282. dslmain_staticip_b = 0;
  283. dslmain_staticip_c = 0;
  284. dslmain_staticip_d = 0;
  285. g.dsl_lbl_staticip.className="text-primary";
  286. dslmain_subnetmask = '';
  287. dslmain_subnetmask_a = 0;
  288. dslmain_subnetmask_b = 0;
  289. dslmain_subnetmask_c = 0;
  290. dslmain_subnetmask_d = 0;
  291. g.dsl_lbl_subnetmask.className="text-primary";
  292. dslmain_defgateway = '';
  293. dslmain_defgateway_a = 0;
  294. dslmain_defgateway_b = 0;
  295. dslmain_defgateway_c = 0;
  296. dslmain_defgateway_d = 0;
  297. g.dsl_lbl_defgateway.className="text-primary";
  298. }
  299. else
  300. {
  301. dslmain_fAutoIpAddress = false;
  302. if (validate_ip_addr(g.dsl_staticip.value))
  303. {
  304. dslmain_staticip = g.dsl_staticip.value;
  305. ip_regex.test(dslmain_staticip);
  306. dslmain_staticip_a = parseInt(RegExp.$1);
  307. dslmain_staticip_b = parseInt(RegExp.$2);
  308. dslmain_staticip_c = parseInt(RegExp.$3);
  309. dslmain_staticip_d = parseInt(RegExp.$4);
  310. g.dsl_lbl_staticip.innerHTML=L_StaticIpAddress_Text;
  311. g.dsl_lbl_staticip.className="text-primary";
  312. }
  313. else
  314. {
  315. fSuccess = false;
  316. g.dsl_lbl_staticip.innerHTML=L_StaticIpAddress2_Text;
  317. g.dsl_lbl_staticip.className="text-error";
  318. }
  319. if (validate_subnet_mask(g.dsl_subnetmask.value))
  320. {
  321. dslmain_subnetmask = g.dsl_subnetmask.value;
  322. ip_regex.test(dslmain_subnetmask);
  323. dslmain_subnetmask_a = parseInt(RegExp.$1);
  324. dslmain_subnetmask_b = parseInt(RegExp.$2);
  325. dslmain_subnetmask_c = parseInt(RegExp.$3);
  326. dslmain_subnetmask_d = parseInt(RegExp.$4);
  327. g.dsl_lbl_subnetmask.innerHTML=L_SubnetMask_Text;
  328. g.dsl_lbl_subnetmask.className="text-primary";
  329. }
  330. else
  331. {
  332. fSuccess = false;
  333. g.dsl_lbl_subnetmask.innerHTML=L_SubnetMask2_Text;
  334. g.dsl_lbl_subnetmask.className="text-error";
  335. }
  336. if (validate_ip_addr(g.dsl_defgateway.value))
  337. {
  338. dslmain_defgateway = g.dsl_defgateway.value;
  339. ip_regex.test(dslmain_defgateway);
  340. dslmain_defgateway_a = parseInt(RegExp.$1);
  341. dslmain_defgateway_b = parseInt(RegExp.$2);
  342. dslmain_defgateway_c = parseInt(RegExp.$3);
  343. dslmain_defgateway_d = parseInt(RegExp.$4);
  344. g.dsl_lbl_defgateway.innerHTML=L_Defaultgateway_Text;
  345. g.dsl_lbl_defgateway.className="text-primary";
  346. }
  347. else
  348. {
  349. fSuccess = false;
  350. g.dsl_lbl_defgateway.innerHTML=L_Defaultgateway2_Text;
  351. g.dsl_lbl_defgateway.className="text-error";
  352. }
  353. }
  354. // Validate and save preferred and alternate DNS addresses
  355. //
  356. if (g.dsl_autodns.checked)
  357. {
  358. dslmain_fAutoDns = true;
  359. dslmain_prefdns = '';
  360. dslmain_prefdns_a = 0;
  361. dslmain_prefdns_b = 0;
  362. dslmain_prefdns_c = 0;
  363. dslmain_prefdns_d = 0;
  364. g.dsl_lbl_prefdns="text-primary";
  365. dslmain_altdns = '';
  366. dslmain_altdns_a = 0;
  367. dslmain_altdns_b = 0;
  368. dslmain_altdns_c = 0;
  369. dslmain_altdns_d = 0;
  370. g.dsl_lbl_altdns="text-primary";
  371. }
  372. else
  373. {
  374. dslmain_fAutoDns = false;
  375. if (validate_ip_addr(g.dsl_prefdns.value))
  376. {
  377. dslmain_prefdns = g.dsl_prefdns.value;
  378. ip_regex.test(dslmain_prefdns);
  379. dslmain_prefdns_a = parseInt(RegExp.$1);
  380. dslmain_prefdns_b = parseInt(RegExp.$2);
  381. dslmain_prefdns_c = parseInt(RegExp.$3);
  382. dslmain_prefdns_d = parseInt(RegExp.$4);
  383. g.dsl_lbl_prefdns.innerHTML=L_PreferredDNS_Text;
  384. g.dsl_lbl_prefdns.className="text-primary";
  385. }
  386. else
  387. {
  388. fSuccess = false;
  389. g.dsl_lbl_prefdns.innerHTML=L_PreferredDNS2_Text;
  390. g.dsl_lbl_prefdns.className="text-error";
  391. }
  392. // If Alternate DNS is blank, it should be acceptable since it is optional.
  393. if (g.dsl_altdns.value == "")
  394. {
  395. dslmain_altdns = '';
  396. dslmain_altdns_a = 0;
  397. dslmain_altdns_b = 0;
  398. dslmain_altdns_c = 0;
  399. dslmain_altdns_d = 0;
  400. g.dsl_lbl_altdns.innerHTML=L_AlternateDNS_Text;
  401. g.dsl_lbl_altdns.className="text-primary";
  402. }
  403. else
  404. {
  405. if (validate_ip_addr(g.dsl_altdns.value))
  406. {
  407. dslmain_altdns = g.dsl_altdns.value;
  408. ip_regex.test(dslmain_altdns);
  409. dslmain_altdns_a = parseInt(RegExp.$1);
  410. dslmain_altdns_b = parseInt(RegExp.$2);
  411. dslmain_altdns_c = parseInt(RegExp.$3);
  412. dslmain_altdns_d = parseInt(RegExp.$4);
  413. g.dsl_lbl_altdns.innerHTML=L_AlternateDNS_Text;
  414. g.dsl_lbl_altdns.className="text-primary";
  415. }
  416. else
  417. {
  418. fSuccess = false;
  419. g.dsl_lbl_altdns.innerHTML=L_AlternateDNS2_Text;
  420. g.dsl_lbl_altdns.className="text-error";
  421. }
  422. }
  423. }
  424. if (fSuccess)
  425. g.dslinvalidtexterror.style.display="none";
  426. else
  427. g.dslinvalidtexterror.style.display="inline";
  428. return fSuccess;
  429. }
  430. function dsl_autoipClickHandler()
  431. {
  432. if (g.dsl_autoip.checked)
  433. {
  434. g.dsl_staticip.value='';
  435. g.dsl_subnetmask.value='';
  436. g.dsl_defgateway.value='';
  437. g.dsl_staticip.style.backgroundColor='#dddddd';
  438. g.dsl_subnetmask.style.backgroundColor='#dddddd';
  439. g.dsl_defgateway.style.backgroundColor='#dddddd';
  440. g.dsl_staticip.disabled=true;
  441. g.dsl_subnetmask.disabled=true;
  442. g.dsl_defgateway.disabled=true;
  443. g.dsl_lbl_staticip.innerHTML=L_StaticIpAddress_Text;
  444. g.dsl_lbl_subnetmask.innerHTML=L_SubnetMask_Text;
  445. g.dsl_lbl_defgateway.innerHTML=L_Defaultgateway_Text;
  446. g.dsl_lbl_staticip.className="text-primary";
  447. g.dsl_lbl_subnetmask.className="text-primary";
  448. g.dsl_lbl_defgateway.className="text-primary";
  449. }
  450. else
  451. {
  452. g.dsl_staticip.value=dslmain_staticip;
  453. g.dsl_subnetmask.value=dslmain_subnetmask;
  454. g.dsl_defgateway.value=dslmain_defgateway;
  455. g.dsl_staticip.style.backgroundColor='#ffffff';
  456. g.dsl_subnetmask.style.backgroundColor='#ffffff';
  457. g.dsl_defgateway.style.backgroundColor='#ffffff';
  458. g.dsl_staticip.disabled=false;
  459. g.dsl_subnetmask.disabled=false;
  460. g.dsl_defgateway.disabled=false;
  461. g.dsl_staticip.select();
  462. g.dsl_staticip.focus();
  463. }
  464. }
  465. function dsl_autodnsClickHandler()
  466. {
  467. if (g.dsl_autodns.checked)
  468. {
  469. g.dsl_prefdns.value='';
  470. g.dsl_altdns.value='';
  471. g.dsl_prefdns.style.backgroundColor='#dddddd';
  472. g.dsl_altdns.style.backgroundColor='#dddddd';
  473. g.dsl_prefdns.disabled=true;
  474. g.dsl_altdns.disabled=true;
  475. g.dsl_lbl_prefdns.innerHTML=L_PreferredDNS_Text;
  476. g.dsl_lbl_altdns.innerHTML=L_AlternateDNS_Text;
  477. g.dsl_lbl_prefdns.className="text-primary";
  478. g.dsl_lbl_altdns.className="text-primary";
  479. }
  480. else
  481. {
  482. g.dsl_prefdns.value=dslmain_prefdns;
  483. g.dsl_altdns.value=dslmain_altdns;
  484. g.dsl_prefdns.style.backgroundColor='#ffffff';
  485. g.dsl_altdns.style.backgroundColor='#ffffff';
  486. g.dsl_prefdns.disabled=false;
  487. g.dsl_altdns.disabled=false;
  488. g.dsl_prefdns.select();
  489. g.dsl_prefdns.focus();
  490. }
  491. }