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.

226 lines
7.4 KiB

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="directives.inc" -->
  4. <!--#include file="calendar.str"-->
  5. <%
  6. On Error Resume Next
  7. Dim blurcntrl, datecntrl, Dy, Mo, Yr, nextmonth, startwith, thisMo, thisYr, thisDate
  8. Dim prevMonthLastDate, currMonthLastDate, i, j, lastnum, AnyDate
  9. datecntrl= Request("cntrl")
  10. blurcntrl= Request("blurcntrl")
  11. if( blurcntrl = "" ) then
  12. blurcntrl=datecntrl
  13. end if
  14. Dy = CInt(Request("Dy"))
  15. Mo = CInt(Request("Mo"))
  16. Yr = CInt(Request("Yr"))
  17. nextmonth = false
  18. %>
  19. <!--#include file="iisetfnt.inc"-->
  20. <HTML>
  21. <HEAD>
  22. <TITLE><%= L_CALENDARTITLE_TEXT %></TITLE>
  23. <SCRIPT LANGUAGE="JavaScript">
  24. function setDate(Dy,Mo,Yr)
  25. {
  26. self.location.href="calendar.asp?cntrl=<%= datecntrl %>&Dy=" + Dy + "&Mo=" + Mo + "&Yr=" + Yr + "&blurcntrl=" + "<%= blurcntrl %>";
  27. }
  28. function saveDate()
  29. {
  30. top.opener.<%= datecntrl %>.value ="<%= Mo & "/" & Dy & "/" & Yr %>"
  31. //force execution of onblur event proc on output field..
  32. if( <%= blurcntrl %> != "" )
  33. {
  34. top.opener.<%= blurcntrl %>.focus();
  35. top.opener.<%= blurcntrl %>.blur();
  36. }
  37. top.window.close();
  38. }
  39. </SCRIPT>
  40. </HEAD>
  41. <BODY BGCOLOR="<%= Session("BGCOLOR") %>" LINK="Navy">
  42. <FORM NAME="userform">
  43. <TABLE WIDTH = 100% CELLPADDING=2 CELLSPACING=0>
  44. <TR>
  45. <TD ALIGN="left">
  46. <%= sFont("","","",True) %>
  47. <%= writeMonths(Mo) %>
  48. </FONT>
  49. </TD>
  50. <TD ALIGN="right">
  51. <%= sFont("","","",True) %>
  52. <%= writeYears(Yr) %>
  53. </FONT>
  54. </TD>
  55. </TR>
  56. </TABLE>
  57. <TABLE WIDTH = 100% BORDER=1 BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="<%= Session("BGCOLOR") %>" BORDERCOLORLIGHT="<%= Session("BGCOLOR") %>" CELLPADDING=2 CELLSPACING=0>
  58. <%
  59. function nextDate(startwith, maxdays)
  60. startwith = startwith + 1
  61. if startwith > maxdays then
  62. startwith = 1
  63. end if
  64. nextDate = startwith
  65. end function
  66. function GetLastDay(Mo,Yr)
  67. if Mo=2 then
  68. if (Yr Mod 4)=0 then
  69. GetLastDay = 29
  70. else
  71. GetLastDay = 28
  72. end if
  73. elseif ((Mo = 0) OR (Mo = 1) OR (Mo = 3) OR (Mo = 5) OR (Mo = 7) OR (Mo = 8) OR (Mo = 10) OR (Mo = 12)) then
  74. GetLastDay = 31
  75. else
  76. GetLastDay = 30
  77. end if
  78. end function
  79. function GetFirstDayOffset(Mo,Yr)
  80. GetFirstDayOffset = weekday(Mo & "/01/" & Yr)-1
  81. end function
  82. function writeMonths(selMo)
  83. dim i, selstr
  84. selstr = "<SELECT NAME='Months' onChange='setDate(" & Dy & ",this.selectedIndex+1," & Yr & ");'>"
  85. for i=1 to 12
  86. if selMo = i then
  87. selstr = selstr & "<OPTION SELECTED>" & MonthName(i)
  88. else
  89. selstr = selstr & "<OPTION>" & MonthName(i)
  90. end if
  91. next
  92. selstr = selstr & "</SELECT>"
  93. writeMonths = selstr
  94. end function
  95. function writeYears(selYear)
  96. dim i, selstr
  97. selstr = "<SELECT NAME='Years' onChange='setDate(" & Dy & "," & Mo & ",this.options[this.selectedIndex].value);'>"
  98. for i=1900 to 2100
  99. if selYear = i then
  100. selstr = selstr & "<OPTION SELECTED VALUE=" & i & ">" & i
  101. else
  102. selstr = selstr & "<OPTION VALUE=" & i & ">" & i
  103. end if
  104. next
  105. selstr = selstr & "</SELECT>"
  106. writeYears = selstr
  107. end function
  108. prevMonthLastDate=GetLastDay((Mo-1),Yr)
  109. currMonthLastDate=GetLastDay(Mo,Yr)
  110. startwith=(prevMonthLastDate-GetFirstDayOffset(Mo, Yr))
  111. %>
  112. <TR>
  113. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="Gray" BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" >
  114. <%= sFont("","","#FFFFFF",True) %><B><%= L_CALSHORTSUN_TEXT %></B></FONT>
  115. </TD>
  116. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="Gray" BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" >
  117. <%= sFont("","","#FFFFFF",True) %><B><%= L_CALSHORTMON_TEXT %></B></FONT>
  118. </TD>
  119. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="Gray" BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" >
  120. <%= sFont("","","#FFFFFF",True) %><B><%= L_CALSHORTTUE_TEXT %></B></FONT>
  121. </TD>
  122. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="Gray" BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" >
  123. <%= sFont("","","#FFFFFF",True) %><B><%= L_CALSHORTWED_TEXT %></B></FONT>
  124. </TD>
  125. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="Gray" BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" >
  126. <%= sFont("","","#FFFFFF",True) %><B><%= L_CALSHORTTHU_TEXT %></B></FONT>
  127. </TD>
  128. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="Gray" BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" >
  129. <%= sFont("","","#FFFFFF",True) %><B><%= L_CALSHORTFRI_TEXT %></B></FONT>
  130. </TD>
  131. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="Gray" BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" style="font-family: Helv,Arial; font-size: 10pt;">
  132. <%= sFont("","","#FFFFFF",True) %><B><%= L_CALSHORTSAT_TEXT %></B></FONT>
  133. </TD>
  134. </TR>
  135. <% For j = 1 to 6 %>
  136. <TR>
  137. <% For i = 1 to 7 %>
  138. <% if j = 1 then %>
  139. <% startwith = nextDate(startwith, prevMonthLastDate) %>
  140. <% if startwith = Dy and startwith < 7 then %>
  141. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="#AAAAAA" BORDERCOLOR="#AAAAAA" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#AAAAAA" >
  142. <% else %>
  143. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" >
  144. <% end if %>
  145. <% thisYr = Yr %>
  146. <%= sFont("","","",True) %>
  147. <% if startwith < 7 then %>
  148. <B>
  149. <% thisMo = Mo %>
  150. <% else %>
  151. <% thisMo = Mo - 1 %>
  152. <% if thisMo = 0 then %>
  153. <% thisMo = 12 %>
  154. <% thisYr = Yr-1 %>
  155. <% end if %>
  156. <% end if %>
  157. <A HREF="javascript:setDate( <%= startwith %>, <%= thisMo %>,<%= thisYr %>);">
  158. <% response.write startwith %>
  159. </A>
  160. </FONT>
  161. </TD>
  162. <% else %>
  163. <% lastnum = startwith %>
  164. <% startwith = nextDate(startwith, currMonthLastDate) %>
  165. <% if lastnum > startwith then%>
  166. <% nextmonth = true %>
  167. <% end if %>
  168. <% if startwith = Dy and not nextmonth then %>
  169. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BGCOLOR="#AAAAAA" BORDERCOLOR="#AAAAAA" BORDERCOLORDARK="#AAAAAA" BORDERCOLORLIGHT="#FFFFFF" >
  170. <% else %>
  171. <TD WIDTH = <%= L_CALENDARCELL_NUM %> HEIGHT = <%= L_CALENDARCELL_NUM %> BORDERCOLOR="<%= Session("BGCOLOR") %>" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" >
  172. <% end if %>
  173. <% thisYr = Yr %>
  174. <% if not nextmonth then %>
  175. <B>
  176. <% thisMo = Mo %>
  177. <% else %>
  178. <% thisMo = Mo + 1 %>
  179. <% if thisMo = 13 then %>
  180. <% thisMo = 1 %>
  181. <% thisYr = Yr+1 %>
  182. <% end if %>
  183. <% end if %>
  184. <%= sFont("","","",True) %>
  185. <A HREF="javascript:setDate(<%= startwith %>, <%= thisMo %>, <%= thisYr %>);">
  186. <% response.write startwith %>
  187. </A>
  188. </FONT>
  189. </TD>
  190. <% end if %>
  191. <% Next %>
  192. </TR>
  193. <% Next %>
  194. </TABLE>
  195. <P>
  196. <CENTER>
  197. <INPUT TYPE="button" VALUE="<%= L_CALENDAROK_TEXT %>" onClick="saveDate();">&nbsp;&nbsp;
  198. <INPUT TYPE="button" VALUE="<%= L_CALENDARCANCEL_TEXT %>" onClick="top.window.close();">
  199. </CENTER>
  200. </FORM>
  201. </BODY>
  202. </HTML>