PDA

View Full Version : Web App Calendar Popup



Joe Coley
13-Jan-2006, 10:41 AM
I seem to remember back when I didn't want, need or understand it, that I
saw some reference to a calendar popup similar to the one in VDFQuery --
only asp that could be used for a webapp. Searching now I'm coming up with
zip. Can anyone point me in the right direction to find out how to do this?

TIA,
Joe Coley

Ian Telfer
15-Jan-2006, 10:21 PM
Hi Joe,

I think this is what you mean, not sure where it came from though.

Cheers

Ian


Joe Coley wrote:
> I seem to remember back when I didn't want, need or understand it, that I
> saw some reference to a calendar popup similar to the one in VDFQuery --
> only asp that could be used for a webapp. Searching now I'm coming up with
> zip. Can anyone point me in the right direction to find out how to do this?
>
> TIA,
> Joe Coley
>
>


<%
Response.Expires = -1
BeginCal = False

' Check to see which month we will be displaying
dToday = Request.QueryString("Date")
If Request.QueryString("Date") = "" Then
dToday = Date()
End If

' Split the parts of the date for later use
MonthNum = Month(dToday)
Month_Name = MonthName(MonthNum)
DayNum = Day(dToday)
ThisYear = Year(dToday)

' If Len(MonthNum) < 2 Then
' MoNum = "0" & MonthNum
' Else
' MoNum = MonthNum
' End If
'
' MoYr = MoNum & "/" & ThisYear

' Find the first and last day of the current month
FirstDayOfMonth = MonthNum & "/01/" & ThisYear
FirstWeekday = Weekday(FirstDayOfMonth)

LastDay = 32

Do
LastDay = LastDay - 1
LastDateOfMonth = MonthNum & "/" & LastDay & "/" & ThisYear
Loop Until IsDate(LastDateOfMonth)

LastDayOfMonth = Day(LastDateOfMonth)

' Find the dates of the previous and the next month for navigation
If MonthNum > 1 Then
PrevMonth = MonthNum - 1 & "/01/" & ThisYear
Else
PrevMonth = "12/01/" & ThisYear - 1
End If

If MonthNum < 12 Then
NextMonth = MonthNum + 1 & "/01/" & ThisYear
Else
NextMonth = "01/01/" & ThisYear + 1
End If

%>
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>Click on the Date You Wish to Use</title>
<style type="text/css">
<!--
td {font-family: verdana, arial; font-size: 10pt}
..month {font-family: arial, verdana; font-size: 14pt; font-weight: bold}
-->
</style>
<script language="JavaScript">
<!--
var dateField
var parentWindow

function loadValues(){
if(self.opener){
parentWindow = self.opener
dateField = parentWindow.currentField
}
}

function returnDateValue(day){
if(document.all){
dayNum = day.innerText
newDate = "<%=MonthNum%>/" + dayNum + "/<%=ThisYear%>"
if(dateField){
dateField.value = newDate
dateField.focus()
self.close()
}
}
}

function hilite(day,glow){
if(document.all){
if(glow){ day.bgColor = "aqua" }
else { day.bgColor = "white" }
}
}

function changeMonth(field){
month = field.selectedIndex
url = "date-picker.asp?Date=" + month + "/01/<%=ThisYear%>"
self.location.href = url
}

function returnLinkValue(day){
if(document.all){event.cancelbubble = true}
if(dateField){
newDate = "<%=MonthNum%>/" + day + "/<%=ThisYear%>"
dateField.value = newDate
dateField.focus()
self.close()
}
}

//-->
</script>
</head>

<body onLoad="loadValues()">
<form>
<table border="2" cellpadding="2" bgcolor="#C0C0C0" bordercolorlight="#006699" bordercolordark="#000000">
<tr>
<td colspan="7">

<table width="100%" border="0" bgcolor="#FFFFFF">
<tr>
<td nowrap align="center">
<a href="date-picker.asp?Date=<%=PrevMonth%>" accesskey="B" onFocus="this.click()"
style="text-decoration:none">&lt;&lt; <u>B</u>ack</a>
</td>
<td width="100%" align="center" class="month"><%= Month_Name & " " & ThisYear %></td>
<td nowrap align="center">
<a href="date-picker.asp?Date=<%=NextMonth%>" accesskey="N" onFocus="this.click()"
style="text-decoration:none"><u>N</u>ext &gt;&gt;</a>
</td>
</tr>
</table>

</td>
</tr>
<tr>
<td width="50" align="center" bgcolor="#006699" bordercolorlight="#000000" bordercolordark="#FFFFFF"><font color="#FFFFFF">Sun</font></td>
<td width="50" align="center" bgcolor="#006699" bordercolorlight="#000000" bordercolordark="#FFFFFF"><font color="#FFFFFF">Mon</font></td>
<td width="50" align="center" bgcolor="#006699" bordercolorlight="#000000" bordercolordark="#FFFFFF"><font color="#FFFFFF">Tue</font></td>
<td width="50" align="center" bgcolor="#006699" bordercolorlight="#000000" bordercolordark="#FFFFFF"><font color="#FFFFFF">Wed</font></td>
<td width="50" align="center" bgcolor="#006699" bordercolorlight="#000000" bordercolordark="#FFFFFF"><font color="#FFFFFF">Thu</font></td>
<td width="50" align="center" bgcolor="#006699" bordercolorlight="#000000" bordercolordark="#FFFFFF"><font color="#FFFFFF">Fri</font></td>
<td width="50" align="center" bgcolor="#006699" bordercolorlight="#000000" bordercolordark="#FFFFFF"><font color="#FFFFFF">Sat</font></td>
</tr>
<%
dTemp = date()

For Row = 1 To 6
%>
<tr>
<%
For Cell = 1 To 7
If Row = 1 And Cell = FirstWeekDay Then
ThisDay = 1
BeginCal = True
ElseIf BeginCal And ThisDay < LastDayOfMonth Then
ThisDay = ThisDay + 1
Else
ThisDay = "&nbsp;"
End If
%>
<td align="center" <% If Not ThisDay = "&nbsp;" Then
Response.Write "onClick='returnDateValue(this);' " & _
"onMouseOver='hilite(this,true);' onMouseOut='hilite(this,false);'"
End If %> <%
If MonthNum = Month(dTemp) And ThisDay = Day(dTemp) And ThisYear = Year(dTemp) Then
Response.Write "style='font-weight:bold;font-size:12pt;font-family:arial'"
End If %> bgcolor="#FFFFFF">
<% If Not ThisDay = "&nbsp;" Then %><a href="JavaScript://" onClick="returnLinkValue('<%=ThisDay%>');"><% End If %>
<%=ThisDay%><% If Not ThisDay = "&nbsp;" Then %></a><% End If %></td>
<% Next %>
</tr>
<%
If (Row > 2 And ThisDay = "&nbsp;") Or (ThisDay = LastDayOfMonth) Then Exit For
Next

%>
</table>

<table border="0" width="100%">
<tr>
<td width="50%">
<p><font face="Verdana" size="2">
<a href="JavaScript://" onClick="self.close();">Close this Window</a>
</font></p>
</td>
<td width="50%">
<p align="right">
<select size="1" name="month" style="font-size:8pt" onchange="changeMonth(this);">
<option selected >Jump to Month:</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">Novemeber</option>
<option value="12">December</option>
</select>
</td>
</tr>
</table>

</form>
</body>
</html>

Anders Öhrt
16-Jan-2006, 03:46 AM
>I seem to remember back when I didn't want, need or understand it, that I
> saw some reference to a calendar popup similar to the one in VDFQuery --
> only asp that could be used for a webapp. Searching now I'm coming up
> with
> zip. Can anyone point me in the right direction to find out how to do
> this?

I found a very good and flexible, and free (LGPL), calender just last week.
Check out http://www.dynarch.com/projects/calendar/.

// Anders

wila
22-Jan-2006, 06:30 PM
Anders Öhrt wrote:
> I found a very good and flexible, and free (LGPL), calender just last week.
> Check out http://www.dynarch.com/projects/calendar/.
Ah.. Mishoo did it again... HtmlArea.. was/is dead.. while i liked it in
the past. His latest date popup calender (this one) is wicked. Thanks
Anders for pointing me to this again.
I love his aqua theme on the calendar popup, it makes all the
difference.. guess i should thank him personally :)

--
Wil