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.

1343 lines
43 KiB

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