Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Remove function

Please can somebody remove the holiday function from this calendar as i have no use for it. The calendar works but when i remove the functionerrors occur. If more code is needed just ask.

<!--#include file="dsn.inc.asp"-->

<%    
     strconn = "driver={microsoft access driver (*.mdb)};" & _
             "dbq=" & databasepath & ";"
     set objconn = server.createobject("adodb.connection")
     objconn.open strconn
 
     strsql = "select * from calendar_config;"

     set objrec = objconn.execute(strsql)
               
        calendar_title  = objrec("calendar_title")                  
        calendar_height = objrec("calendar_height")                  
        calendar_width  = objrec("calendar_width")                  
        day_abbr        = objrec("day_abbr")
        headerrowcolor  = objrec("headerrowcolor")                  
            headertextcolor = objrec("headertextcolor")                
            headertext      = objrec("headertext")                      
            headertextsize  = objrec("headertextsize")                  
            headertextcolor = objrec("headertextcolor")                
            showheadertext  = objrec("showheadertext")                  
            monthrowcolor   = objrec("monthrowcolor")                  
            monthtext       = objrec("monthtext")                      
            monthtextsize   = objrec("monthtextsize")                  
            monthtextcolor  = objrec("monthtextcolor")                  
            showmonthtext   = objrec("showmonthtext")                  
            daycellcolor    = objrec("daycellcolor")                    
            daytext         = objrec("daytext")                        
            daytextsize     = objrec("daytextsize")                    
            daytextcolor    = objrec("daytextcolor")                    
            publiccellcolor = objrec("publiccellcolor")                
            publictext      = objrec("publictext")                      
            publictextsize  = objrec("publictextsize")                  
            publiccellcolor = objrec("publiccellcolor")                
            publictextcolor = objrec("publictextcolor")                
            highlightpublic = objrec("highlightpublic")                
            todaycellcolor  = objrec("todaycellcolor")                  
            todaytext       = objrec("todaytext")                      
            todaytextsize   = objrec("todaytextsize")                  
            todaytextcolor  = objrec("todaytextcolor")                  
            highlighttoday  = objrec("highlighttoday")                  

       'Get public holidays
       
            strsql = "select * from public_hols"

     set objrec = objconn.execute(strsql)
             
          Redim arrPublic(0)
          arrIndex = 0
          
          Do While NOT objREC.EOF
             arrPublic(arrIndex)    = objREC("HolDate")
             arrIndex = arrIndex + 1
             Redim Preserve arrPublic(arrIndex)
            objREC.MoveNext
          Loop
              
         Redim Preserve arrPublic(Ubound(arrPublic)-1)
        



        
        
        if Len(Request.Querystring("MONTH")) then
              dtSelected = Request.querystring("YEAR") &"/" &Request.querystring("MONTH") &"/1"
              strMonth   = MONTHNAME(Request.QueryString("MONTH"))
              strYear    = Request.Querystring("YEAR")
              strNewDate = Request.querystring("YEAR") &"/" &Request.querystring("MONTH") &"/"
         elseif Len(Request.Form("MONTH")) then
                 dtSelected = Request.form("YEAR") &"/" &Request.form("MONTH") &"/1"
              strMonth   = MONTHNAME(Request.form("MONTH"))
              strYear    = Request.form("YEAR")
              strNewDate = Request.form("YEAR") &"/" &Request.form("MONTH") &"/"
          
           else
                   dtSelected = CDAte(NOW-DAY(NOW)+1)
              strMonth   = MONTHNAME(MONTH(NOW))
              strYear    = YEAR(NOW)
              strNewDate = YEAR(NOW) &"/" &MONTH(NOW) &"/"
             
          end if
                      
          strSQL = "select top 24 DueDate,Count(*) as Total,MAX(LastModified) as Latest  from message where Month(DueDate)= " _
          &Month(dtSelected) &" and Year(DueDate) = " &Year(dtSelected) _
          &"  group by DueDate order by DueDate DESC"
          'Response.Write strSQL
          set objREC = objCONN.Execute(strSQL)
          
          Redim aMessages(0)
          Redim aMessageDate(0)
          Redim aMessageStatus(0)
          arrIndex = 0
          
          Do While NOT objREC.EOF
             aMessages(arrIndex)    = objREC("Total")
             aMessageDate(arrIndex) = objREC("DueDate")
             aMessageStatus(arrIndex) = objREC("Latest")
            
             arrIndex = arrIndex + 1
             Redim Preserve aMessages(arrIndex)
             Redim Preserve aMessageDate(arrIndex)
             Redim Preserve aMessageStatus(arrIndex)
            objREC.MoveNext
          Loop
        
           objrec.close
           objconn.close
           set objrec = nothing
           set objconn = nothing


   

%><HTML>
<HEAD>
<TITLE>Calendar</TITLE>
<SCRIPT LANGUAGE="VBSCRIPT">
<!--
Sub Group_Nommer_OnChange
 Document.Form_Calendars.Submit
End Sub
-->
</SCRIPT>
</HEAD>
<STYLE>
<!--
TD{
      font-family : sans-serif;font-size : 8 pt;font-style : normal;letter-spacing : 0.1mm;border : 1px Ouset #000000 ;background-color :#FFFFFF;color : #000000;
}
TD.DAYS {
      font-family : <%=daytext%>;font-size : <%=daytextsize%>pt;font-style : normal;letter-spacing : 0.1mm;border : 1pt OutSet <%=daycellcolor%>#000000 ;background-color : <%=daycellcolor%>;color : <%=daytextcolor%>;
}
TD.HEAD {
      font-family : <%=headertext%>;font-size :<%=headertextsize%>pt;font-style : normal;font-weight : bold;letter-spacing : 0.1mm;background-color : <%=headerrowcolor%>;color : <%=headertextcolor%>;
}
TD.MONTH {
      font-family : <%=monthtext%>;font-size :<%=monthtextsize%>pt;font-style : normal;font-weight : bold;letter-spacing : 0.1mm;background-color : <%=monthrowcolor%>;color : <%=monthtextcolor%>;
}
TD.MONTHNAME {
      font-family : <%=monthtext%>;font-size :<%=monthtextsize%>pt;font-style : normal;font-weight : bold;letter-spacing : 0.1mm;border-bottom:1px solid black;background-color : <%=monthrowcolor%>;color : <%=monthtextcolor%>;
}

TD.MAIN {
      border : medium double Double;
}
TD.TODAY {
      font-family : <%=todaytext%>;font-size : <%=todaytextsize%>pt;font-weight : bold;font-color : blue;letter-spacing : 0.1mm;border : thin Inset #FFFACD;background-color : <%=todaycellcolor%>;color : <%=todaytextcolor%>;
}
TD.PUBLIC {
      font-family : <%=publictext%>;font-size : <%=publictextsize%>pt;font-weight : bold;font-color : blue;letter-spacing : 0.1mm;border : thin Inset #FFFACD;background-color : <%=publiccellcolor%>;color : <%=publictextcolor%>;
}

a:link {color: <%=daytextcolor%>; text-decoration: none}
a:active {color: <%=daytextcolor%>; text-decoration: none}
a:visited {color: <%=daytextcolor%>; text-decoration: none}
a.links:hover {color: <%=daytextcolor%>; text-decoration: underline;font-size:<%=todaytextsize+2%>}
-->
</STYLE>
<body marginwidth="5" leftmargin=10 marginheight=0 topmargin=50 bgcolor=#EEEEEE>


<%   'arrPublic = array("2001/03/21","2001/04/13","2001/04/16","2001/04/27","2001/05/01","2001/06/16","2001/08/09","2001/09/24","2001/12/16","2001/12/25","2001/12/26","2002/01/01","2001/01/01")
   
     '*************************************
     '       Get the cell dimensions
     '*************************************
     CELL_WIDTH  = calendar_width
     CELL_HEIGHT = calendar_height
     
     '*************************************
     '  Must the Day Names be abbreviated
     '*************************************

     blnAbbr     = Day_Abbr
   
              
      
      
      prevMonth  = MONTH(DATEADD("M",-1,dtSelected))
      nextMonth  = MONTH(DATEADD("M",1,dtSelected))
      prevYear   = YEAR(DATEADD("M",-1,dtSelected))
      nextYear   = YEAR(DATEADD("M",1,dtSelected))
      
      '******************************************************************
      '    Work out the number of days in the month that was submitted
      '******************************************************************
      datetime   = dateadd("d", -datepart("d",dtSelected)+1,dtSelected)
      datetime   = dateadd("m", 1, datetime)
      datetime   = dateadd("d", -1, datetime)
      intDays    = datepart("d",datetime)
      
      
      

      '****************************************************************
      '                      CALENDAR HEADER
      '****************************************************************
      %>

      <TABLE>
      <TR><TD CLASS=MAIN>
      <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 >
      <%If ShowHeaderTExt then %>
      <TR><TD ALIGN=CENTER CLASS=HEAD COLSPAN=7><%=calendar_title%></TD></TR>
      <%end if %>
      
      <TR><TD ALIGN=CENTER CLASS=MONTH><A HREF="calendar.asp?group_nommer=<%=intGroupNommer%>&month=<%=prevMonth%>&year=<%=prevYear%>"><img src="images\ltarr.gif" border=0 alt=<%=MonthName(prevmonth)%> height=16 width=16></A></TD>
      <%If ShowMonthTExt then %>
      <TD COLSPAN=5 CLASS=MONTH ALIGN=CENTER><%=strMonth &" - " &strYear%></TD>
      <%else%>
      <TD COLSPAN=5 CLASS=MONTH ALIGN=CENTER>&nbsp;</TD>
      <%end if%>
      <TD ALIGN=CENTER CLASS=MONTH><A HREF="calendar.asp?group_nommer=<%=intGroupNommer%>&month=<%=nextMonth%>&year=<%=nextYear%>"><img  src="images\rtarr.gif" border=0 alt=<%=MonthName(nextMonth)%>  height=16 width=16></A></TD>
      </TR><TR>
        <%
        For I = 1 to 7
        Response.Write "<TD ALIGN=CENTER CLASS=MONTHNAME>" &WeekdayName(I,blnAbbr) &"</TD>"
        Next
        %>
      </TR><TR>
      
      <%    
      
      '****************************************************************
      'Use intCounter to see how many cells have been written out
      '****************************************************************
      
      
        For  I = 1 to Weekday(dtSelected)-1
          Response.Write "<TD VALIGN=TOP ALIGN=RIGHT WIDTH="&CELL_WIDTH &" HEIGHT="&CELL_HEIGHT&">&nbsp;</TD>"
          intCounter = intCounter + 1
        Next  

        If intCounter-1  >= 7 then
           intCounter = 0
           Response.Write "</TR><TR>"
        End if

        For I = 1 to intDays

          blnISPublic = FALSE
          intCounter = intCounter + 1

      
          newdate =  strNewDate &I

          If HighlightPublic then    
          For J = 0 to UBOUND(arrPublic)
           If CDate(NewDate) = CDate(arrPublic(J)) then
             blnIsPublic = TRUE
           End if
          Next
          end if

         
          If CDate(NewDate) = DATE then
            If highlighttoday then
           strCLASS = "TODAY"
            end if
          elseif blnIsPublic  then
           strCLASS = "PUBLIC"
           else  
           strCLASS = "DAYS"
           end if  

      '****************************************************************       
      '                    Write out data
      '****************************************************************
      For J= 0 to UBOUND(aMessageDate)-1
       
        DatePlus7 = CDate(dateadd("d", -7,NOW))
        DatePlus14 = CDate(dateadd("d", -14,NOW))
       
        If CDate(aMessageStatus(J)) >= DatePlus7 then
          strDateIMG = ""
         elseif CDate(aMessageStatus(J)) >= DatePlus14  and CDate(aMessageStatus(J)) < DatePlus7 then
          strDateIMG = "seven"
         else
          strDateIMG = "fourteen"  
       
       end if
       
      If CDate(aMessagedate(J)) = CDate(NEWDATE) then
      strIMG = "<CENTER><A HREF='messages.asp?Group_Nommer=" &intGroupNommer &"&date=" &aMessagedate(J) _
      &"'><IMG SRC='./images/" &aMessages(J) &strDateIMG &".gif' ALT='number of events (" &aMessages(J) &")' BORDER=0></A>"                
      exit For
      else strIMG = "&nbsp;"
      End if
      Next

        if intCounter mod 7 <> 0 then  
           Response.Write "<TD CLASS=" &strCLASS &" VALIGN=TOP ALIGN=RIGHT WIDTH="&CELL_WIDTH _
           &" HEIGHT="&CELL_HEIGHT &" BGCOLOR=" &strBGCOLOR   &">"   &"&nbsp;<A CLASS=LINKS HREF='messages.asp?Group_Nommer=" &intGroupNommer &"&Date=" &strNewDate&I &"'>" &I &"</A><BR>" _
           &strIMG &"</TD>"
         else
           Response.Write "<TD CLASS=" &strCLASS &" VALIGN=TOP ALIGN=RIGHT WIDTH=" _
           &CELL_WIDTH &" HEIGHT="&CELL_HEIGHT &" BGCOLOR=" _
           &strBGCOLOR &">" &"&nbsp;<A CLASS=LINKS HREF='messages.asp?Group_Nommer=" &intGroupNommer &"&Date=" &strNewDate &I &"'>" &I &"</A><BR>" &strIMG &"</TD></TR><TR>"
        end if  
      Next  %> </TR> </TABLE>
        <TABLE>
         <TR>
         <TD CLASS="TODAY" STYLE="WIDTH:10"></TD><TD>Today</td>
         </TR>
        </TABLE>
       </TD>
       
      </TABLE>
      <INPUT TYPE=HIDDEN NAME="MONTH" VALUE=<%=Month(dtSelected)%>>
      <INPUT TYPE=HIDDEN NAME="YEAR" VALUE=<%=Year(dtSelected)%>>
      </FORM>
  </TABLE>
</TABLE>
</HTML>
0
lukegriffiths110
Asked:
lukegriffiths110
1 Solution
 
randeepsCommented:
1. if the change is temporary, then why not delete the data from the public_hols database.
2. Remove this code in the begining

'Get public holidays
       
            strsql = "select * from public_hols"

     set objrec = objconn.execute(strsql)
             
          Redim arrPublic(0)
         arrIndex = 0
         
         Do While NOT objREC.EOF
            arrPublic(arrIndex)    = objREC("HolDate")
            arrIndex = arrIndex + 1
            Redim Preserve arrPublic(arrIndex)
           objREC.MoveNext
         Loop
             
         Redim Preserve arrPublic(Ubound(arrPublic)-1)
       
-----
and replace woith below line only

       Redim arrPublic(0)


I am not removing the functionality of the holidays.. all io am doing is removing the population of the holidays otherwise any change can render your functionality inoperable or make it buggy. Hope this helps.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now