
<!--#include file="../checkLogin.asp"-->
<!--#include file="nl.asp"-->  
<html>
<head><title></title><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../css/style.css" />


<body>

<table width="99%" height="499" border="0" cellpadding="0" cellspacing="0">
  <tr>
     <td height="30"><table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
      <tr>
	   
        <td width="70" class="Nemuselect" ><div align="center"><a href="calendar.asp" target="_self">年月视图</a></div></td>
        <td width="70" class="NemuNot" > <div align="center"><a href="XueQicalendar.asp" target="_self">学期列表</a></div></td>
        <td    class="NemuLine">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
   <td height="470" valign="top"   class="NemuMainBox">
	 <br>
	 
	 
	 
	 
	 <% 
    Function FormatStr(String)
      ' Replaces a double carrige return with a paragraph break
      ' a single carrige return with a break rule and CHR(13) with nothing
      String = Replace(String, CHR(13), "")
      String = Replace(String, CHR(10) & CHR(10), "</P><P>")
      String = Replace(String, CHR(10), "<BR>")
      FormatStr = String
    End Function

' ---------- Page Variables ----------
    Const intCharToShow = 19		' The number of characters shown in each day
    Const bolEditable   = True		' If the calendar is editable or not (Can be tied into password verification)

    Dim dtToday 			' Today's Date
    Dim dtCurrentDate			' The current date
    Dim aCalendarDays(42)		' Array of possible calendar dates
    Dim iFirstDayOfMonth		' The first day of the month
    Dim iDaysInMonth	 		' The number of days in the month
    Dim iColumns, iRows	, iDay, iWeek	' The numer of columns and rows in the table, and counters to print them
    Dim objConn, strConn, strSQL, objRS ' Database Variables
    Dim counter 			' Loop counter
    Dim strNextMonth, strPrevMonth	' The next and previous month dates
    Dim dailyMsg			' The message for the day
    Dim dtOnDay				' The current day being displayed by the loops
    Dim strPage				' The link that each day takes you too

' ---------- Variable Definitions ----------
    dtToday 	  = Date()

    If Request("currentDate") <> "" Then
      dtCurrentDate = Request("currentDate")
    Else
      dtCurrentDate = dtToday
    End If

    iFirstDayOfMonth = DatePart("w", DateSerial(Year(dtCurrentDate), Month(dtCurrentDate), 1))
    iDaysInMonth = DatePart("d", DateSerial(Year(dtCurrentDate), Month(dtCurrentDate)+1, 1-1))

    For counter = 1 to iDaysInMonth
      aCalendarDays(counter + iFirstDayOfMonth - 1) = counter
    Next

    iColumns = 7
    iRows    = 6 - Int((42 - (iFirstDayOfMonth + iDaysInMonth)) / 7)

    strPrevMonth = Server.URLEncode(DateAdd("m", -1, dtCurrentDate))
    strNextMonth = Server.URLEncode(DateAdd("m",  1, dtCurrentDate))

' ---------- Drawing the Calendar ----------
%>
<!--#include file="../SQLconn.asp"-->


   <HTML>
   <HEAD>
  <TITLE>Caledar - <%= MonthName(Month(dtCurrentDate)) & " " & Year(dtCurrentDate) %></TITLE>
  <STYLE TYPE="text/css">
    <!--
    BODY 	    {background-color: #FFFFFF; text-align: center; font-size: 12px; font-family: Verdana;}
    A 		    {text-decoration: none;}
    A:active 	    {color: #000000;}
    A:visited 	    {color: #0000FF;}
    A:link 	    {color: #0000FF;}
    A:hover 	    {color: #D80E0E;}
    .blackBacking   {background-color: #000000;}
    .names 	    {background-color: #ff9900; font-size: 13px; color: #FFFFFF; text-decoration: none; text-align:  center;       font-family: Verdana; font-weight: bold;}
    .calendarBody   {background-color: #F2EBCB; font-size: 12px; color: #000000; text-decoration: none; text-align:  center; font-family: Verdana;}
    .calCurrentDay  {background-color: #FFCCCC; font-size: 11px; color: #FFFFFF;}
    .calOtherDay    {background-color: #E1F0FF; font-size: 11px; color: #000000;}
    .calNotDay	    {background-color: #EEF1F2; font-size: 11px; color: #000000;}
    .calFormMenu    {background-color: #AECE6A; font-size: 13px; color: #FFFFFF; text-decoration: none; text-align:  center; font-family: Verdana; font-weight: bold;}
.STYLE4 {font-size: 18}
    -->
  </STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></HEAD>
<BODY>
  <FORM NAME="pageForm" ACTION="calendar.asp" METHOD="GET">
 <%username=request.cookies("tname")%>
  
       <CENTER>
       <TABLE CELLPADDING=0 CELLSPACING=0 width="95%" BORDER=0>
       <TR>
       <TD CLASS="blackBacking">
	   <TABLE width="100%" height="53" BORDER=0 CELLPADDING=1 CELLSPACING=1>
       <TR HEIGHT=30px>
  	   <TD HEIGHT=38px COLSPAN=7 bgcolor="#6633FF" CLASS="calOtherDay">
	   <div align="center"><A HREF="calendar.asp?currentDate=<%= strPrevMonth %>">&laquo; 上一个月</A>
	   &nbsp;
	   <SELECT NAME="currentDate" CLASS="calFormMenu" onChange="pageForm.submit()">
	   <% For counter = 1 to 12 %>
	          <OPTION VALUE="<%= DateSerial(Year(dtCurrentDate), counter, 1) %>" 
			  <% If (DatePart("m", dtCurrentDate) = counter) Then Response.Write "SELECTED"%>>
			  <%= MonthName(counter) & " " & Year(dtCurrentDate) %></OPTION>
	    <% Next %>
	    </SELECT>
	         &nbsp;
	        <A HREF="calendar.asp?currentDate=<%= strNextMonth %>">下一个月 &raquo;</A> 
            </div></TD>
         </TR>
	         <!-- Writring the days of the week for headers -->
             <TR VALIGN="CENTER" ALIGN="CENTER">
             <% For iDay = vbSunday To vbSaturday %>
             <TD WIDTH="14%" height="38" bgcolor="#6633FF" class="calNotDay"><%= WeekDayName(iDay, True) %>.</TD>
             <% Next %>
             </TR>
       <%
       For iWeek = 1 To iRows
       Response.Write "<TR VALIGN=TOP>"
       For iDay = 1 To iColumns
	   ' Checks to see if there is a day this month on the date being written
	   If aCalendarDays((iWeek-1)*7 + iDay) > 0 then
	   dtOnDay = DateSerial(Year(dtCurrentDate), Month(dtCurrentDate), aCalendarDays((iWeek-1)*7 + iDay))
  	   ' Checks to see if the day being printed is today
	    If dtOnDay = dtToday Then
	        Response.Write "<TD HEIGHT=68 CLASS='calCurrentDay'>"
 	    Else
   	         Response.Write "<TD HEIGHT=68 CLASS='calOtherDay'>"
 	    End If

	    ' Checks to see the type of calendar (editable or non-editable)
 	    If (bolEditable) then
   	        strPage = "updateCalendar_form.asp?currentDate=" & dtOnDay
 	    Else
   	       strPage = "viewDay.asp?currentDate=" & dtOnDay
	    End If%>
       
	    <P align=center><a href="manage.asp?dtondate=<%=dtOnDay%>"  target="main" class="STYLE1">
        <span class="STYLE1"> 
	    <FONT size=5>
	        <%=(aCalendarDays((iWeek-1)*7 + iDay))%>
			<%if right(nl(dtOnDay),2)="初一" then%>
			    <FONT size=2 color="#ff69b9"><%=right(nl(dtOnDay),4)%></FONT>
			<%else%>
			    <FONT size=2 color="#ff69b9"><%=right(nl(dtOnDay),2)%></FONT>
			<%end if%>
	      </FONT>
	    </span>
	    </P>
       <script>	
            function my_note(CAL_ID)
                {
                  window.open("note.asp?ciD="+CAL_ID,'_blank',  "height=250,width=250,status=0,toolbar=no,menubar=no,location=no,left=300,top=200,scrollbars=auto,resizable=no");
                 }
	    </script>
       	<%   
		 Set    MyOAASPObj = Server.CreateObject("YFSchoolOApro.YFSchoolDll")
        call    MyOAASPObj.Calendar(dtOnDay,username)
		    set MyOAASPObj=nothing   
         %>
	  <%
         rs.close
		 Set rs = Nothing
       %>

	  </td>

      
	  <% 
	      Else 
	          Response.Write ("<TD HEIGHT=60 CLASS='calNotDay'>&nbsp;")
	      End IF
        	Response.Write "</TD>"
          Next
          Response.Write "</TR>"
          Next

         objConn.Close
         set objConn = Nothing
%>

	 </TABLE>
      </TD>
      </TR>
     </TABLE>
    <span class="STYLE4">
     <%
    ' Notification for the user to know that the calendar is editable
     If (bolEditable) Then Response.Write "<h6><FONT size=2>工作事务安排</FONT><BR>"
      %><FONT size=2 color="#ff69b9">(<%=nl(now())%>)</FONT>
     </span>
</FORM>
	 
	 
	 
	 
	 
	 
	 
	 </td>
  </tr>
</table>
</body>
</html>
