Avatar billede agm Nybegynder
07. november 2010 - 11:55 Der er 1 kommentar og
1 løsning

Ændring i kalender script

Hej

Nogen der ved hvordan jeg får ugedage på min asp-kalender.
Og.. hvis admin har oprettet noget på dagene så skal dagene bare markeres med en farve og ikke hente tekst..

Index fil:
Function FormatStr(String)
    on Error resume next
    String = Replace(String, CHR(13), "")
    String = Replace(String, CHR(10) & CHR(10), "</P><P>")
    String = Replace(String, CHR(10), "<BR>")
    FormatStr = String
End Function

Dim dtToday,my_conn,dbpath,payroll,strsql,rs,rs2,rs3,strsql2,stryear,rsyearly,cnpath
dtToday = Date()

Dim dtCurViewMonth ' First day of the currently viewed month
Dim dtCurViewDay ' Current day of the currently viewed month
Dim frmDate,tmpMonth,tmpYear,tmpDate,mnth ' Date submitted by form

' if the GO button was used, build the date from the month and year

If InStr(1, Request.Form, "subGO", 1) > 0  then
    if Request.Form("CURDATE_month") = "" then
        tmpMonth = month(now())
    else
        tmpMonth = Request.Form("CURDATE_month")
    End If
   
    if Request.Form("CURDATE_year") = "" then
        tmpyear = year(now())
    else
        tmpyear = Request.Form("CURDATE_year")
    End If
       
    tmpDate = "1 " & tmpMonth & " 1999"
   
    mnth = Month(tmpDate)
    frmDate = DateSerial(tmpyear, mnth, 1)
Else

    frmDate = Request.Form("CURDATE")
   
end if

if Request("view_date") <> "" then
    frmDate= DateSerial(year(Request("view_date")), month(Request("view_date")), 1)
end if

%>
<% REM This section defines functions to be used later on. %>
<% REM This sets the Previous Sunday and the Current Month %>
<%

'--------------------------------------------------
  Function DtPrevSunday(ByVal dt)
      Do While WeekDay(dt) > vbSunday
        dt = DateAdd("d", -1, dt)
      Loop
  DtPrevSunday = dt
  End Function
'--------------------------------------------------
%>
<%REM Set current view month from posted CURDATE,  or
' the current date as appropriate.

' if posted from the form
' if prev button was hit on the form
  If InStr(1, Request.Form, "subPrev", 1) > 0 Then
      dtCurViewMonth = DateAdd("m", -1, frmDate)
' if next button was hit on the form
  ElseIf InStr(1, Request.Form, "subNext", 1) > 0 Then
      dtCurViewMonth = DateAdd("m", 1, frmDate)
' anyother time
      Else
' date add in text box
        If InStr(1, Request.Form, "subGO", 1) > 0 then
            dtCurViewMonth = frmDate
        Else
            if Request("view_date") <> "" then
                dtCurviewMonth = frmDate
            else
            dtCurViewMonth = DateSerial(Year(dtToday), Month(dtToday), 1)
            End If
        End If
  End If
%>
<% REM --------BEGINNING OF DRAW CALENDAR SECTION-------- %>
<% REM This section executes the event query and draws a matching calendar. %>
<%
  Dim iDay, iWeek, sFontColor, dictDte(31,2), intCount
  strSql = "SELECT * FROM calendar WHERE year(dte) = " & year(dtCurViewMonth) &" AND month(dte)= " & month(dtCurViewMonth) & " ORDER BY Day(dte)"
stryear = "select * FROM yearlycal Where month(dte)= " & month(dtCurViewMonth) & " ORDER BY Day(dte)"
    set rsyearly = my_conn.execute (stryear)
  set rs = my_conn.Execute (StrSql)
      intCount= 0
      ' populate array with days of month
  do until rs.EOF or intCount = 31
    if Day(rs("dte")) = intCount + 1 then
                dictDte(intCount, 1) = rs("text_field")&"<br>"
        rs.Movenext       
    End If
    'dictDte(intCount, 2) = intCount + 1
    intCount = intCount + 1
  loop
  rs.close

intCount= 0
    ' populate array with days of month
  do until rsyearly.EOF or intCount = 31
    if Day(rsyearly("dte")) = intCount + 1 then
                dictDte(intCount, 1) = dictDte(intCount, 1)&"<font color=#FFFF00>"&rsyearly("yearlyevents")&"</font><br>"
                'response.write dictDte(intCount, 1)
        rsyearly.Movenext       
    End If
    'dictDte(intCount, 2) = intCount + 1
    intCount = intCount + 1
  loop
  rsyearly.close


%>
<html>
<head>
<title>Web Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body text="#000000" link="#FFFFFF" vlink="#FFFFFF" bgcolor="#FFFFFF">
<p align="center"><a href="mailto:stefan@fckbanden.dk"><font color="#0000FF"><br>
  </font></a> <table CELLPADDING="3" CELLSPACING="0" WIDTH="100%" BORDER="2" BGCOLOR="#000099" bordercolordark="#1C644C" bordercolor="#000099" bordercolorlight="#FFFFFF">
<tr VALIGN="MIDDLE" ALIGN="CENTER"> <form NAME="fmNextPrev" ACTION="index.asp" METHOD="POST">
  <input type="hidden" name="CURDATE" value="<%=dtCurViewMonth%>">
  <table CELLPADDING="3" CELLSPACING="0" WIDTH="79%" BORDER="2" BGCOLOR="#99CCFF" BORDERCOLORDARK="#003399" BORDERCOLORLIGHT="#FFFFFF">
    <tr VALIGN="MIDDLE" ALIGN="CENTER">
          <td WIDTH="30%" ALIGN="RIGHT"><input TYPE="image" NAME="subPrev" SRC="Left.gif" BORDER="0" WIDTH="18" HEIGHT="20" HSPACE="0" VSPACE="0"> </td>
          <td WIDTH="40%"><font FACE="Arial" COLOR="#000000"><b><%=MonthName(Month(dtCurViewMonth)) & " " & Year(dtCurViewMonth)%></b> </font></td>
          <td WIDTH="30%" ALIGN="LEFT" colspan="7"><input TYPE="image" NAME="subNext" SRC="Right.gif" BORDER="0" WIDTH="18" HEIGHT="20" HSPACE="0" VSPACE="0"> </td>
       
        </tr>
      </table>
  <table width="79%">
    <tr VALIGN="TOP" ALIGN="CENTER" BGCOLOR="#000099">
<% For iDay = vbSunday To vbSaturday %>
      <th WIDTH="14%"><font FACE="Arial" SIZE="-2" COLOR="#FFFFFF"><%=WeekDayName(iDay)%></font></th>
<%Next %>
    </tr>
<%
  dtCurViewDay = DtPrevSunday(dtCurViewMonth)
 
  For iWeek = 0 To 5
      Response.Write "<TR VALIGN=TOP>" & vbCrLf

Dim sBGCOLOR
sBGCOLOR = "#99ccff"


For iDay = 0 To 6
sBGCOLOR = "#003399"
If Month(dtCurViewDay) = Month(dtCurViewMonth) Then
If dtCurViewDay = dtToday Then sBGCOLOR = "#99ccff"
else
sBGCOLOR = "#003399"

End If
Response.Write "<TD HEIGHT=50 bgcolor='" & sBGCOLOR & "' >"
       
     
  If Month(dtCurViewDay) = Month(dtCurViewMonth) Then
        If dtCurViewDay = dtToday Then
              sFontColor = "#00FF00<i></i>"

            Else
              sFontColor = "#00FF00"
            End If
     
        '---- Write day of month
            Response.Write "<FONT FACE=""Arial"" SIZE=""-2"" COLOR=""" & sFontColor & """><B>"
            Response.Write "<a href=view_day.asp?" & "view_date=" & day(dtCurViewday) & "-" & monthname(month(dtCurViewday)) & "-"&Year(dtCurViewMonth)&" style=""text-decoration: none"">"  & Day(dtCurViewDay) & "</B><font color='"&sfontcolor&"'><br>" & formatStr(dictDte(Day(dtCurViewDay)- 1, 1)) & "</a></FONT><BR>"
        '---Else
            '---Response.Write " "
        End If

        Response.Write "&nbsp</TD>" & vbCrLf
        dtCurViewDay = DateAdd("d", 1, dtCurViewDay)
      Next
      Response.Write "</TR>" & vbCrLf
  Next
%>
<%REM --------END OF DRAW CALENDAR SECTION--------
Avatar billede majbom Novice
11. november 2010 - 11:09 #1
uden at vide det, vil jeg tro du får mere hjælp under asp-kategorien :)
Avatar billede agm Nybegynder
13. november 2010 - 15:23 #2
Ja.. sikkert ;o)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester