home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
iis4_03.cab
/
iihdrhd.asp
< prev
next >
Wrap
Text File
|
1997-11-12
|
19KB
|
731 lines
<%@ LANGUAGE=VBScript %>
<% Option Explicit %>
<% Response.Expires = 0 %>
<% if Session("FONTSIZE") = "" then %>
<!--#include file="iito.inc"-->
<% else %>
<%
' strings for localization
Const L_HTTPHEADERS_TEXT = "HTTP Headers"
Const L_ACCESSDENIED_TEXT="Access Denied"
Const L_ENABLEEXPIRE_TEXT="Enable Content Expiration"
Const L_CONTENTSHOULD_TEXT="Content should:"
Const L_EXPIMM_TEXT="Expire Immediately"
Const L_EXPAFT_TEXT="Expire after"
Const L_SECONDS_TEXT="Second(s)"
Const L_MINUTES_TEXT="Minute(s)"
Const L_HOURS_TEXT="Hour(s)"
Const L_DAYS_TEXT="Day(s)"
Const L_EXPON_TEXT="Expire on"
Const L_MIDNIGHT_TEXT="Midnight"
Const L_MONTH_TEXT="Month"
Const L_DAY_TEXT="Day"
Const L_YEAR_TEXT="Year"
Const L_TIME_TEXT="Time"
Const L_ENTERHEADER_TEXT="Enter a custom name and value pair below:"
Const L_SAMPHDR_TEXT="Custom Header:Value"
Const L_SELECTITEM_TEXT="Select a header to delete."
Const L_JAN_TEXT = "January"
Const L_FEB_TEXT = "February"
Const L_MAR_TEXT = "March"
Const L_APR_TEXT = "April"
Const L_MAY_TEXT = "May"
Const L_JUN_TEXT = "June"
Const L_JUL_TEXT = "July"
Const L_AUG_TEXT = "August"
Const L_SEP_TEXT = "September"
Const L_OCT_TEXT = "October"
Const L_NOV_TEXT = "November"
Const L_DEC_TEXT = "December"
Const L_MON_TEXT = "Monday"
Const L_TUE_TEXT = "Tuesday"
Const L_WED_TEXT = "Wednesday"
Const L_THU_TEXT = "Thursday"
Const L_FRI_TEXT = "Friday"
Const L_SAT_TEXT = "Saturday"
Const L_SUN_TEXT = "Sunday"
On Error Resume Next
Dim path, currentobj, httpexp, timeunit,expireon, SetLocale
SetLocale = False
path=Session("dpath")
Session("path")=path
Set currentobj=GetObject(path)
Session("SpecObj")=path
Session("SpecProps")="HttpExpires"
httpexp=currentobj.HttpExpires
if err <> 0 then
httpexp="d,-1"
end if
httpexp = UCase(trim(httpexp))
timeunit="<OPTION VALUE=0>" & L_SECONDS_TEXT & "<OPTION VALUE=1 SELECTED>" & L_MINUTES_TEXT & "<OPTION VALUE=2>" & L_HOURS_TEXT & "<OPTION VALUE=3 >" & L_DAYS_TEXT
function expires()
httpexp = UCase(Trim(httpexp))
if len(httpexp)= 0 then
expires="<INPUT TYPE='checkbox' NAME='hdnchkHttpExpires' OnClick='SetExp(null);top.title.Global.updated=true;'>"
elseif httpexp="D,-1" then
expires="<INPUT TYPE='checkbox' NAME='hdnchkHttpExpires' OnClick='SetExp(null);top.title.Global.updated=true;'>"
elseif Left(httpexp,2)="S," then
expires="<INPUT TYPE='checkbox' NAME='hdnchkHttpExpires' CHECKED OnClick='SetExp(null);top.title.Global.updated=true;'>"
elseif Left(httpexp,2)="D," then
expires="<INPUT TYPE='checkbox' NAME='hdnchkHttpExpires' CHECKED OnClick='SetExp(null);top.title.Global.updated=true;'>"
else
expires="<INPUT TYPE='checkbox' NAME='hdnchkHttpExpires' OnClick='SetExp(null);top.title.Global.updated=true;'>"
end if
end function
function expireType(thisbutton)
Dim typestr, etype
typestr=Mid(httpexp,1,4)
if typestr="" then
etype=""
elseif Mid(httpexp,1,2)="D," then
if len(httpexp) > 4 then
etype=1
else
etype=0
end if
elseif Mid(httpexp,1,2)="S," then
etype=2
else
etype=""
end if
if thisbutton=etype then
expireType="<INPUT TYPE='radio' NAME='hdnrdoHttpExpires' CHECKED OnClick='SetExp(" & thisbutton & ");top.title.Global.updated=true;'>"
else
expireType="<INPUT TYPE='radio' NAME='hdnrdoHttpExpires' OnClick='SetExp(" & thisbutton & ");top.title.Global.updated=true;'>"
end if
end function
function hexToDec(hexstr)
hexToDec = CLng("&H" & hexstr)
end function
function writeExpires(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly,readonly)
On Error Resume Next
Dim strExpires, numsecs, timeelapse, thisdate
strExpires=httpexp
'global
expireon=""
'httpexp is global
if Mid(httpexp,1,2) = "D," then
numsecs = Trim(Mid(strExpires,Instr(strExpires,",")+1))
if fieldname="Seconds" then
if instr(numsecs,"X") then
numsecs=hexToDec(Trim(Mid(numsecs, Instr(numsecs,"X")+1)))
end if
timeelapse=numsecs
if numsecs mod 86400=0 then
timeelapse=numsecs/86400
'timeunit is global
timeunit="<OPTION VALUE=0 >" & L_SECONDS_TEXT & "<OPTION VALUE=1>" & L_MINUTES_TEXT & "<OPTION VALUE=2>" & L_HOURS_TEXT & "<OPTION SELECTED VALUE=3>" & L_DAYS_TEXT
elseif numsecs mod 3600=0 then
timeelapse=numsecs/3600
'timeunit is global
timeunit="<OPTION VALUE=0 >" & L_SECONDS_TEXT & "<OPTION VALUE=1>" & L_MINUTES_TEXT & "<OPTION SELECTED VALUE=2 >" & L_HOURS_TEXT & "<OPTION VALUE=3>" & L_DAYS_TEXT
elseif numsecs mod 60=0 then
timeelapse=numsecs/60
'timeunit is global
timeunit="<OPTION VALUE=0 >" & L_SECONDS_TEXT & "<OPTION SELECTED VALUE=1>" & L_MINUTES_TEXT & "<OPTION VALUE=2>" & L_HOURS_TEXT & "<OPTION VALUE=3>" & L_DAYS_TEXT
end if
if timeelapse > 0 then
expireon=timeelapse
else
expireon=""
end if
end if
elseif Mid(httpexp,1,2) = "S," then
SetLocale = True
'trim off the "S,"
strExpires = Mid(strExpires,Instr(strExpires,",")+1)
'trim off the "Day,"
strExpires = Mid(strExpires,Instr(strExpires,",")+1)
'trim off the GMT... plus any spaces...
strExpires=Trim(Mid(strExpires,1, len(strExpires)-3))
if isDate(strExpires) then
thisdate=CDate(strExpires)
end if
Select Case fieldname
Case "Date"
dim Dy,Mo, Yr
Dy = Day(thisdate)
Mo = Month(thisdate)
Yr = Year(thisdate)
expireon= WeekDayName(WeekDay(Mo & "/" & Dy & "/" & Yr),False,vbUseSystem) & ", " & MonthName(Mo, False)& " " & Dy & ", " & Yr
Case "Hours"
expireon=Hour(thisdate)
Case "Minutes"
expireon=Minute(thisdate)
End Select
else
expireon=""
end if
writeExpires=inputboxfixed(err,"TEXT", ("hdn" & "HttpExpires" & fieldname), expireon ,fieldsize,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly)
end function
%>
<!--#include file="iiset.inc"-->
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="JavaScript">
top.title.Global.helpFileName="iipy_9";
top.title.Global.siteProperties = false;
userSet=true;
EXP_NONE = 0
EXP_DYNAMIC = 1
EXP_STATIC = 2
MONTHS = new Array()
MONTHS[0] = "<%= L_JAN_TEXT %>";
MONTHS[1] = "<%= L_FEB_TEXT %>";
MONTHS[2] = "<%= L_MAR_TEXT %>";
MONTHS[3] = "<%= L_APR_TEXT %>";
MONTHS[4] = "<%= L_MAY_TEXT %>";
MONTHS[5] = "<%= L_JUN_TEXT %>";
MONTHS[6] = "<%= L_JUL_TEXT %>";
MONTHS[7] = "<%= L_AUG_TEXT %>";
MONTHS[8] = "<%= L_SEP_TEXT %>";
MONTHS[9] = "<%= L_OCT_TEXT %>";
MONTHS[10] = "<%= L_NOV_TEXT %>";
MONTHS[11] = "<%= L_DEC_TEXT %>";
DAYS = new Array()
DAYS[0] = "<%= L_SUN_TEXT %>";
DAYS[1] = "<%= L_MON_TEXT %>";
DAYS[2] = "<%= L_TUE_TEXT %>";
DAYS[3] = "<%= L_WED_TEXT %>";
DAYS[4] = "<%= L_THU_TEXT %>";
DAYS[5] = "<%= L_FRI_TEXT %>";
DAYS[6] = "<%= L_SAT_TEXT %>";
function isNum(txtcntrl,min) {
str=txtcntrl.value;
for (var i=0; i < str.length; i++) {
num = parseInt(str);
if (isNaN(num)){
alert("Please enter an integer.");
return false;
}
if (num < min) {
alert("Please enter an integer greater than " + (min-1) + ".");
return false;
}
}
return true;
}
function SetRdo(rdo,fromCntrl, toCntrl){
if (!rdo){
if (fromCntrl.value !=""){
toCntrl.value=fromCntrl.value;
fromCntrl.value="";
}
}
else{
if (toCntrl.value !=""){
fromCntrl.value=toCntrl.value;
toCntrl.value="";
}
}
}
function SetExp(expType){
if (expType==null){
if (document.userform.hdnchkHttpExpires.checked){
document.userform.hdnrdoHttpExpires[0].checked=true;
document.userform.HttpExpires.value=document.userform.hdnHttpExpires.value;
}
else{
document.userform.hdnHttpExpires.value=document.userform.HttpExpires.value;
document.userform.HttpExpires.value="d,-1";
clearSeconds();
clearGMT();
}
}
else{
document.userform.hdnchkHttpExpires.checked=true;
if (expType == EXP_NONE){
document.userform.HttpExpires.value="D,0";
clearSeconds();
clearGMT();
}
if (expType == EXP_DYNAMIC){
clearGMT();
expsecs=parseInt(document.userform.hdnhdnHttpExpiresSeconds.value);
if (isNaN(expsecs))
{
expsecs = 30;
document.userform.hdnHttpSeconds.value = 1800;
document.userform.hdnHttpExpiresTimeUnit.options[1].selected = true;
}
document.userform.hdnHttpExpiresSeconds.value=expsecs;
secval = parseInt(document.userform.hdnHttpSeconds.value);
secstr = secval.toString(16);
<% ' Netscape's toString is broken... this hack should fix it... %>
<% if not Session("IsIE") then %>
while (secstr.indexOf(":") > -1){
secstr = secstr.substring(0,secstr.indexOf(":")) + "a" + secstr.substring(secstr.indexOf(":")+1,secstr.length);
}
<% end if %>
document.userform.HttpExpires.value="D,0X"+secstr;
}
if (expType == EXP_STATIC){
clearSeconds();
setRadiotoStatic();
expdate=new Date();
SetDateCntrls(expdate)
}
}
}
function clearSeconds(){
if (document.userform.hdnHttpExpiresSeconds.value !=""){
userSet=false;
document.userform.hdnhdnHttpExpiresSeconds.value=document.userform.hdnHttpExpiresSeconds.value ;
document.userform.hdnHttpExpiresSeconds.value="";
userSet=true;
}
}
function SetSeconds(){
tp=document.userform.hdnHttpExpiresTimeUnit.selectedIndex;
if (document.userform.hdnHttpExpiresSeconds.value==""){
expsecval=0;
}
else{
expsecval=parseInt(document.userform.hdnHttpExpiresSeconds.value);
if (tp==0){
document.userform.hdnHttpSeconds.value=expsecval ;
}
if (tp==1){
document.userform.hdnHttpSeconds.value=expsecval * 60;
}
if (tp==2){
document.userform.hdnHttpSeconds.value=expsecval * 3600;
}
if (tp==3){
document.userform.hdnHttpSeconds.value=expsecval * 86400;
}
document.userform.hdnrdoHttpExpires[1].checked=true;
document.userform.hdnhdnHttpExpiresSeconds.value=document.userform.hdnHttpExpiresSeconds.value;
SetExp(EXP_DYNAMIC);
}
}
function SetLocale(){
expdate=parseUIDate();
tzdiff=expdate.getTimezoneOffset()
hrsdiff=parseInt(tzdiff/60)
mindiff=tzdiff%(hrsdiff*60)
var hrs = document.userform.hdnHttpExpiresHours.value
var mns = document.userform.hdnHttpExpiresMinutes.value
if (hrs == "")
{
hrs = 0;
}
if (mns == "")
{
mns = 0;
}
expdate.setHours(hrs - hrsdiff);
expdate.setMinutes(mns -mindiff);
SetDateCntrls(expdate)
}
function SetDateCntrls(dateObj){
year=dateObj.getYear();
if (year < 100){
year="19" + year;
}
datestr = DAYS[dateObj.getDay()] + ", " + MONTHS[dateObj.getMonth()] + " " + dateObj.getDate() + ", " + year;
document.userform.hdnHttpExpiresDate.value = datestr;
document.userform.hdnHttpExpiresHours.value=dateObj.getHours();
document.userform.hdnHttpExpiresMinutes.value=dateObj.getMinutes();
if (document.userform.hdnHttpExpiresMinutes.value < 10){
document.userform.hdnHttpExpiresMinutes.value="0" + document.userform.hdnHttpExpiresMinutes.value;
}
document.userform.HttpExpires.value="s," + expdate.toGMTString();
}
function setRadiotoStatic(){
document.userform.hdnchkHttpExpires.checked=true;
document.userform.hdnrdoHttpExpires[2].checked=true;
<% if Session("Browser") = "IE4" then %>
document.userform.hdnHttpExpiresDate.disabled = false;
<% end if %>
}
function setStaticDate(){
newDate = parseUIDate();
newDate.setHours(document.userform.hdnHttpExpiresHours.value);
newDate.setMinutes(document.userform.hdnHttpExpiresMinutes.value);
document.userform.HttpExpires.value = "s,"+newDate.toGMTString();
}
function fixStaticDate(staticdate)
{
return staticdate;
}
function parseUIDate(){
if (document.userform.hdnHttpExpiresDate.value != "")
{
datestr = document.userform.hdnHttpExpiresDate.value;
datestr = datestr.substring(datestr.indexOf(",")+2, datestr.length);
newDate = new Date(datestr);
}
else{
<% if Session("Browser") = "IE4" then %>
document.userform.hdnHttpExpiresDate.disabled = true;
<% end if %>
newDate = new Date();
}
return newDate;
}
function clearGMT(){
document.userform.hdnHttpExpiresDate.value="";
document.userform.hdnHttpExpiresHours.value="";
document.userform.hdnHttpExpiresMinutes.value="";
}
function popBox(title, width, height, filename){
thefile=(filename + ".asp");
thefile="iipop.asp?pg="+thefile;
<% if Session("Browser") <> "IE3" then %>
width=width +25;
height=height + 50;
<% end if %>
popbox=window.open(thefile,title,"toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+width+",height="+height);
if(popbox !=null){
if (popbox.opener==null){
popbox.opener=self;
}
}
}
function popCalendar(cntrlname,someDate){
if (someDate == ""){
newdate = new Date();
someDate = newdate.toGMTString();
}
thefile="calendar.asp?cntrl="+cntrlname + "¤tDate=" + escape(someDate);
<% if Session("FONTSIZE") = "LARGE" then %>
popbox=window.open(thefile,"Calendar","resizable=yes,toolbar=no,scrollbars=no,directories=no,menubar=no,width=250,height=260");
<% else %>
popbox=window.open(thefile,"Calendar","resizable=yes,toolbar=no,scrollbars=no,directories=no,menubar=no,width=250,height=240");
<% end if %>
if(popbox !=null){
if (popbox.opener==null){
popbox.opener=self;
}
}
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#CCCCCC" TOPMARGIN=5 TEXT="#000000" LINK="#FFFFFF" onLoad="loadList();" STYLE="font-face: Helv,Arial; font-size:10pt;">
<FONT SIZE=1 FACE="HELV,ARIAL">
<FORM NAME="userform">
<B>
<%= L_HTTPHEADERS_TEXT %>
</B>
<P>
<%= expires %>
<%= L_ENABLEEXPIRE_TEXT %>
<P>
<TABLE BORDER=0 CELLPADDING=0>
<TR>
<TD VALIGN="top" WIDTH = 100>
<FONT SIZE=1 FACE="HELV,ARIAL">
<%= L_CONTENTSHOULD_TEXT %>
</FONT>
</TD>
<TD VALIGN="top">
<FONT SIZE=1 FACE="HELV,ARIAL">
<%= expireType(0) %>
</FONT>
</TD>
<TD>
<FONT SIZE=1 FACE="HELV,ARIAL">
<%= L_EXPIMM_TEXT %>
</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="top">
</TD>
<TD VALIGN="top">
<FONT SIZE=1 FACE="HELV,ARIAL">
<%= expireType(1) %>
</FONT>
</TD>
<TD>
<FONT SIZE=1 FACE="HELV,ARIAL">
<%= L_EXPAFT_TEXT %>
<%= writeExpires("Seconds",5,"","","isNum(this,0);SetSeconds();",true,false,False) %>
<INPUT TYPE="hidden" NAME="hdnHttpSeconds">
<SELECT NAME="hdnHttpExpiresTimeUnit" OnChange="SetSeconds();top.title.Global.updated=true;">
<%= timeunit %>
</SELECT>
</FONT>
</TD>
</TR>
<TR>
<TD VALIGN="top">
</TD>
<TD VALIGN="top">
<FONT SIZE=1 FACE="HELV,ARIAL">
<%= expireType(2) %>
</FONT>
</TD>
<TD>
<FONT SIZE=1 FACE="HELV,ARIAL">
<%= L_EXPON_TEXT %>
</FONT>
</TD>
</TR>
<TR>
<TD COLSPAN=2>
</TD>
<TD>
<TABLE>
<TR>
<TD>
<FONT SIZE=1 FACE="HELV,ARIAL">
<%= writeExpires("Date",35,"","","setStaticDate();",false,false,True) %>
<INPUT TYPE="button" VALUE="..." OnClick="setRadiotoStatic();popCalendar('document.userform.hdnHttpExpiresDate',document.userform.hdnHttpExpiresDate.value);">
<INPUT TYPE="hidden" NAME="HttpExpires" VALUE="<%= currentobj.HttpExpires %>">
<INPUT TYPE="hidden" NAME="hdnHttpExpires" VALUE="<%= currentobj.HttpExpires %>">
</FONT>
</TD>
<TD> </TD>
<TD><FONT SIZE=1 FACE="HELV,ARIAL"><%= writeExpires("Hours",2,"","","isNum(this,0);setStaticDate();",false,false,false) %>: <%= writeExpires("Minutes",2,"","","isNum(this,0);setStaticDate();",false,false,false) %></FONT></TD>
</TR>
<TR>
<TD> </TD>
<TD> </TD>
<TD ALIGN="center"><FONT SIZE=1 FACE="HELV,ARIAL"><%= L_TIME_TEXT %></FONT></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</FONT>
</TD>
</TR>
</TABLE>
</FORM>
<HR>
<SCRIPT LANGUAGE="JavaScript">
function loadList(){
<% if SetLocale then %>
SetLocale();
<% end if %>
<% if Session("IsIE") then %>
parent.list.location.href = "iihdrls.asp";
<% else %>
parent.frames[1].location.href="iihdrls.asp";
<% end if %>
}
function addItem(){
header=prompt("<%= L_ENTERHEADER_TEXT %>","<%= L_SAMPHDR_TEXT %>");
if ((header != "") && (header != null)){
i=cachedList.length;
cachedList[i]=new listObj(header);
cachedList[i].updated=true;
cachedList[i].newitem=true;
loadList();
}
}
function delItem(){
ndxnum=parent.list.document.userform.selHttpCustomHeader.options.selectedIndex;
if (ndxnum != -1){
var i=parent.list.document.userform.selHttpCustomHeader.options[ndxnum].value;
if (i !=""){
cachedList[i].deleted=true;
cachedList[i].updated=true;
loadList();
}
}
else{
alert("<%= L_SELECTITEM_TEXT %>");
}
}
function buildListForm(){
numrows=0;
for (var i=0; i < cachedList.length; i++) {
if ((!cachedList[i].deleted) && (cachedList[i].header !="")){
numrows=numrows + 1;
}
}
qstr="numrows="+numrows;
qstr=qstr+"&cols=HttpCustomHeaders"
top.body.hlist.location.href="iihdn.asp?"+qstr;
<% 'the list values will be grabbed by the hiddenlistform script... %>
}
function SetListVals(){
listForm=parent.parent.hlist.document.hiddenlistform;
j=0;
for (var i=0; i < cachedList.length; i++) {
if ((!cachedList[i].deleted) && (cachedList[i].header !="")){
listForm.elements[j++].value=cachedList[i].header;
//cachedList[i].updated=false;
}
}
}
function popBox(title, width, height, filename){
thefile=(filename + ".asp");
thefile="iipop.asp?pg="+thefile;
<% if not Session("IsIE") then %>
width=width +25;
height=height + 50;
<% end if %>
popbox=window.open(thefile,title,"toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+width+",height="+height);
if(popbox !=null){
if (popbox.opener==null){
popbox.opener=self;
}
}
}
function listFuncs(){
this.loadList=loadList;
this.addItem=addItem;
this.delItem=delItem;
this.writeList=buildListForm;
this.popBox=popBox;
this.SetListVals=SetListVals;
this.ndx=0;
}
function listObj(header){
this.header=header;
this.deleted=false;
this.updated=false;
this.newitem=false;
}
cachedList=new Array()
listFunc=new listFuncs();
<%
Dim aHdrs,arraybound, i
aHdrs=currentobj.HttpCustomHeaders
arraybound=UBound(aHdrs)
if aHdrs(arraybound) <> "" then
for i=0 to arraybound
%>cachedList[<%= i %>]=new listObj("<%= aHdrs(i) %>");<%
Next
end if
%>
</SCRIPT>
</FONT>
</BODY>
</HTML>
<% end if %>