Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > JavaScript
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

JavaScript JavaScript are you needing help with functions in your script, free help is offered here for all JavaScript problems so if you have an JavaScript error in your code just ask.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-01-2007, 5:39 PM   #1
Jeff
 
Jeff's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Another Calendar ?

Ok. so i have a calendar script that displays the month and days. and it is
set up to go to a page when a date is clicked on.

what i would like to do, is connect it with a DB so that if there is a
tourney on a day... it will show the title of the tourney in the date box.
here is the script for the calendar.


<!--#include file="connection.asp" -->
<%

Class Calendar
Public Top
Public Left
Public Width
Public Height
Public Position
Public ZIndex
Public TitlebarColor
Public TitlebarFont
Public TitlebarFontColor
Public TodayBGColor
Public OnDayClick
Public OnNextMonthClick
Public OnPrevMonthClick
Public ShowDateSelect
Private mdDate
Private msToday
Private mnDay
Private mnMonth
Private mnYear
Private mnDayMonthStarts
Private mnDaysInMonth
Private mcolDays
Private mbDaysInitialized

Private Sub Class_Initialize()
Top = 0
Left = 0
Width = 500
Height= 500
Position = "absolute"
TitlebarColor = "darkblue"
TitlebarFont = "arial"
TitlebarFontColor = "white"
TodayBGColor = "skyblue"
ShowDateSelect = True
msToday = FormatDateTime(DateSerial(Year(Now()), Month(Now()),
Day(Now())), 2)
zIndex = 1

Set mcolDays = Server.CreateObject("Scripting.Dictionary")
If Request("date") <> "" Then SetDate(Request("date")) Else SetDate(Now())

OnDayClick = Request.ServerVariables("SCRIPT_NAME")
OnNextMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" &
Server.URLEncode(DateSerial(mnYear, mnMonth + 1, mnDay))
OnPrevMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" &
Server.URLEncode(DateSerial(mnYear, mnMonth - 1, mnDay))

mbDaysInitialized = False
End Sub

Private Sub Class_Terminate()
If IsObject(mcolDays) Then
mcolDays.RemoveAll
Set mcolDays = Nothing
End If
End Sub

Public Property Get GetDate()
GetDate = mdDate
End Property

Public Property Get DaysInMonth()
DaysInMonth = mnDaysInMonth
End Property

Public Property Get WeeksInMonth()
If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then
WeeksInMonth = 6
Else
WeeksInMonth = 5
End If
End Property

Public Property Get Days(nIndex)
If Not mbDaysInitialized Then InitDays()
If mcolDays.Exists(nIndex) Then Set Days = mcolDays.Item(nIndex)
End Property

Private Sub InitDays()
Dim nDayIndex
Dim objNewDay

If mcolDays.Count > 0 Then mcolDays.RemoveAll()

For nDayIndex = 1 To mnDaysInMonth
Set objNewDay = New CalendarDay
objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth,
nDayIndex),2)
objNewDay.OnClick = OnDayClick

mcolDays.Add nDayIndex, objNewDay
Next

mbDaysInitialized = True
End Sub

Public Sub SetDate(dDate)
mdDate = CDate(dDate)
mnDay = Day(dDate)
mnMonth = Month(dDate)
mnYear = Year(dDate)

mnDaysInMonth = Day(DateAdd("d", -1, DateSerial(mnYear, mnMonth + 1, 1)))
mnDayMonthStarts = WeekDay(DateAdd("d", -(Day(CDate(dDate)) - 1),
CDate(dDate)))
End Sub

Public Sub Draw()
Dim nDayCount
Dim nCellWidth, nCellHeight, nFontSizeRatio
Dim objDay

If Not mbDaysInitialized Then InitDays()

nCellWidth = CInt(Width / 7)
If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then
nCellHeight = CInt((Height - 80) / 6)
Else
nCellHeight = CInt((Height - 80) / 5)
End If

nFontSizeRatio = Fix(Width / 200)

Send "<div id=""calendar"" style=""top: " & CStr(Top) & "px; left: " &
CStr(Left) & "px; position: " & Position & "; z-index: " & ZIndex & """>"
Send "<table border=""1"" width=""" & Width & """ height=""" & Height &
""" cellspacing=""0"">"
Send "<tr><td colspan=""7"" height=""10"" bgcolor=""" & TitlebarColor &
""">"
Send " <table border=""0"" width=""100%"" cellspacing=0>"
Send " <tr>"
Send " <td align=""left""><a style=""text-decoration: none; color: " &
TitlebarFontColor & ";"" href=""" & Replace(OnPrevMonthClick, "$date",
DateSerial(mnYear, mnMonth - 1, mnDay)) & """><font face=""" & TitlebarFont
& """ size=""" & nFontSizeRatio & """><b>&nbsp;&lt;&lt;</b></font></a></td>"
Send " <td align=""center""><font size=""" & nFontSizeRatio & """ face="""
& TitlebarFont & """ color=""" & TitlebarFontColor & """><b>" &
MonthName(mnMonth) & " " & mnYear & "</b></font></td>"
Send " <td align=""right""><a style=""text-decoration: none; color: " &
TitlebarFontColor & ";"" href=""" & Replace(OnNextMonthClick, "$date",
DateSerial(mnYear, mnMonth + 1, mnDay)) & """><font face=""" & TitlebarFont
& """ size=""" & nFontSizeRatio & """><b>&gt;&gt;&nbsp;</b></font></a></td>"
Send " </tr>"
Send " </table>"
Send "</td></tr>"
Send "<tr>"
Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
align=""center""><small>S</small></td>"
Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
align=""center""><small>M</small></td>"
Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
align=""center""><small>T</small></td>"
Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
align=""center""><small>W</small></td>"
Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
align=""center""><small>T</small></td>"
Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
align=""center""><small>F</small></td>"
Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
align=""center""><small>S</small></td>"
Send "</tr>"

Send "<tr>"
For nDayCount = 1 To mnDayMonthStarts - 1
Send "<td height=""" & CStr(nCellHeight) & """ width=""" &
CStr(nCellWidth) & """ bgcolor=""#dddddd"">&nbsp;</td>"
Next

nDayCount = nDayCount - 1

For Each objDay In mcolDays.Items

If nDayCount = 7 Then
Send "</tr><tr>"
nDayCount = 0
End If

Response.Write "<td height=""" & CStr(nCellHeight) & """ width=""" &
CStr(nCellWidth) & """ valign=""top"" bgcolor="""
If objDay.DateString = msToday Then Send TodayBGColor & """>" Else Send
"white"">"

objDay.Draw()
Send "</td>"

nDayCount = nDayCount + 1
Next

If nDayCount < 7 Then
For nDayCount = nDayCount To 6
Send "<td height=""" & CStr(nCellHeight) & """ width=""" &
CStr(nCellWidth) & """ bgcolor=""#dddddd"">&nbsp;</td>"
Next
End If

Send "</tr>"

If ShowDateSelect Then
Send "<tr><td height=""30"" colspan=""7"" align=""center"">"
DrawDateSelect()
Send "</td></tr>"
End If

Send "</table>"
Send "</div>"
End Sub

Private Sub DrawDateSelect()
Dim nIndex
Send " <form id=frmGO name=frmGO>"
Send " <table border=""0"">"
Send " <tr>"
Send " <td><select name=""month"">"
For nIndex = 1 To 12
Response.Write "<option value=""" & nIndex & """"
If nIndex = Month(mdDate) Then Response.Write " selected"
Send ">" & MonthName(nIndex, True) & "</option>"
Next
Send " </select></td>"
Send " <td><select name=""year"">"
For nIndex = Year(Now()) - 4 To Year(Now()) + 6
Response.Write "<option value=""" & nIndex & """"
If nIndex = Year(mdDate) Then Response.Write " selected"
Send ">" & CStr(nIndex) & "</option>"
Next
Send " </select></td>"
Send " <td><input type=""button"" Value=""Go""
onclick=""document.location='" & Request.ServerVariables("SCRIPT_NAME") &
"?date='+this.form.month.options[this.form.month.selectedIndex].value+'/1/'+this.form.year.options[this.form.year.selectedIndex].value;""
id=1 name=1></td>"
Send " </form>"
Send " </tr></table>"
End Sub

Private Sub Send(sHTML)
Response.Write sHTML & vbCrLf
End Sub

End Class


Class CalendarDay
Public DateString
Public OnClick
Private mcolActivities
Private mbActivitiesInit

Private Sub Class_Initialize()
mbActivitiesInit = False
End Sub

Private Sub Class_Terminate()
If IsObject(mcolActivities) Then
mcolActivities.RemoveAll()
Set mcolActivities = Nothing
End If
End Sub

Private Sub InitActivities()
Set mcolActivities = Server.CreateObject("Scripting.Dictionary")
mbActivitiesInit = True
End Sub

Public Sub AddActivity(sActivity, sColor)
If Not mbActivitiesInit Then InitActivities()
mcolActivities.Add mcolActivities.Count + 1, "bgcolor=""" & sColor & """>"
& sActivity
End Sub

Public Sub Draw()
Dim objActivity

Send "<table width=""100%"" border=""0"" cellspacing=""2""
cellpadding=""1"">"
Send "<tr><td align=""left"" valign=""top""><a href=""" & Replace(OnClick,
"$date", DateString) & """><small>" & Day(DateString) &
"</small></a></td></tr>"
If mbActivitiesInit Then
For Each objActivity In mcolActivities.Items
Send "<tr><td height=""20""" & objActivity & "</td></tr>"
Next
End If
Send "</table>"
End Sub

Private Sub Send(sHTML)
Response.Write sHTML & vbCrLf
End Sub
End Class


%>

lots of lines.... but that is the code.

now i have connected to the DB as you can see.

the iheader field contains the title that i want. so somewhere i need a line
that checks the date against the DB, and if true then display the title.

can anyone help me here??

thanks
Jeff


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 07-01-2007, 5:39 PM   #2
Jeff
 
Jeff's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Another Calendar ?


"Jeff" <gig_bam@adelphia.net> wrote in message
news:a_adnVRvbZsjw4rZRVn-iw@adelphia.com...
> Ok. so i have a calendar script that displays the month and days. and it
> is set up to go to a page when a date is clicked on.
>
> what i would like to do, is connect it with a DB so that if there is a
> tourney on a day... it will show the title of the tourney in the date box.
> here is the script for the calendar.
>
>
> <!--#include file="connection.asp" -->
> <%
>
> Class Calendar
> Public Top
> Public Left
> Public Width
> Public Height
> Public Position
> Public ZIndex
> Public TitlebarColor
> Public TitlebarFont
> Public TitlebarFontColor
> Public TodayBGColor
> Public OnDayClick
> Public OnNextMonthClick
> Public OnPrevMonthClick
> Public ShowDateSelect
> Private mdDate
> Private msToday
> Private mnDay
> Private mnMonth
> Private mnYear
> Private mnDayMonthStarts
> Private mnDaysInMonth
> Private mcolDays
> Private mbDaysInitialized
>
> Private Sub Class_Initialize()
> Top = 0
> Left = 0
> Width = 500
> Height= 500
> Position = "absolute"
> TitlebarColor = "darkblue"
> TitlebarFont = "arial"
> TitlebarFontColor = "white"
> TodayBGColor = "skyblue"
> ShowDateSelect = True
> msToday = FormatDateTime(DateSerial(Year(Now()), Month(Now()),
> Day(Now())), 2)
> zIndex = 1
>
> Set mcolDays = Server.CreateObject("Scripting.Dictionary")
> If Request("date") <> "" Then SetDate(Request("date")) Else
> SetDate(Now())
>
> OnDayClick = Request.ServerVariables("SCRIPT_NAME")
> OnNextMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" &
> Server.URLEncode(DateSerial(mnYear, mnMonth + 1, mnDay))
> OnPrevMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" &
> Server.URLEncode(DateSerial(mnYear, mnMonth - 1, mnDay))
>
> mbDaysInitialized = False
> End Sub
>
> Private Sub Class_Terminate()
> If IsObject(mcolDays) Then
> mcolDays.RemoveAll
> Set mcolDays = Nothing
> End If
> End Sub
>
> Public Property Get GetDate()
> GetDate = mdDate
> End Property
>
> Public Property Get DaysInMonth()
> DaysInMonth = mnDaysInMonth
> End Property
>
> Public Property Get WeeksInMonth()
> If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then
> WeeksInMonth = 6
> Else
> WeeksInMonth = 5
> End If
> End Property
>
> Public Property Get Days(nIndex)
> If Not mbDaysInitialized Then InitDays()
> If mcolDays.Exists(nIndex) Then Set Days = mcolDays.Item(nIndex)
> End Property
>
> Private Sub InitDays()
> Dim nDayIndex
> Dim objNewDay
>
> If mcolDays.Count > 0 Then mcolDays.RemoveAll()
>
> For nDayIndex = 1 To mnDaysInMonth
> Set objNewDay = New CalendarDay
> objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth,
> nDayIndex),2)
> objNewDay.OnClick = OnDayClick
>
> mcolDays.Add nDayIndex, objNewDay
> Next
>
> mbDaysInitialized = True
> End Sub
>
> Public Sub SetDate(dDate)
> mdDate = CDate(dDate)
> mnDay = Day(dDate)
> mnMonth = Month(dDate)
> mnYear = Year(dDate)
>
> mnDaysInMonth = Day(DateAdd("d", -1, DateSerial(mnYear, mnMonth + 1,
> 1)))
> mnDayMonthStarts = WeekDay(DateAdd("d", -(Day(CDate(dDate)) - 1),
> CDate(dDate)))
> End Sub
>
> Public Sub Draw()
> Dim nDayCount
> Dim nCellWidth, nCellHeight, nFontSizeRatio
> Dim objDay
>
> If Not mbDaysInitialized Then InitDays()
>
> nCellWidth = CInt(Width / 7)
> If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then
> nCellHeight = CInt((Height - 80) / 6)
> Else
> nCellHeight = CInt((Height - 80) / 5)
> End If
>
> nFontSizeRatio = Fix(Width / 200)
>
> Send "<div id=""calendar"" style=""top: " & CStr(Top) & "px; left: " &
> CStr(Left) & "px; position: " & Position & "; z-index: " & ZIndex & """>"
> Send "<table border=""1"" width=""" & Width & """ height=""" & Height &
> """ cellspacing=""0"">"
> Send "<tr><td colspan=""7"" height=""10"" bgcolor=""" & TitlebarColor &
> """>"
> Send " <table border=""0"" width=""100%"" cellspacing=0>"
> Send " <tr>"
> Send " <td align=""left""><a style=""text-decoration: none; color: " &
> TitlebarFontColor & ";"" href=""" & Replace(OnPrevMonthClick, "$date",
> DateSerial(mnYear, mnMonth - 1, mnDay)) & """><font face=""" &
> TitlebarFont & """ size=""" & nFontSizeRatio &
> """><b>&nbsp;&lt;&lt;</b></font></a></td>"
> Send " <td align=""center""><font size=""" & nFontSizeRatio & """
> face=""" & TitlebarFont & """ color=""" & TitlebarFontColor & """><b>" &
> MonthName(mnMonth) & " " & mnYear & "</b></font></td>"
> Send " <td align=""right""><a style=""text-decoration: none; color: " &
> TitlebarFontColor & ";"" href=""" & Replace(OnNextMonthClick, "$date",
> DateSerial(mnYear, mnMonth + 1, mnDay)) & """><font face=""" &
> TitlebarFont & """ size=""" & nFontSizeRatio &
> """><b>&gt;&gt;&nbsp;</b></font></a></td>"
> Send " </tr>"
> Send " </table>"
> Send "</td></tr>"
> Send "<tr>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>S</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>M</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>T</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>W</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>T</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>F</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>S</small></td>"
> Send "</tr>"
>
> Send "<tr>"
> For nDayCount = 1 To mnDayMonthStarts - 1
> Send "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ bgcolor=""#dddddd"">&nbsp;</td>"
> Next
>
> nDayCount = nDayCount - 1
>
> For Each objDay In mcolDays.Items
>
> If nDayCount = 7 Then
> Send "</tr><tr>"
> nDayCount = 0
> End If
>
> Response.Write "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ valign=""top"" bgcolor="""
> If objDay.DateString = msToday Then Send TodayBGColor & """>" Else Send
> "white"">"
>
> objDay.Draw()
> Send "</td>"
>
> nDayCount = nDayCount + 1
> Next
>
> If nDayCount < 7 Then
> For nDayCount = nDayCount To 6
> Send "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ bgcolor=""#dddddd"">&nbsp;</td>"
> Next
> End If
>
> Send "</tr>"
>
> If ShowDateSelect Then
> Send "<tr><td height=""30"" colspan=""7"" align=""center"">"
> DrawDateSelect()
> Send "</td></tr>"
> End If
>
> Send "</table>"
> Send "</div>"
> End Sub
>
> Private Sub DrawDateSelect()
> Dim nIndex
> Send " <form id=frmGO name=frmGO>"
> Send " <table border=""0"">"
> Send " <tr>"
> Send " <td><select name=""month"">"
> For nIndex = 1 To 12
> Response.Write "<option value=""" & nIndex & """"
> If nIndex = Month(mdDate) Then Response.Write " selected"
> Send ">" & MonthName(nIndex, True) & "</option>"
> Next
> Send " </select></td>"
> Send " <td><select name=""year"">"
> For nIndex = Year(Now()) - 4 To Year(Now()) + 6
> Response.Write "<option value=""" & nIndex & """"
> If nIndex = Year(mdDate) Then Response.Write " selected"
> Send ">" & CStr(nIndex) & "</option>"
> Next
> Send " </select></td>"
> Send " <td><input type=""button"" Value=""Go""
> onclick=""document.location='" & Request.ServerVariables("SCRIPT_NAME") &
> "?date='+this.form.month.options[this.form.month.selectedIndex].value+'/1/'+this.form.year.options[this.form.year.selectedIndex].value;""
> id=1 name=1></td>"
> Send " </form>"
> Send " </tr></table>"
> End Sub
>
> Private Sub Send(sHTML)
> Response.Write sHTML & vbCrLf
> End Sub
>
> End Class
>
>
> Class CalendarDay
> Public DateString
> Public OnClick
> Private mcolActivities
> Private mbActivitiesInit
>
> Private Sub Class_Initialize()
> mbActivitiesInit = False
> End Sub
>
> Private Sub Class_Terminate()
> If IsObject(mcolActivities) Then
> mcolActivities.RemoveAll()
> Set mcolActivities = Nothing
> End If
> End Sub
>
> Private Sub InitActivities()
> Set mcolActivities = Server.CreateObject("Scripting.Dictionary")
> mbActivitiesInit = True
> End Sub
>
> Public Sub AddActivity(sActivity, sColor)
> If Not mbActivitiesInit Then InitActivities()
> mcolActivities.Add mcolActivities.Count + 1, "bgcolor=""" & sColor &
> """>" & sActivity
> End Sub
>
> Public Sub Draw()
> Dim objActivity
>
> Send "<table width=""100%"" border=""0"" cellspacing=""2""
> cellpadding=""1"">"
> Send "<tr><td align=""left"" valign=""top""><a href=""" &
> Replace(OnClick, "$date", DateString) & """><small>" & Day(DateString) &
> "</small></a></td></tr>"
> If mbActivitiesInit Then
> For Each objActivity In mcolActivities.Items
> Send "<tr><td height=""20""" & objActivity & "</td></tr>"
> Next
> End If
> Send "</table>"
> End Sub
>
> Private Sub Send(sHTML)
> Response.Write sHTML & vbCrLf
> End Sub
> End Class
>
>
> %>
>
> lots of lines.... but that is the code.
>
> now i have connected to the DB as you can see.
>
> the iheader field contains the title that i want. so somewhere i need a
> line that checks the date against the DB, and if true then display the
> title.
>
> can anyone help me here??
>
> thanks
> Jeff
>


let me add the actual output/display page for the calendar

<%
Dim MyCalendar



' Create the calendar
Set MyCalendar = New Calendar

' Set the visual properties
MyCalendar.Top = 0 'Sets the top position
MyCalendar.Left = 0 'Sets the left position
MyCalendar.Position = "center" 'Relative or Absolute positioning
MyCalendar.Height = "600" 'Sets the height
MyCalendar.Width = "600" 'Sets the width
MyCalendar.TitlebarColor = "darkblue" 'Sets the color of the titlebar
MyCalendar.TitlebarFont = "arial" 'Sets the font face of the titlebar
MyCalendar.TitlebarFontColor = "white" 'Sets the font color of the titlebar
MyCalendar.TodayBGColor = "skyblue" 'Sets the highlight color of the
current day
MyCalendar.ShowDateSelect = True 'Toggles the Date Selection form.

' Add event code for when a day is clicked on. Notice
' that when run inside your browser, "$date" is replaced
' by the date you click on.
MyCalendar.OnDayClick = "calendar2.asp?d=$date"



' Draw the calendar to the browser
MyCalendar.Draw()
%>


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 5:39 PM   #3
Jeff
 
Jeff's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Another Calendar ?

dang.... and the date is in the field idate


"Jeff" <gig_bam@adelphia.net> wrote in message
news:a_adnVRvbZsjw4rZRVn-iw@adelphia.com...
> Ok. so i have a calendar script that displays the month and days. and it
> is set up to go to a page when a date is clicked on.
>
> what i would like to do, is connect it with a DB so that if there is a
> tourney on a day... it will show the title of the tourney in the date box.
> here is the script for the calendar.
>
>
> <!--#include file="connection.asp" -->
> <%
>
> Class Calendar
> Public Top
> Public Left
> Public Width
> Public Height
> Public Position
> Public ZIndex
> Public TitlebarColor
> Public TitlebarFont
> Public TitlebarFontColor
> Public TodayBGColor
> Public OnDayClick
> Public OnNextMonthClick
> Public OnPrevMonthClick
> Public ShowDateSelect
> Private mdDate
> Private msToday
> Private mnDay
> Private mnMonth
> Private mnYear
> Private mnDayMonthStarts
> Private mnDaysInMonth
> Private mcolDays
> Private mbDaysInitialized
>
> Private Sub Class_Initialize()
> Top = 0
> Left = 0
> Width = 500
> Height= 500
> Position = "absolute"
> TitlebarColor = "darkblue"
> TitlebarFont = "arial"
> TitlebarFontColor = "white"
> TodayBGColor = "skyblue"
> ShowDateSelect = True
> msToday = FormatDateTime(DateSerial(Year(Now()), Month(Now()),
> Day(Now())), 2)
> zIndex = 1
>
> Set mcolDays = Server.CreateObject("Scripting.Dictionary")
> If Request("date") <> "" Then SetDate(Request("date")) Else
> SetDate(Now())
>
> OnDayClick = Request.ServerVariables("SCRIPT_NAME")
> OnNextMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" &
> Server.URLEncode(DateSerial(mnYear, mnMonth + 1, mnDay))
> OnPrevMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" &
> Server.URLEncode(DateSerial(mnYear, mnMonth - 1, mnDay))
>
> mbDaysInitialized = False
> End Sub
>
> Private Sub Class_Terminate()
> If IsObject(mcolDays) Then
> mcolDays.RemoveAll
> Set mcolDays = Nothing
> End If
> End Sub
>
> Public Property Get GetDate()
> GetDate = mdDate
> End Property
>
> Public Property Get DaysInMonth()
> DaysInMonth = mnDaysInMonth
> End Property
>
> Public Property Get WeeksInMonth()
> If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then
> WeeksInMonth = 6
> Else
> WeeksInMonth = 5
> End If
> End Property
>
> Public Property Get Days(nIndex)
> If Not mbDaysInitialized Then InitDays()
> If mcolDays.Exists(nIndex) Then Set Days = mcolDays.Item(nIndex)
> End Property
>
> Private Sub InitDays()
> Dim nDayIndex
> Dim objNewDay
>
> If mcolDays.Count > 0 Then mcolDays.RemoveAll()
>
> For nDayIndex = 1 To mnDaysInMonth
> Set objNewDay = New CalendarDay
> objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth,
> nDayIndex),2)
> objNewDay.OnClick = OnDayClick
>
> mcolDays.Add nDayIndex, objNewDay
> Next
>
> mbDaysInitialized = True
> End Sub
>
> Public Sub SetDate(dDate)
> mdDate = CDate(dDate)
> mnDay = Day(dDate)
> mnMonth = Month(dDate)
> mnYear = Year(dDate)
>
> mnDaysInMonth = Day(DateAdd("d", -1, DateSerial(mnYear, mnMonth + 1,
> 1)))
> mnDayMonthStarts = WeekDay(DateAdd("d", -(Day(CDate(dDate)) - 1),
> CDate(dDate)))
> End Sub
>
> Public Sub Draw()
> Dim nDayCount
> Dim nCellWidth, nCellHeight, nFontSizeRatio
> Dim objDay
>
> If Not mbDaysInitialized Then InitDays()
>
> nCellWidth = CInt(Width / 7)
> If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then
> nCellHeight = CInt((Height - 80) / 6)
> Else
> nCellHeight = CInt((Height - 80) / 5)
> End If
>
> nFontSizeRatio = Fix(Width / 200)
>
> Send "<div id=""calendar"" style=""top: " & CStr(Top) & "px; left: " &
> CStr(Left) & "px; position: " & Position & "; z-index: " & ZIndex & """>"
> Send "<table border=""1"" width=""" & Width & """ height=""" & Height &
> """ cellspacing=""0"">"
> Send "<tr><td colspan=""7"" height=""10"" bgcolor=""" & TitlebarColor &
> """>"
> Send " <table border=""0"" width=""100%"" cellspacing=0>"
> Send " <tr>"
> Send " <td align=""left""><a style=""text-decoration: none; color: " &
> TitlebarFontColor & ";"" href=""" & Replace(OnPrevMonthClick, "$date",
> DateSerial(mnYear, mnMonth - 1, mnDay)) & """><font face=""" &
> TitlebarFont & """ size=""" & nFontSizeRatio &
> """><b>&nbsp;&lt;&lt;</b></font></a></td>"
> Send " <td align=""center""><font size=""" & nFontSizeRatio & """
> face=""" & TitlebarFont & """ color=""" & TitlebarFontColor & """><b>" &
> MonthName(mnMonth) & " " & mnYear & "</b></font></td>"
> Send " <td align=""right""><a style=""text-decoration: none; color: " &
> TitlebarFontColor & ";"" href=""" & Replace(OnNextMonthClick, "$date",
> DateSerial(mnYear, mnMonth + 1, mnDay)) & """><font face=""" &
> TitlebarFont & """ size=""" & nFontSizeRatio &
> """><b>&gt;&gt;&nbsp;</b></font></a></td>"
> Send " </tr>"
> Send " </table>"
> Send "</td></tr>"
> Send "<tr>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>S</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>M</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>T</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>W</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>T</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>F</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>S</small></td>"
> Send "</tr>"
>
> Send "<tr>"
> For nDayCount = 1 To mnDayMonthStarts - 1
> Send "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ bgcolor=""#dddddd"">&nbsp;</td>"
> Next
>
> nDayCount = nDayCount - 1
>
> For Each objDay In mcolDays.Items
>
> If nDayCount = 7 Then
> Send "</tr><tr>"
> nDayCount = 0
> End If
>
> Response.Write "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ valign=""top"" bgcolor="""
> If objDay.DateString = msToday Then Send TodayBGColor & """>" Else Send
> "white"">"
>
> objDay.Draw()
> Send "</td>"
>
> nDayCount = nDayCount + 1
> Next
>
> If nDayCount < 7 Then
> For nDayCount = nDayCount To 6
> Send "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ bgcolor=""#dddddd"">&nbsp;</td>"
> Next
> End If
>
> Send "</tr>"
>
> If ShowDateSelect Then
> Send "<tr><td height=""30"" colspan=""7"" align=""center"">"
> DrawDateSelect()
> Send "</td></tr>"
> End If
>
> Send "</table>"
> Send "</div>"
> End Sub
>
> Private Sub DrawDateSelect()
> Dim nIndex
> Send " <form id=frmGO name=frmGO>"
> Send " <table border=""0"">"
> Send " <tr>"
> Send " <td><select name=""month"">"
> For nIndex = 1 To 12
> Response.Write "<option value=""" & nIndex & """"
> If nIndex = Month(mdDate) Then Response.Write " selected"
> Send ">" & MonthName(nIndex, True) & "</option>"
> Next
> Send " </select></td>"
> Send " <td><select name=""year"">"
> For nIndex = Year(Now()) - 4 To Year(Now()) + 6
> Response.Write "<option value=""" & nIndex & """"
> If nIndex = Year(mdDate) Then Response.Write " selected"
> Send ">" & CStr(nIndex) & "</option>"
> Next
> Send " </select></td>"
> Send " <td><input type=""button"" Value=""Go""
> onclick=""document.location='" & Request.ServerVariables("SCRIPT_NAME") &
> "?date='+this.form.month.options[this.form.month.selectedIndex].value+'/1/'+this.form.year.options[this.form.year.selectedIndex].value;""
> id=1 name=1></td>"
> Send " </form>"
> Send " </tr></table>"
> End Sub
>
> Private Sub Send(sHTML)
> Response.Write sHTML & vbCrLf
> End Sub
>
> End Class
>
>
> Class CalendarDay
> Public DateString
> Public OnClick
> Private mcolActivities
> Private mbActivitiesInit
>
> Private Sub Class_Initialize()
> mbActivitiesInit = False
> End Sub
>
> Private Sub Class_Terminate()
> If IsObject(mcolActivities) Then
> mcolActivities.RemoveAll()
> Set mcolActivities = Nothing
> End If
> End Sub
>
> Private Sub InitActivities()
> Set mcolActivities = Server.CreateObject("Scripting.Dictionary")
> mbActivitiesInit = True
> End Sub
>
> Public Sub AddActivity(sActivity, sColor)
> If Not mbActivitiesInit Then InitActivities()
> mcolActivities.Add mcolActivities.Count + 1, "bgcolor=""" & sColor &
> """>" & sActivity
> End Sub
>
> Public Sub Draw()
> Dim objActivity
>
> Send "<table width=""100%"" border=""0"" cellspacing=""2""
> cellpadding=""1"">"
> Send "<tr><td align=""left"" valign=""top""><a href=""" &
> Replace(OnClick, "$date", DateString) & """><small>" & Day(DateString) &
> "</small></a></td></tr>"
> If mbActivitiesInit Then
> For Each objActivity In mcolActivities.Items
> Send "<tr><td height=""20""" & objActivity & "</td></tr>"
> Next
> End If
> Send "</table>"
> End Sub
>
> Private Sub Send(sHTML)
> Response.Write sHTML & vbCrLf
> End Sub
> End Class
>
>
> %>
>
> lots of lines.... but that is the code.
>
> now i have connected to the DB as you can see.
>
> the iheader field contains the title that i want. so somewhere i need a
> line that checks the date against the DB, and if true then display the
> title.
>
> can anyone help me here??
>
> thanks
> Jeff
>



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 5:39 PM   #4
Jeff
 
Jeff's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Another Calendar ?

does this mean that this was the wrong place to post this ???


"Jeff" <gig_bam@adelphia.net> wrote in message
news:a_adnVRvbZsjw4rZRVn-iw@adelphia.com...
> Ok. so i have a calendar script that displays the month and days. and it
> is set up to go to a page when a date is clicked on.
>
> what i would like to do, is connect it with a DB so that if there is a
> tourney on a day... it will show the title of the tourney in the date box.
> here is the script for the calendar.
>
>
> <!--#include file="connection.asp" -->
> <%
>
> Class Calendar
> Public Top
> Public Left
> Public Width
> Public Height
> Public Position
> Public ZIndex
> Public TitlebarColor
> Public TitlebarFont
> Public TitlebarFontColor
> Public TodayBGColor
> Public OnDayClick
> Public OnNextMonthClick
> Public OnPrevMonthClick
> Public ShowDateSelect
> Private mdDate
> Private msToday
> Private mnDay
> Private mnMonth
> Private mnYear
> Private mnDayMonthStarts
> Private mnDaysInMonth
> Private mcolDays
> Private mbDaysInitialized
>
> Private Sub Class_Initialize()
> Top = 0
> Left = 0
> Width = 500
> Height= 500
> Position = "absolute"
> TitlebarColor = "darkblue"
> TitlebarFont = "arial"
> TitlebarFontColor = "white"
> TodayBGColor = "skyblue"
> ShowDateSelect = True
> msToday = FormatDateTime(DateSerial(Year(Now()), Month(Now()),
> Day(Now())), 2)
> zIndex = 1
>
> Set mcolDays = Server.CreateObject("Scripting.Dictionary")
> If Request("date") <> "" Then SetDate(Request("date")) Else
> SetDate(Now())
>
> OnDayClick = Request.ServerVariables("SCRIPT_NAME")
> OnNextMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" &
> Server.URLEncode(DateSerial(mnYear, mnMonth + 1, mnDay))
> OnPrevMonthClick = Request.ServerVariables("SCRIPT_NAME") & "?date=" &
> Server.URLEncode(DateSerial(mnYear, mnMonth - 1, mnDay))
>
> mbDaysInitialized = False
> End Sub
>
> Private Sub Class_Terminate()
> If IsObject(mcolDays) Then
> mcolDays.RemoveAll
> Set mcolDays = Nothing
> End If
> End Sub
>
> Public Property Get GetDate()
> GetDate = mdDate
> End Property
>
> Public Property Get DaysInMonth()
> DaysInMonth = mnDaysInMonth
> End Property
>
> Public Property Get WeeksInMonth()
> If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then
> WeeksInMonth = 6
> Else
> WeeksInMonth = 5
> End If
> End Property
>
> Public Property Get Days(nIndex)
> If Not mbDaysInitialized Then InitDays()
> If mcolDays.Exists(nIndex) Then Set Days = mcolDays.Item(nIndex)
> End Property
>
> Private Sub InitDays()
> Dim nDayIndex
> Dim objNewDay
>
> If mcolDays.Count > 0 Then mcolDays.RemoveAll()
>
> For nDayIndex = 1 To mnDaysInMonth
> Set objNewDay = New CalendarDay
> objNewDay.DateString = FormatDateTime(DateSerial(mnYear, mnMonth,
> nDayIndex),2)
> objNewDay.OnClick = OnDayClick
>
> mcolDays.Add nDayIndex, objNewDay
> Next
>
> mbDaysInitialized = True
> End Sub
>
> Public Sub SetDate(dDate)
> mdDate = CDate(dDate)
> mnDay = Day(dDate)
> mnMonth = Month(dDate)
> mnYear = Year(dDate)
>
> mnDaysInMonth = Day(DateAdd("d", -1, DateSerial(mnYear, mnMonth + 1,
> 1)))
> mnDayMonthStarts = WeekDay(DateAdd("d", -(Day(CDate(dDate)) - 1),
> CDate(dDate)))
> End Sub
>
> Public Sub Draw()
> Dim nDayCount
> Dim nCellWidth, nCellHeight, nFontSizeRatio
> Dim objDay
>
> If Not mbDaysInitialized Then InitDays()
>
> nCellWidth = CInt(Width / 7)
> If (mnDayMonthStarts + mnDaysInMonth - 1) > 35 Then
> nCellHeight = CInt((Height - 80) / 6)
> Else
> nCellHeight = CInt((Height - 80) / 5)
> End If
>
> nFontSizeRatio = Fix(Width / 200)
>
> Send "<div id=""calendar"" style=""top: " & CStr(Top) & "px; left: " &
> CStr(Left) & "px; position: " & Position & "; z-index: " & ZIndex & """>"
> Send "<table border=""1"" width=""" & Width & """ height=""" & Height &
> """ cellspacing=""0"">"
> Send "<tr><td colspan=""7"" height=""10"" bgcolor=""" & TitlebarColor &
> """>"
> Send " <table border=""0"" width=""100%"" cellspacing=0>"
> Send " <tr>"
> Send " <td align=""left""><a style=""text-decoration: none; color: " &
> TitlebarFontColor & ";"" href=""" & Replace(OnPrevMonthClick, "$date",
> DateSerial(mnYear, mnMonth - 1, mnDay)) & """><font face=""" &
> TitlebarFont & """ size=""" & nFontSizeRatio &
> """><b>&nbsp;&lt;&lt;</b></font></a></td>"
> Send " <td align=""center""><font size=""" & nFontSizeRatio & """
> face=""" & TitlebarFont & """ color=""" & TitlebarFontColor & """><b>" &
> MonthName(mnMonth) & " " & mnYear & "</b></font></td>"
> Send " <td align=""right""><a style=""text-decoration: none; color: " &
> TitlebarFontColor & ";"" href=""" & Replace(OnNextMonthClick, "$date",
> DateSerial(mnYear, mnMonth + 1, mnDay)) & """><font face=""" &
> TitlebarFont & """ size=""" & nFontSizeRatio &
> """><b>&gt;&gt;&nbsp;</b></font></a></td>"
> Send " </tr>"
> Send " </table>"
> Send "</td></tr>"
> Send "<tr>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>S</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>M</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>T</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>W</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>T</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>F</small></td>"
> Send "<td height=""20"" width=""" & CStr(nCellWidth) & """
> align=""center""><small>S</small></td>"
> Send "</tr>"
>
> Send "<tr>"
> For nDayCount = 1 To mnDayMonthStarts - 1
> Send "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ bgcolor=""#dddddd"">&nbsp;</td>"
> Next
>
> nDayCount = nDayCount - 1
>
> For Each objDay In mcolDays.Items
>
> If nDayCount = 7 Then
> Send "</tr><tr>"
> nDayCount = 0
> End If
>
> Response.Write "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ valign=""top"" bgcolor="""
> If objDay.DateString = msToday Then Send TodayBGColor & """>" Else Send
> "white"">"
>
> objDay.Draw()
> Send "</td>"
>
> nDayCount = nDayCount + 1
> Next
>
> If nDayCount < 7 Then
> For nDayCount = nDayCount To 6
> Send "<td height=""" & CStr(nCellHeight) & """ width=""" &
> CStr(nCellWidth) & """ bgcolor=""#dddddd"">&nbsp;</td>"
> Next
> End If
>
> Send "</tr>"
>
> If ShowDateSelect Then
> Send "<tr><td height=""30"" colspan=""7"" align=""center"">"
> DrawDateSelect()
> Send "</td></tr>"
> End If
>
> Send "</table>"
> Send "</div>"
> End Sub
>
> Private Sub DrawDateSelect()
> Dim nIndex
> Send " <form id=frmGO name=frmGO>"
> Send " <table border=""0"">"
> Send " <tr>"
> Send " <td><select name=""month"">"
> For nIndex = 1 To 12
> Response.Write "<option value=""" & nIndex & """"
> If nIndex = Month(mdDate) Then Response.Write " selected"
> Send ">" & MonthName(nIndex, True) & "</option>"
> Next
> Send " </select></td>"
> Send " <td><select name=""year"">"
> For nIndex = Year(Now()) - 4 To Year(Now()) + 6
> Response.Write "<option value=""" & nIndex & """"
> If nIndex = Year(mdDate) Then Response.Write " selected"
> Send ">" & CStr(nIndex) & "</option>"
> Next
> Send " </select></td>"
> Send " <td><input type=""button"" Value=""Go""
> onclick=""document.location='" & Request.ServerVariables("SCRIPT_NAME") &
> "?date='+this.form.month.options[this.form.month.selectedIndex].value+'/1/'+this.form.year.options[this.form.year.selectedIndex].value;""
> id=1 name=1></td>"
> Send " </form>"
> Send " </tr></table>"
> End Sub
>
> Private Sub Send(sHTML)
> Response.Write sHTML & vbCrLf
> End Sub
>
> End Class
>
>
> Class CalendarDay
> Public DateString
> Public OnClick
> Private mcolActivities
> Private mbActivitiesInit
>
> Private Sub Class_Initialize()
> mbActivitiesInit = False
> End Sub
>
> Private Sub Class_Terminate()
> If IsObject(mcolActivities) Then
> mcolActivities.RemoveAll()
> Set mcolActivities = Nothing
> End If
> End Sub
>
> Private Sub InitActivities()
> Set mcolActivities = Server.CreateObject("Scripting.Dictionary")
> mbActivitiesInit = True
> End Sub
>
> Public Sub AddActivity(sActivity, sColor)
> If Not mbActivitiesInit Then InitActivities()
> mcolActivities.Add mcolActivities.Count + 1, "bgcolor=""" & sColor &
> """>" & sActivity
> End Sub
>
> Public Sub Draw()
> Dim objActivity
>
> Send "<table width=""100%"" border=""0"" cellspacing=""2""
> cellpadding=""1"">"
> Send "<tr><td align=""left"" valign=""top""><a href=""" &
> Replace(OnClick, "$date", DateString) & """><small>" & Day(DateString) &
> "</small></a></td></tr>"
> If mbActivitiesInit Then
> For Each objActivity In mcolActivities.Items
> Send "<tr><td height=""20""" & objActivity & "</td></tr>"
> Next
> End If
> Send "</table>"
> End Sub
>
> Private Sub Send(sHTML)
> Response.Write sHTML & vbCrLf
> End Sub
> End Class
>
>
> %>
>
> lots of lines.... but that is the code.
>
> now i have connected to the DB as you can see.
>
> the iheader field contains the title that i want. so somewhere i need a
> line that checks the date against the DB, and if true then display the
> title.
>
> can anyone help me here??
>
> thanks
> Jeff
>



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags:




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar (with a CSS layout) ©® CSS 3 07-01-2007 2:16 PM
Calendar Using CSS Layout Joe Follansbee HTML 1 07-01-2007 1:42 PM
Calendar Using CSS Layout Jacqui or (maybe) Pete HTML 0 07-01-2007 1:27 PM
Calendar Notification Bug? danielgazineu@gmail.com Google questions 0 05-28-2007 1:45 AM


Featured Websites




All times are GMT +1. The time now is 6:10 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98