Leaked source code of windows server 2003
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.

425 lines
14 KiB

  1. // Localization Strings
  2. // =====================================================
  3. var L_YourUserName_Text = "Your <u>u</u>ser name:";
  4. var L_YourPassword_Text = "Your user pass<u>w</u>ord:";
  5. var L_YourPhone_Text = "Your ISP\'s <u>p</u>hone number:";
  6. var L_StaticIPAddrX_Text = "* Stati<u>c</u> Internet Protocol (IP) address:";
  7. var L_StaticIPAddr_Text = "Stati<u>c</u> Internet Protocol (IP) address:";
  8. var L_PreferredDNSX_Text = "* P<u>r</u>eferred Domain Name Server (DNS):";
  9. var L_PreferredDNS_Text = "P<u>r</u>eferred Domain Name Server (DNS):";
  10. var L_AlternateDNSX_Text = "* <u>A</u>lternate Domain Name Server (DNS):";
  11. var L_AlternateDNS_Text = "<u>A</u>lternate Domain Name Server (DNS):";
  12. var L_SampleIPRange_Text = "Range: 1-223.0-255.0-255.0-255";
  13. var L_OptionalField_Text = "(Optional)";
  14. var g_iconnectImgDir="images/";
  15. var g_iconnect_SW1="0";
  16. ///////////////////////////////////////////////////////////
  17. // msobshel.htm - initialization
  18. ///////////////////////////////////////////////////////////
  19. function iconnect_InitSimpleNavMap()
  20. {
  21. var iconnect_dir="html\\iconnect\\";
  22. g_SimpleNavMap.Add("iconnect.htm", iconnect_dir + "icntlast.htm");
  23. }
  24. ///////////////////////////////////////////////////////////
  25. // iconnect.htm
  26. ///////////////////////////////////////////////////////////
  27. pattern = /^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$/
  28. valid_ip_switch = false;
  29. var ip_reg_exp1 = 0;
  30. var ip_reg_exp2 = 0;
  31. var ip_reg_exp3 = 0;
  32. var ip_reg_exp4 = 0;
  33. var iconnect_fAutoIPAddress = true;
  34. var iconnect_ipaddr_a = 0;
  35. var iconnect_ipaddr_b = 0;
  36. var iconnect_ipaddr_c = 0;
  37. var iconnect_ipaddr_d = 0;
  38. var iconnect_fAutoDNS = true;
  39. var iconnect_ipaddrDns_a = 0;
  40. var iconnect_ipaddrDns_b = 0;
  41. var iconnect_ipaddrDns_c = 0;
  42. var iconnect_ipaddrDns_d = 0;
  43. var iconnect_ipaddrDnsAlt_a = 0;
  44. var iconnect_ipaddrDnsAlt_b = 0;
  45. var iconnect_ipaddrDnsAlt_c = 0;
  46. var iconnect_ipaddrDnsAlt_d = 0;
  47. function validate_ip(instr, current_ip_field)
  48. {
  49. ip_addr = new RegExp(pattern)
  50. if (!ip_addr.test(instr)) // check if our parameter matched our pattern regular expression.
  51. {
  52. valid_ip_switch = false;
  53. if (current_ip_field == 1) // we have to do these stuff to "ENFORCE PROPER PASSING" of parameters to the API.
  54. {
  55. iconnect_fAutoIPAddress = true;
  56. iconnect_ipaddr_a = 0;
  57. iconnect_ipaddr_b = 0;
  58. iconnect_ipaddr_c = 0;
  59. iconnect_ipaddr_d = 0;
  60. }
  61. if (current_ip_field == 2)
  62. {
  63. iconnect_fAutoDNS = true;
  64. iconnect_ipaddrDns_a = 0;
  65. iconnect_ipaddrDns_b = 0;
  66. iconnect_ipaddrDns_c = 0;
  67. iconnect_ipaddrDns_d = 0;
  68. }
  69. if ((instr != "") && (current_ip_field == 3))
  70. {
  71. iconnect_fAutoDNS = true;
  72. iconnect_ipaddrDnsAlt_a = 0;
  73. iconnect_ipaddrDnsAlt_b = 0;
  74. iconnect_ipaddrDnsAlt_c = 0;
  75. iconnect_ipaddrDnsAlt_d = 0;
  76. }
  77. if ((instr == "") && (current_ip_field == 3))
  78. {
  79. valid_ip_switch = true;
  80. iconnect_fAutoDNS = false; // So that we can be sure the Preferred DNS can still be saved.
  81. iconnect_ipaddrDnsAlt_a = 0;
  82. iconnect_ipaddrDnsAlt_b = 0;
  83. iconnect_ipaddrDnsAlt_c = 0;
  84. iconnect_ipaddrDnsAlt_d = 0;
  85. }
  86. }
  87. else
  88. {
  89. ip_reg_exp1 = parseInt(RegExp.$1);
  90. ip_reg_exp2 = parseInt(RegExp.$2);
  91. ip_reg_exp3 = parseInt(RegExp.$3);
  92. ip_reg_exp4 = parseInt(RegExp.$4);
  93. // we now check for the range of each.
  94. if ((ip_reg_exp1<1 || ip_reg_exp1>223) || (ip_reg_exp2<0 || ip_reg_exp2>255) || (ip_reg_exp3<0 || ip_reg_exp3>255) || (ip_reg_exp4<0 || ip_reg_exp4>255))
  95. {
  96. valid_ip_switch = false;
  97. }
  98. else
  99. {
  100. valid_ip_switch = true;
  101. if (current_ip_field == 1)
  102. {
  103. iconnect_fAutoIPAddress = false;
  104. iconnect_ipaddr_a = ip_reg_exp1;
  105. iconnect_ipaddr_b = ip_reg_exp2;
  106. iconnect_ipaddr_c = ip_reg_exp3;
  107. iconnect_ipaddr_d = ip_reg_exp4;
  108. }
  109. if (current_ip_field == 2)
  110. {
  111. iconnect_fAutoDNS = false;
  112. iconnect_ipaddrDns_a = ip_reg_exp1;
  113. iconnect_ipaddrDns_b = ip_reg_exp2;
  114. iconnect_ipaddrDns_c = ip_reg_exp3;
  115. iconnect_ipaddrDns_d = ip_reg_exp4;
  116. }
  117. if (current_ip_field == 3)
  118. {
  119. iconnect_fAutoDNS = false;
  120. iconnect_ipaddrDnsAlt_a = ip_reg_exp1;
  121. iconnect_ipaddrDnsAlt_b = ip_reg_exp2;
  122. iconnect_ipaddrDnsAlt_c = ip_reg_exp3;
  123. iconnect_ipaddrDnsAlt_d = ip_reg_exp4;
  124. }
  125. }
  126. }
  127. }
  128. function iconnect_validate1()
  129. {
  130. var iconnect_UserName=g.enableform.iconnect_user.value;
  131. var iconnect_UserPass=g.enableform.iconnect_pass.value;
  132. var iconnect_ISPPhone=g.enableform.iconnect_ispphone.value;
  133. var iconnect_ISPAreaCode=g.enableform.iconnect_ispareacode.value;
  134. if (iconnect_UserName == "")
  135. {
  136. FormatRequiredFieldLabel(g.iconnect_spn_username,1)
  137. }
  138. else
  139. {
  140. FormatRequiredFieldLabel(g.iconnect_spn_username,0)
  141. }
  142. if (iconnect_UserPass == "")
  143. {
  144. FormatRequiredFieldLabel(g.iconnect_spn_password,1)
  145. }
  146. else
  147. {
  148. FormatRequiredFieldLabel(g.iconnect_spn_password,0)
  149. }
  150. if (iconnect_ISPPhone == "")
  151. {
  152. FormatRequiredFieldLabel(g.iconnect_spn_phoneno,1)
  153. }
  154. else
  155. {
  156. FormatRequiredFieldLabel(g.iconnect_spn_phoneno,0)
  157. }
  158. var p_ip = false;
  159. if (g.enableform.iconnect_obtainip.checked)
  160. {
  161. p_ip = true;
  162. }
  163. else
  164. {
  165. var iconnect_staticIP=g.enableform.iconnect_staticip.value;
  166. validate_ip(iconnect_staticIP,1);
  167. if ((iconnect_staticIP == "") || (!valid_ip_switch))
  168. {
  169. g.iconnect_spn_staticIP.innerHTML=L_StaticIPAddrX_Text;
  170. g.iconnect_spn_staticIP.className = "text-error";
  171. g.iconnect_spn_obtainIP_tx1.style.display="inline";
  172. g.iconnect_spn_staticIP_exp.style.display="inline";
  173. }
  174. else
  175. {
  176. g.iconnect_spn_staticIP.innerHTML=L_StaticIPAddr_Text;
  177. g.iconnect_spn_staticIP.className = "text-primary";
  178. g.iconnect_spn_obtainIP_tx1.style.display="none";
  179. g.iconnect_spn_staticIP_exp.style.display="none";
  180. p_ip = true;
  181. }
  182. }
  183. var p_dns = false;
  184. var a_dns = false;
  185. if (g.enableform.iconnect_obtaindns.checked)
  186. {
  187. p_dns = true;
  188. a_dns = true;
  189. }
  190. else
  191. {
  192. var iconnect_pref_DNS=g.enableform.iconnect_prefdns.value;
  193. validate_ip(iconnect_pref_DNS,2);
  194. if ((iconnect_pref_DNS == "") || (!valid_ip_switch))
  195. {
  196. g.iconnect_spn_prefrDNS.innerHTML=L_PreferredDNSX_Text;
  197. g.iconnect_spn_prefrDNS.className = "text-error";
  198. g.iconnect_spn_prefrdns_exp.style.display="inline";
  199. }
  200. else
  201. {
  202. g.iconnect_spn_prefrDNS.innerHTML=L_PreferredDNS_Text;
  203. g.iconnect_spn_prefrDNS.className = "text-primary";
  204. g.iconnect_spn_prefrdns_exp.style.display="none";
  205. p_dns = true;
  206. }
  207. var iconnect_altr_DNS=g.enableform.iconnect_altdns.value;
  208. validate_ip(iconnect_altr_DNS,3);
  209. // since this textbox is only optional. blank should be ok.
  210. if ((iconnect_altr_DNS != "") && (!valid_ip_switch))
  211. {
  212. g.iconnect_spn_alterDNS.innerHTML=L_AlternateDNSX_Text;
  213. g.iconnect_spn_alterDNS.className = "text-error";
  214. g.iconnect_spn_alterdns_exp.innerHTML=L_SampleIPRange_Text;
  215. g.iconnect_spn_alterdns_exp.className = "text-error-small";
  216. g.iconnect_spn_alterdns_exp.style.display="inline";
  217. }
  218. else
  219. {
  220. g.iconnect_spn_alterDNS.innerHTML=L_AlternateDNS_Text;
  221. g.iconnect_spn_alterDNS.className = "text-primary";
  222. g.iconnect_spn_alterdns_exp.style.display="none";
  223. g.iconnect_spn_alterdns_exp.innerHTML=L_OptionalField_Text;
  224. g.iconnect_spn_alterdns_exp.className = "text-primary";
  225. g.iconnect_spn_alterdns_exp.style.display="inline";
  226. a_dns = true;
  227. }
  228. if ((iconnect_pref_DNS == "") || (!p_dns || !a_dns))
  229. {g.iconnect_spn_obtainDNS_tx1.style.display="inline";}
  230. else
  231. {g.iconnect_spn_obtainDNS_tx1.style.display="none";}
  232. }
  233. // all fields should contain something, else the next button wont continue...
  234. // --------------------------------------------------------------------------------
  235. if (iconnect_UserName == "" || iconnect_UserPass == "" || iconnect_ISPPhone == "" || !p_ip || !p_dns || !a_dns)
  236. {
  237. g_iconnect_SW1="0";
  238. }
  239. else
  240. {
  241. g_iconnect_SW1="1";
  242. window.external.CreateModemConnectoid(
  243. iconnect_ISPAreaCode,
  244. iconnect_ISPPhone,
  245. iconnect_fAutoIPAddress,
  246. iconnect_ipaddr_a,
  247. iconnect_ipaddr_b,
  248. iconnect_ipaddr_c,
  249. iconnect_ipaddr_d,
  250. iconnect_fAutoDNS,
  251. iconnect_ipaddrDns_a,
  252. iconnect_ipaddrDns_b,
  253. iconnect_ipaddrDns_c,
  254. iconnect_ipaddrDns_d,
  255. iconnect_ipaddrDnsAlt_a,
  256. iconnect_ipaddrDnsAlt_b,
  257. iconnect_ipaddrDnsAlt_c,
  258. iconnect_ipaddrDnsAlt_d,
  259. iconnect_UserName,
  260. iconnect_UserPass);
  261. // CreateModemConnectoid set the connectoid to be firewalled at
  262. // the end of OOBE via an API from HomeNet. we don't want the firewalling
  263. // if there is one ore more net cards because the function call can affect
  264. // bridging of the net cards.
  265. if (HasNetwork())
  266. {
  267. window.external.FirewallPreferredConnection(false);
  268. }
  269. // We set the registry flag for INS signup. Do it also for manual signup
  270. ApiObj.set_RegValue(HKEY_LOCAL_MACHINE, OOBE_MAIN_REG_KEY + "\\TEMP", "ISPSignup", 1);
  271. }
  272. }
  273. function iconnectNextBtnHandler()
  274. {
  275. iconnect_validate1();
  276. if (g_iconnect_SW1=="1")
  277. {
  278. SimpleNavNext();
  279. }
  280. }
  281. function iconnectFirstPage_LoadMe()
  282. {
  283. InitFrameRef('External');
  284. if (g.btnNext != null)
  285. g_FirstFocusElement = g.btnNext;
  286. else
  287. if (g.btnSkip != null)
  288. g_FirstFocusElement = g.btnSkip;
  289. else
  290. if (g.btnBack != null)
  291. g_FirstFocusElement = g.btnBack;
  292. InitNewButtons(null, "SimpleNext");
  293. checkme2();
  294. checkme3();
  295. if (g_FirstFocusElement != null)
  296. g_FirstFocusElement.focus();
  297. else
  298. g.document.body.focus();
  299. g.enableform.iconnect_ispareacode.value = TapiObj.get_AreaCode();
  300. g.btnNext.onclick = iconnectNextBtnHandler;
  301. }
  302. ///////////////////////////////////////////////////////////
  303. // icntlast.htm
  304. ///////////////////////////////////////////////////////////
  305. function iconnectLastPage_LoadMe()
  306. {
  307. InitFrameRef('External');
  308. InitNewButtons("SimpleBack", null);
  309. g.iconnect_spn_congrats.style.display="inline";
  310. g.iconnect_spn_valid.style.display="inline";
  311. g_FirstFocusElement = g.btnNext;
  312. g_FirstFocusElement.focus();
  313. }
  314. ///////////////////////////////////////////////////////////
  315. // iconnect scripts - enable/disable text boxes...
  316. ///////////////////////////////////////////////////////////
  317. // iconnect.htm
  318. // ------------
  319. function checkme2()
  320. {
  321. if (g.enableform.iconnect_obtainip.checked)
  322. {
  323. g.enableform.iconnect_staticip.value='';
  324. g.enableform.iconnect_staticip.style.backgroundColor='#dddddd';
  325. g.enableform.iconnect_staticip.disabled=true;
  326. g.iconnect_spn_staticIP.innerHTML=L_StaticIPAddr_Text;
  327. g.iconnect_spn_staticIP.className = "text-primary";
  328. g.iconnect_spn_obtainIP_tx1.style.display="none";
  329. g.iconnect_spn_staticIP_exp.style.display="none";
  330. iconnect_fAutoIPAddress = true;
  331. iconnect_ipaddr_a=0;
  332. iconnect_ipaddr_b=0;
  333. iconnect_ipaddr_c=0;
  334. iconnect_ipaddr_d=0;
  335. }
  336. else
  337. {
  338. g.enableform.iconnect_staticip.value='';
  339. g.enableform.iconnect_staticip.style.backgroundColor='#ffffff';
  340. g.enableform.iconnect_staticip.disabled=false;
  341. g.enableform.iconnect_staticip.focus();
  342. }
  343. }
  344. function checkme3()
  345. {
  346. if (g.enableform.iconnect_obtaindns.checked)
  347. {
  348. g.enableform.iconnect_prefdns.value='';
  349. g.enableform.iconnect_altdns.value='';
  350. g.enableform.iconnect_prefdns.style.backgroundColor='#dddddd';
  351. g.enableform.iconnect_altdns.style.backgroundColor='#dddddd';
  352. g.enableform.iconnect_prefdns.disabled=true;
  353. g.enableform.iconnect_altdns.disabled=true;
  354. g.iconnect_spn_prefrDNS.innerHTML=L_PreferredDNS_Text;
  355. g.iconnect_spn_prefrDNS.className = "text-primary";
  356. g.iconnect_spn_obtainDNS_tx1.style.display="none";
  357. g.iconnect_spn_prefrdns_exp.style.display="none";
  358. g.iconnect_spn_alterDNS.innerHTML=L_AlternateDNS_Text;
  359. g.iconnect_spn_alterDNS.className = "text-primary";
  360. g.iconnect_spn_alterdns_exp.style.display="none";
  361. g.iconnect_spn_alterdns_exp.innerHTML=L_OptionalField_Text;
  362. g.iconnect_spn_alterdns_exp.className = "text-primary";
  363. g.iconnect_spn_alterdns_exp.style.display="inline";
  364. iconnect_fAutoDNS=true;
  365. iconnect_ipaddrDns_a=0;
  366. iconnect_ipaddrDns_b=0;
  367. iconnect_ipaddrDns_c=0;
  368. iconnect_ipaddrDns_d=0;
  369. iconnect_ipaddrDnsAlt_a=0;
  370. iconnect_ipaddrDnsAlt_b=0;
  371. iconnect_ipaddrDnsAlt_c=0;
  372. iconnect_ipaddrDnsAlt_d=0;
  373. }
  374. else
  375. {
  376. g.enableform.iconnect_prefdns.value='';
  377. g.enableform.iconnect_altdns.value='';
  378. g.enableform.iconnect_prefdns.style.backgroundColor='#ffffff';
  379. g.enableform.iconnect_altdns.style.backgroundColor='#ffffff';
  380. g.enableform.iconnect_prefdns.disabled=false;
  381. g.enableform.iconnect_altdns.disabled=false;
  382. g.enableform.iconnect_prefdns.focus();
  383. }
  384. }