Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

655 lines
15 KiB

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="directives.inc" -->
  4. <% if Session("FONTSIZE") = "" then %>
  5. <!--#include file="iito.inc"-->
  6. <% else %>
  7. <!--#include file="iihdrhd.str"-->
  8. <!--#include file="calendar.str"-->
  9. <!--#include file="iiaspstr.inc"-->
  10. <!--#include file="date.str"-->
  11. <%
  12. On Error Resume Next
  13. Dim path, currentobj, httpexp
  14. Dim timeUnitSelect
  15. Dim expireStaticNumber
  16. Dim expireSet
  17. timeUnitSelect="<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
  18. expireStaticNumber = ""
  19. expireSet = ""
  20. path=Session("dpath")
  21. Session("path")=path
  22. Set currentobj=GetObject(path)
  23. Session("SpecObj")=path
  24. Session("SpecProps")="HttpExpires"
  25. httpexp=currentobj.HttpExpires
  26. if err <> 0 then
  27. httpexp="d,-1"
  28. else
  29. ' We got some sort of expiration date, set default values accordingly
  30. httpexp = UCase(trim(httpexp))
  31. InitControlValues
  32. end if
  33. ' set all the default values based on httpexpires
  34. sub InitControlValues()
  35. Dim numsecs, timeelapse, strExpires, thisdate
  36. if len(httpexp) = 0 then
  37. ' Empty string
  38. elseif httpexp="D,-1" then
  39. ' ???
  40. elseif Left(httpexp,2)="S," then
  41. ' The value is a string
  42. expireSet = "CHECKED"
  43. SetLocale = True
  44. ' Note: we aren't actually setting anything here, we'll wait until
  45. ' SetLocale() is called on the client to convert httpexpires into
  46. ' into an actual date
  47. elseif Left(httpexp,2)="D," then
  48. ' Number of seconds
  49. expireSet = "CHECKED"
  50. numsecs = Trim(Mid(httpexp,Instr(httpexp,",")+1))
  51. ' Convert to decimal
  52. if instr(numsecs,"X") then
  53. numsecs=hexToDec(Trim(Mid(numsecs, Instr(numsecs,"X")+1)))
  54. end if
  55. ' Set our selection control string
  56. timeelapse=numsecs
  57. if numsecs mod 86400=0 then
  58. timeelapse=numsecs/86400
  59. timeUnitSelect="<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
  60. elseif numsecs mod 3600=0 then
  61. timeelapse=numsecs/3600
  62. timeUnitSelect="<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
  63. elseif numsecs mod 60=0 then
  64. timeelapse=numsecs/60
  65. timeUnitSelect="<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
  66. end if
  67. ' Set our static time value
  68. if timeelapse > 0 then
  69. expireStaticNumber=timeelapse
  70. end if
  71. else
  72. ' Use our default values
  73. end if
  74. end sub
  75. function expireType(thisbutton)
  76. Dim typestr, etype
  77. typestr=Mid(httpexp,1,4)
  78. if typestr="" then
  79. etype=""
  80. elseif Mid(httpexp,1,2)="D," then
  81. if len(httpexp) > 4 then
  82. etype=1
  83. else
  84. etype=0
  85. end if
  86. elseif Mid(httpexp,1,2)="S," then
  87. etype=2
  88. else
  89. etype=""
  90. end if
  91. if thisbutton=etype then
  92. expireType="<INPUT TYPE='radio' NAME='hdnrdoHttpExpires' CHECKED OnClick='SetExp(" & thisbutton & ");top.title.Global.updated=true;'>"
  93. else
  94. expireType="<INPUT TYPE='radio' NAME='hdnrdoHttpExpires' OnClick='SetExp(" & thisbutton & ");top.title.Global.updated=true;'>"
  95. end if
  96. end function
  97. function hexToDec(hexstr)
  98. hexToDec = CLng("&H" & hexstr)
  99. end function
  100. %>
  101. <!--#include file="iiset.inc"-->
  102. <!--#include file="iisetfnt.inc"-->
  103. <!--#include file="date.inc"-->
  104. <HTML>
  105. <HEAD>
  106. <TITLE></TITLE>
  107. <SCRIPT LANGUAGE="JavaScript">
  108. <!--#include file="iijsfuncs.inc"-->
  109. top.title.Global.helpFileName="iipy_9";
  110. top.title.Global.siteProperties = false;
  111. userSet=true;
  112. EXP_NONE = 0
  113. EXP_DYNAMIC = 1
  114. EXP_STATIC = 2
  115. function SetRdo(rdo,fromCntrl, toCntrl)
  116. {
  117. if (!rdo)
  118. {
  119. if (fromCntrl.value !="")
  120. {
  121. toCntrl.value=fromCntrl.value;
  122. fromCntrl.value="";
  123. }
  124. }
  125. else
  126. {
  127. if (toCntrl.value !="")
  128. {
  129. fromCntrl.value=toCntrl.value;
  130. toCntrl.value="";
  131. }
  132. }
  133. }
  134. function SetExp(expType)
  135. {
  136. if (expType==null)
  137. {
  138. if (document.userform.hdnchkHttpExpires.checked)
  139. {
  140. document.userform.hdnrdoHttpExpires[0].checked=true;
  141. document.userform.HttpExpires.value=document.userform.hdnHttpExpires.value;
  142. }
  143. else
  144. {
  145. document.userform.hdnHttpExpires.value=document.userform.HttpExpires.value;
  146. document.userform.HttpExpires.value="d,-1";
  147. clearSeconds();
  148. clearGMT();
  149. }
  150. }
  151. else
  152. {
  153. document.userform.hdnchkHttpExpires.checked=true;
  154. if (expType == EXP_NONE)
  155. {
  156. document.userform.HttpExpires.value="D,0";
  157. clearSeconds();
  158. clearGMT();
  159. }
  160. if (expType == EXP_DYNAMIC)
  161. {
  162. clearGMT();
  163. expsecs=parseInt(document.userform.hdnhdnHttpExpiresSeconds.value);
  164. if (isNaN(expsecs))
  165. {
  166. expsecs = 30;
  167. document.userform.hdnHttpSeconds.value = 1800;
  168. document.userform.hdnHttpExpiresTimeUnit.options[1].selected = true;
  169. }
  170. document.userform.hdnHttpExpiresSeconds.value=expsecs;
  171. secval = parseInt(document.userform.hdnHttpSeconds.value);
  172. secstr = secval.toString(16);
  173. <% ' Netscape's toString is broken... this hack should fix it... %>
  174. <% if not Session("IsIE") then %>
  175. while (secstr.indexOf(":") > -1)
  176. {
  177. secstr = secstr.substring(0,secstr.indexOf(":")) + "a" + secstr.substring(secstr.indexOf(":")+1,secstr.length);
  178. }
  179. <% end if %>
  180. document.userform.HttpExpires.value="D,0X"+secstr;
  181. }
  182. if (expType == EXP_STATIC)
  183. {
  184. clearSeconds();
  185. setRadiotoStatic();
  186. expdate=new Date();
  187. SetDateCntrls(expdate)
  188. }
  189. }
  190. }
  191. function clearSeconds()
  192. {
  193. if (document.userform.hdnHttpExpiresSeconds.value !="")
  194. {
  195. userSet=false;
  196. document.userform.hdnhdnHttpExpiresSeconds.value=document.userform.hdnHttpExpiresSeconds.value ;
  197. document.userform.hdnHttpExpiresSeconds.value="";
  198. userSet=true;
  199. }
  200. }
  201. function SetSeconds()
  202. {
  203. tp=document.userform.hdnHttpExpiresTimeUnit.selectedIndex;
  204. if (document.userform.hdnHttpExpiresSeconds.value=="")
  205. {
  206. expsecval=0;
  207. }
  208. else
  209. {
  210. expsecval=parseInt(document.userform.hdnHttpExpiresSeconds.value);
  211. if (tp==0)
  212. {
  213. document.userform.hdnHttpSeconds.value=expsecval;
  214. }
  215. if (tp==1)
  216. {
  217. document.userform.hdnHttpSeconds.value=expsecval * 60;
  218. }
  219. if (tp==2)
  220. {
  221. document.userform.hdnHttpSeconds.value=expsecval * 3600;
  222. }
  223. if (tp==3)
  224. {
  225. document.userform.hdnHttpSeconds.value=expsecval * 86400;
  226. }
  227. document.userform.hdnrdoHttpExpires[1].checked=true;
  228. document.userform.hdnhdnHttpExpiresSeconds.value=document.userform.hdnHttpExpiresSeconds.value;
  229. SetExp(EXP_DYNAMIC);
  230. }
  231. }
  232. var dateFormater = new UIDateFormat( <%= DATEFORMAT_LONG %> );
  233. // SetLocale
  234. //
  235. // This function gets called once, when the list is loaded. It sets
  236. // the values of all the UI controls based on the metabase date value
  237. // adjusted to the current time zone.
  238. function SetLocale()
  239. {
  240. var strExpires = document.userform.HttpExpires.value;
  241. var iStringDesignation = strExpires.indexOf( "S," );
  242. var expdate = new Date();
  243. // Sanity check
  244. if( iStringDesignation > -1 )
  245. {
  246. // trim off the "S,"
  247. strExpires = strExpires.substring( 2, strExpires.length );
  248. expdate.setTime( Date.parse( strExpires ) );
  249. SetDateCntrls(expdate);
  250. }
  251. }
  252. function SetDateCntrls(dateObj)
  253. {
  254. if( document.userform.hdnchkHttpExpires.checked && document.userform.hdnrdoHttpExpires[2].checked )
  255. {
  256. document.userform.hdnHttpExpiresDate.value = dateFormater.getDate(dateObj);
  257. if( dateObj.getHours() < 10 )
  258. {
  259. document.userform.hdnHttpExpiresHours.value = "0" + dateObj.getHours();
  260. }
  261. else
  262. {
  263. document.userform.hdnHttpExpiresHours.value = dateObj.getHours();
  264. }
  265. if (dateObj.getMinutes() < 10)
  266. {
  267. document.userform.hdnHttpExpiresMinutes.value = "0" + dateObj.getMinutes();
  268. }
  269. else
  270. {
  271. document.userform.hdnHttpExpiresMinutes.value = dateObj.getMinutes();
  272. }
  273. document.userform.hdnHttpExpires.value = getNeutralDateString( dateObj );
  274. document.userform.HttpExpires.value="S, " + dateObj.toGMTString();
  275. }
  276. }
  277. function setRadiotoStatic()
  278. {
  279. document.userform.hdnchkHttpExpires.checked=true;
  280. document.userform.hdnrdoHttpExpires[2].checked=true;
  281. <% if Session("hasDHTML") then %>
  282. document.userform.hdnHttpExpiresDate.disabled = false;
  283. <% end if %>
  284. }
  285. function updateDateControls()
  286. {
  287. // Called when the hour, minute or hdnHttpExpires controls
  288. // are changed or the static radio button is selected
  289. if( document.userform.hdnchkHttpExpires.checked && document.userform.hdnrdoHttpExpires[2].checked )
  290. {
  291. var newDate = new Date();
  292. if( document.userform.hdnHttpExpires.value != "" )
  293. {
  294. var strDate = document.userform.hdnHttpExpires.value;
  295. var dateParts = strDate.split("/");
  296. newDate.setYear( dateParts[2] );
  297. newDate.setMonth( parseInt(dateParts[0]) - 1 );
  298. newDate.setDate( dateParts[1] );
  299. }
  300. if( document.userform.hdnHttpExpiresHours.value != "" )
  301. {
  302. newDate.setHours( document.userform.hdnHttpExpiresHours.value );
  303. }
  304. if( document.userform.hdnHttpExpiresMinutes.value != "" )
  305. {
  306. newDate.setMinutes( document.userform.hdnHttpExpiresMinutes.value );
  307. }
  308. SetDateCntrls( newDate );
  309. }
  310. }
  311. function clearGMT()
  312. {
  313. document.userform.hdnHttpExpiresDate.value="";
  314. document.userform.hdnHttpExpires.value="";
  315. document.userform.hdnHttpExpiresHours.value="";
  316. document.userform.hdnHttpExpiresMinutes.value="";
  317. }
  318. function popCalendar(cntrlname, blurctrlname, someDate)
  319. {
  320. if (someDate == "")
  321. {
  322. newdate = new Date();
  323. someDate = getNeutralDateString(newdate);
  324. }
  325. var dateParts = someDate.split( "/" );
  326. width = <%= iHScale(L_CALENDAR_W) %>;
  327. height = <%= iVScale(L_CALENDAR_H) %>;
  328. dsize = "width=" + width +",height=" + height;
  329. thefile="calendar.asp?cntrl="+cntrlname + "&Mo=" + dateParts[0] + "&Dy=" + dateParts[1] + "&Yr=" + dateParts[2] + "&blurcntrl=" + blurctrlname;
  330. popbox=window.open(thefile,"Calendar","resizable=yes,toolbar=no,scrollbars=no,directories=no,menubar=no," + dsize);
  331. if(popbox != null)
  332. {
  333. if (popbox.opener==null)
  334. {
  335. popbox.opener=self;
  336. }
  337. }
  338. }
  339. </SCRIPT>
  340. </HEAD>
  341. <BODY BGCOLOR="<%= Session("BGCOLOR") %>" TOPMARGIN=5 TEXT="#000000" LINK="#FFFFFF" onLoad="loadList();" >
  342. <TABLE WIDTH = 500>
  343. <TR>
  344. <TD>
  345. <%= sFont("","","",True) %>
  346. <FORM NAME="userform">
  347. <B>
  348. <%= L_HTTPHEADERS_TEXT %>
  349. </B>
  350. <P>
  351. <IMG SRC="images/hr.gif" WIDTH=5 HEIGHT=2 BORDER=0 ALIGN="middle">
  352. <INPUT TYPE='checkbox' NAME='hdnchkHttpExpires' <%= expireSet %> OnClick='SetExp(null);top.title.Global.updated=true;'>
  353. <%= L_ENABLEEXPIRE_TEXT %>
  354. <IMG SRC="images/hr.gif" WIDTH=<%= L_ENABLEEXPIREHR_NUM %> HEIGHT=2 BORDER=0 ALIGN="middle">
  355. <P>
  356. <%= sFont("","","",True) %>
  357. <%= L_CONTENTSHOULD_TEXT %>
  358. </FONT>
  359. <BR>
  360. <TABLE BORDER=0 CELLPADDING=1>
  361. <TR>
  362. <TD VALIGN="top" WIDTH=<%= L_LEFTINDENT_NUM %>>
  363. </TD>
  364. <TD VALIGN="top">
  365. <%= sFont("","","",True) %>
  366. <%= expireType(0) %>
  367. </FONT>
  368. </TD>
  369. <TD>
  370. <%= sFont("","","",True) %>
  371. <%= L_EXPIMM_TEXT %>
  372. </FONT>
  373. </TD>
  374. </TR>
  375. <TR>
  376. <TD VALIGN="top">
  377. </TD>
  378. <TD VALIGN="top">
  379. <%= sFont("","","",True) %>
  380. <%= expireType(1) %>
  381. </FONT>
  382. </TD>
  383. <TD>
  384. <%= sFont("","","",True) %>
  385. <%= L_EXPAFT_TEXT %>&nbsp;
  386. <%= inputboxfixed(0,"TEXT", "hdnHttpExpiresSeconds", expireStaticNumber, 5, 5,"","","isNum(this,0,'');SetSeconds();",true,false,false) %>
  387. <INPUT TYPE="hidden" NAME="hdnHttpSeconds">
  388. <%= writeSelect("hdnHttpExpiresTimeUnit", "", "SetSeconds();top.title.Global.updated=true;", false) %>
  389. <%= timeUnitSelect %>
  390. </SELECT>
  391. </FONT>
  392. </TD>
  393. </TR>
  394. <TR>
  395. <TD VALIGN="top">
  396. </TD>
  397. <TD VALIGN="top">
  398. <%= sFont("","","",True) %>
  399. <%= expireType(2) %>
  400. </FONT>
  401. </TD>
  402. <TD>
  403. <%= sFont("","","",True) %>
  404. <%= L_EXPON_TEXT %>&nbsp;
  405. </FONT>
  406. </TD>
  407. </TR>
  408. <TR>
  409. <TD COLSPAN=2>
  410. </TD>
  411. <TD>
  412. <TABLE>
  413. <TR>
  414. <TD>
  415. <%= sFont("","","",True) %>
  416. <%= inputboxfixed(0,"TEXT", "hdnHttpExpiresDate", "", L_EXPIREDATE_NUM, L_EXPIREDATE_NUM,"","","updateDateControls();",false,false,true) %>
  417. <INPUT TYPE="button" VALUE="..." OnClick="setRadiotoStatic();popCalendar('document.userform.hdnHttpExpires','document.userform.hdnHttpExpiresDate',document.userform.hdnHttpExpires.value);">
  418. <INPUT TYPE="hidden" NAME="HttpExpires" VALUE="<%= httpexp %>">
  419. <INPUT TYPE="hidden" NAME="hdnHttpExpires" VALUE="">
  420. </FONT>
  421. </TD>
  422. <TD>&nbsp;&nbsp;</TD>
  423. <TD>
  424. <%= sFont("","","",True) %>
  425. <%= inputboxfixed(0,"TEXT", "hdnHttpExpiresHours", "", L_EXPIRETIME_NUM, L_EXPIRETIME_NUM,"","","isNum(this,0,'');updateDateControls();",false,false,false) %>
  426. :&nbsp;
  427. <%= inputboxfixed(0,"TEXT", "hdnHttpExpiresMinutes", "", L_EXPIRETIME_NUM, L_EXPIRETIME_NUM,"","","isNum(this,0,'');updateDateControls();",false,false,false) %>
  428. </FONT>
  429. </TD>
  430. </TR>
  431. <TR>
  432. <TD>&nbsp;&nbsp;</TD>
  433. <TD>&nbsp;&nbsp;</TD>
  434. <TD ALIGN="center">
  435. <%= sFont("","","",True) %>
  436. <%= L_TIME_TEXT %>
  437. </FONT>
  438. </TD>
  439. </TR>
  440. </TABLE>
  441. </TD>
  442. </TR>
  443. </TABLE>
  444. </FONT>
  445. </TD>
  446. </TR>
  447. </TABLE>
  448. </FORM>
  449. </TD>
  450. </TR>
  451. </TABLE>
  452. <SCRIPT LANGUAGE="JavaScript">
  453. function loadList()
  454. {
  455. <% if SetLocale then %>
  456. SetLocale();
  457. <% end if %>
  458. <% if Session("IsIE") then %>
  459. parent.list.location.href = "iihdrls.asp";
  460. <% else %>
  461. parent.frames[1].location.href="iihdrls.asp";
  462. <% end if %>
  463. }
  464. function addItem()
  465. {
  466. header=prompt("<%= L_ENTERHEADER_TEXT %>","<%= L_SAMPHDR_TEXT %>");
  467. if ((header != "") && (header != null))
  468. {
  469. i=cachedList.length;
  470. cachedList[i]=new listObj(header);
  471. cachedList[i].updated=true;
  472. cachedList[i].newitem=true;
  473. loadList();
  474. }
  475. }
  476. function delItem()
  477. {
  478. ndxnum=parent.list.document.userform.selHttpCustomHeader.options.selectedIndex;
  479. if (ndxnum != -1)
  480. {
  481. var i=parent.list.document.userform.selHttpCustomHeader.options[ndxnum].value;
  482. if (i !="")
  483. {
  484. cachedList[i].deleted=true;
  485. cachedList[i].updated=true;
  486. loadList();
  487. }
  488. }
  489. else
  490. {
  491. alert("<%= L_SELECTITEM_TEXT %>");
  492. }
  493. }
  494. function buildListForm()
  495. {
  496. numrows=0;
  497. for (var i=0; i < cachedList.length; i++)
  498. {
  499. if ((!cachedList[i].deleted) && (cachedList[i].header !=""))
  500. {
  501. numrows=numrows + 1;
  502. }
  503. }
  504. qstr="numrows="+numrows;
  505. qstr=qstr+"&cols=HttpCustomHeaders"
  506. top.body.hlist.location.href="iihdn.asp?"+qstr;
  507. <% 'the list values will be grabbed by the hiddenlistform script... %>
  508. }
  509. function SetListVals()
  510. {
  511. listForm=parent.parent.hlist.document.hiddenlistform;
  512. j=0;
  513. for (var i=0; i < cachedList.length; i++)
  514. {
  515. if ((!cachedList[i].deleted) && (cachedList[i].header !=""))
  516. {
  517. listForm.elements[j++].value=cachedList[i].header;
  518. }
  519. }
  520. }
  521. function popBox(title, width, height, filename)
  522. {
  523. thefile=(filename + ".asp");
  524. thefile="iipop.asp?pg="+thefile;
  525. <% if not Session("IsIE") then %>
  526. width=width +25;
  527. height=height + 50;
  528. <% end if %>
  529. popbox=window.open(thefile,title,"toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+width+",height="+height);
  530. if(popbox !=null)
  531. {
  532. if (popbox.opener==null)
  533. {
  534. popbox.opener=self;
  535. }
  536. }
  537. }
  538. function listFuncs()
  539. {
  540. this.bHasList = true;
  541. this.loadList=loadList;
  542. this.addItem=addItem;
  543. this.delItem=delItem;
  544. this.writeList=buildListForm;
  545. this.popBox=popBox;
  546. this.SetListVals=SetListVals;
  547. this.ndx=0;
  548. }
  549. function listObj(header)
  550. {
  551. this.header=header;
  552. this.deleted=false;
  553. this.updated=false;
  554. this.newitem=false;
  555. }
  556. cachedList=new Array()
  557. listFunc=new listFuncs();
  558. <%
  559. Dim aHdrs,arraybound, i
  560. aHdrs=currentobj.HttpCustomHeaders
  561. arraybound=UBound(aHdrs)
  562. if aHdrs(arraybound) <> "" then
  563. for i=0 to arraybound
  564. %>cachedList[<%= i %>]=new listObj("<%= aHdrs(i) %>");<%
  565. Next
  566. end if
  567. %>
  568. </SCRIPT>
  569. </FONT>
  570. </BODY>
  571. </HTML>
  572. <% end if %>