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.

1236 lines
40 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' folder_prop.asp : This page displays the properties of folder information
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. ' Date Description
  10. ' 18-01-2001 Creation date
  11. ' 21-03-2001 Modified date
  12. '-------------------------------------------------------------------------
  13. %>
  14. <!-- #include virtual="/admin/inc_framework.asp" -->
  15. <!-- #include file="loc_folder.asp"-->
  16. <%
  17. '-------------------------------------------------------------------------
  18. ' Global Variables
  19. '-------------------------------------------------------------------------
  20. Dim rc 'Page Variable
  21. Dim page 'Page Variable
  22. Dim g_iTabGeneral 'Variable for General tab
  23. Dim g_iTabCompress 'Variable for Compress tab
  24. Dim G_strFolderName 'Folder name
  25. Dim G_strOldFolderName 'Previous name of the folder
  26. Dim G_objDirInstance 'WMI Instance object
  27. Dim SOURCE_FILE 'File name
  28. SOURCE_FILE = SA_GetScriptFileName()
  29. '-------------------------------------------------------------------------
  30. ' Form Variables and Constants
  31. '-------------------------------------------------------------------------
  32. Dim F_strFolderName 'Folder Name
  33. Dim F_strFolderType 'Folder Type
  34. Dim F_strFolderSize 'Folder Size
  35. Dim F_strContains 'Folder Contains
  36. Dim F_strFolderCreated 'Folder Created
  37. Dim F_strReadOnly 'Folder ReadOnly
  38. Dim F_strHidden 'Folder Hidden
  39. Dim F_strArchive 'Folder Archive
  40. Dim F_strChangeOption 'Folder Changes options
  41. Dim F_nFolderCompress 'Folder Compress
  42. Dim F_strCompressed 'Status to Compressed folder
  43. Dim F_blnFolderFlag 'Flag to hold value if more than one folders are selected
  44. Dim F_nCount 'Total number of folders selected in OTS page
  45. Dim F_strFolders 'String of folder names
  46. Dim F_strParentFolder 'Parent folder name
  47. Const CONST_TRISTATE_TEXT = "TRISTATE"
  48. Const CONST_UNCHECKED_TEXT = "UNCHECKED"
  49. Const CONST_CHECKED_TEXT = "CHECKED"
  50. Const CONST_ARR_APPLYALLFOLDERS = "ALL"
  51. Const CONST_ARR_APPLYFOLDER = "ONE"
  52. 'Create a Tabbed Property Page
  53. rc = SA_CreatePage( L_PAGETITLE_TEXT, "", PT_TABBED, page )
  54. 'Add two tabs
  55. rc = SA_AddTabPage( page, L_GENERAL_TEXT, g_iTabGeneral)
  56. rc = SA_AddTabPage( page, L_COMPRESS_TEXT, g_iTabCompress)
  57. 'Show the page
  58. rc = SA_ShowPage( page )
  59. '-------------------------------------------------------------------------
  60. 'Function name: OnInitPage
  61. 'Description: Called to signal first time processing for this page.
  62. 'Input Variables: PageIn,EventArg
  63. 'Output Variables: PageIn,EventArg
  64. 'Returns: TRUE to indicate initialization was successful. FALSE to indicate
  65. ' errors. Returning FALSE will cause the page to be abandoned.
  66. 'Global Variables: F_strFolderName
  67. '--------------------------------------------------------------------------
  68. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  69. Call GetFolderProperty()
  70. Call SA_MungeURL(mstrReturnURL, "PKey", F_strParentFolder)
  71. OnInitPage = true
  72. End Function
  73. '-------------------------------------------------------------------------
  74. 'Function name: OnPostBackPage
  75. 'Description: Called to signal that the page has been posted-back.
  76. 'Input Variables: PageIn,EventArg
  77. 'Output Variables: PageIn,EventArg
  78. 'Returns: TRUE to indicate initialization was successful. FALSE to indicate
  79. ' errors. Returning FALSE will cause the page to be abandoned.
  80. 'Global Variables: F_(*),G_strOldFolderName,G_strFolderName
  81. '--------------------------------------------------------------------------
  82. Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  83. Call SA_TraceOut(SOURCE_FILE, "OnPostBackPage")
  84. 'Updating the form variables and global variables
  85. if Request.Form("chkCompress") = "" then
  86. F_strCompressed = CONST_UNCHECKED_TEXT
  87. else
  88. F_strCompressed = Request.Form("chkCompress")
  89. end if
  90. if Request.Form("chkHidden") = "" then
  91. F_strHidden = CONST_UNCHECKED_TEXT
  92. else
  93. F_strHidden = Request.Form("chkHidden")
  94. end if
  95. if Request.Form("chkReadOnly") = "" then
  96. F_strReadOnly = CONST_UNCHECKED_TEXT
  97. else
  98. F_strReadOnly = Request.Form("chkReadOnly")
  99. end if
  100. if Request.Form("chkArchive") = "" then
  101. F_strArchive = CONST_UNCHECKED_TEXT
  102. else
  103. F_strArchive = Request.Form("chkArchive")
  104. end if
  105. F_strFolderName = trim(Request.Form("hdnFolderName"))
  106. G_strOldFolderName = trim(Request.Form("hdnOldName"))
  107. G_strFolderName = trim(Request.Form("txtFolderName"))
  108. F_strFolderType = Request.Form("hdnType")
  109. F_strFolderSize = Request.Form("hdnSize")
  110. F_strContains = Request.Form("hdnContains")
  111. F_strFolderCreated = Request.Form("hdnCreated")
  112. F_nFolderCompress = Request.Form("radFolders")
  113. F_blnFolderFlag = Request.Form("hdnblnFolderFlag")
  114. F_strFolders = Request.Form("hdnfolders")
  115. F_nCount = Request.Form("hdnfolderCnt")
  116. F_strParentFolder = Request.Form("hdnParentFolder")
  117. If F_nFolderCompress = CONST_ARR_APPLYALLFOLDERS then
  118. F_strChangeOption = CONST_CHECKED_TEXT
  119. Else
  120. F_strChangeOption = CONST_UNCHECKED_TEXT
  121. End if
  122. OnPostBackPage = TRUE
  123. End Function
  124. '-------------------------------------------------------------------------
  125. 'Function name: OnServeTabbedPropertyPage
  126. 'Description: Called when the page needs to be served. Use this method to
  127. ' serve content.
  128. 'Input Variables: PageIn,iTab,bIsVisible,EventArg
  129. 'Output Variables: PageIn,EventArg
  130. 'Returns: TRUE to indicate not problems occured. FALSE to indicate errors.
  131. ' Returning FALSE will cause the page to be abandoned.
  132. 'Global Variables: In:None
  133. ' Out:None
  134. '--------------------------------------------------------------------------
  135. Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  136. ByVal iTab, _
  137. ByVal bIsVisible, ByRef EventArg)
  138. Call SA_TraceOut(SOURCE_FILE, "OnServeTabbedPropertyPage")
  139. Select Case iTab
  140. Case g_iTabGeneral
  141. Call ServeTabGeneral(PageIn, bIsVisible)
  142. Case g_iTabCompress
  143. Call ServeTabCompress(PageIn, bIsVisible)
  144. Case Else
  145. Call SA_TraceOut (SOURCE_FILE, "OnServeTabbedPropertyPage")
  146. End Select
  147. OnServeTabbedPropertyPage = TRUE
  148. End Function
  149. '-------------------------------------------------------------------------
  150. 'Function name: OnSubmitPage
  151. 'Description: Called when the page has been submitted for processing.
  152. 'Input Variables: PageIn,EventArg
  153. 'Output Variables: PageIn,EventArg
  154. 'Returns: TRUE if the submit was successful, FALSE to indicate error(s).
  155. ' Returning FALSE will cause the page to be served again using
  156. ' a call to OnServePropertyPage.
  157. 'Global Variables: None
  158. '
  159. '--------------------------------------------------------------------------
  160. Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  161. OnSubmitPage = SetFolderProperty
  162. End Function
  163. '-------------------------------------------------------------------------
  164. 'Function name: OnClosePage
  165. 'Description: Called when the page is about to be closed.
  166. 'Input Variables: PageIn,EventArg
  167. 'Output Variables: PageIn,EventArg
  168. 'Returns: TRUE to allow close, FALSE to prevent close. Returning FALSE
  169. ' will result in a call to OnServePropertyPage.
  170. 'Global Variables: F_strFolderName
  171. '--------------------------------------------------------------------------
  172. Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  173. OnClosePage = TRUE
  174. End Function
  175. '-------------------------------------------------------------------------
  176. 'Function name: ServeTabGeneral
  177. 'Description: Serves when the tab one is selected
  178. 'Input Variables: PageIn,bIsVisible
  179. 'Output Variables: PageIn
  180. 'Returns: None
  181. 'Global Variables: G_strFolderName,F_(*),gc_ERR_SUCCESS,
  182. ' G_strOldFolderName,L_(*)
  183. '--------------------------------------------------------------------------
  184. Function ServeTabGeneral(ByRef PageIn, ByVal bIsVisible)
  185. If ( bIsVisible ) Then
  186. Call ServeCommonJavaScript()
  187. Call ServeCommonJavaScriptGeneral()
  188. %>
  189. <table border= "0">
  190. <tr>
  191. <td nowrap class = "TasksBody">
  192. <%=L_FOLDERNAME_TEXT %>
  193. </td>
  194. <td class = "TasksBody">
  195. <%If UCase(F_blnFolderFlag) <> UCase("True") Then %>
  196. <input class = "FormField" name="txtFolderName" type="text" size="20" maxlength="240" value="<%=Server.HTMLEncode(G_strFolderName)%>">
  197. <%Else%>
  198. <input class = "FormFieldDisabled" name="txtFolderName" type="text" size="20" maxlength="240" value="" Disabled>
  199. <%End if%>
  200. </td>
  201. </tr>
  202. <tr>
  203. <td nowrap class = "TasksBody">
  204. <%=L_FOLDERTYPE_TEXT %>
  205. </td>
  206. <td class = "TasksBody">
  207. <%If UCase(F_blnFolderFlag) <> UCase("True") Then %>
  208. <%=Server.HTMLEncode(F_strFolderType)%>
  209. <%else%>
  210. <%=L_FILETYPE_TEXT%>
  211. <%End If%>
  212. </td>
  213. </tr>
  214. <tr>
  215. <td nowrap class = "TasksBody">
  216. <%=L_FOLDERLOCATION_TEXT %>
  217. </td>
  218. <td nowrap class = "TasksBody">
  219. <%=server.HTMLEncode(replace(F_strParentFolder,"/","\"))%>
  220. </td>
  221. </tr>
  222. <tr>
  223. <td nowrap class = "TasksBody">
  224. <%=L_FOLDERSIZE_TEXT %>
  225. </td>
  226. <td class = "TasksBody">
  227. <%If UCase(F_blnFolderFlag) <> UCase("True") Then %>
  228. <%=server.HTMLEncode(F_strFolderSize)%>
  229. <%End if%>
  230. </td>
  231. </tr>
  232. <tr>
  233. <td nowrap class = "TasksBody">
  234. <%=L_FOLDERCONTAINS_TEXT%>
  235. </td>
  236. <td class = "TasksBody">
  237. <%If UCase(F_blnFolderFlag) <> UCase("True") Then %>
  238. <%=Server.HTMLEncode(F_strContains)%>
  239. <%End if%>
  240. </td>
  241. </tr>
  242. <tr>
  243. <td class = "TasksBody">
  244. </tr>
  245. <tr>
  246. <td nowrap class = "TasksBody" >
  247. <%=L_FOLDERCEATED_TEXT%>
  248. </td>
  249. <td class = "TasksBody">
  250. <%If UCase(F_blnFolderFlag) <> UCase("True") Then %>
  251. <%=Server.HTMLEncode(F_strFolderCreated)%>
  252. <%End if%>
  253. </td>
  254. </tr>
  255. <tr>
  256. <td class = "TasksBody">
  257. </tr>
  258. <tr>
  259. <td nowrap class = "TasksBody">
  260. <%=L_FOLDERATTRIBUTE_TEXT%>
  261. </td>
  262. </tr>
  263. <tr>
  264. <td class = "TasksBody">
  265. <input type="checkbox" class="FormCheckBox" name=chkReadOnly onclick=OnClickReadOnly()><%=L_READONLY_TEXT%>
  266. </td>
  267. <td class = "TasksBody">
  268. <input type="checkbox" class="FormCheckBox" name=chkHidden onclick=OnClickHidden()><%=L_HIDDEN_TEXT%>
  269. </td>
  270. </tr>
  271. <tr>
  272. <td class = "TasksBody">
  273. <input type="checkbox" class="FormCheckBox" name="chkArchive" onclick=OnClickArchive()><%=L_ARCHIVING_TEXT%>
  274. </td>
  275. </tr>
  276. </table>
  277. <input name="hdnParentFolder" type=Hidden value="<%=Server.HTMLEncode(F_strParentFolder )%>">
  278. <input name="hdnblnFolderFlag" type=Hidden value="<%=Server.HTMLEncode(F_blnFolderFlag)%>">
  279. <input name="hdnFolderName" type=Hidden value="<%=Server.HTMLEncode(F_strFolderName)%>">
  280. <input name="hdnOldName" type=Hidden value="<%=Server.HTMLEncode(G_strOldFolderName)%>">
  281. <input name="hdnType" type=Hidden value="<%=Server.HTMLEncode(F_strFolderType)%>">
  282. <input name="hdnSize" type=Hidden value="<%=Server.HTMLEncode(F_strFolderSize)%>">
  283. <input name="hdnContains" type=Hidden value="<%=Server.HTMLEncode(F_strContains)%>">
  284. <input name="hdnCreated" type=Hidden value="<%=Server.HTMLEncode( F_strFolderCreated)%>">
  285. <input name="hdnfolders" type=Hidden value="<%=Server.HTMLEncode(F_strFolders)%>">
  286. <input name="hdnfolderCnt" type=Hidden value="<%=Server.HTMLEncode(F_nCount)%>">
  287. <%
  288. Else
  289. %>
  290. <input name="hdnParentFolder" type=Hidden value="<%=Server.HTMLEncode(F_strParentFolder )%>">
  291. <input name="hdnblnFolderFlag" type=Hidden value="<%=Server.HTMLEncode(F_blnFolderFlag)%>">
  292. <input name="hdnFolderName" type=Hidden value="<%=Server.HTMLEncode(F_strFolderName)%>">
  293. <input name="chkHidden" type=Hidden value="<%=Server.HTMLEncode(F_strHidden)%>">
  294. <input name="chkReadOnly" type=Hidden value="<%=Server.HTMLEncode(F_strReadOnly)%>">
  295. <input name="chkArchive" type=Hidden value="<%=Server.HTMLEncode(F_strArchive)%>">
  296. <input name="txtFolderName" type=Hidden value="<%=Server.HTMLEncode(G_strFolderName)%>">
  297. <input name="hdnOldName" type=Hidden value="<%=Server.HTMLEncode(G_strOldFolderName)%>">
  298. <input name="hdnType" type=Hidden value="<%=Server.HTMLEncode(F_strFolderType)%>">
  299. <input name="hdnSize" type=Hidden value="<%=Server.HTMLEncode(F_strFolderSize)%>">
  300. <input name="hdnContains" type=Hidden value="<%=Server.HTMLEncode(F_strContains)%>">
  301. <input name="hdnCreated" type=Hidden value="<%=Server.HTMLEncode( F_strFolderCreated)%>">
  302. <input name="hdnfolders" type=Hidden value="<%=Server.HTMLEncode(F_strFolders)%>">
  303. <input name="hdnfolderCnt" type=Hidden value="<%=Server.HTMLEncode(F_nCount)%>">
  304. <%
  305. End If
  306. End Function
  307. '-------------------------------------------------------------------------
  308. 'Function name: ServeTabCompress
  309. 'Description: Serves when the tab two is selected
  310. 'Input Variables: PageIn,bIsVisible
  311. 'Output Variables: PageIn
  312. 'Returns: None
  313. 'Global Variables: G_strFolderName,F_(*),L_(*)Out: gc_ERR_SUCCESS,
  314. ' G_strOldFolderName
  315. '--------------------------------------------------------------------------
  316. Function ServeTabCompress(ByRef PageIn, ByVal bIsVisible)
  317. If ( bIsVisible ) Then
  318. Call ServeCommonJavaScript()
  319. Call ServeCommonJavaScriptCompress()
  320. %> <table border="0" >
  321. <tr>
  322. <td class = "TasksBody">
  323. <%=L_FOLDER_TEXT %> &nbsp;
  324. <%If UCase(F_blnFolderFlag) <> UCase("True") Then %>
  325. <%if instr(F_strParentFolder,"/")=len(F_strParentFolder) then
  326. Response.write Server.HTMLEncode(replace((F_strParentFolder & G_strFolderName),"/","\"))
  327. else
  328. Response.write Server.HTMLEncode(replace((F_strParentFolder & chr(92) & G_strFolderName),"/","\"))
  329. end if%>
  330. <%End If%>
  331. </td>
  332. </tr>
  333. <tr>
  334. <td class = "TasksBody">
  335. <input type="checkbox" name=chkCompress class="FormCheckBox" onclick=OnClickCompress()>&nbsp;<%=L_COMPRESSCONTENTS_TEXT%>
  336. </td>
  337. </tr>
  338. <tr>
  339. <td class = "TasksBody">
  340. <input type="radio" name="radFolders" value= "<%=CONST_ARR_APPLYFOLDER%>" checked>&nbsp;<%=L_APPLYCHANGES_TEXT%>
  341. </td>
  342. </tr>
  343. <tr>
  344. <td class = "TasksBody">
  345. <input type="radio" name="radFolders" value= "<%=CONST_ARR_APPLYALLFOLDERS%>" <%=F_strChangeOption%>>&nbsp;<%=L_APPLYCHANGES_EX_TEXT%>
  346. </td>
  347. </tr>
  348. </table>
  349. <%
  350. Else
  351. %>
  352. <input name="chkCompress" type=Hidden value="<%=Server.HTMLEncode(F_strCompressed)%>">
  353. <input name="radFolders" type=Hidden value="<%=Server.HTMLEncode(F_nFolderCompress)%>">
  354. <%
  355. End If
  356. End Function
  357. '-------------------------------------------------------------------------
  358. 'Function name: ServeCommonJavaScriptGeneral
  359. 'Description: Common javascript functions that are required for General tab
  360. 'Input Variables: None
  361. 'Output Variables: None
  362. 'Returns: None
  363. 'Global Variables: In:None
  364. ' Out:None
  365. '--------------------------------------------------------------------------
  366. Function ServeCommonJavaScriptGeneral()
  367. %>
  368. <script language="javascript">
  369. function Init()
  370. {
  371. SetCheckStateTabGeneral();
  372. }
  373. function ValidatePage()
  374. {
  375. var strFoldername = document.frmTask.txtFolderName.value;
  376. //Blank Folder name Validation
  377. if (document.frmTask.hdnblnFolderFlag.value != "True")
  378. {
  379. if (strFoldername.length == 0)
  380. {
  381. DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_ENTERFOLDERNAME_ERRORMESSAGE))%>");
  382. document.frmTask.onkeypress = ClearErr
  383. return false;
  384. }
  385. }
  386. //Checks for invalid characters in the folder name
  387. if( checkKeyforValidCharacters(strFoldername))
  388. return true;
  389. else
  390. return false;
  391. }
  392. function SetData()
  393. {
  394. }
  395. //Validate page function for General tab
  396. //To check for Invalid Characters
  397. function checkKeyforValidCharacters(strFoldername)
  398. {
  399. var nLength = strFoldername.length;
  400. for(var i=0; i<nLength;i++)
  401. {
  402. charAtPos = strFoldername.charCodeAt(i);
  403. if(charAtPos == 47 || charAtPos == 92 || charAtPos ==58 || charAtPos == 42 || charAtPos == 63 || charAtPos == 34 || charAtPos == 60 || charAtPos == 62 || charAtPos == 124 || charAtPos == 91 || charAtPos == 93 || charAtPos == 59 || charAtPos == 43 || charAtPos == 61 || charAtPos == 44 )
  404. {
  405. DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_INVALIDCHARACTERINFOLDERNAME_ERRORMESSAGE))%>");
  406. document.frmTask.onkeypress = ClearErr;
  407. return false;
  408. }
  409. }
  410. return true;
  411. }
  412. function SetCheckStateTabGeneral()
  413. {
  414. document.frmTask.chkReadOnly.value = ReadOnlyState;
  415. document.frmTask.chkHidden.value = HiddenState;
  416. document.frmTask.chkArchive.value = ArchiveState;
  417. switch (ReadOnlyState)
  418. {
  419. case "<%=CONST_CHECKED_TEXT%>" :
  420. document.frmTask.chkReadOnly.checked = true;
  421. break;
  422. case "<%=CONST_UNCHECKED_TEXT%>" :
  423. document.frmTask.chkReadOnly.checked = false;
  424. break;
  425. case "<%=CONST_TRISTATE_TEXT%>" :
  426. document.frmTask.chkReadOnly.checked = true;
  427. GreyOut(document.frmTask.chkReadOnly);
  428. }
  429. switch (HiddenState)
  430. {
  431. case "<%=CONST_CHECKED_TEXT%>" :
  432. document.frmTask.chkHidden.checked = true;
  433. break;
  434. case "<%=CONST_UNCHECKED_TEXT%>" :
  435. document.frmTask.chkHidden.checked = false;
  436. break;
  437. case "<%=CONST_TRISTATE_TEXT%>" :
  438. document.frmTask.chkHidden.checked = true;
  439. GreyOut(document.frmTask.chkHidden);
  440. }
  441. switch (ArchiveState)
  442. {
  443. case "<%=CONST_CHECKED_TEXT%>" :
  444. document.frmTask.chkArchive.checked = true;
  445. break;
  446. case "<%=CONST_UNCHECKED_TEXT%>" :
  447. document.frmTask.chkArchive.checked = false;
  448. break;
  449. case "<%=CONST_TRISTATE_TEXT%>" :
  450. document.frmTask.chkArchive.checked = true;
  451. GreyOut(document.frmTask.chkArchive);
  452. }
  453. }
  454. </script>
  455. <%
  456. End Function
  457. '-------------------------------------------------------------------------
  458. 'Function name: ServeCommonJavaScriptCompress
  459. 'Description: Common javascript functions that are required for Compress tab
  460. 'Input Variables: None
  461. 'Output Variables: None
  462. 'Returns: None
  463. 'Global Variables: In:None
  464. ' Out:None
  465. '--------------------------------------------------------------------------
  466. Function ServeCommonJavaScriptCompress()
  467. %>
  468. <script language="JavaScript">
  469. function Init()
  470. {
  471. SetCheckStateTabCompress();
  472. }
  473. function ValidatePage()
  474. {
  475. return true;
  476. }
  477. function SetData()
  478. {
  479. }
  480. function SetCheckStateTabCompress()
  481. {
  482. document.frmTask.chkCompress.value = CompressState;
  483. switch (CompressState)
  484. {
  485. case "<%=CONST_CHECKED_TEXT%>" :
  486. document.frmTask.chkCompress.checked = true;
  487. break;
  488. case "<%=CONST_UNCHECKED_TEXT%>" :
  489. document.frmTask.chkCompress.checked = false;
  490. break;
  491. case "<%=CONST_TRISTATE_TEXT%>" :
  492. document.frmTask.chkCompress.checked = true;
  493. GreyOut(document.frmTask.chkCompress);
  494. }
  495. }
  496. </script>
  497. <%
  498. End Function
  499. '-------------------------------------------------------------------------
  500. 'Function name: ServeCommonJavaScript
  501. 'Description: Common javascript functions that are required by the Web
  502. ' Framework.
  503. 'Input Variables: None
  504. 'Output Variables: None
  505. 'Returns: None
  506. 'Global Variables: In:None
  507. ' Out:None
  508. '--------------------------------------------------------------------------
  509. Function ServeCommonJavaScript()
  510. %>
  511. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  512. </script>
  513. <script language="JavaScript">
  514. var ReadOnlyState = "<%=F_strReadOnly%>";
  515. var HiddenState = "<%=F_strHidden%>";
  516. var ArchiveState = "<%=F_strArchive%>";
  517. var CompressState = "<%=F_strCompressed%>";
  518. function TriStateOnClick(object)
  519. {
  520. switch (object.value)
  521. {
  522. case "<%=CONST_CHECKED_TEXT%>" :
  523. object.checked = true;
  524. object.value = "<%=CONST_TRISTATE_TEXT%>";
  525. GreyOut(object);
  526. break;
  527. case "<%=CONST_UNCHECKED_TEXT%>" :
  528. object.checked = true;
  529. object.value = "<%=CONST_CHECKED_TEXT%>";
  530. break;
  531. case "<%=CONST_TRISTATE_TEXT%>" :
  532. object.checked = false;
  533. object.value = "<%=CONST_UNCHECKED_TEXT%>";
  534. UnDoGreyOut(object);
  535. }
  536. }
  537. function DualOnClick(object)
  538. {
  539. switch (object.value)
  540. {
  541. case "<%=CONST_CHECKED_TEXT%>" :
  542. object.checked = false;
  543. object.value = "<%=CONST_UNCHECKED_TEXT%>";
  544. break;
  545. case "<%=CONST_UNCHECKED_TEXT%>" :
  546. object.checked = true;
  547. object.value = "<%=CONST_CHECKED_TEXT%>";
  548. }
  549. }
  550. function OnClickReadOnly()
  551. {
  552. if(ReadOnlyState == "<%=CONST_TRISTATE_TEXT%>")
  553. TriStateOnClick(document.frmTask.chkReadOnly);
  554. else
  555. DualOnClick(document.frmTask.chkReadOnly);
  556. }
  557. function OnClickHidden()
  558. {
  559. if(HiddenState == "<%=CONST_TRISTATE_TEXT%>")
  560. TriStateOnClick(document.frmTask.chkHidden);
  561. else
  562. DualOnClick(document.frmTask.chkHidden);
  563. }
  564. function OnClickArchive()
  565. {
  566. if(ArchiveState == "<%=CONST_TRISTATE_TEXT%>")
  567. TriStateOnClick(document.frmTask.chkArchive);
  568. else
  569. DualOnClick(document.frmTask.chkArchive);
  570. }
  571. function OnClickCompress()
  572. {
  573. if(CompressState == "<%=CONST_TRISTATE_TEXT%>")
  574. TriStateOnClick(document.frmTask.chkCompress);
  575. else
  576. DualOnClick(document.frmTask.chkCompress);
  577. }
  578. function GreyOut(object)
  579. {
  580. object.style.backgroundColor = "lightgrey";
  581. }
  582. function UnDoGreyOut(object)
  583. {
  584. object.style.backgroundColor="white";
  585. }
  586. </script>
  587. <%
  588. End Function
  589. '-------------------------------------------------------------------------
  590. 'Function name: GetFolderProperty
  591. 'Description: Get Folder Information from the system
  592. 'Input Variables: None
  593. 'Output Variables: None
  594. 'Returns: True/False
  595. 'Global Variables: F_(*),L_(*),G_objDirInstance,G_strOldFolderName
  596. '--------------------------------------------------------------------------
  597. Function GetFolderProperty
  598. Err.Clear
  599. On Error Resume Next
  600. Dim objConnection 'Object to connect to WMI
  601. Dim objFolder 'Folder Object
  602. Dim objFileSysObject 'File system object
  603. Dim objFolderFiles 'Object to get files
  604. Dim objCollection 'To get instance of Win32_LogicalDisk class
  605. Dim objInstance 'To get Instances of Win32_LogicalDisk class
  606. Dim strFolderContains 'Folder contains
  607. Dim nFilesCnt 'Files Count
  608. Dim nFolderContainsCnt 'Folders Count
  609. Dim objfolds 'File system object
  610. Dim objFolders 'Folders old name
  611. Dim nFolderCount 'Folder count
  612. Dim strItemFolder 'string to get folder names from OTS page
  613. Dim nCount 'Total number of folders
  614. Dim arrPKey 'Array of folders
  615. Dim arrFolder 'Array of folders after spliting
  616. Dim arrAttributes 'Array of attributes
  617. Dim arrFolderName 'Array of folder names
  618. Dim nArchive 'Count to get the number of archive attributes
  619. Dim nCompress 'Count to get the number of compress attributes
  620. Dim nHidden 'Count to get the number of hidden attributes
  621. Dim nReadOnly 'Count to get the number of read only attributes
  622. Dim strQuery 'WMI Query
  623. Dim objDirInstance 'WMI object for Win32_Directory
  624. Dim nFilesCount 'Total files count
  625. GetFolderProperty = True
  626. Call SA_TraceOut (SOURCE_FILE, "GetFolderProperty")
  627. nArchive = 0
  628. nCompress = 0
  629. nHidden = 0
  630. nReadOnly = 0
  631. F_nCount = OTS_GetTableSelectionCount(SA_DEFAULT)
  632. F_strParentFolder = Request.QueryString("parent")
  633. If F_nCount > 1 then
  634. 'Form variable to hold boolean value depending on number of folders selected
  635. F_blnFolderFlag = True
  636. Else
  637. F_blnFolderFlag = False
  638. End if
  639. 'Initialize the compression option to CONST_ARR_APPLYFOLDER
  640. F_nFolderCompress = CONST_ARR_APPLYFOLDER
  641. nCount = F_nCount
  642. Redim arrPKey(nCount)
  643. F_strFolders = ""
  644. For nFolderCount = 1 to nCount
  645. Call OTS_GetTableSelection("", nFolderCount, strItemFolder)
  646. arrPKey(nFolderCount-1) = strItemFolder
  647. arrFolder = split(arrPKey(nFolderCount-1),chr(1))
  648. arrFolderName = arrFolder(0)
  649. arrAttributes = arrFolder(1)
  650. 'Calling unescape to remove the escape characters
  651. F_strFolderName=UnescapeChars(arrFolderName)
  652. If Instr(arrAttributes,"A") <> 0 then
  653. nArchive = nArchive + 1
  654. End if
  655. If Instr(arrAttributes,"H") <> 0 then
  656. nHidden = nHidden + 1
  657. End if
  658. If Instr(arrAttributes,"C") <> 0 then
  659. nCompress = nCompress + 1
  660. End if
  661. If Instr(arrAttributes,"R") <> 0 then
  662. nReadOnly = nReadOnly + 1
  663. End if
  664. F_strFolders = F_strFolders & arrFolderName & chr(1)
  665. If nCount = 1 then
  666. 'To get file system object
  667. set objFileSysObject =server.CreateObject("scripting.FilesystemObject")
  668. 'To get the folder object
  669. Set objFolder=objFileSysObject.GetFolder(F_strFolderName)
  670. 'Folders and files count
  671. nFolderContainsCnt = GetFolderCount(objFileSysObject,F_strFolderName)
  672. nFilesCnt = objFolder.files.count
  673. 'To get files in the folder
  674. objFolderFiles = GetFiles(objFileSysObject,F_strFolderName)
  675. nFilesCount = objFolderFiles + nFilesCnt
  676. 'Localisation being done
  677. Dim arrVarReplacementStringsFolderContains(2)
  678. arrVarReplacementStringsFolderContains(0) = Cstr(nFilesCount)
  679. arrVarReplacementStringsFolderContains(1) = Cstr(nFolderContainsCnt)
  680. strFolderContains = SA_GetLocString("foldermsg.dll", "4043003B", arrVarReplacementStringsFolderContains)
  681. 'Connect to WMI
  682. Set objConnection = getWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  683. 'Create instance of Win32_Directory
  684. strQuery = "Select * from Win32_Directory where Name = " & chr(34) & replace(F_strFolderName,"/","\\") & chr(34)
  685. 'Create instance of Win32_Directory
  686. Set G_objDirInstance = objConnection.ExecQuery(strQuery)
  687. 'Failed to connect to WMI
  688. If Err.Number <> 0 Then
  689. Call SA_ServeFailurepage (L_WMICONNECTIONFAILED_ERRORMESSAGE & " " & Hex(Err.Number))
  690. GetFolderProperty = FALSE
  691. Exit Function
  692. End if
  693. 'Getting drive from WMI
  694. Set objCollection = objConnection.ExecQuery("Select * from Win32_LogicalDisk")
  695. 'Getting folders attributes
  696. For Each objInstance in objCollection
  697. If Ucase(objInstance.Name)= Ucase(F_strFolderName) then
  698. G_strOldFolderName = objInstance.VolumeName
  699. G_strFolderName = G_strOldFolderName
  700. End if
  701. Next
  702. 'Failed in connecting to WMI
  703. If Err.Number <> 0 Then
  704. Call SA_ServeFailurepage (L_WMICONNECTIONFAILED_ERRORMESSAGE & " " & Hex(Err.Number))
  705. GetFolderProperty = False
  706. Exit Function
  707. End if
  708. If G_strOldFolderName="" then
  709. set objfolds=server.CreateObject("scripting.filesystemobject")
  710. set objFolders=objfolds.GetFolder(F_strFolderName)
  711. G_strOldFolderName = objFolders.name
  712. G_strFolderName=G_strOldFolderName
  713. set objfolds=Nothing
  714. set objFolders = Nothing
  715. End if
  716. Dim arrVarReplacementStringsFolder(1)
  717. arrVarReplacementStringsFolder(0) = Cstr(objFolder.Size)
  718. F_strFolderSize = SA_GetLocString("foldermsg.dll", "4043003C", arrVarReplacementStringsFolder)
  719. F_strContains = strFolderContains
  720. F_strFolderCreated = objFolder.DateCreated
  721. 'Updating the form variables
  722. For each objDirInstance in G_objDirInstance
  723. F_strFolderType = objDirInstance.FileType
  724. F_strCompressed = objDirInstance.Compressed
  725. Exit for
  726. Next
  727. 'Release the object
  728. Set objDirInstance = Nothing
  729. End if
  730. Next
  731. If nReadOnly = 0 then
  732. F_strReadOnly = CONST_UNCHECKED_TEXT
  733. ElseIf int(nReadOnly) = int(nCount) then
  734. F_strReadOnly = CONST_CHECKED_TEXT
  735. ElseIf nReadOnly > 0 and nReadOnly < nCount then
  736. F_strReadOnly = CONST_TRISTATE_TEXT
  737. End if
  738. If nCompress = 0 then
  739. F_strCompressed = CONST_UNCHECKED_TEXT
  740. ElseIf nCompress = nCount then
  741. F_strCompressed = CONST_CHECKED_TEXT
  742. ElseIf nCompress < nCount and nCompress > 0 then
  743. F_strCompressed = CONST_TRISTATE_TEXT
  744. End if
  745. If nArchive = 0 then
  746. F_strArchive=CONST_UNCHECKED_TEXT
  747. ElseIf nArchive = nCount then
  748. F_strArchive=CONST_CHECKED_TEXT
  749. ElseIf nArchive < nCount and nArchive > 0 then
  750. F_strArchive = CONST_TRISTATE_TEXT
  751. End if
  752. If nHidden = 0 then
  753. F_strHidden = CONST_UNCHECKED_TEXT
  754. ElseIf nHidden = nCount then
  755. F_strHidden = CONST_CHECKED_TEXT
  756. ElseIf nHidden < nCount and nHidden > 0 then
  757. F_strHidden = CONST_TRISTATE_TEXT
  758. End if
  759. GetFolderProperty = True
  760. 'Release the objects
  761. Set objConnection = Nothing
  762. Set objCollection = Nothing
  763. Set objFolder = Nothing
  764. Set objFileSysObject = Nothing
  765. Set objFolderFiles = Nothing
  766. Set objCollection = Nothing
  767. Set objInstance = Nothing
  768. End function
  769. '-------------------------------------------------------------------------
  770. 'Function name: SetFolderProperty
  771. 'Description: Setting the properties of the Folder
  772. 'Input Variables: None
  773. 'Output Variables: None
  774. 'Returns: True/False
  775. 'Global Variables: L_(*)
  776. '--------------------------------------------------------------------------
  777. Function SetFolderProperty
  778. Err.Clear
  779. On Error Resume Next
  780. Dim strFolderName 'Folder name
  781. Dim objConnection 'WMI object
  782. Dim objFolder 'Folder object
  783. Dim objFileSystem 'File system object
  784. Dim objInstance 'To get instances of Win32_LogicalDisk
  785. Dim objDrive 'To get instance of Win32_LogicalDisk
  786. Dim objFolderFiles 'Files in the folder
  787. Dim objSubFolders 'Subfolders in a folder
  788. Dim strFolders 'String having folder names
  789. Dim strFolder 'Folder name afetr spliting the string
  790. Dim arrFolders 'Array of folders
  791. Dim nFolderCount 'Folder count
  792. Dim strQuery 'WMI Query
  793. Dim objDirInstance 'WMI object for Win32_Directory
  794. Dim nReturnValue 'Returnvalue after renaming the folder
  795. Call SA_TraceOut (SOURCE_FILE, "SetFolderProperty")
  796. 'Connect to WMI
  797. Set objConnection = getWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  798. 'Create instance of Win32_LogicalDisk
  799. Set objDrive = objConnection.ExecQuery("Select * from Win32_LogicalDisk")
  800. 'Failed to connect to WMI
  801. If Err.Number <> 0 Then
  802. Call SA_ServeFailurepage (L_WMICONNECTIONFAILED_ERRORMESSAGE & " " & Hex(Err.Number))
  803. SetFolderProperty=False
  804. Exit Function
  805. End if
  806. 'Create file system object
  807. Set objFileSystem = server.CreateObject("scripting.FilesystemObject")
  808. 'Failed to get file system object
  809. If Err.number <>0 Then
  810. Call SA_SetErrMsg (L_FILESYSTEMOBJECTNOTCREATED_ERRORMESSAGE & " " & Hex(Err.Number))
  811. SetFolderProperty=False
  812. Exit Function
  813. End If
  814. Redim arrFolders(F_nCount)
  815. For nFolderCount = 1 to F_nCount
  816. strFolder = split(F_strFolders,chr(1))
  817. arrFolders(nFolderCount-1) = strFolder(nFolderCount-1)
  818. F_strFolderName = UnescapeChars(arrFolders(nFolderCount-1))
  819. 'Get the folder
  820. Set objFolder = objFileSystem.GetFolder(F_strFolderName)
  821. 'Error in getting the folder
  822. If Err.number <>0 Then
  823. Call SA_SetErrMsg (L_FOLDERNOTEXISTS_ERRORMESSAGE & "(" & Hex(Err.Number) & ")")
  824. SetFolderProperty=False
  825. Exit Function
  826. End If
  827. 'Get files and subfolders in folders
  828. set objFolderFiles = objFolder.Files
  829. Set objSubFolders = objFolder.SubFolders
  830. If nFolderCount = 1 then
  831. 'Set Drive label
  832. For Each objInstance in objDrive
  833. If Ucase(objInstance.Name)= Ucase(F_strFolderName) then
  834. objInstance.VolumeName = G_strFolderName
  835. objInstance.Put_()
  836. End if
  837. Next
  838. Set objInstance = Nothing
  839. End If
  840. 'Create instance of Win32_Directory
  841. strQuery = "Select * from Win32_Directory where Name = " & chr(34) & replace(F_strFolderName, "/", "\\") & chr(34)
  842. 'Create instance of Win32_Directory
  843. Set G_objDirInstance = objConnection.ExecQuery(strQuery)
  844. 'Failed to connect to WMI
  845. If Err.Number <> 0 Then
  846. Call SA_ServeFailurepage (L_WMICONNECTIONFAILED_ERRORMESSAGE & " " & Hex(Err.Number))
  847. SetFolderProperty=False
  848. Exit Function
  849. End if
  850. 'Folder compress
  851. For each objDirInstance in G_objDirInstance
  852. If Ucase(F_strCompressed) = Ucase(CONST_CHECKED_TEXT) then
  853. if F_nFolderCompress = CONST_ARR_APPLYFOLDER then
  854. objDirInstance.UnCompressEX null,null,True
  855. objDirInstance.CompressEX null,null,False
  856. elseif F_nFolderCompress = CONST_ARR_APPLYALLFOLDERS then
  857. objDirInstance.UnCompressEX null,null,False
  858. objDirInstance.CompressEX null,null,True
  859. end if
  860. ElseIf F_strCompressed = CONST_UNCHECKED_TEXT then
  861. If F_nFolderCompress = CONST_ARR_APPLYFOLDER then
  862. objDirInstance.UnCompressEX null,null,False
  863. elseif F_nFolderCompress = CONST_ARR_APPLYALLFOLDERS then
  864. objDirInstance.UnCompressEX null,null,True
  865. end if
  866. End if
  867. Exit for
  868. Next
  869. 'Release the object
  870. Set objDirInstance = Nothing
  871. 'Connection to WMI failed
  872. If Err.Number <> 0 Then
  873. Call SA_ServeFailurepage (L_WMICONNECTIONFAILED_ERRORMESSAGE & " " & Hex(Err.Number))
  874. SetFolderProperty=False
  875. Exit Function
  876. End if
  877. 'Set the Read only attribute
  878. If objFolder.Attributes and 1 Then
  879. If trim(Ucase(F_strReadOnly)) = trim(Ucase(CONST_UNCHECKED_TEXT)) Then
  880. objFolder.attributes = objFolder.attributes - 1
  881. End if
  882. Else
  883. If trim(Ucase(F_strReadOnly)) = trim(Ucase(CONST_CHECKED_TEXT)) Then
  884. objFolder.attributes = objFolder.attributes + 1
  885. End if
  886. End if
  887. 'Set the hidden attribute
  888. If objFolder.attributes and 2 Then
  889. If trim(Ucase(F_strHidden)) = trim(Ucase(CONST_UNCHECKED_TEXT)) Then
  890. objFolder.attributes = objFolder.attributes - 2
  891. End if
  892. Else
  893. If trim(Ucase(F_strHidden)) = trim(Ucase(CONST_CHECKED_TEXT)) Then
  894. objFolder.attributes =objFolder.attributes + 2
  895. End if
  896. End if
  897. 'Set the archives attribute
  898. If objFolder.attributes and 32 Then
  899. If trim(Ucase(F_strArchive)) = trim(Ucase(CONST_UNCHECKED_TEXT)) Then
  900. objFolder.attributes = objFolder.attributes - 32
  901. End If
  902. Else
  903. If trim(Ucase(F_strArchive)) = trim(Ucase(CONST_CHECKED_TEXT)) Then
  904. objFolder.attributes = objFolder.attributes + 32
  905. End if
  906. End if
  907. Set objFolder = Nothing
  908. Set objFolderFiles = Nothing
  909. Set objSubFolders = Nothing
  910. 'Create instance of Win32_Directory
  911. strQuery = "Select * from Win32_Directory where Name = " & chr(34) & replace(F_strFolderName, "/", "\\") & chr(34)
  912. 'Create instance of Win32_Directory
  913. Set G_objDirInstance = objConnection.ExecQuery(strQuery)
  914. 'Failed to connect to WMI
  915. If Err.Number <> 0 Then
  916. Call SA_ServeFailurepage (L_WMICONNECTIONFAILED_ERRORMESSAGE & " " & Hex(Err.Number))
  917. SetFolderProperty = FALSE
  918. Exit Function
  919. End if
  920. If nFolderCount = 1 then
  921. strFolderName = trim(Left(F_strFolderName,len(F_strFolderName)-len(G_strOldFolderName)) )
  922. 'If the folder name changed check if the folder already exists
  923. If UCase(G_strFolderName) <> UCase(G_strOldFolderName) Then
  924. 'If Folder exists display error message
  925. If objFileSystem.FolderExists(replace(strFolderName & G_strFolderName, "/" , "\")) then
  926. Call SA_SetErrMsg (L_DIRECTORYALREADYEXISTS_ERRORMESSAGE& "(" & Hex(Err.Number) & ")")
  927. SetFolderProperty=False
  928. Exit Function
  929. End if
  930. 'Renaming the folder
  931. For each objDirInstance in G_objDirInstance
  932. nReturnValue = objDirInstance.Rename(strFolderName & G_strFolderName)
  933. Exit for
  934. Next
  935. If nReturnValue <> 0 then
  936. Call SA_SetErrMsg (L_FOLDERRENAME_ERRORMESSAGE & " " & Hex(Err.Number))
  937. SetFolderProperty=False
  938. Exit Function
  939. End If
  940. End If
  941. If Err.number <> 0 Then
  942. Call SA_SetErrMsg (L_FOLDERRENAME_ERRORMESSAGE & " " & Hex(Err.Number) )
  943. SetFolderProperty=False
  944. Exit Function
  945. End If
  946. 'Release the object
  947. Set objDirInstance = Nothing
  948. End If
  949. Next
  950. 'Release the objects
  951. Set objConnection = Nothing
  952. Set objFileSystem = Nothing
  953. Set objDrive = Nothing
  954. 'Failed to create file system object
  955. If Err.number <> 0 Then
  956. Call SA_SetErrMsg (L_FILESYSTEMOBJECTNOTCREATED_ERRORMESSAGE & " " & Hex(Err.Number) )
  957. SetFolderProperty=False
  958. Exit Function
  959. End If
  960. SetFolderProperty=true
  961. End Function
  962. '-------------------------------------------------------------------------
  963. 'Function name: GetFolderCount
  964. 'Description: Serves in getting the count of folders
  965. 'Input Variables: objFileSystem,strFolderPath
  966. 'Output Variables: None
  967. 'Returns: Folder count
  968. 'Global Variables: None
  969. '--------------------------------------------------------------------------
  970. Function GetFolderCount(objFileSystem,strFolderPath)
  971. on error resume next
  972. Err.Clear
  973. Dim objFolderCollection 'Collection fo subfolders
  974. Dim objSubFolder 'To get the subfolders
  975. Dim objFolder 'To get the root folder
  976. Dim objDrive 'To get the drive
  977. Dim nCount 'To get the number of folders
  978. Dim strSubFolderPath 'To get the subfolders path
  979. 'Get the drive and the folders
  980. IF right (strFolderPath,1)=":" Then
  981. Set objDrive=objFileSystem.Getdrive(strFolderPath)
  982. set objFolder =objDrive.RootFolder
  983. Else
  984. Set objFolder = objFileSystem.getFolder(strFolderPath)
  985. End If
  986. 'Initialize the count
  987. nCount = 0
  988. set objFolderCollection = objFolder.subFolders
  989. 'To get the sub folders count
  990. For each objSubFolder in objFolderCollection
  991. strSubFolderPath = objSubFolder.path
  992. if err.number <> 0 then
  993. nCount = nCount - 1
  994. Err.Clear
  995. end if
  996. nCount = nCount + 1
  997. nCount = nCount + GetFolderCount(objFileSystem,objSubFolder.path)
  998. Next
  999. Set objFolderCollection = Nothing
  1000. Set objSubFolder = Nothing
  1001. Set objFolder = Nothing
  1002. Set objDrive = Nothing
  1003. GetFolderCount = nCount
  1004. End Function
  1005. '-------------------------------------------------------------------------
  1006. 'Function name: GetFiles
  1007. 'Description: Serves in getting the count of files
  1008. 'Input Variables: objFileSystem,strFolderPath
  1009. 'Output Variables: None
  1010. 'Returns: Count of files
  1011. 'Global Variables: In:None
  1012. ' Out:None
  1013. '--------------------------------------------------------------------------
  1014. Function GetFiles(objFileSystem,strFolderPath)
  1015. on error resume next
  1016. Err.Clear
  1017. Dim objFolder 'Folder object
  1018. Dim objFiles 'File object
  1019. Dim objFolderCollection 'Collection of folders
  1020. Dim objSubFolder 'Sub folder object
  1021. Dim nFileCount 'File count
  1022. 'To get the sub folders
  1023. set objFolder = objFileSystem.getFolder(strFolderPath)
  1024. set objFolderCollection = objFolder.subFolders
  1025. 'To the files count
  1026. For each objSubFolder in objFolderCollection
  1027. set objFiles=objSubFolder.Files
  1028. nFileCount = nFileCount + objFiles.count
  1029. nFileCount = nFileCount + GetFiles(objFileSystem,objSubFolder.path)
  1030. Next
  1031. GetFiles=nFileCount
  1032. set objFolder = nothing
  1033. set objFiles = nothing
  1034. set objFolderCollection = nothing
  1035. End Function
  1036. %>