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.

530 lines
21 KiB

  1. <!--
  2. * Copyright 1998 Microsoft Corporation. All rights reserved.
  3. * This file was automatically generated by Microsoft Windows NT5
  4. * using the file %THISDIRPATH%\folder.htt (if customized) or
  5. * %TEMPLATEDIR%\folder.htt (if not customized).
  6. -->
  7. <html>
  8. <!--
  9. <link rel=stylesheet href="%TEMPLATEDIR%\webview.css" title="Windows">
  10. -->
  11. <style>
  12. body {margin: 0; font: menu; color: black}
  13. #Panel {position: absolute; width: 200px; height: 100%; visibility: hidden; overflow: auto}
  14. #Corner {padding-left: 12px; padding-top: 11px}
  15. #FolderIcon {width: 32px; height: 32px}
  16. #FolderName {margin-top: 8px; font: 13pt/13pt; font-weight: bold}
  17. #LogoLine {width: 100%; margin-top: 4px; vertical-align: top}
  18. #Details {padding-left: 12px; margin-top: 8px}
  19. #Locked {vertical-align: baseline}
  20. #Preview {}
  21. .Movie {width: 120px; height: 136px}
  22. .Sound {width: 120px; height: 46px}
  23. #Thumbnail {width: 120px; height: 120px}
  24. .Legend {margin-left: 12px; margin-right: -12px}
  25. #PieChart {width: 120px; height: 60px; margin-top: 10px}
  26. #FileList {position: absolute; left: 200px; width: 100% - 200px; height: 100%; tabIndex: 1}
  27. #Brand {position: absolute; left: 200px; width: 100% - 200px; height: 100%; padding-left: 12px}
  28. p {margin-top: 12px}
  29. p.Half {margin-top: 6px}
  30. button {font: 8pt Tahoma; margin-left: 12px; background: white; color: black}
  31. #GlobalNav {position: absolute; left: 10px; top: 250px; width: 170px; height: 20px; padding-left: 0px; font: 8pt Tahoma}
  32. </style>
  33. <head>
  34. <base href="%THISDIRPATH%\">
  35. </head>
  36. <!--
  37. <script language="JavaScript" src="%TEMPLATEDIR%\WebView.js">
  38. -->
  39. <script language="JavaScript">
  40. // THIS SCRIPT IS COMMON FOR ALL CUSTOM WEB VIEWS
  41. var L_Prompt_Text = "All users have access to Documents on Our Server. Access to folders within Documents on Our Server can be restricted using folder security.";
  42. var L_Empty_Text = "There are no documents to show in this folder.";
  43. var L_Multiple_Text = " items selected.";
  44. var L_Size_Text = "Size: ";
  45. var L_FileSize_Text = "Total File Size: ";
  46. var L_Delimiter_Text = ",";
  47. var L_Bytes_Text = "&nbsp;bytes";
  48. var L_Properties_Text = "P&roperties";
  49. var L_Today_Text = "Today at";
  50. var L_Yesterday_Text = "Yesterday at";
  51. var L_Preview_Text = "Generating preview...";
  52. var L_TotalSize_Text = "Capacity: ";
  53. var L_UsedSpace_Text = "Used: ";
  54. var L_FreeSpace_Text = "Free: ";
  55. var L_Attributes_Text = "Attributes";
  56. var L_Codes_Text = "RHSaCE"; // suppress the Archive flag
  57. var L_ReadOnly_Text = "Read-only";
  58. var L_Hidden_Text = "Hidden";
  59. var L_System_Text = "System";
  60. var L_Archive_Text = "Archive";
  61. var L_Compressed_Text = "Compressed";
  62. var L_Encrypted_Text = "Encrypted";
  63. var L_NoAttributes_Text = "(normal)";
  64. var gAttributeNames = new Array(L_ReadOnly_Text, L_Hidden_Text, L_System_Text, L_Archive_Text, L_Compressed_Text, L_Encrypted_Text);
  65. var gIntroText = "";
  66. var gTimer = 0;
  67. var gWantMedia = false; // cool, but may hinder media file manipulation
  68. var gDoBlends = false && (navigator.cpuClass != "Alpha" && screen.colorDepth > 8);
  69. var gToday;
  70. var gYesterday;
  71. var gFolder;
  72. var gFolderPath;
  73. var gFoundAuthor;
  74. var gFolderName;
  75. function FormatDetail(label, data) {
  76. var s;
  77. if (label.length + data.length > 32)
  78. s = "<p>" + label + ":<br>" + data;
  79. else
  80. s = "<p>" + label + ": " + data;
  81. return s;
  82. }
  83. function ShowInfo() {
  84. // updates the left info panel when you select icons
  85. var item;
  86. var name;
  87. var data;
  88. var text;
  89. var title;
  90. var size = 0;
  91. var i;
  92. if (gDoBlends) {
  93. Panel.filters.blendTrans.Stop();
  94. Panel.filters.blendTrans.Apply();
  95. }
  96. // kill any preview
  97. Preview.innerHTML = "";
  98. Preview.style.display = "none";
  99. Thumbnail.style.height = 120;
  100. Thumbnail.style.display = "none";
  101. // disable Change Security Folder button
  102. buttonChangeFolderSecurity.disabled = true;
  103. data = FileList.SelectedItems().Count;
  104. if (data == 0)
  105. text = NoneSelected()+"<p>";
  106. else if (data > 1)
  107. text = ManySelected(data);
  108. else {
  109. item = FileList.SelectedItems().Item(0);
  110. // name
  111. name = FileList.Folder.GetDetailsOf(item, 0);
  112. if (!name)
  113. name = item.Name;
  114. if (IsBrowsable(item)){
  115. text = "<b>" + name + "</b>";
  116. //text = "<b>" + name.link(item.Path) + "</b>";
  117. //text = "";
  118. }
  119. else{
  120. text = "<b>" + name + "</b>";
  121. //text = "";
  122. }
  123. if (false && IsFileLocked(FileList.Folder.GetDetailsOf(item, 4)))
  124. text += "&nbsp;&nbsp;<img id=Locked src='res://webview.dll/Locked.gif'>";
  125. // type
  126. data = FileList.Folder.GetDetailsOf(item, 2);
  127. if (data) {
  128. text += "<br>" + data;
  129. // if folder enable Change Folder Security button
  130. if (data == "File Folder") {
  131. gFolderName = name;
  132. buttonChangeFolderSecurity.disabled = false;
  133. }
  134. }
  135. // date
  136. text += HandleDate(item);
  137. // size
  138. text += HandleSize(item);
  139. // extra details?
  140. gFoundAuthor = false;
  141. for (i = 4; i < 10; i++) {
  142. title = FileList.Folder.GetDetailsOf(null, i);
  143. if (!title)
  144. break;
  145. data = FileList.Folder.GetDetailsOf(item, i);
  146. if (title == L_Attributes_Text) {
  147. //text += "<p>" + title + ": " + FormatAttributes(data);
  148. }
  149. else if (data) {
  150. if (title == "Author") {
  151. gFoundAuthor = true;
  152. //text += "<p>" + title + ": <a href='mailto:" + data + "'>" + data + "</a>";
  153. } else
  154. if (i == 9) {
  155. text += "<p>" + data;
  156. //text += FormatDetail(title, data);
  157. }
  158. }
  159. }
  160. //if (GetFileExtension(name) != "exe") {
  161. // gFolderSelected = true;
  162. // gFolderName = name;
  163. //} else
  164. // gFolderSelected = false;
  165. // comment?
  166. text += HandleComment(item);
  167. // try to generate a new thumbnail or media preview
  168. if (item.Size)
  169. if (Thumbnail.displayFile(item.Path))
  170. gTimer = window.setTimeout('Preview.innerHTML = "<br>" + L_Preview_Text; Preview.style.display = ""', 1000);
  171. else if (gWantMedia) {
  172. ext = GetFileExtension(name);
  173. if (IsMovieFile(ext))
  174. Preview.innerHTML = '<p><object class=Movie classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"><param name="FileName" value="' + item.Path + '"><param name=ShowDisplay value=0><param name=AutoPlay value=0></object>';
  175. else if (IsSoundFile(ext))
  176. Preview.innerHTML = '<p><object class=Sound classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"><param name="FileName" value="' + item.Path + '"><param name=ShowDisplay value=0><param name=AutoPlay value=0></object>';
  177. if (Preview.innerHTML != "")
  178. Preview.style.display = "";
  179. }
  180. }
  181. // replace Info with the new text
  182. Info.innerHTML = text;
  183. if (gDoBlends)
  184. Panel.filters.blendTrans.Play();
  185. }
  186. function FormatNumber(n) {
  187. var s = "";
  188. var i, j = 0;
  189. for (i = n.length - 1; i >= 0; i--) {
  190. s = n.charAt(i) + s;
  191. if (i && ((++j % 3) == 0))
  192. s = L_Delimiter_Text + s;
  193. }
  194. return s;
  195. }
  196. function HandleSize(item) {
  197. var s = "";
  198. var size = item.Size;
  199. if (size && size < 1000)
  200. s = "<p>" + L_Size_Text + size + L_Bytes_Text;
  201. else {
  202. var data = FileList.Folder.GetDetailsOf(item, 1);
  203. if (data)
  204. s = "<p>" + FileList.Folder.GetDetailsOf(null, 1) + ": " + data;
  205. else if (size)
  206. s = "<p>" + L_Size_Text + FormatNumber(size.toString()) + L_Bytes_Text;
  207. }
  208. return s;
  209. }
  210. function FormatDate(s) {
  211. var d = new Date(s);
  212. d = d.toLocaleString();
  213. d = d.substring(0, d.indexOf(' '));
  214. if (d == gToday || d == gYesterday) {
  215. var sTime = s.substring(s.indexOf(' '), s.length);
  216. if (d == gToday)
  217. s = L_Today_Text + sTime;
  218. else
  219. s = L_Yesterday_Text + sTime;
  220. }
  221. return s;
  222. }
  223. function HandleDate(item) {
  224. var s = "";
  225. var data = FileList.Folder.GetDetailsOf(item, 3);
  226. if (data)
  227. s = "<p>" + FileList.Folder.GetDetailsOf(null, 3) + ": " + FormatDate(data);
  228. return s;
  229. }
  230. function FormatAttributes(data) {
  231. var s = "";
  232. var code;
  233. for (i = 0; i < L_Codes_Text.length; i++) {
  234. code = L_Codes_Text.charAt(i);
  235. if (data.indexOf(code) > -1) {
  236. if (s)
  237. s += ", ";
  238. s += gAttributeNames[i];
  239. }
  240. }
  241. if (!s)
  242. s = L_NoAttributes_Text;
  243. return s;
  244. }
  245. function FormatComment(data) {
  246. var s = "";
  247. if (data) {
  248. var start;
  249. var end;
  250. var theLink;
  251. var a = data.split("\n");
  252. var L_Author_Text = "Author: ";
  253. // look for a contact
  254. for (var i in a) {
  255. start = a[i].indexOf(L_Author_Text);
  256. if (start < 0)
  257. continue;
  258. if (gFoundAuthor) // already in Details column
  259. a[i] = "";
  260. else {
  261. start += L_Author_Text.length;
  262. end = a[i].length;
  263. theLink = data.substring(start, end);
  264. a[i] = L_Author_Text + "<a href='mailto:" + theLink + "'>" + theLink + "</a>";
  265. }
  266. }
  267. // parse lines for Office files without breaking links below
  268. data = a.join("<br>\n");
  269. // look for embedded links
  270. start = data.indexOf("http://");
  271. if (start < 0)
  272. start = data.indexOf("file://");
  273. if (start < 0)
  274. s += data;
  275. else {
  276. end = data.indexOf(" ", start);
  277. if (end < 0)
  278. end = data.length;
  279. if (start > 0)
  280. s += data.substring(0, start - 1);
  281. theLink = data.substring(start, end);
  282. s += theLink.link(theLink);
  283. if (end < data.length)
  284. s += data.substring(end + 1, data.length);
  285. }
  286. }
  287. return s;
  288. }
  289. function HandleComment(item) {
  290. var s = "";
  291. var data = FileList.Folder.GetDetailsOf(item, -1);
  292. if (data && data != item.Name)
  293. s = "<p>" + FormatComment(data);
  294. return s;
  295. }
  296. function Properties() {
  297. FileList.SelectedItems().Item(0).InvokeVerb(L_Properties_Text);
  298. }
  299. function GetFileExtension(name) {
  300. var ext = name.substring(name.lastIndexOf(".") + 1, name.length);
  301. return ext.toLowerCase();
  302. }
  303. function IsBrowsable(item) {
  304. if (item.IsBrowsable || item.IsFolder)
  305. return true;
  306. var ext = GetFileExtension(item.Path);
  307. var types = "gif,jpg,htm,txt,rtf"
  308. return types.indexOf(ext) > -1;
  309. }
  310. function IsMovieFile(ext) {
  311. var types = "avi,mov,qt,mpe,mpeg,mpg";
  312. return types.indexOf(ext) > -1;
  313. }
  314. function IsSoundFile(ext) {
  315. var types = "aif,aifc,aiff,au,mid,rmi,snd,wav";
  316. return types.indexOf(ext) > -1;
  317. }
  318. function IsFileLocked(name) {
  319. return (name.indexOf(L_Codes_Text.charAt(0)) > -1);
  320. }
  321. function NoneSelected() {
  322. // var s = gIntroText + (FileList.Folder.Items().Count ? L_Prompt_Text : L_Empty_Text);
  323. var s = gIntroText + L_Prompt_Text;
  324. if (false || gFolderPath.length == 4) { // true allows all subfolders to show the pie chart
  325. drive = gFolderPath.substring(0, 3);
  326. if (Thumbnail.displayFile(drive)) {
  327. if (gFolderPath.length == 4)
  328. s += "<p><br>" + L_TotalSize_Text + Thumbnail.totalSpace + "<p>";
  329. else
  330. s += "<p><br>" + drive.link(drive) + "<p><p>" + L_TotalSize_Text + Thumbnail.totalSpace;
  331. s += "<p><table class=Legend width=12 height=12 border=1 align=left bgcolor=threedface bordercolordark=black bordercolorlight=black><tr><td></td></tr></table>&nbsp;" + L_UsedSpace_Text + Thumbnail.usedSpace;
  332. s += "<p><table class=Legend width=12 height=12 border=1 align=left bgcolor=threedhighlight width=12 height=12 border=1 align=left bordercolordark=black bordercolorlight=black><tr><td></td></tr></table>&nbsp;" + L_FreeSpace_Text + Thumbnail.freeSpace;
  333. //Thumbnail.style.height = 60;
  334. Thumbnail.style.display = "";
  335. }
  336. }
  337. return s;
  338. }
  339. function ManySelected(items) {
  340. var s = items + L_Multiple_Text + "<p>";
  341. var size = 0;
  342. if (items <= 100) {
  343. for (var i = 0; i < items; i++)
  344. size += FileList.SelectedItems().Item(i).Size;
  345. if (size)
  346. s += L_FileSize_Text + FormatNumber(size.toString()) + L_Bytes_Text + "<p>";
  347. if (items <= 16)
  348. for (i = 0; i < items; i++)
  349. s += FileList.SelectedItems().Item(i).Name + "<br>";
  350. }
  351. return s;
  352. }
  353. // EVENTS
  354. function Resize() {
  355. if (document.body.clientWidth < Panel.style.pixelWidth * 2) {
  356. Panel.style.visibility = "hidden";
  357. FileList.style.pixelLeft = 0;
  358. } else {
  359. Panel.style.visibility = "visible";
  360. FileList.style.pixelLeft = Panel.style.pixelWidth;
  361. }
  362. FileList.style.pixelWidth = document.body.clientWidth - FileList.style.pixelLeft;
  363. }
  364. function ThumbnailReady() {
  365. window.clearTimeout(gTimer);
  366. Preview.innerHTML = "";
  367. Preview.style.display = "none";
  368. if (Thumbnail.haveThumbnail())
  369. Thumbnail.style.display = "";
  370. }
  371. // INITIALIZATION
  372. function Initialize(introText) {
  373. gIntroText = introText;
  374. gFolder = FileList.Folder;
  375. gFolderPath = Info.innerHTML;
  376. Info.innerHTML = NoneSelected();
  377. // fix styles
  378. var L_SystemFont1_Text = "MS Sans Serif";
  379. var L_SystemFont2_Text = "MS Shell Dlg";
  380. var L_SystemFont_Text = "Tahoma, Verdana";
  381. var tr = document.body.createTextRange();
  382. if (navigator.cpuClass != "Alpha") {
  383. tr.collapse();
  384. var actualFont = tr.queryCommandValue("FontName");
  385. if (actualFont == L_SystemFont1_Text || actualFont == L_SystemFont2_Text)
  386. document.body.style.fontFamily = L_SystemFont_Text;
  387. } else
  388. document.body.style.fontFamily = L_SystemFont_Text;
  389. // init relative dates
  390. gToday = new Date();
  391. gToday = gToday.toLocaleString();
  392. gToday = gToday.substring(0, gToday.indexOf(' '));
  393. gYesterday = new Date(Date.parse(gToday) - (1000 * 60 * 60 * 24));
  394. gYesterday = gYesterday.toLocaleString();
  395. gYesterday = gYesterday.substring(0, gYesterday.indexOf(' '));
  396. // call our Resize() function whenever the window gets resized
  397. window.onresize = Resize;
  398. }
  399. function newFolder()
  400. {
  401. var fso = new ActiveXObject("Scripting.FileSystemObject");
  402. var a = fso.CreateFolder("g:\\NewFolder");//We need IE4 to use this but it is needed for Web View anyway.
  403. }
  404. function changeFolderSecurity() {
  405. Properties();
  406. // FileList.Folder.Application.ShellExecute("\\\\appliance1\\Documents\\Change security.exe", gFolderName);
  407. }
  408. function manageOurServer() {
  409. window.location = "http://appliance1/chameleon"
  410. }
  411. </script>
  412. <script language="JavaScript">
  413. function Load() {
  414. Initialize("");
  415. Resize();
  416. // FileList.focus();
  417. }
  418. </script>
  419. <script language="JavaScript" for="Thumbnail" event="OnThumbnailReady">
  420. ThumbnailReady();
  421. </script>
  422. <script language="JavaScript" for="FileList" event="SelectionChanged">
  423. window.clearTimeout(gTimer);
  424. gTimer = window.setTimeout("ShowInfo()", gDoBlends ? 500 : 0); // need actual double-click time
  425. </script>
  426. <body scroll=no onload=Load()>
  427. <div id=Panel style="background: white URL(file://\\appliance1\documents\logo51.gif) no-repeat">
  428. <div id=Corner>
  429. <object id=FolderIcon classid="clsid:E5DF9D10-3B52-11D1-83E8-00A0C90DC849" width=32 height=32>
  430. <param name="scale" value=100>
  431. </object>
  432. <br>
  433. <div id=FolderName>
  434. %THISDIRNAME%
  435. </div>
  436. on Our Server
  437. <p><br>
  438. </div>
  439. <!--<img id=LogoLine src="%TEMPLATEDIR%\wvline.gif">-->
  440. <div id=Details>
  441. <span id=Info>
  442. %THISDIRPATH%
  443. </span>
  444. <!-- HERE'S A GOOD PLACE TO ADD A FEW LINKS OF YOUR OWN -->
  445. <p>
  446. To create a new folder, click:
  447. <button accessKey='N' onClick='newFolder()' style='width: 130'>New Folder</button>
  448. <p>
  449. To change the security of a folder, select the folder and click:
  450. <button name="buttonChangeFolderSecurity" accessKey='C' onClick='changeFolderSecurity()' style='width: 130' Disabled>Change Folder Security</button>
  451. <p>
  452. To manage Our Server, click:
  453. <button accessKey='S' onClick='manageOurServer()' style='width: 130'>Manage Our Server</button>
  454. <p>
  455. <p class=Half>
  456. <div id=Preview style="display: none">
  457. </div>
  458. <br>
  459. <object id=Thumbnail classid="clsid:1D2B4F40-1F10-11D1-9E88-00C04FDCAB92" style="display: none">
  460. </object>
  461. </div>
  462. </div>
  463. <object id=FileList tabindex=1 border=0 classid="clsid:1820FED0-473E-11D0-A96C-00C04FD705A2">
  464. </object>
  465. </body>
  466. </html>