Metropoli BBS
VIEWER: pick.asp MODE: TEXT (ASCII)
<% @ LANGUAGE=VBSCRIPT CODEPAGE = 1252 %>
<!--#include file="../constant.inc"-->
<!--#include file="../lib/session.inc"-->
<% SendHeader 0, 1 %>
<!--#include file="../lib/getrend.inc"-->
<!--#include file="../lib/pageutil.inc"-->
<%
'<!-- Microsoft Outlook Web Access-->
'<!-- Pick.asp : Date picker frame for the Calendar window -->
'<!-- Copyright (c) Microsoft Corporation 1993-1997. All rights reserved.-->

On Error Resume Next

urlFull = Request.QueryString()
x = CheckSession3(bstrVirtRoot+"/calendar/main_fr.asp?"+urlFull,"parent",1)

Set objRenderer = GetCalendarRenderer
Set objView = objRenderer.CurrentView

urlView  = Request.QueryString("view") '$ This is the current view; we need to communicate
                                       '$ this down to applet if specified. 
If urlView ="" then                
  urlView = 1                      
End if

' Get the requested start date (defaults to today)
szYear  = Request.QueryString("y")
szMonth = Request.QueryString("m")
szDay   = Request.QueryString("d")
If szYear = "0" And szMonth = "0" And szDay = "0" Then
	dt = Now()
	szYear = CStr(Year(dt))
	szMonth = CStr(Month(dt))
	szDay = CStr(Day(dt))
	Session(CURRENT_DATE) = dt
ElseIf szYear <> "" And szMonth <> "" And szDay <> "" Then
	Err.Clear
	dt = DateSerial(CInt(szYear), CInt(szMonth), CInt(szDay))
	szYear = CStr(Year(dt))
	szMonth = CStr(Month(dt))
	szDay = CStr(Day(dt))
	Session(CURRENT_DATE) = dt
Else
	dt = Session(CURRENT_DATE)
	szYear = CStr(Year(dt))
	szMonth = CStr(Month(dt))
	szDay = CStr(Day(dt))
End If

iFirstDOW = objOMSession.GetOption("FirstDayOfWeek") 
gmtOffset = getGMT()


'Localizers change this variable to adjust formatting
L_DayAbbreviation_Text = "" ' Used for FE
L_YearAbbreviation_Text = "" 'Used for FE

'Localizers change this variable to adjust formatting
AppletWidth=220
	
Function isGoodVM
	If (GetVersion < 4) And (isMSIE And isMac) Then 
        isGoodVM = False
    Else
        isGoodVM = True
    End If
End Function
%>
<HTML>
<HEAD>
<STYLE TYPE="text/css">
<!--
A:link 	{ color: black;
          text-decoration: none}
A:visited 	{ color: black;
              text-decoration: none}
A:active 	{ color: black;
            text-decoration: none}
-->
</STYLE>
<%
dim moname
moname = Array(L_Jan_Text, L_Feb_Text, L_Mar_Text, L_Apr_Text, L_May_Text, L_Jun_Text, L_Jul_Text, L_Aug_Text, L_Sep_Text, L_Oct_Text, L_Nov_Text, L_Dec_Text)
Sub DrawMonthPicker(nSelected) 
	Response.Write "<SELECT NAME='gotomonth'>"
	for x=1 to 12
		if x = nSelected then
			Response.Write vbCRLF + "<OPTION SELECTED value=" + cstr(x) + ">"+ moname(x-1)  
		else
			Response.Write vbCRLF + "<OPTION value=" + cstr(x) + ">" + moname(x-1) 
        end if
	next
	Response.Write "</SELECT>"
End Sub
%>
</HEAD>
<body bgcolor=c0c0c0 text=000000 alink=000000 vlink=000000 link=000000 onLoad="parent.done = true;">
<SCRIPT LANGUAGE="JavaScript">
<% If (GetVersion >= 4) Then %>
var javaEnabled=navigator.javaEnabled();
<% Else %>
var javaEnabled=true;
<% End If %>
var pickYear = <%=Year(dt)%>;
var pickMonth = <%=Month(dt)%>;
</SCRIPT>
<table border=0 width="100%">
<tr>
<td align=center>
<% If isGoodVM Then %>
<APPLET	NAME=Calendar CODE=Calendar.class WIDTH=<% =AppletWidth%> HEIGHT=340>
<PARAM NAME="CabBase" VALUE="Calendar.cab">
<PARAM NAME="MonthsAcross" VALUE="1">
<PARAM NAME="MonthsDown" VALUE="2">
<PARAM NAME="DaySelectionOnly" VALUE="false">
<PARAM NAME="ShowWeekNumbers" VALUE="true">
<PARAM NAME="EventsFrame" VALUE="event_fr">
<PARAM NAME="EventsURL" VALUE="events.asp">
<PARAM NAME="StartMonth" VALUE="<%= Month(dt) %>">
<PARAM NAME="StartDay" VALUE="<%= Day(dt) %>">
<PARAM NAME="StartYear" VALUE="<%= Year(dt) %>">
<PARAM NAME="DateOrder" VALUE="<%=L_DateView_Number%>">
<PARAM NAME="FirstDayOfWeek" VALUE="<%= iFirstDOW %>">
<PARAM NAME="StartSelectionType" VALUE="<%= urlView %>">
<% End If %>
<!-- HTML Date Picker -->
<SCRIPT LANGUAGE="JavaScript">
javaEnabled = false;
</SCRIPT>
<%
Err.Clear
objView.RenderDateNavigator dt, 2, Response
If Err.Number <> 0 Then
	Response.Write L_errRenderView_ErrorMessage
'	Response.Write L_errRenderView_ErrorMessage & err.Number & err.description
End If
%>
<FORM NAME="DatePickerfrm" METHOD=GET onSubmit="return(false);">
		<%If L_DateView_Number=0 Then %>
			<TABLE cellpadding=0 cellspacing=0 align=center><tr>
				<td><%DrawMonthPicker(CInt(szMonth))%></td>
				<td><INPUT TYPE=TEXTBOX NAME=gotoday  size=3 VALUE=<% =szDay %>></td>
				<td><INPUT TYPE=TEXTBOX NAME=gotoyear size=5 VALUE=<% =szYear %>></td>
			</TR></TABLE>
		<%ElseIf L_DateView_Number=1 Then%>
			<TABLE cellpadding=0 cellspacing=0 align=center><tr>
				<td><INPUT TYPE=TEXTBOX NAME=gotoyear size=7 VALUE=<% =szYear %>></td>
				<td><%DrawMonthPicker(CInt(szMonth))%></td>
				<td><INPUT TYPE=TEXTBOX NAME=gotoday  size=5 VALUE=<%  =szDay %>></td>
			</TR></TABLE>
		<%Else 'French%>
			<TABLE cellpadding=0 cellspacing=0 align=center><tr>
				<td><INPUT TYPE=TEXTBOX NAME=gotoday  size=3 VALUE=<% =szDay %>></td>
				<td><%DrawMonthPicker(CInt(szMonth))%></td>
				<td><INPUT TYPE=TEXTBOX NAME=gotoyear size=5 VALUE=<% =szYear %>></td>
			</TR></TABLE>
		<%End If%>
<BR>
<INPUT type=button name=GotoDate value="Go" onClick="self.gotoDateEntered()">
<INPUT type=button name=today value="Today" onClick="self.gotoToday()">
</FORM>
<SCRIPT LANGUAGE='JavaScript'>

<% If szYear = "0" OR szYear = "" Then %>
	dt = new Date();
	var m = dt.getMonth();
	var d = dt.getDate();
	var y = dt.getYear() + 1900;
<% Else %>
	var m = <% =szMonth %>;
	var d = <% =szDay %>;
	var y = <% =szYear %>;
<% End If %>
document.DatePickerfrm.gotomonth.selectedIndex = m-1;
<% If L_DateView_Number=1 Then%>
document.DatePickerfrm.gotoday.value = d + " <%= L_DayAbbreviation_Text%>";
document.DatePickerfrm.gotoyear.value = y + " <%= L_YearAbbreviation_Text%>";
<% Else %>
document.DatePickerfrm.gotoday.value = d;
document.DatePickerfrm.gotoyear.value = y;
<% End If %>
</SCRIPT>
<% If isGoodVM Then %>
</APPLET>
<% End If %>
</TD>
</TR>
<TR>
<TD ALIGN=CENTER>


</TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE='JavaScript'>
    var L_InvalidDate_Text = "You must specify a valid date. Check your entries in this dialog box to make sure they represent a valid date.";

	function IsLeapYear(yr)
	{
		if ((yr	% 4	== 0) && (yr % 100 != 0) ||	(yr	% 400 == 0))
			return 1;
		else
			return 0;
	}

	function daysInMonth(mo, yr)
	{
		if (mo == 2)
			return 28 + IsLeapYear(yr);
		else
		    return 30 + ((mo + (mo > 7)) % 2);
	}

	function check()
	{
		// Check for Valid input
		SF = self.document.DatePickerfrm;
		var gotoyear = parseInt(SF.gotoyear.value);
		if (!isNaN(gotoyear))
		{
		
		    if ((1970 <= gotoyear) && (gotoyear <= 2038))
    		{
	    		SF.gotoyear.value = gotoyear; 
		    }
		    else if ((70 <= gotoyear) && (gotoyear <= 99))
    		{
	    		SF.gotoyear.value = gotoyear + 1900; 
		    }
		    else if ((0 <= gotoyear) && (gotoyear <= 38))
    		{
	    		SF.gotoyear.value = gotoyear + 2000; 
		    }
            else
            {
    			alert(L_InvalidDate_Text);
	    		return false;
            }
        }
		else
		{
			alert(L_InvalidDate_Text);
			return false;
		}

		var gotoday = parseInt(SF.gotoday.value);
		if  (!isNaN(gotoday) && 
		     (1 <= gotoday) && (gotoday <= daysInMonth(SF.gotomonth.selectedIndex+1, gotoyear)))
		{
			SF.gotoday.value = gotoday; 
		}
		else
		{
			alert(L_InvalidDate_Text);
			return false;
		}
		d = SF.gotoday.value;
		y = SF.gotoyear.value;
		m = SF.gotomonth.selectedIndex;
        return true;
	}

	function gotoToday()
	{
		if (javaEnabled == true)
		{
		    if (parent.done == true)
            {
                if(document.Calendar != null)
    			    document.Calendar.gotoToday();
            }
        }
		else 
			gotoDate(0,0,0);
	}

	function gotoDate(yr, mo, dy)
	{
		parent.event_fr.location = "events.asp?y=" + yr + "&m=" + mo + "&d=" + dy + "&view=1";
		if (javaEnabled == false)
		{
    		if (yr != pickYear || mo != pickMonth)
    		{
    			self.location        =   "pick.asp?y=" + yr + "&m=" + mo + "&d=" + dy;
    		}
		}
	}

	function gotoDateEntered()
	{
		SF = self.document.DatePickerfrm;

        if (!check())
            return;

		var dy = new Number(document.DatePickerfrm.gotoday.value);
		var yr = new Number(document.DatePickerfrm.gotoyear.value);
		var mo = new Number(document.DatePickerfrm.gotomonth.selectedIndex + 1);

   		if (javaEnabled == true)
		{
		    if (parent.done == true)
    		{
    			dt = mo.toString() + "/" + dy.toString() + "/"+ yr.toString();
        		var nt = document.Calendar.gotoDate(dt);
    		}
        }
		else 
		{
			gotoDate(yr,mo,dy);
		}
	}

</SCRIPT>
</BODY>
</HTML>
[ RETURN TO DIRECTORY ]