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.

918 lines
30 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <% '==================================================
  4. ' Microsoft Server Appliance
  5. '
  6. ' Sets server appliance date and time
  7. '
  8. ' Copyright (c) Microsoft Corporation. All rights reserved.
  9. '================================================== %>
  10. <!-- #include virtual="/admin/inc_framework.asp" -->
  11. <!-- #include file="loc_datetime.asp" -->
  12. <%
  13. '-------------------------------------------------------------------------
  14. ' Global Variables
  15. '-------------------------------------------------------------------------
  16. Dim page
  17. Dim SOURCE_FILE
  18. Const ENABLE_TRACING = FALSE
  19. SOURCE_FILE = SA_GetScriptFileName()
  20. '-------------------------------------------------------------------------
  21. ' Global Form Variables
  22. '-------------------------------------------------------------------------
  23. ' Form values
  24. Dim g_sDateID
  25. Dim g_sTimeID
  26. Dim g_sDay
  27. Dim g_sMonth
  28. Dim g_sYear
  29. Dim g_sHour
  30. Dim g_sMinute
  31. Dim g_sSecond
  32. Dim g_sTimeZone
  33. Dim g_sEnableDaylight
  34. Dim g_sWasChanged
  35. Dim mstrCHelperPROGID
  36. Dim mstrTimeFormat
  37. Dim mstrTimeFormatPathName
  38. Dim mstrTimeFormatValue
  39. '======================================================
  40. ' Entry point
  41. '======================================================
  42. '
  43. ' Create a Property Page
  44. Call SA_CreatePage( L_TASKTITLE_TEXT, "images/datetime_icon.GIF", PT_PROPERTY, page )
  45. '
  46. ' Serve the page
  47. Call SA_ShowPage( page )
  48. '======================================================
  49. ' Web Framework Event Handlers
  50. '======================================================
  51. '---------------------------------------------------------------------
  52. ' Function: OnInitPage
  53. '
  54. ' Synopsis: Called to signal first time processing for this page. Use this method
  55. ' to do first time initialization tasks.
  56. '
  57. ' Returns: TRUE to indicate initialization was successful. FALSE to indicate
  58. ' errors. Returning FALSE will cause the page to be abandoned.
  59. '
  60. '---------------------------------------------------------------------
  61. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  62. If ( ENABLE_TRACING ) Then
  63. Call SA_TraceOut(SOURCE_FILE, "OnInitPage")
  64. End If
  65. Call GetAutoAdjustInfo()
  66. g_sTimeZone = GetTimeZone()
  67. g_sDateID = FormatDateTime(date, vbShortDate)
  68. g_sTimeID = FormatDateTime(time, vbLongTime)
  69. OnInitPage = TRUE
  70. End Function
  71. '---------------------------------------------------------------------
  72. ' Function: OnServePropertyPage
  73. '
  74. ' Synopsis: Called when the page needs to be served. Use this method to
  75. ' serve content.
  76. '
  77. ' Returns: TRUE to indicate not problems occured. FALSE to indicate errors.
  78. ' Returning FALSE will cause the page to be abandoned.
  79. '
  80. '---------------------------------------------------------------------
  81. Public Function OnServePropertyPage(ByRef PageIn, ByRef EventArg)
  82. OnServePropertyPage = TRUE
  83. If ( ENABLE_TRACING ) Then
  84. Call SA_TraceOut(SOURCE_FILE, "OnServePropertyPage")
  85. End If
  86. ServePage
  87. End Function
  88. '----------------------------------------------------------------------------
  89. '
  90. ' Function : ServePage
  91. '
  92. ' Synopsis : serve the property page
  93. '
  94. ' Arguments: None
  95. '
  96. ' Returns : None
  97. '
  98. '----------------------------------------------------------------------------
  99. Sub ServePage
  100. Dim sTempTimeZone
  101. Dim sEnableDaylightAttr
  102. If ( g_sEnableDaylight = "Y" ) Then
  103. sEnableDaylightAttr = ""
  104. Else
  105. sEnableDaylightAttr = " DISABLED "
  106. End If
  107. %>
  108. <SCRIPT LANGUAGE=JavaScript>
  109. //To set Date and Time from the Client
  110. function PresetTimeZone()
  111. {
  112. timezone = "<% =g_sTimeZone %>";
  113. ZoneOpt = document.frmTask.ZoneList.options;
  114. for (ind = 0; ind < ZoneOpt.length; ind++)
  115. {
  116. if (ZoneOpt[ind].value == timezone + "#1")
  117. {
  118. document.frmTask.ZoneList.selectedIndex = ind;
  119. EnableDaylightChecked();
  120. if (document.frmTask.EnableDaylight.value == "Y")
  121. {
  122. document.frmTask.EnableDaylightCheck.checked= true;
  123. }
  124. else
  125. {
  126. document.frmTask.EnableDaylightCheck.checked= false;
  127. }
  128. return;
  129. }
  130. else if (ZoneOpt[ind].value == timezone + "#0")
  131. {
  132. document.frmTask.ZoneList.selectedIndex = ind;
  133. DisableDaylightChecked();
  134. }
  135. }
  136. }
  137. function EnableDaylightChecked()
  138. {
  139. SetDaylightControl(false);
  140. }
  141. function DisableDaylightChecked()
  142. {
  143. SetDaylightControl(true);
  144. }
  145. function SetDaylightControl(bEnabled)
  146. {
  147. var oDaylightChecked = document.getElementById("EnableDaylightCheck");
  148. if ( oDaylightChecked == null )
  149. {
  150. if ( SA_IsDebugEnabled() )
  151. {
  152. alert("document.getElementById(EnableDaylightCheck) returned null");
  153. }
  154. }
  155. else
  156. {
  157. oDaylightChecked.disabled = bEnabled;
  158. oDaylightChecked.checked = !bEnabled;
  159. }
  160. var oDaylightText = document.getElementById("EnableDaylightText");
  161. if ( oDaylightText == null )
  162. {
  163. if ( SA_IsDebugEnabled() )
  164. {
  165. alert("document.getElementById(EnableDaylightText) returned null");
  166. }
  167. }
  168. else
  169. {
  170. if ( bEnabled )
  171. {
  172. oDaylightText.className = "TasksBodyDisabled";
  173. }
  174. else
  175. {
  176. oDaylightText.className = "TasksBody";
  177. }
  178. }
  179. }
  180. //Function is called on change of the zone selected from browser
  181. function ZoneChanged()
  182. {
  183. StopRefresh();
  184. ZoneInfo = document.frmTask.ZoneList.options[document.frmTask.ZoneList.selectedIndex].value.split("#");
  185. if (ZoneInfo[1] == "0")
  186. {
  187. DisableDaylightChecked();
  188. }
  189. else
  190. {
  191. EnableDaylightChecked();
  192. }
  193. }
  194. </SCRIPT>
  195. <script language="JavaScript">
  196. var TimeoutID;
  197. function Refresh()
  198. {
  199. document.frmTask.submit();
  200. }
  201. function StopRefresh()
  202. {
  203. window.clearTimeout(TimeoutID);
  204. document.frmTask.WasChanged.value = "Y"
  205. }
  206. function Init()
  207. {
  208. PresetTimeZone();
  209. <% If ("" = GetErrMsg) Then
  210. response.write "TimeoutID = window.setTimeout('Refresh()', 60000);"
  211. End If %>
  212. }
  213. //Function Validates the inputs of the page before submit.
  214. function ValidatePage()
  215. {
  216. return true;
  217. }
  218. function SetData()
  219. {
  220. // set data to hidden form values
  221. ZoneInfo=document.frmTask.ZoneList.options[document.frmTask.ZoneList.selectedIndex].value.split("#");
  222. document.frmTask.StandardName.value = ZoneInfo[0];
  223. if (document.frmTask.EnableDaylightCheck.checked)
  224. {
  225. document.frmTask.EnableDaylight.value="Y";
  226. }
  227. else
  228. {
  229. document.frmTask.EnableDaylight.value="N";
  230. }
  231. }
  232. </script>
  233. <input name="StandardName" type="hidden" value="<% =g_sTimeZone %>">
  234. <input name="EnableDaylight" type="hidden" value="<% =g_sEnableDaylight %>">
  235. <input name="WasChanged" type="hidden" value="<% =g_sWasChanged %>">
  236. <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 xclass="TasksBody">
  237. <tr>
  238. <td NOWRAP class="TasksBody"><%=L_DATE%></td>
  239. <td class="TasksBody">
  240. <input class="FormField" type="text" name="DateID" id=DateID size=20 maxlength=40 value='<%=g_sDateID%>' onkeypress="StopRefresh()">
  241. </td>
  242. </tr>
  243. <tr>
  244. <td NOWRAP class="TasksBody"><p id=PareID_Time><%=L_TIME%></p></td>
  245. <td class="TasksBody">
  246. <input class="FormField" type="text" name="TimeID" id=TimeID size=20 maxlength=20 value='<%=g_sTimeID%>' onkeypress="StopRefresh()">
  247. </td>
  248. </tr>
  249. <tr>
  250. <td NOWRAP class="TasksBody"><p id=PareID_TimeZone><%=L_TIMEZONE%></p></td>
  251. <td class="TasksBody">
  252. <% RenderTimezoneList %>
  253. </td>
  254. </tr>
  255. <tr><td id=P1ID_1 >&nbsp;</td></tr>
  256. </table>
  257. <table cellpadding="0" cellspacing="0 border="0">
  258. <tr>
  259. <td class="TasksBody"><INPUT TYPE='checkbox' <%=sEnableDaylightAttr%> class=FormField name='EnableDaylightCheck' id='EnableDaylightCheck' onclick='StopRefresh()'></td>
  260. <td class="TasksBody" id="EnableDaylightText"><%=L_AUTOMATICALLY_TEXT%></td>
  261. </tr>
  262. </table>
  263. <p id=PareID_Note><strong><%=L_NOTE_LEFT_TEXT%></strong>
  264. <BR id=PareID_IndepnedenceNote><%=L_NOTE_DESCRIPTION_TEXT%></p>
  265. <%
  266. End Sub
  267. '---------------------------------------------------------------------
  268. ' Function: OnPostBackPage
  269. '
  270. ' Synopsis: Called to signal that the page has been posted-back. A post-back
  271. ' occurs in tabbed property pages and wizards as the user navigates
  272. ' through pages. It is differentiated from a Submit or Close operation
  273. ' in that the user is still working with the page.
  274. '
  275. ' The PostBack event should be used to save the state of page.
  276. '
  277. ' Returns: TRUE to indicate initialization was successful. FALSE to indicate
  278. ' errors. Returning FALSE will cause the page to be abandoned.
  279. '
  280. '---------------------------------------------------------------------
  281. Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  282. OnPostBackPage = TRUE
  283. If ( ENABLE_TRACING ) Then
  284. Call SA_TraceOut(SOURCE_FILE, "OnPostBackPage")
  285. End If
  286. g_sDateID = Request.Form("DateID")
  287. g_sTimeID = Request.Form("TimeID")
  288. g_sTimeZone = Request.Form("StandardName")
  289. g_sEnableDaylight = Request.Form("EnableDaylight")
  290. g_sWasChanged = Request.Form("WasChanged")
  291. If ("Y" <> g_sWasChanged) Then
  292. g_sTimeZone = GetTimeZone()
  293. g_sDateID = FormatDateTime(date, vbShortDate)
  294. g_sTimeID = FormatDateTime(time, vbLongTime)
  295. Call GetAutoAdjustInfo()
  296. End If
  297. End Function
  298. '---------------------------------------------------------------------
  299. ' Function: OnSubmitPage
  300. '
  301. ' Synopsis: Called when the page has been submitted for processing. Use
  302. ' this method to process the submit request.
  303. '
  304. ' Returns: TRUE if the submit was successful, FALSE to indicate error(s).
  305. ' Returning FALSE will cause the page to be served again using
  306. ' a call to OnServePropertyPage.
  307. '
  308. '---------------------------------------------------------------------
  309. Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  310. Const CONST_SETSYSTIMEPRIVILEGE = "SeSystemTimePrivilege"
  311. on error resume next
  312. Err.Clear
  313. Dim objSAHelper
  314. Dim bModifiedPrivilege
  315. bModifiedPrivilege = FALSE
  316. 'Create SAHelper object
  317. Set objSAHelper = Server.CreateObject("ServerAppliance.SAHelper")
  318. if err.number <> 0 Then
  319. SA_TraceOut "Create object failed for SAHelper object", err.description
  320. else
  321. 'enable set system time privilege
  322. bModifiedPrivilege = objSAHelper.SAModifyUserPrivilege(CONST_SETSYSTIMEPRIVILEGE, TRUE)
  323. if err.number <> 0 Then
  324. SA_TraceOut "Enable privilege failed", err.description
  325. exit function
  326. end if
  327. end if
  328. If ( ENABLE_TRACING ) Then
  329. Call SA_TraceOut(SOURCE_FILE, "OnSubmitPage")
  330. End If
  331. OnSubmitPage = SetServerDate
  332. if ( bModifiedPrivilege ) then
  333. 'revert back to disabled state
  334. bModifiedPrivilege = objSAHelper.SAModifyUserPrivilege(CONST_SETSYSTIMEPRIVILEGE, FALSE)
  335. if err.number <> 0 Then
  336. SA_TraceOut "Disable privilege failed", err.description
  337. exit function
  338. end if
  339. end if
  340. set objSAHelper = Nothing
  341. End Function
  342. '---------------------------------------------------------------------
  343. ' Function: OnClosePage
  344. '
  345. ' Synopsis: Called when the page is about to be closed. Use this method
  346. ' to perform clean-up processing.
  347. '
  348. ' Returns: TRUE to allow close, FALSE to prevent close. Returning FALSE
  349. ' will result in a call to OnServePropertyPage.
  350. '
  351. '---------------------------------------------------------------------
  352. Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  353. OnClosePage = TRUE
  354. If ( ENABLE_TRACING ) Then
  355. Call SA_TraceOut(SOURCE_FILE, "OnClosePage")
  356. End If
  357. End Function
  358. '----------------------------------------------------------------------------
  359. '
  360. ' Function : SetServerDate
  361. '
  362. ' Synopsis : function to set server date and time
  363. '
  364. ' Arguments: None
  365. '
  366. ' Returns : None
  367. '
  368. '----------------------------------------------------------------------------
  369. Function SetServerDate()
  370. Dim sErrorMessage
  371. SetServerDate = False
  372. If IsDate(g_sDateID) Then
  373. g_sDay = CStr(Day(g_sDateID))
  374. g_sMonth = CStr(Month(g_sDateID))
  375. g_sYear = CStr(Year(g_sDateID))
  376. If ( ENABLE_TRACING ) Then
  377. Call SA_TraceOut(SOURCE_FILE, "SetServerDate Date (D/M/Y):"+g_sDay+"/"+g_sMonth+"/"+g_sYear)
  378. End If
  379. If (1991 > Year(g_sDateID)) Or (2037 < Year(g_sDateID)) Then
  380. Call SA_TraceOut(SOURCE_FILE, "SetServerDate Date not valid:"+g_sDateID+" year:"+CStr(Year(g_sDateID)))
  381. sErrorMessage = GetLocString("datetimemsg.dll","&H400100B3", Array(g_sDay, MonthName(g_sMonth), g_sYear))
  382. Call SetErrMsg(sErrorMessage)
  383. SetServerDate = False
  384. exit function
  385. End If
  386. Else
  387. SetErrMsg L_INVALIDDATE_ERRORMESSAGE
  388. SetServerDate = False
  389. exit function
  390. End If
  391. If IsDate(g_sTimeID) Then
  392. g_sHour = CStr(Hour(g_sTimeID))
  393. g_sMinute = CStr(Minute(g_sTimeID))
  394. g_sSecond = CStr(Second(g_sTimeID))
  395. If ( ENABLE_TRACING ) Then
  396. Call SA_TraceOut(SOURCE_FILE, "SetServerDate Time:"+g_sHour+"/"+g_sMinute+"/"+g_sSecond)
  397. End If
  398. Else
  399. SetErrMsg L_INVALIDTIME_ERRORMESSAGE
  400. SetServerDate = False
  401. exit function
  402. End If
  403. If SetTimeZone = True Then
  404. If SetDateTime = True Then
  405. SetServerDate = True
  406. End If
  407. End If
  408. End Function
  409. '----------------------------------------------------------------------------
  410. '
  411. ' Function : GetTimeZone
  412. '
  413. ' Synopsis : gets the Time Zone
  414. '
  415. ' Arguments: None
  416. '
  417. ' Returns : None
  418. '
  419. '----------------------------------------------------------------------------
  420. Function GetTimeZone()
  421. on error resume next
  422. Err.Clear
  423. Dim Locator
  424. Dim Service
  425. Dim TimeZone
  426. Dim Entries
  427. Dim entry
  428. Dim StandardName
  429. Set Service = GetWMIConnection("")
  430. Set TimeZone = Service.Get("Win32_TimeZone")
  431. Set Entries = TimeZone.Instances_
  432. If Err.number<>0 then
  433. SetErrMsg L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE
  434. GetTimeZone=""
  435. Exit Function
  436. End if
  437. For each entry in Entries
  438. StandardName = entry.StandardName 'There should be only one entry
  439. Next
  440. GetTimeZone = StandardName
  441. Set Service = nothing
  442. Set TimeZone = nothing
  443. End Function
  444. '----------------------------------------------------------------------------
  445. '
  446. ' Function : SetTimeZone
  447. '
  448. ' Synopsis : sets the Time Zone
  449. '
  450. ' Arguments: None
  451. '
  452. ' Returns : None
  453. '
  454. '----------------------------------------------------------------------------
  455. Function SetTimeZone
  456. on error resume next
  457. Err.Clear
  458. Dim objTCtx
  459. Dim Error
  460. Error = ExecuteTask("SetTimeZone", objTCtx)
  461. if Error <> 0 then
  462. SetErrMsg L_INVALIDTIMEZONE_ERRORMESSAGE
  463. SetTimeZone = False
  464. Else
  465. SetTimeZone = True
  466. End if
  467. set objTCtx = Nothing
  468. End Function
  469. '----------------------------------------------------------------------------
  470. '
  471. ' Function : SetDateTime
  472. '
  473. ' Synopsis : sets the date and time on the server
  474. '
  475. ' Arguments: None
  476. '
  477. ' Returns : None
  478. '
  479. '----------------------------------------------------------------------------
  480. Function SetDateTime
  481. on error resume next
  482. Err.Clear
  483. Dim objTCtx
  484. Dim Error
  485. 'We are calculating values on the server, so we need to put them into
  486. 'the TaskContext object
  487. Set objTCtx = CreateObject("Taskctx.TaskContext")
  488. If Err.Number <> 0 Then
  489. SetErrMsg L_TASKCTX_OBJECT_CREATION_FAIL_ERRORMESSAGE
  490. SetDateTime = False
  491. Exit Function
  492. End If
  493. objTCtx.SetParameter "Day", g_sDay
  494. objTCtx.SetParameter "Month", g_sMonth
  495. objTCtx.SetParameter "Year", g_sYear
  496. objTCtx.SetParameter "Hour", g_sHour
  497. objTCtx.SetParameter "Minute", g_sMinute
  498. objTCtx.SetParameter "Second", g_sSecond
  499. Error = ExecuteTask("SetDateTime", objTCtx)
  500. if Error <> 0 then
  501. SetErrMsg L_INVALIDDATETIME_ERRORMESSAGE
  502. SetDateTime = False
  503. End if
  504. Err.Clear
  505. set objTCtx = Nothing
  506. SetDateTime = True
  507. End Function
  508. '----------------------------------------------------------------------------
  509. '
  510. ' Function : GetAutoAdjustInfo()
  511. '
  512. ' Synopsis : function to Get Auto Adjust of Daylight time set up
  513. '
  514. ' Arguments: None
  515. '
  516. ' Returns : None
  517. '
  518. '----------------------------------------------------------------------------
  519. Function GetAutoAdjustInfo()
  520. on error resume next
  521. Err.Clear
  522. Dim Providers
  523. Dim Provider
  524. Set Providers = GetObject("winmgmts:" & SA_GetWMIConnectionAttributes() & "!root/cimv2").InstancesOf ("ProviderDateTimeAdjust")
  525. If Err.number<>0 then
  526. SetErrMsg L_FAILEDTOGETWMICONNECTION_ERRORMESSAGE
  527. GetAutoAdjustInfo=False
  528. Exit Function
  529. End if
  530. g_sEnableDaylight = "Y"
  531. For each Provider in Providers ' Must be only one
  532. If IsEmpty(Provider.DisableAutoDaylightTimeSet) Or Provider.DisableAutoDaylightTimeSet <> 1 Then
  533. g_sEnableDaylight = "Y"
  534. Else
  535. g_sEnableDaylight = "N"
  536. End If
  537. next
  538. Set Providers = nothing
  539. End Function
  540. '----------------------------------------------------------------------------
  541. '
  542. ' Function : RenderTimezoneList()
  543. '
  544. ' Synopsis : function render the timezone list
  545. '
  546. ' Arguments: None
  547. '
  548. ' Returns : None
  549. '
  550. '----------------------------------------------------------------------------
  551. Function RenderTimezoneList()
  552. on error resume next
  553. Err.Clear
  554. const CONST_LIST_SIZE = 74
  555. Dim objRegService
  556. Dim i, j
  557. Dim arrTimezone (74, 2)
  558. set objRegService = RegConnection()
  559. 'VBScript arrays are zero-based, to make the it's compatible with L_TIMEZONES_TEXT
  560. 'we start it from 1 to 74, arrTimezone(0, i) is ignored
  561. '
  562. 'Init the timezone array
  563. '
  564. 'Set the option text
  565. for i = 1 to CONST_LIST_SIZE
  566. arrTimezone(i, 2) = L_TIMEZONES_TEXT(i)
  567. Next
  568. 'Set the option Ids, which are used by the test team
  569. arrTimezone(1, 0) = "PareID_Enewetak"
  570. arrTimezone(2, 0) = "PareID_MidwayIland"
  571. arrTimezone(3, 0) = "PareID_Hawaii"
  572. arrTimezone(4, 0) = "PareID_Alaska"
  573. arrTimezone(5, 0) = "PareID_Pacific"
  574. arrTimezone(6, 0) = "PareID_Arizona"
  575. arrTimezone(7, 0) = "PareID_Mountain"
  576. arrTimezone(8, 0) = "PareID_America"
  577. arrTimezone(9, 0) = "PareID_CentralUS"
  578. arrTimezone(10, 0) = "PareID_Mexico"
  579. arrTimezone(11, 0) = "PareID_Saskatchewan"
  580. arrTimezone(12, 0) = "PareID_Bogota"
  581. arrTimezone(13, 0) = "PareID_EasternUS"
  582. arrTimezone(14, 0) = "PareID_Indiana"
  583. arrTimezone(15, 0) = "PareID_Atlantic"
  584. arrTimezone(16, 0) = "PareID_Caracas"
  585. arrTimezone(17, 0) = "PareID_PacificStandard"
  586. arrTimezone(18, 0) = "PareID_Newfoundland"
  587. arrTimezone(19, 0) = "PareID_Brasilia"
  588. arrTimezone(20, 0) = "PareID_BuenosAires"
  589. arrTimezone(21, 0) = "PareID_Greenland"
  590. arrTimezone(22, 0) = "PareID_MidAtlantic"
  591. arrTimezone(23, 0) = "PareID_Azores"
  592. arrTimezone(24, 0) = "PareID_Cape"
  593. arrTimezone(25, 0) = "PareID_Casablanca"
  594. arrTimezone(26, 0) = "PareID_Greenwich"
  595. arrTimezone(27, 0) = "PareID_Amsterdam"
  596. arrTimezone(28, 0) = "PareID_Belgrade"
  597. arrTimezone(29, 0) = "PareID_Brussels"
  598. arrTimezone(30, 0) = "PareID_Sarajevo"
  599. arrTimezone(31, 0) = "PareID_CenAfrica"
  600. arrTimezone(32, 0) = "PareID_Athens"
  601. arrTimezone(33, 0) = "PareID_Bucharest"
  602. arrTimezone(34, 0) = "PareID_Cairo"
  603. arrTimezone(35, 0) = "PareID_Harare"
  604. arrTimezone(36, 0) = "PareID_Helsinki"
  605. arrTimezone(37, 0) = "PareID_Israel"
  606. arrTimezone(38, 0) = "PareID_Baghdad"
  607. arrTimezone(39, 0) = "PareID_Kuwait"
  608. arrTimezone(40, 0) = "PareID_Moscow"
  609. arrTimezone(41, 0) = "PareID_Nairobi"
  610. arrTimezone(42, 0) = "PareID_Tehran"
  611. arrTimezone(43, 0) = "PareID_AbuDhabi"
  612. arrTimezone(44, 0) = "PareID_Baku"
  613. arrTimezone(45, 0) = "PareID_Kabul"
  614. arrTimezone(46, 0) = "PareID_Ekaterinburg"
  615. arrTimezone(47, 0) = "PareID_Islamabad"
  616. arrTimezone(48, 0) = "PareID_Bombay"
  617. arrTimezone(49, 0) = "PareID_Nepal"
  618. arrTimezone(50, 0) = "PareID_Novosibirsk"
  619. arrTimezone(51, 0) = "PareID_Almaty"
  620. arrTimezone(52, 0) = "PareID_Colombo"
  621. arrTimezone(53, 0) = "PareID_Myanmar"
  622. arrTimezone(54, 0) = "PareID_Bangkok"
  623. arrTimezone(55, 0) = "PareID_Krasnoyarsk"
  624. arrTimezone(56, 0) = "PareID_Beijing"
  625. arrTimezone(57, 0) = "PareID_Irkutsk"
  626. arrTimezone(58, 0) = "PareID_Singapore"
  627. arrTimezone(59, 0) = "PareID_Perth"
  628. arrTimezone(60, 0) = "PareID_Taipei"
  629. arrTimezone(61, 0) = "PareID_Osaka"
  630. arrTimezone(62, 0) = "PareID_Seoul"
  631. arrTimezone(63, 0) = "PareID_Yakutsk"
  632. arrTimezone(64, 0) = "PareID_Adelaide"
  633. arrTimezone(65, 0) = "PareID_Darwin"
  634. arrTimezone(66, 0) = "PareID_Brisbane"
  635. arrTimezone(67, 0) = "PareID_Canberra"
  636. arrTimezone(68, 0) = "PareID_Guam"
  637. arrTimezone(69, 0) = "PareID_Hobart"
  638. arrTimezone(70, 0) = "PareID_Vladivostok"
  639. arrTimezone(71, 0) = "PareID_Magadan"
  640. arrTimezone(72, 0) = "PareID_Auckland"
  641. arrTimezone(73, 0) = "PareID_Fiji"
  642. arrTimezone(74, 0) = "PareID_Nuku"
  643. 'Set the Option values based on the registry value
  644. arrTimezone(1, 1) = GetTimezoneValueFromRegistry(objRegService, "Dateline Standard Time") & "#0"
  645. arrTimezone(2, 1) = GetTimezoneValueFromRegistry(objRegService, "Samoa Standard Time") & "#0"
  646. arrTimezone(3, 1) = GetTimezoneValueFromRegistry(objRegService, "Hawaiian Standard Time") & "#0"
  647. arrTimezone(4, 1) = GetTimezoneValueFromRegistry(objRegService, "Alaskan Standard Time") & "#1"
  648. arrTimezone(5, 1) = GetTimezoneValueFromRegistry(objRegService, "Pacific Standard Time") & "#1"
  649. arrTimezone(6, 1) = GetTimezoneValueFromRegistry(objRegService, "US Mountain Standard Time") & "#0"
  650. arrTimezone(7, 1) = GetTimezoneValueFromRegistry(objRegService, "Mountain Standard Time") & "#1"
  651. arrTimezone(8, 1) = GetTimezoneValueFromRegistry(objRegService, "Central America Standard Time") & "#0"
  652. arrTimezone(9, 1) = GetTimezoneValueFromRegistry(objRegService, "Central Standard Time") & "#1"
  653. arrTimezone(10, 1) = GetTimezoneValueFromRegistry(objRegService, "Mexico Standard Time") & "#1"
  654. arrTimezone(11, 1) = GetTimezoneValueFromRegistry(objRegService, "Canada Central Standard Time") & "#0"
  655. arrTimezone(12, 1) = GetTimezoneValueFromRegistry(objRegService, "SA Pacific Standard Time") & "#0"
  656. arrTimezone(13, 1) = GetTimezoneValueFromRegistry(objRegService, "Eastern Standard Time") & "#1"
  657. arrTimezone(14, 1) = GetTimezoneValueFromRegistry(objRegService, "US Eastern Standard Time") & "#0"
  658. arrTimezone(15, 1) = GetTimezoneValueFromRegistry(objRegService, "Atlantic Standard Time") & "#1"
  659. arrTimezone(16, 1) = GetTimezoneValueFromRegistry(objRegService, "SA Western Standard Time") & "#0"
  660. arrTimezone(17, 1) = GetTimezoneValueFromRegistry(objRegService, "Pacific SA Standard Time") & "#1"
  661. arrTimezone(18, 1) = GetTimezoneValueFromRegistry(objRegService, "Newfoundland Standard Time") & "#1"
  662. arrTimezone(19, 1) = GetTimezoneValueFromRegistry(objRegService, "E. South America Standard Time") & "#1"
  663. arrTimezone(20, 1) = GetTimezoneValueFromRegistry(objRegService, "SA Eastern Standard Time") & "#0"
  664. arrTimezone(21, 1) = GetTimezoneValueFromRegistry(objRegService, "Greenland Standard Time") & "#1"
  665. arrTimezone(22, 1) = GetTimezoneValueFromRegistry(objRegService, "Mid-Atlantic Standard Time") & "#1"
  666. arrTimezone(23, 1) = GetTimezoneValueFromRegistry(objRegService, "Azores Standard Time") & "#1"
  667. arrTimezone(24, 1) = GetTimezoneValueFromRegistry(objRegService, "Cape Verde Standard Time") & "#0"
  668. arrTimezone(25, 1) = GetTimezoneValueFromRegistry(objRegService, "Greenwich Standard Time") & "#0"
  669. arrTimezone(26, 1) = GetTimezoneValueFromRegistry(objRegService, "GMT Standard Time") & "#1"
  670. arrTimezone(27, 1) = GetTimezoneValueFromRegistry(objRegService, "W. Europe Standard Time") & "#1"
  671. arrTimezone(28, 1) = GetTimezoneValueFromRegistry(objRegService, "Central Europe Standard Time") & "#1"
  672. arrTimezone(29, 1) = GetTimezoneValueFromRegistry(objRegService, "Romance Standard Time") & "#1"
  673. arrTimezone(30, 1) = GetTimezoneValueFromRegistry(objRegService, "Central European Standard Time") & "#1"
  674. arrTimezone(31, 1) = GetTimezoneValueFromRegistry(objRegService, "W. Central Africa Standard Time") & "#0"
  675. arrTimezone(32, 1) = GetTimezoneValueFromRegistry(objRegService, "GTB Standard Time") & "#1"
  676. arrTimezone(33, 1) = GetTimezoneValueFromRegistry(objRegService, "E. Europe Standard Time") & "#1"
  677. arrTimezone(34, 1) = GetTimezoneValueFromRegistry(objRegService, "Egypt Standard Time") & "#1"
  678. arrTimezone(35, 1) = GetTimezoneValueFromRegistry(objRegService, "South Africa Standard Time") & "#0"
  679. arrTimezone(36, 1) = GetTimezoneValueFromRegistry(objRegService, "FLE Standard Time") & "#1"
  680. arrTimezone(37, 1) = GetTimezoneValueFromRegistry(objRegService, "Israel Standard Time") & "#0"
  681. arrTimezone(38, 1) = GetTimezoneValueFromRegistry(objRegService, "Arabic Standard Time") & "#1"
  682. arrTimezone(39, 1) = GetTimezoneValueFromRegistry(objRegService, "Arab Standard Time") & "#0"
  683. arrTimezone(40, 1) = GetTimezoneValueFromRegistry(objRegService, "Russian Standard Time") & "#1"
  684. arrTimezone(41, 1) = GetTimezoneValueFromRegistry(objRegService, "E. Africa Standard Time") & "#0"
  685. arrTimezone(42, 1) = GetTimezoneValueFromRegistry(objRegService, "Iran Standard Time") & "#1"
  686. arrTimezone(43, 1) = GetTimezoneValueFromRegistry(objRegService, "Arabian Standard Time") & "#0"
  687. arrTimezone(44, 1) = GetTimezoneValueFromRegistry(objRegService, "Caucasus Standard Time") & "#1"
  688. arrTimezone(45, 1) = GetTimezoneValueFromRegistry(objRegService, "Afghanistan Standard Time") & "#0"
  689. arrTimezone(46, 1) = GetTimezoneValueFromRegistry(objRegService, "Ekaterinburg Standard Time") & "#1"
  690. arrTimezone(47, 1) = GetTimezoneValueFromRegistry(objRegService, "West Asia Standard Time") & "#0"
  691. arrTimezone(48, 1) = GetTimezoneValueFromRegistry(objRegService, "India Standard Time") & "#0"
  692. arrTimezone(49, 1) = GetTimezoneValueFromRegistry(objRegService, "Nepal Standard Time") & "#0"
  693. arrTimezone(50, 1) = GetTimezoneValueFromRegistry(objRegService, "N. Central Asia Standard Time") & "#1"
  694. arrTimezone(51, 1) = GetTimezoneValueFromRegistry(objRegService, "Central Asia Standard Time") & "#0"
  695. arrTimezone(52, 1) = GetTimezoneValueFromRegistry(objRegService, "Sri Lanka Standard Time") & "#0"
  696. arrTimezone(53, 1) = GetTimezoneValueFromRegistry(objRegService, "Myanmar Standard Time") & "#0"
  697. arrTimezone(54, 1) = GetTimezoneValueFromRegistry(objRegService, "SE Asia Standard Time") & "#0"
  698. arrTimezone(55, 1) = GetTimezoneValueFromRegistry(objRegService, "North Asia Standard Time") & "#1"
  699. arrTimezone(56, 1) = GetTimezoneValueFromRegistry(objRegService, "China Standard Time") & "#0"
  700. arrTimezone(57, 1) = GetTimezoneValueFromRegistry(objRegService, "North Asia East Standard Time") & "#1"
  701. arrTimezone(58, 1) = GetTimezoneValueFromRegistry(objRegService, "Singapore Standard Time") & "#0"
  702. arrTimezone(59, 1) = GetTimezoneValueFromRegistry(objRegService, "W. Australia Standard Time") & "#0"
  703. arrTimezone(60, 1) = GetTimezoneValueFromRegistry(objRegService, "Taipei Standard Time") & "#0"
  704. arrTimezone(61, 1) = GetTimezoneValueFromRegistry(objRegService, "Tokyo Standard Time") & "#0"
  705. arrTimezone(62, 1) = GetTimezoneValueFromRegistry(objRegService, "Korea Standard Time") & "#0"
  706. arrTimezone(63, 1) = GetTimezoneValueFromRegistry(objRegService, "Yakutsk Standard Time") & "#1"
  707. arrTimezone(64, 1) = GetTimezoneValueFromRegistry(objRegService, "Cen. Australia Standard Time") & "#1"
  708. arrTimezone(65, 1) = GetTimezoneValueFromRegistry(objRegService, "AUS Central Standard Time") & "#0"
  709. arrTimezone(66, 1) = GetTimezoneValueFromRegistry(objRegService, "E. Australia Standard Time") & "#0"
  710. arrTimezone(67, 1) = GetTimezoneValueFromRegistry(objRegService, "AUS Eastern Standard Time") & "#1"
  711. arrTimezone(68, 1) = GetTimezoneValueFromRegistry(objRegService, "West Pacific Standard Time") & "#0"
  712. arrTimezone(69, 1) = GetTimezoneValueFromRegistry(objRegService, "Tasmania Standard Time") & "#1"
  713. arrTimezone(70, 1) = GetTimezoneValueFromRegistry(objRegService, "Vladivostok Standard Time") & "#1"
  714. arrTimezone(71, 1) = GetTimezoneValueFromRegistry(objRegService, "Central Pacific Standard Time") & "#0"
  715. arrTimezone(72, 1) = GetTimezoneValueFromRegistry(objRegService, "New Zealand Standard Time") & "#1"
  716. arrTimezone(73, 1) = GetTimezoneValueFromRegistry(objRegService, "Fiji Standard Time") & "#0"
  717. arrTimezone(74, 1) = GetTimezoneValueFromRegistry(objRegService, "Tonga Standard Time") & "#0"
  718. '
  719. 'Render the select list
  720. '
  721. %>
  722. <select class="FormField" name="ZoneList" ID="ZoneList" size="1" onchange="ZoneChanged()">
  723. <%
  724. for i = 1 to CONST_LIST_SIZE
  725. %>
  726. <option id=<%=arrTimezone(i,0)%> value="<%=arrTimezone(i,1)%>"
  727. <%
  728. ' Check to see if the option is the selected one
  729. If (1 = InStr(arrTimezone(i,1), g_sTimeZone)) Then %>
  730. selected
  731. <% End If %> >
  732. <%=arrTimezone(i,2)%>
  733. </option>
  734. <%
  735. next
  736. %>
  737. </select>
  738. <%
  739. set objRegService = nothing
  740. End Function
  741. '----------------------------------------------------------------------------
  742. '
  743. ' Function : GetTimezoneValueFromRegistry
  744. '
  745. ' Synopsis : Get the timezone value from the registry key
  746. '
  747. ' Arguments: In-objRegService : registry service
  748. ' In-strKey : English name of the timezone
  749. '
  750. ' Returns : registry key value of the timezone
  751. '
  752. '----------------------------------------------------------------------------
  753. Function GetTimezoneValueFromRegistry(objRegService, strName)
  754. on error resume next
  755. Err.Clear
  756. CONST CONST_TIMEZONEPATH = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\"
  757. CONST CONST_STRING = 2
  758. CONST CONST_KEYNAME = "Std"
  759. GetTimezoneValueFromRegistry = GetRegKeyValue(objRegService, CONST_TIMEZONEPATH & strName, CONST_KEYNAME, CONST_STRING)
  760. If Err.number <> 0 Then
  761. GetTimezoneValueFromRegistry = ""
  762. Exit Function
  763. end if
  764. End Function
  765. %>