Leaked source code of windows server 2003
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.

1358 lines
44 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' Ftp_LogSettings.asp: set the logs for FTP sites
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. ' Date Description
  10. ' 06-11-2000 Created date
  11. '-------------------------------------------------------------------------
  12. %>
  13. <!-- #include virtual="/admin/inc_framework.asp" -->
  14. <!-- #include virtual="/admin/wsa/inc_wsa.asp" -->
  15. <!-- #include virtual="/admin/wsa/inc_wsa.js" -->
  16. <!-- #include file="inc_MasterWeb.js" -->
  17. <%
  18. '-------------------------------------------------------------------------
  19. ' Form Variables
  20. '-------------------------------------------------------------------------
  21. Dim F_strWebRoorDir 'Root Dir for the form
  22. Dim F_chkEnableLogging
  23. Dim F_selectActiveFormat
  24. Dim F_optLogPeriod
  25. Dim F_FileSize
  26. Dim F_LocalTime
  27. Dim F_LogFileDir
  28. Dim F_IISSites
  29. Dim F_selectTasks
  30. Dim L_FILE
  31. 'Dim F_SiteCriteria
  32. Dim G_objSites
  33. Dim FTPInstalled
  34. '-------------------------------------------------------------------------
  35. ' Global Variables
  36. '-------------------------------------------------------------------------
  37. Dim G_objService
  38. '-------------------------------------------------------------------------
  39. ' Start of localization content
  40. '-------------------------------------------------------------------------
  41. Dim L_INVALID_DIR_FORMAT_ERRORMESSAGE
  42. Dim L_INVALID_DIR_ERRORMESSAGE
  43. Dim L_DIRPATHEMPTY_ERRORMESSAGE
  44. Dim L_INFORMATION_ERRORMESSAGE
  45. Dim L_FILEINFORMATION_ERRORMESSAGE
  46. Dim L_FAILED_CREATE_DIR_ERRORMESSAGE
  47. Dim L_NOT_NTFS_DRIVE_ERRORMESSAGE
  48. Dim L_INVALID_DRIVE_ERRORMESSAGE
  49. Dim L_DIRQUOTAERRORMESSAGE
  50. Dim L_FAIL_TO_SET_LOGS
  51. Dim L_APPLYTOALLFTPTEXT
  52. Dim L_APPLYTOINHERITEDFTPTEXT
  53. Dim L_LOGFILEDIR
  54. Dim L_LOCALTIME
  55. Dim L_ENABLELOGGING
  56. Dim L_ACTIVELOGFORMAT
  57. Dim L_IISLOGFORMAT
  58. Dim L_COMMONLOGFORMAT
  59. Dim L_ODBCLOG
  60. Dim L_EXTENDEDLOGFILE
  61. Dim L_NEWLOGTIME
  62. Dim L_HOURLY
  63. Dim L_MONTHLY
  64. Dim L_DAILY
  65. Dim L_UNLIMITEDFILESIZE
  66. Dim L_WEEKLY
  67. Dim L_WHENFILESIZE
  68. Dim L_MB
  69. Dim L_FTPLOG_TEXT
  70. 'Dim L_FTPLOGSDIRHELP
  71. Dim L_FTPNOTINSTALLED_ERRORMESSAGE
  72. Dim L_ID_NOTEMPTY_ERROR_MESSAGE
  73. Dim L_SITE_IDENTIFIER_EMPTY_TEXT
  74. L_FTPLOG_TEXT = GetLocString("GeneralSettings.dll", "4042004E", "")
  75. 'L_FTPLOGSDIRHELP = GetLocString("GeneralSettings.dll", "40420050", "")
  76. L_ENABLELOGGING = GetLocString("GeneralSettings.dll", "40420039", "")
  77. L_ACTIVELOGFORMAT = GetLocString("GeneralSettings.dll", "4042003A", "")
  78. L_IISLOGFORMAT = GetLocString("GeneralSettings.dll", "4042003B", "")
  79. L_COMMONLOGFORMAT = GetLocString("GeneralSettings.dll", "4042003C", "")
  80. L_ODBCLOG = GetLocString("GeneralSettings.dll", "4042003D", "")
  81. L_EXTENDEDLOGFILE = GetLocString("GeneralSettings.dll", "4042003E", "")
  82. L_NEWLOGTIME = GetLocString("GeneralSettings.dll", "4042003F", "")
  83. L_HOURLY = GetLocString("GeneralSettings.dll", "40420040", "")
  84. L_MONTHLY = GetLocString("GeneralSettings.dll", "40420041", "")
  85. L_DAILY = GetLocString("GeneralSettings.dll", "40420042", "")
  86. L_UNLIMITEDFILESIZE = GetLocString("GeneralSettings.dll", "40420043", "")
  87. L_WEEKLY = GetLocString("GeneralSettings.dll", "40420044", "")
  88. L_WHENFILESIZE = GetLocString("GeneralSettings.dll", "40420045", "")
  89. L_MB = GetLocString("GeneralSettings.dll", "40420046", "")
  90. L_LOCALTIME = GetLocString("GeneralSettings.dll", "40420047", "")
  91. L_LOGFILEDIR = GetLocString("GeneralSettings.dll", "40420048", "")
  92. L_APPLYTOALLFTPTEXT = GetLocString("GeneralSettings.dll", "4042002B", "")
  93. L_APPLYTOINHERITEDFTPTEXT = GetLocString("GeneralSettings.dll", "4042002C", "")
  94. L_FAIL_TO_SET_LOGS = GetLocString("GeneralSettings.dll", "C0420049", "")
  95. L_INVALID_DRIVE_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420022", "")
  96. L_NOT_NTFS_DRIVE_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000D", "")
  97. L_FAILED_CREATE_DIR_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000E", "")
  98. L_FILEINFORMATION_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000C", "")
  99. L_INFORMATION_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042000F", "")
  100. L_INVALID_DIR_FORMAT_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "40420004", "")
  101. L_INVALID_DIR_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042004B", "")
  102. L_DIRPATHEMPTY_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C042004C", "")
  103. L_FILE = GetLocString("GeneralSettings.dll", "4042004A", "")
  104. L_FTPNOTINSTALLED_ERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420058", "")
  105. '-------------------------------------------------------------------------
  106. 'END of localization content
  107. '-------------------------------------------------------------------------
  108. 'Create property page
  109. Dim rc
  110. Dim page
  111. rc=SA_CreatePage(L_FTPLOG_TEXT,"",PT_PROPERTY,page)
  112. 'Serve the page
  113. If(rc=0) then
  114. SA_ShowPage(Page)
  115. End if
  116. '-------------------------------------------------------------------------
  117. 'Function: OnInitPage()
  118. 'Description: Called to signal first time processing for this page.
  119. ' Use this method to do first time initialization tasks
  120. 'Input Variables: PageIn,EventArg
  121. 'Output Variables: None
  122. 'Returns: True/False
  123. 'Global Variables: None
  124. '-------------------------------------------------------------------------
  125. Public Function OnInitPage(ByRef PageIn,ByRef EventArg)
  126. InitObjects()
  127. if FTPInstalled = false then
  128. ServeFailurePage L_FTPNOTINSTALLED_ERRORMESSAGE ,sReturnURL
  129. end if
  130. SetVariablesFromSystem()
  131. OnInitPage = True
  132. End Function
  133. '-------------------------------------------------------------------------
  134. 'Function: OnServePropertyPage()
  135. 'Description: Called when the page needs to be served.Use this
  136. ' method to serve content
  137. 'Input Variables: PageIn,EventArg
  138. 'Output Variables: None
  139. 'Returns: True/False
  140. 'Global Variables: None
  141. '-------------------------------------------------------------------------
  142. Public Function OnServePropertyPage(ByRef PageIn,Byref EventArg)
  143. Call ServeCommonJavaScript()
  144. Call ServePage()
  145. OnServePropertyPage = True
  146. End Function
  147. '-------------------------------------------------------------------------
  148. 'Function: OnPostBackPage()
  149. 'Description: Called to signal that the page has been posted-back.
  150. 'Input Variables: PageIn,EventArg
  151. 'Output Variables: None
  152. 'Returns: True/False
  153. 'Global Variables: None
  154. '-------------------------------------------------------------------------
  155. Public Function OnPostBackPage(ByRef PageIn ,ByRef EventArg)
  156. OnPostBackPage = True
  157. End Function
  158. '-------------------------------------------------------------------------
  159. 'Function: OnSubmitPage()
  160. 'Description: Called when the page has been submitted for processing.
  161. ' Use this method to process the submit request.
  162. 'Input Variables: PageIn,EventArg
  163. 'Output Variables: None
  164. 'Returns: True/False
  165. 'Global Variables: None
  166. '-------------------------------------------------------------------------
  167. Public Function OnSubmitPage(ByRef PageIn ,ByRef EventArg)
  168. OnSubmitPage = ServeVariablesFromForm()
  169. End Function
  170. '-------------------------------------------------------------------------
  171. 'Function: OnClosePage()
  172. 'Description: Called when the page is about closed.Use this method
  173. ' to perform clean-up processing
  174. 'Input Variables: PageIn,EventArg
  175. 'Output Variables: None
  176. 'Returns: True/False
  177. 'Global Variables: None
  178. '-------------------------------------------------------------------------
  179. Public Function OnClosePage(ByRef PageIn ,ByRef EventArg)
  180. OnClosePage = TRUE
  181. End Function
  182. '-------------------------------------------------------------------------
  183. 'Function: ServeCommonJavaScript
  184. 'Description: Serves in initialiging the values,setting the form
  185. ' data and validating the form values
  186. 'Input Variables: None
  187. 'Output Variables: None
  188. 'Returns: True/False
  189. 'Global Variables: None
  190. '-------------------------------------------------------------------------
  191. Function ServeCommonJavaScript()
  192. %>
  193. <!-- #include file="inc_MasterWeb.js" -->
  194. <script language="JavaScript">
  195. function ValidatePage()
  196. {
  197. // validate directory
  198. var FTPinst = "<%=FTPInstalled%>";
  199. if (FTPinst == "True")
  200. {
  201. var strID = "";
  202. strID = document.frmTask.txtLogFileDir.value;
  203. var strIndex = strID.indexOf("\\\\");
  204. var index = strID.indexOf(":\\",4);
  205. var indexColon = strID.indexOf(":",3);
  206. if (strIndex > 0 || index > 0 || indexColon > 0 )
  207. {
  208. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DIR_FORMAT_ERRORMESSAGE))%>");
  209. document.frmTask.txtLogFileDir.focus();
  210. return false;
  211. }
  212. if (document.frmTask.txtFileSize.disabled==false)
  213. {
  214. var strFileSize = document.frmTask.txtFileSize.value;
  215. if (strFileSize == "" || strFileSize == 0)
  216. {
  217. document.frmTask.txtFileSize.value = 1;
  218. return true;
  219. }
  220. }
  221. // validate site directory
  222. if (!(checkKeyforValidCharacters(strID)))
  223. return false;
  224. UpdateHiddenVariables();
  225. return true;
  226. }
  227. }
  228. function checkKeyforValidCharacters(strID)
  229. {
  230. var len = strID.length;
  231. var charAtPos;
  232. if(len > 0)
  233. {
  234. for(var i=0; i<len;i++)
  235. {
  236. charAtPos = strID.charCodeAt(i);
  237. if(charAtPos ==47 || charAtPos == 42 || charAtPos == 63 || charAtPos == 34 || charAtPos == 60 || charAtPos == 62 || charAtPos == 124 || charAtPos == 91 || charAtPos == 93 || charAtPos == 59 || charAtPos == 43 || charAtPos == 61 || charAtPos == 44)
  238. {
  239. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALID_DIR_ERRORMESSAGE))%>");
  240. document.frmTask.txtLogFileDir.value = strID;
  241. document.frmTask.txtLogFileDir.focus();
  242. return false;
  243. }
  244. }
  245. return true;
  246. }
  247. else
  248. {
  249. var enableLogging = document.frmTask.chkEnableLogging.checked;
  250. if (enableLogging == true)
  251. {
  252. SA_DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_DIRPATHEMPTY_ERRORMESSAGE))%>");
  253. document.frmTask.txtLogFileDir.focus();
  254. return false;
  255. }
  256. else
  257. return true;
  258. }
  259. }
  260. //init function
  261. function Init()
  262. {
  263. var FTPinst = "<%=Server.HTMLEncode(FTPInstalled)%>";
  264. if (FTPinst == "True")
  265. {
  266. var ActiveFormat = "<%= Server.HTMLEncode(F_selectActiveFormat) %>";
  267. if (ActiveFormat == "<%= Server.HTMLEncode(CONST_MSIISLOGFILE_FORMAT) %>")
  268. {
  269. document.frmTask.selectActiveFormat.selectedIndex = 0;
  270. }
  271. else if (ActiveFormat == "<%= Server.HTMLEncode(CONST_ODBCLOGFILE_FORMAT) %>")
  272. {
  273. document.frmTask.selectActiveFormat.selectedIndex = 1;
  274. }
  275. else if (ActiveFormat == "<%= Server.HTMLEncode(CONST_W3CEXLOGFILE_FORMAT) %>")
  276. {
  277. document.frmTask.selectActiveFormat.selectedIndex = 2;
  278. }
  279. var myValue,i;
  280. myValue = document.frmTask.selectActiveFormat.options[document.frmTask.selectActiveFormat.selectedIndex].value;
  281. if(myValue == "<%= Server.HTMLEncode(CONST_ODBCLOGFILE_FORMAT) %>")
  282. {
  283. var len = document.frmTask.optLogPeriod.length;
  284. for(i=0;i<len;i++)
  285. {
  286. document.frmTask.optLogPeriod[i].disabled=true;
  287. document.frmTask.optLogPeriod[i].checked = false;
  288. }
  289. document.frmTask.txtLogFileDir.disabled = true;
  290. document.frmTask.chkLocalTime.disabled = true;
  291. document.frmTask.txtFileSize.disabled = true;
  292. document.frmTask.txtFileSize.value = "";
  293. }
  294. if(myValue == "<%=Server.HTMLEncode(CONST_W3CEXLOGFILE_FORMAT)%>" ||
  295. myValue == "<%=Server.HTMLEncode(CONST_MSIISLOGFILE_FORMAT)%>")
  296. {
  297. var len = document.frmTask.optLogPeriod.length;
  298. tempVal1 = document.frmTask.optLogPeriod[3].checked;
  299. tempVal2 = document.frmTask.optLogPeriod[5].checked;
  300. if(tempVal1 == true){
  301. document.frmTask.chkLocalTime.disabled = true;
  302. document.frmTask.txtFileSize.disabled = true;
  303. }
  304. if(tempVal2 == true){
  305. document.frmTask.chkLocalTime.disabled = true;
  306. document.frmTask.txtFileSize.disabled = false;
  307. }
  308. else
  309. {
  310. if(!(myValue == "<%=Server.HTMLEncode(CONST_MSIISLOGFILE_FORMAT)%>"))
  311. {
  312. if(document.frmTask.chkLocalTime.checked == true)
  313. {
  314. document.frmTask.chkLocalTime.disabled = false;
  315. document.frmTask.chkLocalTime.checked = true;
  316. }
  317. else
  318. {
  319. if(tempVal1 == true || tempVal2 == true)
  320. {
  321. document.frmTask.chkLocalTime.disabled = true;
  322. document.frmTask.chkLocalTime.checked = false;
  323. }
  324. else
  325. {
  326. document.frmTask.chkLocalTime.disabled = false;
  327. document.frmTask.chkLocalTime.checked = false;
  328. }
  329. }
  330. }
  331. }
  332. document.frmTask.txtLogFileDir.disabled = false;
  333. var len = document.frmTask.optLogPeriod.length;
  334. for(i=0;i<len;i++)
  335. document.frmTask.optLogPeriod[i].disabled=false;
  336. }
  337. var enableLogging = "<%= F_chkEnableLogging %>";
  338. if (enableLogging == "false")
  339. {
  340. document.frmTask.txtLogFileDir.disabled = true;
  341. document.frmTask.chkLocalTime.disabled = true;
  342. document.frmTask.selectActiveFormat.disabled = true;
  343. var len = document.frmTask.optLogPeriod.length;
  344. for(i=0;i<len;i++)
  345. document.frmTask.optLogPeriod[i].disabled=true;
  346. document.frmTask.txtFileSize.disabled = true;
  347. }
  348. }
  349. else
  350. {
  351. document.frmTask.chkEnableLogging.disabled = true;
  352. document.frmTask.selectActiveFormat.disabled = true;
  353. var len = document.frmTask.optLogPeriod.length;
  354. for(i=0;i<len;i++)
  355. {
  356. document.frmTask.optLogPeriod[i].disabled=true;
  357. }
  358. document.frmTask.txtLogFileDir.disabled = true;
  359. document.frmTask.chkLocalTime.disabled = true;
  360. document.frmTask.chkLocalTime.checked = false
  361. document.frmTask.txtFileSize.disabled = true;
  362. document.frmTask.txtFileSize.value = "";
  363. //document.frmTask.optAllSites[0].disabled = true;
  364. //document.frmTask.optAllSites[1].disabled = true;
  365. return true;
  366. }
  367. }
  368. function enableFileTextBox()
  369. {
  370. ClearErr();
  371. document.frmTask.txtFileSize.disabled = false;
  372. document.frmTask.txtFileSize.focus();
  373. var myValue,i;
  374. myValue = document.frmTask.selectActiveFormat.options[document.frmTask.selectActiveFormat.selectedIndex].value;
  375. if(myValue == "<%=Server.HTMLEncode(CONST_W3CEXLOGFILE_FORMAT)%>")
  376. {
  377. var len = document.frmTask.optLogPeriod.length;
  378. tempVal1 = document.frmTask.optLogPeriod[3].checked;
  379. tempVal2 = document.frmTask.optLogPeriod[5].checked;
  380. if(tempVal1 == true){
  381. document.frmTask.chkLocalTime.disabled = true;
  382. document.frmTask.txtFileSize.disabled = true;
  383. return true;}
  384. if(tempVal2 == true){
  385. document.frmTask.chkLocalTime.disabled = true;
  386. document.frmTask.txtFileSize.disabled = false;
  387. return true;}
  388. else{
  389. document.frmTask.chkLocalTime.disabled = false;
  390. return true;}
  391. }
  392. else{
  393. tempVal1 = document.frmTask.optLogPeriod[3].checked;
  394. if(tempVal1 == true){
  395. document.frmTask.chkLocalTime.disabled = true;
  396. document.frmTask.txtFileSize.disabled = true;
  397. return true;}
  398. }
  399. }
  400. function DisableFileTextBox()
  401. {
  402. ClearErr();
  403. var myValue,i;
  404. myValue = document.frmTask.selectActiveFormat.options[document.frmTask.selectActiveFormat.selectedIndex].value;
  405. if(myValue == "<%=Server.HTMLEncode(CONST_W3CEXLOGFILE_FORMAT)%>")
  406. {
  407. tempVal1 = document.frmTask.optLogPeriod[3].checked;
  408. tempVal2 = document.frmTask.optLogPeriod[5].checked;
  409. if(tempVal1 == true)
  410. {
  411. document.frmTask.chkLocalTime.disabled = true;
  412. document.frmTask.txtFileSize.disabled = true;
  413. return true;
  414. }
  415. else if(tempVal2 == true)
  416. {
  417. document.frmTask.chkLocalTime.disabled = true;
  418. document.frmTask.txtFileSize.disabled = false;
  419. return true;
  420. }
  421. else
  422. {
  423. document.frmTask.chkLocalTime.disabled = false;
  424. document.frmTask.txtFileSize.disabled = true;
  425. return true;
  426. }
  427. }
  428. else
  429. {
  430. document.frmTask.chkLocalTime.disabled = true;
  431. document.frmTask.txtFileSize.disabled = true;
  432. }
  433. }
  434. function EnableLogFile()
  435. {
  436. ClearErr();
  437. var myValue,i;
  438. myValue = document.frmTask.selectActiveFormat.options[document.frmTask.selectActiveFormat.selectedIndex].value;
  439. if(myValue == "<%=Server.HTMLEncode(CONST_W3CEXLOGFILE_FORMAT)%>")
  440. {
  441. document.frmTask.chkLocalTime.disabled = false;
  442. document.frmTask.txtLogFileDir.disabled = false;
  443. var len = document.frmTask.optLogPeriod.length;
  444. for(i=0;i<len;i++)
  445. {
  446. document.frmTask.optLogPeriod[i].disabled=false;
  447. }
  448. var temp = document.frmTask.optLogPeriod[5].checked;
  449. if (temp==true){
  450. enableFileTextBox();
  451. document.frmTask.chkLocalTime.checked = false;
  452. document.frmTask.chkLocalTime.disabled = true;}
  453. var temp = document.frmTask.optLogPeriod[3].checked;
  454. if (temp==true){
  455. document.frmTask.txtFileSize.disabled = true;
  456. document.frmTask.chkLocalTime.disabled = true;}
  457. var len = document.frmTask.optLogPeriod.length;
  458. var j = 0;
  459. for(i=0;i<len;i++)
  460. {
  461. var temp = document.frmTask.optLogPeriod[i].checked;
  462. if(temp===false)
  463. j= j+1;
  464. }
  465. if(j==len)
  466. document.frmTask.optLogPeriod[2].checked = true;
  467. return true;
  468. }
  469. else if(myValue == "<%=Server.HTMLEncode(CONST_ODBCLOGFILE_FORMAT)%>")
  470. {
  471. DisableFileTextBox();
  472. var len = document.frmTask.optLogPeriod.length;
  473. for(i=0;i<len;i++)
  474. {
  475. document.frmTask.optLogPeriod[i].disabled=true;
  476. document.frmTask.optLogPeriod[i].checked=false;
  477. }
  478. document.frmTask.chkLocalTime.disabled = true;
  479. document.frmTask.chkLocalTime.checked = false;
  480. document.frmTask.txtLogFileDir.disabled = true;
  481. document.frmTask.txtFileSize.value = "";
  482. return true;
  483. }
  484. else
  485. {
  486. var len = document.frmTask.optLogPeriod.length;
  487. var temp = document.frmTask.optLogPeriod[5].checked;
  488. document.frmTask.chkLocalTime.disabled = true;
  489. if (myValue == "<%=Server.HTMLEncode(CONST_MSIISLOGFILE_FORMAT)%>")
  490. {
  491. document.frmTask.chkLocalTime.checked = false;
  492. }
  493. document.frmTask.txtLogFileDir.disabled = false;
  494. if (temp==true)
  495. {
  496. enableFileTextBox();
  497. document.frmTask.chkLocalTime.disabled = true;
  498. }
  499. for(i=0;i<len;i++)
  500. document.frmTask.optLogPeriod[i].disabled=false;
  501. var len = document.frmTask.optLogPeriod.length;
  502. var j = 0;
  503. for(i=0;i<len;i++)
  504. {
  505. var temp = document.frmTask.optLogPeriod[i].checked;
  506. if(temp===false)
  507. j= j+1;
  508. }
  509. if(j==len)
  510. document.frmTask.optLogPeriod[2].checked = true;
  511. return true;
  512. }
  513. }
  514. function enableAll()
  515. {
  516. ClearErr();
  517. var myValue;
  518. myValue = document.frmTask.selectActiveFormat.options[document.frmTask.selectActiveFormat.selectedIndex].value;
  519. if(document.frmTask.chkEnableLogging.checked == false)
  520. {
  521. document.frmTask.selectActiveFormat.disabled = true;
  522. var len = document.frmTask.optLogPeriod.length;
  523. for(i=0;i<len;i++)
  524. {
  525. document.frmTask.optLogPeriod[i].disabled=true;
  526. }
  527. document.frmTask.txtLogFileDir.disabled = true;
  528. document.frmTask.chkLocalTime.disabled = true;
  529. document.frmTask.chkLocalTime.checked = false
  530. document.frmTask.txtFileSize.disabled = true;
  531. document.frmTask.txtFileSize.value = "";
  532. return true;
  533. }
  534. if( myValue == "<%=Server.HTMLEncode(CONST_ODBCLOGFILE_FORMAT) %>" )
  535. {
  536. document.frmTask.selectActiveFormat.disabled = false;
  537. var len = document.frmTask.optLogPeriod.length;
  538. for(i=0;i<len;i++)
  539. {
  540. document.frmTask.optLogPeriod[i].disabled=true;
  541. }
  542. document.frmTask.txtLogFileDir.disabled = true;
  543. document.frmTask.chkLocalTime.disabled = true;
  544. document.frmTask.chkLocalTime.checked = false;
  545. document.frmTask.txtFileSize.value = "";
  546. document.frmTask.txtFileSize.disabled = true;
  547. return true;
  548. }
  549. else if( myValue == "<%=Server.HTMLEncode(CONST_W3CEXLOGFILE_FORMAT)%>" )
  550. {
  551. var tempVal1 = document.frmTask.optLogPeriod[3].checked;
  552. var tempVal2 = document.frmTask.optLogPeriod[5].checked;
  553. if(tempVal1 == true)
  554. {
  555. document.frmTask.chkLocalTime.disabled = true;
  556. document.frmTask.txtFileSize.disabled = true;
  557. }
  558. else if(tempVal2 == true)
  559. {
  560. document.frmTask.chkLocalTime.disabled = true;
  561. document.frmTask.txtFileSize.disabled = false;
  562. }
  563. else
  564. {
  565. document.frmTask.chkLocalTime.disabled = false;
  566. }
  567. }
  568. else
  569. {
  570. document.frmTask.chkLocalTime.disabled = true;
  571. }
  572. document.frmTask.selectActiveFormat.disabled = false;
  573. var len = document.frmTask.optLogPeriod.length;
  574. for(i=0;i<len;i++)
  575. {
  576. document.frmTask.optLogPeriod[i].disabled=false;
  577. }
  578. document.frmTask.txtLogFileDir.disabled = false;
  579. var temp = document.frmTask.optLogPeriod[5].checked;
  580. if (temp==true)
  581. {
  582. document.frmTask.txtFileSize.disabled = false;
  583. document.frmTask.chkLocalTime.disabled = true;
  584. }
  585. }
  586. function SetData()
  587. {
  588. UpdateHiddenVariables();
  589. }
  590. function UpdateHiddenVariables()
  591. {
  592. var FTPinst = "<%=FTPInstalled%>";
  593. if (FTPinst == "True")
  594. {
  595. document.frmTask.hdnEnableLog.value = document.frmTask.chkEnableLogging.checked;
  596. if (document.frmTask.chkLocalTime.disabled == false)
  597. document.frmTask.fileRollOver.value = document.frmTask.chkLocalTime.checked;
  598. else
  599. document.frmTask.fileRollOver.value = false;
  600. }
  601. }
  602. function checkforEmptyfield()
  603. {
  604. var strFileSize = document.frmTask.txtFileSize.value;
  605. if (strFileSize == "")
  606. document.frmTask.txtFileSize.value = 1;
  607. else if (strFileSize == 0)
  608. document.frmTask.txtFileSize.value = 1;
  609. }
  610. </script>
  611. <% End Function
  612. '-------------------------------------------------------------------------
  613. 'Function: ServePage()
  614. 'Description: For displaying outputs HTML to the user
  615. 'Input Variables: None
  616. 'Output Variables: None
  617. 'Returns: None
  618. 'Global Variables: L_DELETE_CONFIRM_TEXT
  619. '-------------------------------------------------------------------------
  620. Function ServePage
  621. %>
  622. <table border=0 CELLSPACING=0 CELLPADDING=0 align=left class="TasksBody">
  623. <TR>
  624. <td>
  625. <% if F_chkEnableLogging = "true" then %>
  626. <input type=checkbox name=chkEnableLogging checked tabIndex=1 onclick="enableAll()" value="ON">
  627. <%else%>
  628. <input type=checkbox name=chkEnableLogging tabIndex=1 onclick="enableAll()" value="ON">
  629. <%end if%>
  630. </td>
  631. <td nowrap class="TasksBody">
  632. <%= L_ENABLELOGGING %>
  633. </td>
  634. </TR>
  635. <TR>
  636. <td></td>
  637. <TD nowrap class="TasksBody">
  638. <%= L_ACTIVELOGFORMAT %>
  639. </td>
  640. <td colspan=4>
  641. <SELECT name=selectActiveFormat class="formField" size=1 tabIndex=2 onChange="EnableLogFile()" value="<%=Server.HTMLEncode(F_selectActiveFormat)%>">
  642. <OPTION VALUE="<%=Server.HTMLEncode(CONST_MSIISLOGFILE_FORMAT) %>"><%=L_IISLOGFORMAT %></OPTION>
  643. <OPTION selected value="<%=Server.HTMLEncode(CONST_ODBCLOGFILE_FORMAT) %>" ><%= L_ODBCLOG %></OPTION>
  644. <OPTION value="<%=Server.HTMLEncode(CONST_W3CEXLOGFILE_FORMAT) %>" ><%= L_EXTENDEDLOGFILE %></OPTION>
  645. </SELECT>
  646. </TD>
  647. </TR>
  648. <TR>
  649. <td></td>
  650. <TD nowrap class="TasksBody">
  651. <%= L_NEWLOGTIME %>
  652. </td>
  653. <td>
  654. <%if F_optLogPeriod = L_HOURLY then%>
  655. <input type=radio name=optLogPeriod value="<%=Server.HTMLEncode(L_HOURLY) %>" tabIndex=3 onclick="DisableFileTextBox();" checked>
  656. <%elseif F_selectActiveFormat = CONST_ODBCLOGFILE_FORMAT then %>
  657. <input type=radio name=optLogPeriod value="<%=Server.HTMLEncode(L_HOURLY) %>" tabIndex=3 disabled onclick="DisableFileTextBox();">
  658. <%else%>
  659. <input type=radio name=optLogPeriod value="<%=Server.HTMLEncode(L_HOURLY) %>" tabIndex=3 onclick="DisableFileTextBox();">
  660. <%end if %>
  661. </TD>
  662. <td nowrap class="TasksBody">
  663. <%= L_HOURLY %>
  664. </td>
  665. <td>
  666. <%if F_optLogPeriod = L_MONTHLY and F_selectActiveFormat <> CONST_ODBCLOGFILE_FORMAT then%>
  667. <input type=radio name=optLogPeriod value="<%=Server.HTMLEncode(L_MONTHLY) %>" onclick="DisableFileTextBox();" tabIndex=4 checked>
  668. <%elseif F_selectActiveFormat = CONST_ODBCLOGFILE_FORMAT then %>
  669. <input type=radio name=optLogPeriod disabled value="<%=Server.HTMLEncode(L_MONTHLY) %>" tabIndex=4 onclick="DisableFileTextBox();">
  670. <%else%>
  671. <input type=radio name=optLogPeriod value="<%=Server.HTMLEncode(L_MONTHLY) %>" tabIndex=4 onclick="DisableFileTextBox();" >
  672. <%end if %>
  673. </td>
  674. <td nowrap class="TasksBody">
  675. <%= L_MONTHLY %>
  676. </td>
  677. </TR>
  678. <TR>
  679. <td colspan=2 >
  680. </td>
  681. <TD>
  682. <%if F_optLogPeriod = L_DAILY then%>
  683. <input type=radio name=optLogPeriod value="<%=Server.HTMLEncode(L_DAILY) %>" tabIndex=5 onclick="DisableFileTextBox();" checked>
  684. <%elseif F_selectActiveFormat = CONST_ODBCLOGFILE_FORMAT then %>
  685. <input type=radio value="<%=Server.HTMLEncode(L_DAILY) %>" name=optLogPeriod disabled tabIndex=5 onclick="DisableFileTextBox();">
  686. <% else %>
  687. <input type=radio name=optLogPeriod value="<%=Server.HTMLEncode(L_DAILY) %>" tabIndex=5 onclick="DisableFileTextBox();" >
  688. <%end if%>
  689. </TD>
  690. <td width=50% nowrap class="TasksBody">
  691. <%= L_DAILY %>
  692. </td>
  693. <TD>
  694. <%if F_optLogPeriod = L_UNLIMITEDFILESIZE and F_selectActiveFormat <> CONST_ODBCLOGFILE_FORMAT then%>
  695. <input type=radio name=optLogPeriod checked value ="<%=Server.HTMLEncode(L_UNLIMITEDFILESIZE) %>" tabIndex=6 onclick="DisableFileTextBox();" >
  696. <%elseif F_selectActiveFormat = CONST_ODBCLOGFILE_FORMAT then %>
  697. <input type=radio value ="<%=Server.HTMLEncode(L_UNLIMITEDFILESIZE) %>" name=optLogPeriod disabled tabIndex=6 onclick="DisableFileTextBox();">
  698. <%else%>
  699. <input type=radio name=optLogPeriod value ="<%=Server.HTMLEncode(L_UNLIMITEDFILESIZE) %>" tabIndex=6 onclick="DisableFileTextBox();" >
  700. <%end if %>
  701. </TD>
  702. <td width=50% nowrap class="TasksBody">
  703. <%= L_UNLIMITEDFILESIZE %>
  704. </td>
  705. </TR>
  706. <TR>
  707. <td colspan=2 >
  708. </td>
  709. <td>
  710. <%if F_optLogPeriod = L_WEEKLY then%>
  711. <input type=radio name=optLogPeriod onclick="DisableFileTextBox();" value="<%=Server.HTMLEncode(L_WEEKLY) %>" tabIndex=7 checked>
  712. <%elseif F_selectActiveFormat = CONST_ODBCLOGFILE_FORMAT then %>
  713. <input type=radio value="<%=Server.HTMLEncode(L_WEEKLY) %>" name=optLogPeriod disabled tabIndex=7 onclick="DisableFileTextBox();">
  714. <%else%>
  715. <input type=radio name=optLogPeriod value="<%=Server.HTMLEncode(L_WEEKLY) %>" tabIndex=7 onclick="DisableFileTextBox();" >
  716. <%end if%>
  717. </td>
  718. <td colspan=3 nowrap class="TasksBody">
  719. <%= L_WEEKLY %>
  720. </td>
  721. </TR>
  722. <TR>
  723. <td colspan=2 >
  724. </td>
  725. <TD >
  726. <%if F_optLogPeriod = L_FILE then%>
  727. <input type=radio name=optLogPeriod value ="<%=Server.HTMLEncode(L_FILE) %>" checked tabIndex=8 onclick="javascript:enableFileTextBox();">
  728. </td><td colspan=3 nowrap class="TasksBody"><%=L_WHENFILESIZE %>&nbsp;&nbsp;
  729. <input type=text name=txtFileSize class="formField" value="<%=Server.HTMLEncode(F_FileSize)%>" OnKeyUP="javaScript:checkUserLimit(this,'filesize');" OnKeypress="javaScript:checkKeyforNumbers(this);" onblur = "checkforEmptyfield();" size="20">
  730. <%elseif F_selectActiveFormat = CONST_ODBCLOGFILE_FORMAT then %>
  731. <input type=radio name=optLogPeriod disabled tabIndex=8 value ="<%=Server.HTMLEncode(L_FILE) %>" onclick="javascript:enableFileTextBox();" >
  732. </td><td colspan=3 nowrap class="TasksBody"><%=L_WHENFILESIZE %>&nbsp;&nbsp;
  733. <input type=text name=txtFileSize class="formField" disabled value="<%=Server.HTMLEncode(F_FileSize)%>" OnKeyUP="javaScript:checkUserLimit(this,'filesize');" OnKeypress="javaScript:checkKeyforNumbers(this);" onblur = "checkforEmptyfield();" size="20">
  734. <%else%>
  735. <input type=radio name=optLogPeriod value ="<%=Server.HTMLEncode(L_FILE) %>" tabIndex=8 onclick="javascript:enableFileTextBox();">
  736. </td><td colspan=3 nowrap class="TasksBody"><%=L_WHENFILESIZE %>&nbsp;&nbsp;
  737. <input type=text name=txtFileSize class="formField" disabled value="<%=Server.HTMLEncode(F_FileSize)%>" OnKeyUP="javaScript:checkUserLimit(this,'filesize');" OnKeypress="javaScript:checkKeyforNumbers(this);" onblur = "checkforEmptyfield();" size="20">
  738. <%end if %>
  739. </TD>
  740. </TR>
  741. <tr>
  742. <td>
  743. &nbsp;
  744. </td>
  745. </tr>
  746. <tr>
  747. <td></td>
  748. <td colspan=5 class="TasksBody">
  749. <%if F_optLogPeriod = L_FILE or F_optLogPeriod = L_UNLIMITEDFILESIZE then%>
  750. <input type=checkbox name=chkLocalTime tabIndex=9 disabled value="ON">
  751. <%else%>
  752. <%if F_selectActiveFormat = CONST_W3CEXLOGFILE_FORMAT and F_LocalTime=true then %>
  753. <input type=checkbox name=chkLocalTime tabIndex=9 checked value="ON">
  754. <%elseif F_selectActiveFormat = CONST_W3CEXLOGFILE_FORMAT and F_LocalTime=false then %>
  755. <input type=checkbox tabIndex=9 name=chkLocalTime value="ON">
  756. <%else%>
  757. <input type=checkbox name=chkLocalTime tabIndex=9 disabled value="ON">
  758. <%end if%>
  759. <%end if%>
  760. &nbsp;&nbsp;<%= L_LOCALTIME %>
  761. </td>
  762. </tr>
  763. <tr>
  764. <td>
  765. </td>
  766. <td colspan=5 class="TasksBody">
  767. <%= L_LOGFILEDIR %>
  768. &nbsp;&nbsp;
  769. <%if F_selectActiveFormat = CONST_ODBCLOGFILE_FORMAT then %>
  770. <input type=text disabled name=txtLogFileDir class="formField" tabIndex=11 onKeyPress= "ClearErr();" size=40 value="<%=F_LogFileDir%>">
  771. <%else%>
  772. <input type=text name=txtLogFileDir class="formField" size=40 tabIndex=11 onKeyPress= "ClearErr();"value="<%=F_LogFileDir%>">
  773. <%end if%>
  774. </td>
  775. </tr>
  776. </table>
  777. <input type=hidden name=fileRollOver>
  778. <input type=hidden name=hdnEnableLog>
  779. <%
  780. End Function
  781. '-------------------------------------------------------------------------
  782. 'Function name: ServeVariablesFromForm()
  783. 'Description: Serves in getting the data from Client
  784. 'Input Variables: None
  785. 'Output Variables: None
  786. 'Returns: True/False
  787. 'Global Variables: None
  788. '-------------------------------------------------------------------------
  789. Function ServeVariablesFromForm
  790. 'setting the form variables
  791. F_chkEnableLogging = Request.Form("hdnEnableLog")
  792. F_selectActiveFormat = Request.Form("selectActiveFormat")
  793. F_optLogPeriod = Request.Form("optLogPeriod")
  794. F_FileSize = Request.Form("txtFileSize")
  795. F_LocalTime = Request.Form("fileRollOver")
  796. F_LogFileDir = Request.Form("txtLogFileDir")
  797. F_IISSites = Request.Form("selectSites")
  798. 'F_SiteCriteria = Request.Form("optAllSites")
  799. 'set the master settings
  800. If SetLogSettings()then
  801. ServeVariablesFromForm = true
  802. else
  803. ServeVariablesFromForm = false
  804. end if
  805. End Function
  806. '-------------------------------------------------------------------------
  807. 'Function name: SetVariablesFromSystem
  808. 'Description: Serves in Getting the data from Client
  809. 'Input Variables: None
  810. 'Output Variables: None
  811. 'Returns: None
  812. 'Global Variables: G_objService
  813. ' G_objSites
  814. '-------------------------------------------------------------------------
  815. Function SetVariablesFromSystem()
  816. Dim inst
  817. Dim strQuery
  818. Dim objLogFormat
  819. Dim instLog
  820. for each inst in G_objSites
  821. select case inst.Logtype
  822. case 1
  823. F_chkEnableLogging = "true"
  824. case else
  825. F_chkEnableLogging = "false"
  826. end select
  827. if F_chkEnableLogging = "true" then
  828. F_selectActiveFormat = IISLogFileGUIDToENName(inst.LogPluginClsId)
  829. end if
  830. select case inst.LogFilePeriod
  831. case 1
  832. F_optLogPeriod = L_DAILY
  833. case 2
  834. F_optLogPeriod = L_WEEKLY
  835. case 3
  836. F_optLogPeriod = L_MONTHLY
  837. case 4
  838. F_optLogPeriod = L_HOURLY
  839. case 0
  840. if inst.LogFileTruncateSize <>-1 then
  841. F_optLogPeriod = L_FILE
  842. else
  843. F_optLogPeriod =L_UNLIMITEDFILESIZE
  844. end if
  845. end select
  846. if F_optLogPeriod = L_FILE then
  847. F_FileSize = inst.LogFileTruncateSize / (1024*1024)
  848. else
  849. F_FileSize = ""
  850. end if
  851. F_LocalTime = inst.LogFileLocaltimeRollover
  852. if inst.LogFileDirectory = "" then
  853. Dim objSysDrive,strSysDrive
  854. Set objSysDrive = server.CreateObject("Scripting.FileSystemObject")
  855. strSysDrive = objSysDrive.GetSpecialFolder(1).Drive ' 1 for systemfolder,0 for windows folder
  856. F_LogFileDir = strSysDrive & "\" & CONST_DEF_WEBROOT
  857. else
  858. F_LogFileDir = inst.LogFileDirectory
  859. end if
  860. exit for
  861. next
  862. 'Getting values from system
  863. End Function
  864. '-------------------------------------------------------------------------
  865. 'Function name: InitObjects
  866. 'Description: Initialization of global variables is done
  867. 'Input Variables: None
  868. 'Returns: true/false
  869. 'Global Variables: G_objService
  870. ' G_objSites
  871. '--------------------------------------------------------------------------
  872. Function InitObjects()
  873. Err.Clear
  874. on error resume next
  875. ' Get instances of IIS_FTPServiceSetting that are visible throughout
  876. Set G_objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  877. set G_objSites = G_objService.InstancesOf(GetIISWMIProviderClassName("IIS_FTPServiceSetting"))
  878. if Err.number <> 0 or G_objSites.count = 0 then
  879. FTPInstalled = false
  880. Err.Clear
  881. else
  882. FTPInstalled = true
  883. end if
  884. end function
  885. '----------------------------------------------------------------------
  886. 'Function name: SetLogSettings
  887. 'Description: Serves in setting the logs to the FTP server
  888. 'Input Variables: None
  889. 'Output Variables: boolean
  890. 'Returns: None
  891. 'Global Variables: G_objService
  892. '----------------------------------------------------------------------
  893. Function SetLogSettings()
  894. on error resume next
  895. Dim strObjPath
  896. InitObjects()
  897. if FTPInstalled = true then
  898. SetLogSettings = false
  899. if F_chkEnableLogging = "true" then
  900. if ValidateInputs = True then
  901. 'select case F_SiteCriteria
  902. 'apply to all sites
  903. if NOT SetLogsForAllSites(G_objService) then
  904. ServeFailurePage L_FAIL_TO_SET_LOGS, sReturnURL
  905. end if
  906. SetLogSettings = true
  907. exit function
  908. end if
  909. else
  910. Dim inst
  911. Dim objSite
  912. Dim arrProp(4)
  913. arrProp(0) = "LogType"
  914. arrProp(1) = "LogPluginClsId"
  915. arrProp(2) = "LogFilePeriod"
  916. arrProp(3) = "LogFileTruncateSize"
  917. arrProp(4) = "LogFileLocaltimeRollover"
  918. strObjPath = GetIISWMIProviderClassName("IIs_FtpServiceSetting") & ".Name='MSFTPSVC'"
  919. set objSite = G_objService.Get(strObjPath)
  920. if Err.number <> 0 then
  921. SetErrMsg L_INFORMATION_ERRORMESSAGE
  922. exit function
  923. end if
  924. objSite.Logtype = 0
  925. objSite.put_(WBEMFLAG)
  926. if Err.number <> 0 then
  927. SA_TraceOut "Ftp_LogSettings", L_FAIL_TO_SET_LOGS
  928. SetLogSettings = false
  929. exit function
  930. end if
  931. Err.Clear
  932. Set objSite = GetNonInheritedFTPSites(G_objService, "IIS_FTPServerSetting","IIS_FTPServiceSetting", arrProp)
  933. If ( Err.Number <> 0 ) Then
  934. Call SA_TraceOut(SA_GetScriptFileName(), "GetNonInheritedFTPSites failed, error: " & Hex(Err.Number) & " " & Err.Description)
  935. SetLogSettings = true
  936. exit function
  937. End If
  938. if (IsNull(objSite) OR objSite.count = 0) then
  939. SetLogSettings = true
  940. exit function
  941. end if
  942. for each inst in objSite
  943. inst.Logtype = 0
  944. inst.put_(WBEMFLAG)
  945. if Err.number <> 0 then
  946. SA_TraceOut "Ftp_LogSettings", L_FAIL_TO_SET_LOGS
  947. SetLogSettings = false
  948. exit function
  949. end if
  950. next
  951. SetLogSettings = true
  952. end if
  953. end if
  954. 'release the object
  955. set G_objService = nothing
  956. set G_objSites = nothing
  957. set objSite = nothing
  958. end function
  959. '-----------------------------------------------------------------------------------------------------------
  960. 'Function name: SetLogsForAllSites
  961. 'Description: Serves in setting the logs to the new FTP sites
  962. 'Input Variables: G_objService
  963. 'Output Variables: boolean
  964. 'Returns: None
  965. 'Global variables: G_objService
  966. 'Other functions called:GetNonInheritedFTPSites
  967. '-----------------------------------------------------------------------------------------------------------
  968. Function SetLogsForAllSites(G_objService)
  969. Err.Clear
  970. On error resume next
  971. Dim objSite
  972. Dim inst
  973. Dim arrProp(4)
  974. 'Set Master settings
  975. SetLogsForNewSites G_objService
  976. SetLogsForAllSites = false
  977. arrProp(0) = "LogType"
  978. arrProp(1) = "LogPluginClsId"
  979. arrProp(2) = "LogFilePeriod"
  980. arrProp(3) = "LogFileTruncateSize"
  981. arrProp(4) = "LogFileLocaltimeRollover"
  982. Set objSite = GetNonInheritedFTPSites(G_objService, GetIISWMIProviderClassName("IIS_FTPServerSetting"),GetIISWMIProviderClassName("IIS_FTPServiceSetting"), arrProp)
  983. if (Err.number <> 0) then
  984. SetLogsForAllSites = false
  985. exit function
  986. end if
  987. if objSite.count = 0 then
  988. SetLogsForAllSites = true
  989. exit function
  990. end if
  991. for each inst in objSite
  992. if not SetLogs(inst) then
  993. SA_TraceOut "Web_LogSettings", L_FAIL_TO_SET_LOGS
  994. SetLogsForAllSites = false
  995. exit function
  996. end if
  997. next
  998. 'release the object
  999. set objSite = nothing
  1000. SetLogsForAllSites = true
  1001. End Function
  1002. '-----------------------------------------------------------------------------------------------------------
  1003. 'Function name: SetLogsForNewSites
  1004. 'Description: Serves in setting the logs to the new FTP sites
  1005. 'Input Variables: G_objService
  1006. 'Output Variables: boolean
  1007. 'Returns: None
  1008. 'Global Variables: G_objService
  1009. '-----------------------------------------------------------------------------------------------------------
  1010. Function SetLogsForNewSites(G_objService)
  1011. Err.Clear
  1012. On error resume next
  1013. Dim objSite
  1014. Dim strObjPath
  1015. SetLogsForNewSites = false
  1016. strObjPath = GetIISWMIProviderClassName("IIs_FtpServiceSetting") & ".Name='MSFTPSVC'"
  1017. set objSite = G_objService.Get(strObjPath)
  1018. if Err.number <> 0 then
  1019. SetErrMsg L_INFORMATION_ERRORMESSAGE
  1020. exit function
  1021. end if
  1022. if not SetLogs(objSite) then
  1023. SA_TraceOut "FTP_LogSettings", L_FAIL_TO_SET_LOGS
  1024. end if
  1025. SetLogsForNewSites = true
  1026. 'release the object
  1027. set objSite = nothing
  1028. SetLogsForNewSites = true
  1029. End Function
  1030. '----------------------------------------------------------------------------------------------------
  1031. 'Function name: ValidateInputs
  1032. 'Description: Check whether directory exists
  1033. ' If directory does not exist, create the web site if the drive letter is valid
  1034. ' else give error message
  1035. 'Input Variables: None
  1036. 'Returns: true/false
  1037. 'Global Variables: None
  1038. '-----------------------------------------------------------------------------------------------------
  1039. Function ValidateInputs
  1040. Dim strIndx
  1041. Dim objFso
  1042. Dim nRetVal
  1043. Dim strDir
  1044. ValidateInputs = false
  1045. if F_selectActiveFormat <> CONST_ODBCLOGFILE_FORMAT then
  1046. Set objFso = server.CreateObject("Scripting.FileSystemObject")
  1047. if Err.number <> 0 then
  1048. SetErrMsg L_FILEINFORMATION_ERRORMESSAGE
  1049. exit function
  1050. end if
  1051. if mid(ucase(F_LogFileDir),1,8) = ucase("%WinDir%") then
  1052. strDir = objFso.GetSpecialFolder(0) & mid(F_LogFileDir,9)
  1053. elseif mid(ucase(F_LogFileDir),1,13) = ucase("%SystemDrive%") then
  1054. strDir = objFso.GetSpecialFolder(0).Drive & mid(F_LogFileDir,14)
  1055. else
  1056. strDir = F_LogFileDir
  1057. end if
  1058. nRetVal = CreateSitePath( objFso, strDir )
  1059. if nRetVal <> CONST_SUCCESS then
  1060. if nRetVal = CONST_INVALID_DRIVE then
  1061. SetErrMsg L_INVALID_DRIVE_ERRORMESSAGE
  1062. elseif nRetVal = CONST_NOTNTFS_DRIVE then
  1063. SetErrMsg L_NOT_NTFS_DRIVE_ERRORMESSAGE
  1064. else
  1065. SetErrMsg L_FAILED_CREATE_DIR_ERRORMESSAGE
  1066. end if
  1067. exit Function
  1068. end if
  1069. Dim strDriveName,objDriveType, intDriveSize
  1070. strDriveName = left(strDir,2)
  1071. if objFso.DriveExists(ucase(strDriveName)) then
  1072. set objDriveType = objFso.GetDrive(strDriveName)
  1073. intDriveSize = clng(objDriveType.TotalSize / (1024*1024))
  1074. end if
  1075. 'Release the object
  1076. set objDriveType = nothing
  1077. if clng(F_FileSize) > intDriveSize then
  1078. L_DIRQUOTAERRORMESSAGE = GetLocString("GeneralSettings.dll", "C0420057", Array(CStr(intDriveSize)))
  1079. SetErrMsg(L_DIRQUOTAERRORMESSAGE)
  1080. exit Function
  1081. end if
  1082. end if
  1083. ValidateInputs = true
  1084. 'Release the object
  1085. set objFso = nothing
  1086. End Function
  1087. '------------------------------------------------------------------
  1088. 'Function name: SetLogs
  1089. 'Description: Serves in setting the logs
  1090. 'Input Variables: inst
  1091. 'Returns: boolean 'true if no error occurs else false
  1092. 'Global Variables: G_objService
  1093. '------------------------------------------------------------------
  1094. Function SetLogs(inst)
  1095. On Error Resume Next
  1096. Err.Clear
  1097. Dim strQuery
  1098. Dim objLogFormat
  1099. Dim instLog
  1100. SetLogs = false
  1101. inst.LogType = 1 'to enable logging
  1102. inst.LogPluginClsId = IISLogFileENNameToGUID(F_selectActiveFormat)
  1103. if F_selectActiveFormat <> CONST_ODBCLOGFILE_FORMAT then
  1104. select case F_optLogPeriod
  1105. case L_DAILY
  1106. inst.LogFilePeriod = 1
  1107. inst.LogFileTruncateSize = 512 * 1024 * 1024
  1108. case L_WEEKLY
  1109. inst.LogFilePeriod = 2
  1110. inst.LogFileTruncateSize = 512 * 1024 * 1024
  1111. case L_MONTHLY
  1112. inst.LogFilePeriod = 3
  1113. inst.LogFileTruncateSize = 512 * 1024 * 1024
  1114. case L_HOURLY
  1115. inst.LogFilePeriod = 4
  1116. inst.LogFileTruncateSize = 512 * 1024 * 1024
  1117. case L_FILE
  1118. inst.LogFilePeriod = 0
  1119. if trim(F_FileSize) <> "" then
  1120. inst.LogFileTruncateSize = clng(F_FileSize) * 1024 * 1024
  1121. else
  1122. inst.LogFileTruncateSize = 1024 * 1024
  1123. end if
  1124. case L_UNLIMITEDFILESIZE
  1125. inst.LogFilePeriod = 0
  1126. inst.LogFileTruncateSize = -1
  1127. end select
  1128. inst.LogFileLocaltimeRollover = cbool(F_LocalTime)
  1129. inst.LogFileDirectory = trim(F_LogFileDir)
  1130. end if
  1131. inst.put_(WBEMFLAG)
  1132. if Err.number <> 0 then
  1133. SA_TraceOut "Ftp_LogSettings", L_FAIL_TO_SET_LOGS
  1134. SetLogs = false
  1135. exit function
  1136. end if
  1137. 'release the object
  1138. set objLogFormat = nothing
  1139. SetLogs = true
  1140. End function
  1141. %>