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.

761 lines
20 KiB

  1. var PAGE_DIAL_READY = 40;
  2. var PAGE_DIAL_UP = 41;
  3. var gNextChkPt = 0;
  4. var APP_OOBE_MODE = 0;
  5. var APP_REG_MODE = 2;
  6. var APP_ACT_MODE = 5;
  7. var REMIND_REG = 0;
  8. var REMIND_ISP = 1;
  9. var APP_MSN_MODE = 4;
  10. // Localization strings
  11. var L_REGSRV_Text = "Your computer is connecting to the registration server.";
  12. var L_ACTSRV_Text = "Your computer is connecting to the activation server.";
  13. var L_ACT_REG_SRV_Text = "Your computer is connecting to the activation and registration server.";
  14. var L_REGCOM_Text = "Registering Windows... ";
  15. var L_REGCOM2_Text = "Registering your computer... ";
  16. var L_ACTCOM_Text = "Activating Windows... ";
  17. var L_ACTREGCOM_Text = "Activating and registering Windows... ";
  18. var g_CustomPhoneBook = null;
  19. var g_CustomDialingPage = null;
  20. function SetCustomDialing(PhoneBook, DialingPage)
  21. {
  22. g_CustomDialingPage = DialingPage;
  23. g_CustomPhoneBook = PhoneBook;
  24. }
  25. //
  26. // This function indicates whether we are in a mode that reminds the user to activate
  27. // and/or register. For dialmgr.js, activation mode should be handled the same way
  28. // as registration.
  29. //
  30. function InActivation_AppMode()
  31. {
  32. return (APP_ACT_MODE == window.external.Directions.get_AppMode());
  33. }
  34. function InReminderMode()
  35. {
  36. return (APP_REG_MODE == window.external.Directions.get_AppMode() ||
  37. APP_ACT_MODE == window.external.Directions.get_AppMode()
  38. );
  39. }
  40. function ShowAregDial()
  41. {
  42. Navigate("actsetup\\aregdial.htm");
  43. SetTimerShowIFrame(500);
  44. }
  45. function GoToDialingPage()
  46. {
  47. if ( APP_REG_MODE == window.external.Directions.get_AppMode() ) {
  48. Navigate("regsetup\\rregdial.htm");
  49. } else if ( APP_ACT_MODE == window.external.Directions.get_AppMode() ) {
  50. ShowIFrame('False');
  51. window.setTimeout("ShowAregDial();",500);
  52. } else {
  53. DisableAllButtons();
  54. switch (g_CurrentCKPT)
  55. {
  56. case CKPT_MIGDIAL:
  57. //alert("CKPT_MIGDIAL");
  58. Navigate("setup\\migdial.htm");
  59. break;
  60. case CKPT_REFDIAL:
  61. //alert("CKPT_REFDIAL");
  62. // already downloaded offer
  63. if (true == StatusObj.get_Status(REFERALDLCOMPLETED))
  64. {
  65. GoNavigate(CKPT_MIGLIST);
  66. }
  67. else
  68. {
  69. Navigate("setup\\refdial.htm");
  70. }
  71. break;
  72. case CKPT_REGDIAL:
  73. //alert("CKPT_REGDIAL");
  74. Navigate("setup\\regdial.htm");
  75. break;
  76. case CKPT_ISPDIAL:
  77. //alert("CKPT_ISPDIAL");
  78. if (g_CustomDialingPage)
  79. {
  80. Navigate(g_CustomDialingPage);
  81. }
  82. else
  83. {
  84. Navigate("setup\\dialup.htm");
  85. }
  86. break;
  87. default:
  88. //alert("CKPT_REGDIAL ?");
  89. break;
  90. }
  91. }
  92. }
  93. function DialRdy_OutsideLineClicked( )
  94. {
  95. try
  96. {
  97. if (null == g.event)
  98. return;
  99. }
  100. catch(e)
  101. {
  102. return;
  103. }
  104. DialRdy_SetOutsideLine( );
  105. }
  106. function DialRdy_SetOutsideLine( )
  107. {
  108. if (true == g.radioOutsideLineYes.checked &&
  109. "visible" == g.spnOutsideLine.style.visibility)
  110. {
  111. g.spnOutsideLineNumber.style.visibility = "visible";
  112. g.edtOutsideLineNumber.style.visibility = "visible";
  113. g.edtOutsideLineNumber.value = TapiObj.get_DialOut;
  114. if (0 == g.edtOutsideLineNumber.value.length)
  115. {
  116. g.edtOutsideLineNumber.value = "9";
  117. }
  118. }
  119. else
  120. {
  121. g.edtOutsideLineNumber.value = "";
  122. g.spnOutsideLineNumber.style.visibility = "hidden";
  123. g.spnOutsideLine.style.visibility = "hidden";
  124. }
  125. }
  126. //////////////////////////////////////////////////////////////////////////////////////
  127. // Next Button Handler
  128. //////////////////////////////////////////////////////////////////////////////////////
  129. function Dial_NextBtnHandler()
  130. {
  131. switch (gCurrPage)
  132. {
  133. case PAGE_DIAL_READY:
  134. {
  135. if (g.DialRdy_ctrl1.style.visibility=="visible")
  136. {
  137. TapiObj.set_AreaCode = g.edtAreaCode.value;
  138. TapiObj.set_CountryIndex = g.selCountry.selectedIndex;
  139. // If Touch tone is checked
  140. if (g.PulseToneDialing.style.visibility != "hidden")
  141. {
  142. if (g.radioTouchToneYes.checked)
  143. TapiObj.set_PhoneSystem = 1;
  144. else
  145. TapiObj.set_PhoneSystem = 0;
  146. }
  147. }
  148. if ("visible" == g.spnOutsideLine.style.visibility &&
  149. true == g.radioOutsideLineYes.checked &&
  150. "visible" == g.spnOutsideLineNumber.style.visibility
  151. )
  152. {
  153. TapiObj.set_DialOut = g.edtOutsideLineNumber.value;
  154. }
  155. if (window.external.CheckPhoneBook(
  156. (g_CustomPhoneBook == null) ? "msobe.isp" : g_CustomPhoneBook
  157. ))
  158. {
  159. GoToDialingPage();
  160. }
  161. else
  162. {
  163. if (InReminderMode())
  164. {
  165. Navigate("regerror\\rpberr.htm");
  166. }
  167. else
  168. {
  169. if (g_CurrentCKPT == CKPT_ISPDIAL)
  170. {
  171. Navigate("isperror\\isppberr.htm");
  172. }
  173. else
  174. {
  175. Navigate("error\\pberr.htm");
  176. }
  177. }
  178. }
  179. break;
  180. }
  181. case PAGE_DIAL_UP:
  182. {
  183. break;
  184. }
  185. }
  186. }
  187. var g_IgnoreDialErr = true;
  188. //////////////////////////////////////////////////////////////////////////////////////
  189. // Back Button Handler
  190. //////////////////////////////////////////////////////////////////////////////////////
  191. function Dial_BackBtnHandler()
  192. {
  193. switch (gCurrPage)
  194. {
  195. case PAGE_DIAL_READY:
  196. {
  197. break;
  198. }
  199. case PAGE_DIAL_UP:
  200. {
  201. g_IgnoreDialErr = true;
  202. ResetDialing();
  203. GoBack();
  204. break;
  205. }
  206. }
  207. }
  208. //////////////////////////////////////////////////////////////////////////////////////
  209. // Skip Button Handler
  210. //////////////////////////////////////////////////////////////////////////////////////
  211. function Dial_SkipBtnHandler()
  212. {
  213. PopCKPT(CKPT_ISPDIAL); // Pop all possible dial ready checkpoint
  214. PopCKPT(CKPT_REGDIAL);
  215. switch (gCurrPage)
  216. {
  217. case PAGE_DIAL_READY:
  218. {
  219. GoCancel();
  220. break;
  221. }
  222. case PAGE_DIAL_UP:
  223. {
  224. ResetDialing();
  225. GoCancel();
  226. break;
  227. }
  228. }
  229. }
  230. //////////////////////////////////////////////////////////////////////////////////////
  231. // Dial Ready page for OEM, ISP, MSN dialing.
  232. //////////////////////////////////////////////////////////////////////////////////////
  233. function DialRdy_LoadMe()
  234. {
  235. if (InActivation_AppMode())
  236. ShowIFrame();
  237. gCurrPage = PAGE_DIAL_READY;
  238. InitFrameRef();
  239. if (InActivation_AppMode())
  240. CheckContrastMode();
  241. if (g != null)
  242. {
  243. g_FirstFocusElement = g.btnNext;
  244. if (InActivation_AppMode())
  245. window.setTimeout("DoFocus();",1000);
  246. else
  247. g_FirstFocusElement.focus();
  248. }
  249. InitButtons();
  250. var fTapi = TapiObj.IsTAPIConfigured;
  251. if (!fTapi && !g_bTapiDone)
  252. {
  253. g.DialRdy_ctrl1.style.visibility="visible";
  254. if(g_CountryIdx < 0)
  255. {
  256. g_CountryIdx = TapiObj.get_CountryIndex;
  257. }
  258. g.edtAreaCode.value = TapiObj.get_AreaCode;
  259. g.selCountry.selectedIndex = g_CountryIdx;
  260. if(1 == TapiObj.get_PhoneSystem)
  261. g.radioTouchToneYes.checked = true; //touch tone
  262. else
  263. g.radioTouchToneNo.checked = true; //rotary
  264. }
  265. if (true == ApiObj.get_OOBEDebugMode)
  266. {
  267. g.spnOutsideLine.style.visibility = "visible";
  268. }
  269. DialRdy_SetOutsideLine( );
  270. g.btnNext.onclick = Dial_NextBtnHandler;
  271. g.btnSkip.onclick = Dial_SkipBtnHandler;
  272. if ((APP_MSN_MODE == window.external.Directions.get_AppMode()) &&
  273. window.external.CalledFromMsn())
  274. {
  275. g.btnBack.style.visibility = "hidden";
  276. g.BackBtnLocalText.style.visibility = "hidden";
  277. }
  278. }
  279. //////////////////////////////////////////////////////////////////////////////////////
  280. // Dial Ready page for OEM, ISP, MSN dialing.
  281. //////////////////////////////////////////////////////////////////////////////////////
  282. var L_PostToOEMandMS_Text = "We'll now dial a telephone number to register your new computer with Microsoft and %1. ";
  283. var L_PostToMS_Text = "We'll now dial a telephone number to register your new computer with Microsoft. ";
  284. var L_PostToOEM_Text = "We'll now dial a telephone number to register your new computer with %1. ";
  285. var L_PrepToActRegOnline_Text = "Preparing to activate and register Online";
  286. var L_PrepToActReg_Text = "Windows will now dial a telephone number to activate and register Windows with Microsoft.";
  287. var L_PrepToActReg2_Text = "Windows will now dial a telephone number to activate Windows with Microsoft and register with %1. ";
  288. var L_PrepToActReg3_Text = "Windows will now dial a telephone number to activate and register Windows with Microsoft and register with %1. ";
  289. var L_PrepToAct_Text = "Windows will now dial a telephone number to activate Windows with Microsoft.";
  290. var OemNameStr = window.external.Signup.get_OEMName();
  291. function RegDialRdy_LoadMe()
  292. {
  293. DialRdy_LoadMe();
  294. if (InActivation_AppMode())
  295. {
  296. if (g_PostToMS)
  297. {
  298. g.Title_Text.innerText = L_PrepToActRegOnline_Text;
  299. g.RegDialReadyIntro.innerText = L_PrepToActReg_Text;
  300. }
  301. // Change "Skip" to "Remind me later".
  302. var L_RemindMeLater01_Text = " Re<u>m</u>ind me later ";
  303. var AccesskeyRemind_M = "M";
  304. g.btnSkip.innerHTML = L_RemindMeLater01_Text;
  305. g.btnSkip.accessKey = AccesskeyRemind_M;
  306. }
  307. if (!InReminderMode())
  308. {
  309. if (g_DoActivation)
  310. {
  311. if (g_PostToMS && !g_PostToOEM)
  312. g.RegDialReadyIntro.innerText = L_PrepToActReg_Text;
  313. else if (!g_PostToMS && g_PostToOEM)
  314. g.RegDialReadyIntro.innerText = ApiObj.FormatMessage(L_PrepToActReg2_Text, OemNameStr);
  315. else if (g_PostToMS && g_PostToOEM)
  316. g.RegDialReadyIntro.innerText = ApiObj.FormatMessage(L_PrepToActReg3_Text, OemNameStr);
  317. else if (!g_PostToMS && !g_PostToOEM)
  318. g.RegDialReadyIntro.innerText = L_PrepToAct_Text;
  319. }
  320. else
  321. {
  322. if (g_PostToMS && g_PostToOEM)
  323. {
  324. g.RegDialReadyIntro.innerText = ApiObj.FormatMessage(L_PostToOEMandMS_Text, OemNameStr);
  325. }
  326. else if (g_PostToMS)
  327. {
  328. g.RegDialReadyIntro.innerText = L_PostToMS_Text;
  329. }
  330. else // this must be the g_PostToOEM case
  331. {
  332. g.RegDialReadyIntro.innerText = ApiObj.FormatMessage(L_PostToOEM_Text, OemNameStr);
  333. }
  334. }
  335. }
  336. else
  337. {
  338. GetPageTitle();
  339. if (1 == RegisterObj.get_PostToOEM)
  340. {
  341. if (g_PostToOEM)
  342. {
  343. if (g_PostToMS)
  344. {
  345. g.RegDialReadyIntro.innerText = ApiObj.FormatMessage(L_PostToOEMandMS_Text, OemNameStr);
  346. }
  347. else
  348. {
  349. g.RegDialReadyIntro.innerText = ApiObj.FormatMessage(L_PostToOEM_Text, OemNameStr);
  350. }
  351. }
  352. }
  353. }
  354. }
  355. //////////////////////////////////////////////////////////////////////////////////////
  356. // regdial.htm - Dialing into registration server
  357. //////////////////////////////////////////////////////////////////////////////////////
  358. var L_ConnectToOnlineAct_Text = "Connecting to online activation";
  359. var L_ConnectToOnlineActReg_Text = "Connecting to online activation and registration";
  360. var L_ConnectToOnlineReg_Text = "Connecting to online registration";
  361. function RegDial_LoadMe()
  362. {
  363. gCurrPage = PAGE_DIAL_UP;
  364. InitFrameRef();
  365. if (InActivation_AppMode())
  366. CheckContrastMode();
  367. g.btnNext.disabled = true;
  368. if (g != null)
  369. {
  370. g_FirstFocusElement = g.btnBack;
  371. }
  372. if (InActivation_AppMode())
  373. {
  374. /* We'll just use the default title in the page for now, which is "Connecting..."
  375. if (g_PostToMS)
  376. g.Title_Text.innerText = L_ConnectToOnlineActReg_Text;
  377. else
  378. g.Title_Text.innerText = L_ConnectToOnlineAct_Text;
  379. */
  380. GetPageTitle();
  381. }
  382. if (!InReminderMode())
  383. {
  384. if (g_DoActivation)
  385. {
  386. if (g_PostToMS || g_PostToOEM)
  387. g.regdial_title.innerText = L_ConnectToOnlineActReg_Text;
  388. else
  389. g.regdial_title.innerText = L_ConnectToOnlineAct_Text;
  390. }
  391. else
  392. {
  393. g.regdial_title.innerText = L_ConnectToOnlineReg_Text;
  394. }
  395. }
  396. InitButtons();
  397. setTimeout("DoRegistrationDial()" , 40);
  398. g.btnNext.onclick = Dial_NextBtnHandler;
  399. g.btnBack.onclick = Dial_BackBtnHandler;
  400. g.btnSkip.onclick = Dial_SkipBtnHandler;
  401. }
  402. function DoRegistrationDial()
  403. {
  404. g_IgnoreDialErr = false;
  405. window.external.DialEx(CONNECTED_REGISTRATION, "reg.isp");
  406. }
  407. //////////////////////////////////////////////////////////////////////////////////////
  408. // dialup.htm
  409. //////////////////////////////////////////////////////////////////////////////////////
  410. function Dialup_LoadMe()
  411. {
  412. gCurrPage = PAGE_DIAL_UP;
  413. InitFrameRef();
  414. g.btnNext.disabled = true;
  415. if (g != null)
  416. {
  417. g_FirstFocusElement = g.btnBack;
  418. }
  419. InitButtons();
  420. setTimeout("DoDialExternal()" , 40);
  421. g.btnNext.onclick = Dial_NextBtnHandler;
  422. g.btnBack.onclick = Dial_BackBtnHandler;
  423. g.btnSkip.onclick = Dial_SkipBtnHandler;
  424. }
  425. function ResetDialing()
  426. {
  427. g_bRedial = false;
  428. g_LineProblem = 0;
  429. g_bFirstServerError = true;
  430. g_strISPFile = "";
  431. g_IgnoreDialErr = true;
  432. window.external.Hangup();
  433. }
  434. function SetDialing(strISPFile)
  435. {
  436. g_strISPFile = strISPFile;
  437. g_DialCKPT = g_CurrentCKPT;
  438. g_ModalDialogUp = false;
  439. }
  440. function DoDialExternal()
  441. {
  442. SetDialing((g_CustomPhoneBook == null) ? "msobe.isp" : g_CustomPhoneBook);
  443. DoDial();
  444. }
  445. function DoDial()
  446. {
  447. g_IgnoreDialErr = false;
  448. if (g_bRedial)
  449. {
  450. window.external.ReDialEx(CONNECTED_ISP_SIGNUP, g_strISPFile);
  451. }
  452. else
  453. {
  454. window.external.DialEx(CONNECTED_ISP_SIGNUP, g_strISPFile);
  455. }
  456. }
  457. function Redial()
  458. {
  459. DoDial();
  460. }
  461. <!--REQUIRED FUNCTION NAME-->
  462. function OnDialing()
  463. {
  464. // Called when dial with CONNECTED_REGISTRATION
  465. switch (g_CurrentCKPT)
  466. {
  467. case CKPT_REGDIAL:
  468. if (g != null && g.spnISPName != null)
  469. {
  470. if (InActivation_AppMode())
  471. {
  472. if (g_PostToMS)
  473. g.spnISPName.innerText = L_ACT_REG_SRV_Text;
  474. else
  475. g.spnISPName.innerText = L_ACTSRV_Text;
  476. }
  477. else
  478. if (!InReminderMode())
  479. {
  480. if (g_DoActivation)
  481. {
  482. if (g_PostToMS || g_PostToOEM)
  483. g.spnISPName.innerText = L_ACT_REG_SRV_Text;
  484. else
  485. g.spnISPName.innerText = L_ACTSRV_Text;
  486. }
  487. else
  488. {
  489. g.spnISPName.innerText = L_REGSRV_Text;
  490. }
  491. }
  492. else
  493. {
  494. g.spnISPName.innerText = L_REGSRV_Text;
  495. }
  496. }
  497. if (g != null && g.spnDialing != null)
  498. {
  499. g.spnDialing.innerText = window.external.get_DialNumber;
  500. }
  501. break;
  502. }
  503. }
  504. <!--REQUIRED FUNCTION NAME-->
  505. function OnConnecting()
  506. {
  507. // Called when dial with CONNECTED_REGISTRATION
  508. switch (g_CurrentCKPT)
  509. {
  510. case CKPT_REGDIAL:
  511. if (g != null && g.spnRegDialStatus != null)
  512. {
  513. if (InActivation_AppMode())
  514. {
  515. if (g_PostToMS)
  516. g.spnRegDialStatus.innerText = L_ACTREGCOM_Text;
  517. else
  518. g.spnRegDialStatus.innerText = L_ACTCOM_Text;
  519. g_AfterConnectionDone = true;
  520. }
  521. else
  522. if (!InReminderMode())
  523. {
  524. if (g_DoActivation)
  525. {
  526. if (g_PostToMS || g_PostToOEM)
  527. g.spnRegDialStatus.innerText = L_ACTREGCOM_Text;
  528. else
  529. g.spnRegDialStatus.innerText = L_ACTCOM_Text;
  530. }
  531. else
  532. {
  533. g.spnRegDialStatus.innerText = L_REGCOM2_Text;
  534. }
  535. }
  536. else
  537. {
  538. g.spnRegDialStatus.innerText = L_REGCOM_Text;
  539. }
  540. }
  541. break;
  542. }
  543. }
  544. <!--REQUIRED FUNCTION NAME-->
  545. function OnConnected()
  546. {
  547. // Called when dial with CONNECTED_REGISTRATION
  548. g_bTapiDone = true;
  549. switch (g_CurrentCKPT)
  550. {
  551. case CKPT_REGDIAL:
  552. if ( g_DoActivation )
  553. {
  554. window.external.AsyncActivate( g_PostToMS );
  555. return;
  556. }
  557. else if (g_PostToMS)
  558. {
  559. window.external.PostRegData(POST_TO_MS);
  560. StatusObj.set_Status(MS_REGISTRATION, true);
  561. }
  562. ActivationComplete( );
  563. break;
  564. }
  565. }
  566. <!--REQUIRED FUNCTION NAME-->
  567. function OnDownloading()
  568. {
  569. }
  570. <!--REQUIRED FUNCTION NAME-->
  571. function OnDisconnect()
  572. {
  573. }
  574. <!--REQUIRED FUNCTION NAME-->
  575. function OnDialingError(derr)
  576. {
  577. window.external.Hangup();
  578. if (g_IgnoreDialErr)
  579. return;
  580. // Called when dial with CONNECTED_REGISTRATION
  581. if (InReminderMode())
  582. {
  583. g_AfterConnectionDone = false;
  584. switch (derr)
  585. {
  586. case DERR_PORT_OR_DEVICE:
  587. case DERR_PORT_ALREADY_OPEN:
  588. case DERR_HARDWARE_FAILURE:
  589. case DERR_DIALTONE:
  590. Navigate("regerror\\rdtone.htm");
  591. break;
  592. case DERR_BUSY:
  593. Navigate("regerror\\rtoobusy.htm");
  594. break;
  595. case DERR_VOICEANSWER:
  596. case DERR_PPP_TIMEOUT:
  597. Navigate("regerror\\rhndshk.htm");
  598. break;
  599. case DERR_NO_CARRIER:
  600. Navigate("regerror\\rpulse.htm");
  601. break;
  602. case DERR_REMOTE_DISCONNECT:
  603. Navigate("regerror\\rcnterr.htm");
  604. break;
  605. case DERR_NOANSWER:
  606. Navigate("regerror\\rnoansw.htm");
  607. break;
  608. default:
  609. Navigate("regerror\\rhndshk.htm");
  610. break;
  611. }
  612. }
  613. else
  614. {
  615. switch (derr)
  616. {
  617. case DERR_PORT_OR_DEVICE:
  618. case DERR_PORT_ALREADY_OPEN:
  619. case DERR_HARDWARE_FAILURE:
  620. case DERR_DIALTONE:
  621. Navigate("error\\dialtone.htm");
  622. break;
  623. case DERR_BUSY:
  624. Navigate("error\\toobusy.htm");
  625. break;
  626. case DERR_VOICEANSWER:
  627. case DERR_PPP_TIMEOUT:
  628. Navigate("error\\hndshake.htm");
  629. break;
  630. case DERR_NO_CARRIER:
  631. Navigate("error\\pulse.htm");
  632. break;
  633. case DERR_REMOTE_DISCONNECT:
  634. Navigate("error\\cnncterr.htm");
  635. break;
  636. case DERR_NOANSWER:
  637. Navigate("error\\noanswer.htm");
  638. break;
  639. default:
  640. Navigate("error\\hndshake.htm");
  641. break;
  642. }
  643. }
  644. }
  645. <!--REQUIRED FUNCTION NAME -->
  646. function OnServerError(derr)
  647. {
  648. window.external.Hangup();
  649. if (g_IgnoreDialErr)
  650. return;
  651. Navigate("error\\isp2busy.htm");
  652. }