复制代码 代码如下:
<%@LANGUAGE=”JScript” CODEPAGE=”936″%><%var sSelfPath = Server.MapPath(Request.ServerVariables(“SCRIPT_NAME”)(1)).toLowerCase();var sUrl = Request.ServerVariables(“URL”)(1);var sAction = Request(“a”)+””;var sTarget = (Request(“t”)+””).toLowerCase();var sShowSmall = Request(“s”)+””;var CURRENT_DIRECTORY = Request.Cookies(“Cc_Dm_CurrentFolder”) + “”;if(!isNaN(sShowSmall)){Response.Cookies(“CC_Dm_ShowSmall”)=sShowSmall;sQueryString = “”;var e = new Enumerator(Request.QueryString);for (; !e.atEnd(); e.moveNext()){var x = e.item();if(x!=”s”){sQueryString += x + “=” + Request.QueryString(x) + “&”;};};Response.Redirect(sUrl+”?”+sQueryString);};sShowSmall = Request.Cookies(“CC_Dm_ShowSmall”);if(isNaN(parseInt(sShowSmall))) sShowSmall=”0″;function ShowError(e){Response.write(“<script language=javascript>alert(‘COCOON Online Disk Manager 4.51 \r\n”+ ” Created by: COCOON Studio (www.ccopus.com)\r\n”+ ” Coding by: Sunrise_Chen (sunrise_chen@msn.com)\r\n”+ “提示信息: \r\n\r\n “+ Str4Js(e.description) + “‘);history.back();window.close();</script>”);Response.end();};function Str4Js(s){return (s+”).replace(/\/g,”\\”).replace(/’/g,”'”).replace(/”/g,”"”);};function Cc_DiskManager(){try{this.fso = new ActiveXObject(“Scripting.FileSystemObject”);};catch(e){ShowError(e);};function FormatDateTime(dtDateTime){return new Date(dtDateTime).toLocaleString();};function GetTypeName(s){switch(s){case 0 : return “Unknown”;case 1 : return “3.5 软盘”;case 2 : return “本地硬盘”;case 3 : return “Network”;case 4 : return “CD 驱动器”;case 5 : return “RamDisk”;};};function GetAttribute(nAttrib,b){var a = new Array();if(nAttrib & 128) a[a.length] = (b?”C”:”压缩”);if(nAttrib & 64) a[a.length] = (b?””:”快捷方式”);if(nAttrib & 32) a[a.length] = (b?”A”:”归档”);if(nAttrib & 16) a[a.length] = (b?””:”文件夹”);if(nAttrib & 8) a[a.length] = (b?””:”卷标”);if(nAttrib & 4) a[a.length] = (b?”S”:”系统”);if(nAttrib & 2) a[a.length] = (b?”H”:”隐藏”);if(nAttrib & 1) a[a.length] = (b?”R”:”只读”);if(nAttrib & 2048) a[a.length] = (b?”C”:”压缩”);return a.join((b?””:”, “));};function GetIconByType_Driver(n){/*取得指定驱动器类型的图标*/switch(n){case 0 : return “<font face=’wingdings’ class=’ItemIconStyle’>=</font>”;case 1 : return “<font face=’wingdings’ class=’ItemIconStyle’><</font>”;case 2 : return “<font face=’wingdings’ class=’ItemIconStyle’>;</font>”;case 3 : return “<font face=’wingdings’ class=’ItemIconStyle’>=</font>”;case 4 : return “<font face=’wingdings’ class=’ItemIconStyle’>></font>”;case 5 : return “<font face=’wingdings’ class=’ItemIconStyle’>=</font>”;};};function GetIconByType_File(sFileName){var r = “.” + sFileName;switch(r.substr(r.lastIndexOf(“.”)+1).toLowerCase()){case “txt” :return “<font face=’wingdings’ class=’ItemIconStyle’>2</font>”;case “exe”: case “com”: case “pif”: case “bat”:return “<font face=’wingdings’ class=’ItemIconStyle’>ÿ</font>”;case “jpg”: case “gif”: case “bmp”: case “tiff”: case “jpeg”: case “tif” : case “png” :return “<font face=’webdings’ class=’ItemIconStyle’>Ÿ</font>”;case “mp3”: case “wav”: case”mid” :return “<font face=’webdings’ class=’ItemIconStyle’>¯</font>”;default :return “<font face=’wingdings 2′ class=’ItemIconStyle’>/</font>”;};};function FormatSize(nSize){if(nSize/Math.pow(1024,3)>0.9) return Math.round(nSize/Math.pow(1024,3)*100)/100 + ” GB”;else if(nSize/Math.pow(1024,2)>0.9) return Math.round(nSize/Math.pow(1024,2)*100)/100 + ” MB”;else if(nSize/1024>0.9) return Math.round(nSize/1024*100)/100 + ” KB”;else return “1 KB”;/*nSize + ” Bytes”*/};this.GetDriverList = function(){/*返回驱动器列表的数组*/var fso = this.fso;var a = new Array();var e = new Enumerator(fso.Drives);a[a.length] = new Array(bIsReady/*是否就绪*/, “<font face=’wingdings’ class=’ItemIconStyle’>y</font>”, “<nobr>[Home]</nobr> <nobr>CCDM 4.51</nobr>”, “”, Server.MapPath(“.”), 20, “”, “”, “”, “”,”COCOON Online Disk Manager 4.51.4714″, “Producted by Cocoon Studio (www.ccopus.com)”, “Coding by Sunrise_Chen”);for (; !e.atEnd(); e.moveNext()){var bIsReady = false;var x = e.item();try{bIsReady = x.isReady;};catch(e){bIsReady = false;};if(bIsReady){a[a.length] = new Array(bIsReady/*是否就绪*/, GetIconByType_Driver(x.DriveType)/*图标,用于显示*/, “<nobr>” + GetTypeName(x.DriveType) + “</nobr> <nobr>(” + x.DriveLetter + “:)</nobr>”/*名称,用于显示*/, GetTypeName(x.DriveType) + “(” + x.DriveLetter + “)”, x.RootFolder/*根目录*/, 16/**/, GetTypeName(x.DriveType), “<div align=right>” + FormatSize(x.TotalSize) + “</div>”, “<div align=right>” + FormatSize(x.AvailableSpace) + “</div>”, “”, “路径: ” + x.RootFolder, “类型: ” + GetTypeName(x.DriveType), “文件系统: ” + x.FileSystem, “卷标: ” + x.VolumeName, “总容量: ” + FormatSize(x.TotalSize), “剩余容量: ” + FormatSize(x.AvailableSpace));};else{a[a.length] = new Array(bIsReady, GetIconByType_Driver(x.DriveType), “<nobr>” + GetTypeName(x.DriveType) + “</nobr> <nobr>(” + x.DriveLetter + “:)</nobr>”, GetTypeName(x.DriveType) + “(” + x.DriveLetter + “)”, x.DriveLetter + “:\”, -1, GetTypeName(x.DriveType), “”, “”, “”, “路径: ” + x.DriveLetter + “:\”, “类型: ” + GetTypeName(x.DriveType));};};return a;};/*function GetDriverList;*/this.CurrentFolder = null;this.GetFolderInfo = function(sFolderSpec){if(this.CurrentFolder) return this.CurrentFolder;var fso = this.fso;var a = new Array();try{var x = fso.GetFolder(sFolderSpec);};catch(e){ShowError(e);};a[a.length] = new Array(true, “<font face=’wingdings’ class=’ItemIconStyle’>0</font>”, “<span class=’ItemTitle’><nobr>” + x.name + “</nobr></span>”, x.Name, x.Path, x.Attributes, “路径: “” + x.Path + “””, “属性: ” + GetAttribute(x.Attributes));if(!x.isRootFolder){a[a.length-1]=(new Array).concat(a[a.length-1],Array(“创建时间: ” + FormatDateTime(x.DateCreated), “修改时间: ” + FormatDateTime(x.DateLastModified), “访问时间: ” + FormatDateTime(x.DateLastAccessed)))};try{a[a.length-1]=(new Array).concat(a[a.length-1],Array(“”, “目录数: ” + x.subfolders.count + ” “, “文件数: ” + x.files.count + ” “))};catch(e){a[a.length-1]=(new Array).concat(a[a.length-1],Array(“”, “<span class=error>错误: 没有权限</span>”))};this.CurrentFolder = a;return a;};this.GetFolderList = function(sFolderSpec){var fso = this.fso;var a = new Array();var folder = fso.GetFolder(sFolderSpec);var e = new Enumerator(folder.SubFolders);if(!folder.isRootFolder){a[a.length] = new Array(true, “<font face=’wingdings 3′ class=’ItemIconStyle’>Í</font>”, “<span class=’ItemTitle’><nobr>..</nobr></span>”, “”,folder.ParentFolder,folder.ParentFolder.attributes,””,””,””,””);};else{a[a.length] = new Array(true, “<font face=’wingdings’ class=’ItemIconStyle’>:</font>”, “<span class=’ItemTitle’>..</span>”, “”,””,””,””,””,””,””);};for (; !e.atEnd(); e.moveNext()){var x = e.item();a[a.length] = new Array(true, “<font face=’wingdings’ class=’ItemIconStyle’>0</font>”, “<span class=’ItemTitle’><nobr>” + x.name + “</nobr></span>”, x.Name, x.Path, x.Attributes, “”, x.Type, FormatDateTime(x.DateLastModified), GetAttribute(x.Attributes, true), “路径: “” + x.Path + “””, “属性: ” + GetAttribute(x.Attributes), “创建时间: ” + FormatDateTime(x.DateCreated), “修改时间: ” + FormatDateTime(x.DateLastModified), “访问时间: ” + FormatDateTime(x.DateLastAccessed));};var folder = fso.GetFolder(sFolderSpec);var e = new Enumerator(folder.Files);for (; !e.atEnd(); e.moveNext()){var x = e.item();a[a.length] = new Array(true, GetIconByType_File(x.name), “<span class=’ItemTitle’><nobr>” + x.name + “</nobr></span>”, x.Name, x.Path, x.Attributes, FormatSize(x.size), x.Type, FormatDateTime(x.DateLastModified), GetAttribute(x.Attributes, true), “路径: “” + x.Path + “””, “类型: ” + x.Type, “大小: ” + FormatSize(x.size), “属性: ” + GetAttribute(x.Attributes), “创建时间: ” + FormatDateTime(x.DateCreated), “修改时间: ” + FormatDateTime(x.DateLastModified), “访问时间: ” + FormatDateTime(x.DateLastAccessed));};return a;};this.DownloadFile = function(sTarget){try{var fso = this.fso;var file = fso.GetFile(sTarget);var sFileName = file.name;var sFileSize = file.size;fso = null;var st = new ActiveXObject(“ADODB.Stream”);with(st) { mode=3; type=1; open(); loadFromFile(sTarget); };Response.addHeader(“Content-Disposition”, “attachment; filename=” + sFileName);Response.addHeader(“Content-Length”, sFileSize);Response.charSet = “UTF-8”;Response.contentType = “application/octet-stream”;Response.binaryWrite(st.read());st.close();st = null;};catch(e){ShowError(e);};Response.end();};this.ReadFile = function(sTarget){try{var sBody = “”;var st = new ActiveXObject(“ADODB.Stream”);with(st) { charset=”gb2312″; open(); loadFromFile(sTarget); sBody=st.readText(); close(); };st = null;return sBody;};catch(e){ShowError(e);Response.write(“<script>window.close();</script>”);};};this.WriteFile = function(sTarget,sContent){try{var fso = this.fso;var file = fso.CreateTextFile(sTarget, true);file.write(sContent);file.close();file = fso = null;Response.write(“<script>alert(“保存成功”)</script>”);};catch(e){ShowError(e);Response.end();};};this.CheckFolderExist = function(sTarget){try{return this.fso.FolderExists(sTarget);};catch(e){return false;};};this.CopyFile = function(s,d,b){d = d + “\”;Response.write(“”” + s + “” –> ” + d + ” … “);var fso = this.fso;try{if(fso.FileExists(s))if(b) fso.MoveFile(s,d); else fso.CopyFile(s,d,true);else if(fso.FolderExists(s))if(b) fso.MoveFolder(s,d); else fso.CopyFolder(s,d,true);Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};Response.write(“<br>rn”);Response.Flush();};this.DeleteFile = function(s){Response.write(“删除 “” + s + “” –> … “);var fso = this.fso;try{if(fso.FileExists(s)) fso.DeleteFile(s);else if(fso.FolderExists(s)) fso.DeleteFolder(s);Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};Response.write(“<br>rn”);Response.Flush();};this.Rename = function(s,d){Response.write(“”” + s + “” –> “” + d + “” … “);var fso = this.fso;try{if(fso.FileExists(s)) fso.GetFile(s).Name = d;if(fso.FolderExists(s)) fso.GetFolder(s).Name = d;Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};Response.write(“<br>rn”);Response.Flush();};this.NewDir = function(f,n){Response.write(‘新建文件夹: “‘ + n + ‘” … ‘);var fso = this.fso;try{fso.CreateFolder(f+’\’+n);Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};};this.NewTextFile = function(f,n){Response.write(‘新建文本文件: “‘ + n + ‘” … ‘);var fso = this.fso;try{fso.CreateTextFile(f+’\’+n);Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};};};function Cc_Dm4() {};Cc_Dm4.ShowItem = function(aItemList){for(var i=0;i<aItemList.length;++i){Response.Write(“<span id=’span_item’ class=’ItemStyle'”);Response.Write(“Cc_FileName='” + aItemList[i][3] + “‘” + ” Cc_FilePath='” + aItemList[i][4] + “‘”+ ” Cc_FileType='” + aItemList[i][5] + “‘”+ ” onclick=’domenu(this,” + i + “)’ ondblclick=’doExec(this)'”+ ” title='”);for(var j=10;j<aItemList[i].length;++j){Response.Write(“
” + aItemList[i][j]);};Response.Write(“‘>” + “<span class=’detail0′ id=’icon_item’>”+ “” + aItemList[i][1]+ ” ” + aItemList[i][2] + “</span>”+ “<span class=’detail1′>” + aItemList[i][6] + “</span>”+ “<span class=’detail2′>” + aItemList[i][7] + “</span>”+ “<span class=’detail3′>” + aItemList[i][8] + “</span>”+ “<span class=’detail4′>” + aItemList[i][9] + “</span>”+ “</span>”);};};Cc_Dm4.ShowCurrentFolder = function(sTarget){if(sAction!=”f”) return;var oDm = new Cc_DiskManager;var aItemList = oDm.GetFolderInfo(sTarget);var i = 0;Response.write(“” + aItemList[i][1] + “<b>” + aItemList[i][2] + “</b>”);Response.Write(“<pre>”);for(var j=6;j<aItemList[i].length;++j){Response.Write(“rn” + aItemList[i][j]);};Response.Write(“</pre>” + “rnrn”);};Cc_Dm4.ShowDriverList = function(){var oDm = new Cc_DiskManager;var aDriverList = oDm.GetDriverList();this.ShowItem(aDriverList);};Cc_Dm4.ShowFolderList = function(sTarget){var oDm = new Cc_DiskManager;var aFolderList = oDm.GetFolderList(sTarget);this.ShowItem(aFolderList);};Cc_Dm4.DownloadFile = function(sTarget){var oDm = new Cc_DiskManager;oDm.DownloadFile(sTarget);};Cc_Dm4.HtmlHead = “”+ “<html><head><title>COCOON Online DiskManager 4.51 – Cocoon Studio (www.ccopus.com)</title>”+ “<meta http-equiv=’Content-Type’ content=’text/html; charset=gb2312′>” + “<style>” + “form{margin:0;font-size:9pt;}; “+ “textarea{font-family:Tahoma;font-size:9pt; padding:5px;};”+ “body{margin:2;border:none;overflow:hidden;background-color:buttonface}; “+ “fieldset{margin:2px;font-size:9pt;height:76px;overflow:auto;}; “+ “input{font-family:Tahoma;font-size:9pt;};”+ “pre{margin:0};”+ “.banner{margin-top:8px;margin-right:10px;text-align:right;font-family:Tahoma;font-weight:bold};”+ “</style>”+ “</head>”+ “<body>”;Cc_Dm4.HtmlFoot = “</body></html>”;Cc_Dm4.EditFile = function(sTarget){var oDm = new Cc_DiskManager;var sBody = oDm.ReadFile(sTarget);Response.write( this.HtmlHead+ “<form style=’width:100%;height:100%;’ method=’post’ action='” + sUrl + “‘>”+ “<textarea name=fileContent style=’width:100%;height:90%;’>” + Server.HTMLEncode(sBody) + “</textarea><br>”+ “<div style=’padding-top:5px’> 文件路径:<input type=’text’ name=t value='” + sTarget + “‘ readonly style=’overflow:visible;’>”+ “<input type=’hidden’ name=a value=s> “+ “<input type=checkbox name=ColseWindow id=chk_closewindow value=close><label for=chk_closewindow checked>保存完毕关闭窗口</label> “+ “<input type=’submit’ name=btnSubmit value=’保存’ style=’width:75px;’ onclick=”form.a.value=’s'”>”+ “<input type=’reset’ name=btnReset value=’恢复’ style=’width:75px;’>”+ “<input type=’button’ name=btnReset value=’清空’ style=’width:75px;’ onclick=”form.fileContent.value=””>”+ “<input type=’button’ name=btnReset value=’关闭’ style=’width:75px;’ onclick=”window.close();”>”+ “</div><div class=banner>COCOON Online Text Editor 1.0 for Cocoon Disk Manager 4.51</div></form>” + this.HtmlFoot);Response.End();};Cc_Dm4.SelectItem = function(){try{var sAction = Request.Form(“Action”)(1);switch(sAction){case “copy”:case “cut”:var sItems = Request.Form(“Item”)(1);Response.Cookies(“Cc_Dm_SelectedItem”) = sItems;Response.Cookies(“Cc_Dm_Action”) = sAction;Response.write(this.HtmlHead+ “<fieldset><div style=’margin:5;’><pre>” + sItems + “</pre></div></fieldset>”+ “<input type=’button’ value='”+(sAction==”copy”?”复制”:”剪切”)+”完成’ “+ “style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);break;case “paste”:sAction = Request.Cookies(“Cc_Dm_Action”)+””;var oDm = new Cc_DiskManager;var sFolder = CURRENT_DIRECTORY;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );if(!oDm.CheckFolderExist(sFolder)){Response.write(“目标文件夹不正确 ” + sFolder);};else{var aItems = (Request.Cookies(“Cc_Dm_SelectedItem”)+”).split(“rn”);for(var i=0;i<aItems.length;++i) oDm.CopyFile(aItems[i],sFolder, sAction==”cut”);};Response.write( “</div></fieldset>”+ “<input type=’button’ value=’粘贴完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);case “delete”:var sItems = Request.Form(“Item”)(1);var oDm = new Cc_DiskManager;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );var aItems = sItems.split(“rn”);for(var i=0;i<aItems.length;++i) oDm.DeleteFile(aItems[i]);Response.write( “</div></fieldset>”+ “<input type=’button’ value=’删除完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);};};catch(e){ShowError(e);Response.write(“<script>window.close();</script>”);};Response.End();};Cc_Dm4.SaveFile = function(sTarget){var oDm = new Cc_DiskManager;oDm.WriteFile(sTarget,Request.Form(“fileContent”)+””);if(Request.Form(“colsewindow”)+””!=”close”){var sRefUrl = Request.ServerVariables(“HTTP_REFERER”);if(sRefUrl){Response.write(“<script>location.href='” + Str4Js(sRefUrl) + “‘;</script>”);Response.end();};};Response.write(“<script>window.close();</script>”);Response.End();};Cc_Dm4.ShowFile = function(sTarget){var st = new ActiveXObject(“ADODB.Stream”);with(st) { mode=3; type=1; open(); loadFromFile(sTarget); Response.binaryWrite(read()); close(); };delete st;Response.end();};Cc_Dm4.NewDir = function(sTarget){var oDm = new Cc_DiskManager;var sFolder = CURRENT_DIRECTORY;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );var sItem = Request.Form(“value”)(1);oDm.NewDir(sFolder, sItem);Response.write( “</div></fieldset>”+ “<input type=’button’ value=’新建完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);Response.end();};Cc_Dm4.NewTextFile = function(sTarget){var oDm = new Cc_DiskManager;var sFolder = CURRENT_DIRECTORY;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );var sItem = Request.Form(“value”)(1);oDm.NewTextFile(sFolder, sItem);Response.write( “</div></fieldset>”+ “<input type=’button’ value=’新建完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);Response.end();};Cc_Dm4.Rename = function(){try{var sItems = Request.Form(“Item”)(1);var sValue = Request.Form(“Value”)(1);var aItems = sItems.split(“rn”);var oDm = new Cc_DiskManager;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );for(var i=0;i<aItems.length;++i){if(!i) var NewFileName = sValue.replace(/(*)/g,””);else var NewFileName = sValue.replace(/(*)/g,i+1);oDm.Rename(aItems[i],NewFileName);};Response.write( “</div></fieldset>”+ “<input type=’button’ value=’更名完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);};catch(e){ShowError(e);Response.write(“<script>window.close();</script>”);};Response.end();};/* }; End Of CcDm4 */if(sTarget==sSelfPath){ShowError(new Error(0, “不准碰我!!! >:-<“));};switch(sAction){/*一些需要事先执行的东西!*/case “d” :Cc_Dm4.DownloadFile(sTarget);break;case “h” : Cc_Dm4.ShowFile(sTarget);break;case “e” : Cc_Dm4.EditFile(sTarget);break;case “s” : Cc_Dm4.SaveFile(sTarget);break;case “a” : Cc_Dm4.SelectItem();break;case “r” : Cc_Dm4.Rename();break;case “nd” :Cc_Dm4.NewDir(sTarget);break;case “ntf” :Cc_Dm4.NewTextFile(sTarget);break;case “f” :Response.Cookies(“Cc_Dm_CurrentFolder”) = sTarget;break;};%><html><head><title>COCOON Online Disk Manager 4.51</title><meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″><STYLE>a { color: black; };body,td { font-size: 9pt; font-family: Tahoma; cursor: default; margin:0; overflow: hidden; text-align: left; };form { margin: 0 };input,textarea { font-family: Tahoma; font-size:9pt; inputarea:expression(onselectstart=new Function(“event.cancelBubble=true;”)); };.panelLeft { width: 22%; vertical-align: top; text-overflow: ellipsis; overflow: hidden; text-align: left;propertyarea:expression(onclick=new Function(“event.cancelBubble=true;”));};.panelInnerHead { width:100%; margin: 10px 10px 0px 10px; padding: 5px; overflow: hidden; text-overflow: ellipsis; background-color: #eeeeee;};.panelInner { width:100%; margin: 0px 10px 0px 10px; padding: 5px; overflow: hidden; text-overflow: ellipsis; border:1px solid #eeeeee;};.divMenu { position:absolute; border: 1px solid black; padding: 5px; };.Error { color: red; };#chk_item {display:none;};.ItemStyle{background-color:white;color:black;};.ItemStyleSelected{background-color:gray;color:white;};.popDivTitle { background-color:gray;color:white;width:30px;height:16px;text-align:center; };.popDiv { border:1px solid gray; padding:1pt; background-color: white; };.leftLink{ height: 16px;padding-right: 1px; };.leftLinkItemOver { background-color: gray;color: white; cursor: hand; padding: 2px; };.leftLinkItem{ background-color: white;color: black; cursor: hand; padding: 2px; };</STYLE><STYLE id=”view_2″ <%=(sShowSmall==”2″?””:”disabled”)%>>/*详细样式*/.ItemStyle { width: 100%; height: 18px; text-align: left; margin: 1px; border: 1px sloid white; white-space: nowrap;};.ItemStyleSelected { width: 100%; height: 18px; text-align: left; margin: 1px; border: 1px sloid white; white-space: nowrap;};.ItemIconStyle { font-size: 12pt; vertical-align: baseline; width: 16px; };.ItemTitle { text-overflow: ellipsis; overflow: hidden; width: 90%; text-align: left; };.detail0 { width: 35%; };.detail1 { text-align: right; width: 9%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left:0pt; };.detail2 { text-align: left; width: 24%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left:10pt; };.detail3 { text-align: left; width: 24%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left:0pt; };.detail4 { text-align: left; width: 5%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left:5pt; };</STYLE><STYLE id=”view_1″ <%=(sShowSmall==”1″?””:”disabled”)%>>/*列表样式*/.ItemStyle { width: 240px; height: 18px; text-align: left; margin: 1px; border: 1px sloid white; };.ItemStyleSelected { width: 240px; height: 18px; text-align: left; margin: 1px; border: 1px sloid white; };.ItemIconStyle { font-size: 12pt; vertical-align: baseline; width: 16px; };.ItemTitle { text-overflow: ellipsis; overflow: hidden; width: 85%; text-align: left; };.detail0 { };.detail1, .detail2, .detail3, .detail4 { display: none; };</STYLE><STYLE id=”view_0″ <%=(sShowSmall==”0″?””:”disabled”)%>>/*图标样式*/.ItemStyle { width: 65px; height: 50px; text-align: center; margin: 5px; padding: 3px; border: 1px sloid white; };.ItemStyleSelected { width: 65px; height: 50px; text-align: center; margin: 5px; padding: 3px; border: 1px sloid white; };.ItemIconStyle { font-size: 28pt; vertical-align: baseline; };.ItemTitle { text-overflow: ellipsis; overflow: hidden; width: 100%; };.detail0 { };.detail1, .detail2, .detail3, .detail4 { display: none; };</STYLE><script language=”javascript”>var oDocument = document;var sUrl = “<%=sUrl%>”;SelectedItem = SpanItem = IconItem = PanelInner = PanelTemplet = new Object();InitComplete = false;oDocument.onselectstart = new Function(“event.returnValue = false;”);oDocument.onclick = new Function(“clearSelect();”);window.onload = function init(){SpanItem = oDocument.getElementsByName(“span_item”);IconItem = oDocument.getElementsByName(“icon_item”);PanelInner = oDocument.getElementById(“PanelInner”);PanelTemplet = oDocument.getElementById(“PanelTemplet”);};oDocument.onkeydown = function selectAll(){if((event.keyCode==97||event.keyCode==65)&&event.ctrlKey){clearSelect(true);var b = oDocument.getElementsByName(“span_item”);for(var i=1;i<IconItem.length;++i) ItemSelect(b[i],i);PanelInner.innerHTML = “已选定 ” + (i-1) + ” 个对象。”;};};function getFirstSelectedItem(){var m = Number.POSITIVE_INFINITY;for(var x in SelectedItem) if(parseInt(x)<m) m=parseInt(x);if(m==Number.POSITIVE_INFINITY) return 1;return m;};function ItemSelect(o,n,b){if(b||!o.checked){o.className = “ItemStyleSelected”;o.checked = true;SelectedItem[n] = o;if(!b) PanelInner.innerHTML = “<b>” + IconItem[n].innerHTML + “</b><pre>” + o.title + “</pre>”;};else{o.className = “ItemStyle”;o.checked = false;delete SelectedItem[n];if(!b) PanelInner.innerHTML = PanelTemplet.innerHTML;};};function domenu(o,n){event.cancelBubble = true;if( event.shiftKey ){var x = getFirstSelectedItem();clearSelect(true);var b = oDocument.getElementsByName(o.id);for(var i=Math.min(n,x);i<=Math.max(x,n);++i) ItemSelect(b[i],i,true);PanelInner.innerHTML = “<br><br>已选定 ” + (i-1) + ” 个对象。”;return ;};if( !event.ctrlKey ) clearSelect();ItemSelect(o,n);};function clearSelect(b){for(var x in SelectedItem){SelectedItem[x].checked = false;SelectedItem[x].className = “ItemStyle”;delete SelectedItem[x];};if(!b) PanelInner.innerHTML = PanelTemplet.innerHTML;if(oDocument.popDivOpened){oDocument.popDivOpened.style.display = ‘none’;oDocument.popDivOpened = null;};};function doExec(o){var n = o.Cc_FilePath;var t = parseInt(o.Cc_FileType);if(t<0){alert(‘设备未就绪’);return;};else if(isNaN(t)){/*回首页*/location.href = sUrl;return;};else if(t & 16){/*Folder*/location.href = sUrl + “?a=f&t=” + n;return;};var r = “.” + n;switch(r.substr(r.lastIndexOf(“.”)+1).toLowerCase()){case “txt”: case “bat”: case “ini”: case “inf”: case “log”:case “asp”: case “css”: case “htm”: case “php”: case “cgi”:case “js”: case “vbs”: case “vb”: case “cs”: case “bas” :case “aspx”: case “html”: case “php3”: case “php4”: case “jsp”:case “shtm”: case “shtml”: case “sql”: case “xml” : case “xsl” :doAction(‘edit’);break;case “jpg”: case “gif”: case “bmp”: case “tiff”: case “jpeg”: case “tif” : case “png” :doAction(‘show’);break;default:doAction();};};function ActionWin(sAction){with(oDocument.getElementById(“formAction”)){switch(sAction){case “rename” :var sValue = prompt(‘* 支持按数字顺序批量重命名,模板格式: “NewFileName(*).Ext”‘,’请输新的文件名’);if(!sValue) return;action = “<%=sUrl%>?a=r”;break;case “newDir” :var sValue = prompt(‘新建文件夹’,’请新文件夹名’);if(!sValue) return;action = “<%=sUrl%>?a=nd”;break;case “newTextFile” :var sValue = prompt(‘新建文本文件’,’新建 文本文档.txt’);if(!sValue) return;if(sValue.toLowerCase().indexOf(“.txt”)<0) if(confirm(‘文本文件的扩展名为”.txt”,您刚才输入的文件名中没有包含该后缀。rnrn点击”确定”增加该后缀,点击”取消”保持您输入的文件名’)) sValue += “.txt”; action = “<%=sUrl%>?a=ntf”;break;default : action = “<%=sUrl%>?a=a”;};var a = new Array();var oWin = window.open(‘about:blank’,’CcActionWin’,’width=360,height=80′);for(var x in SelectedItem) a[a.length] = SelectedItem[x].Cc_FilePath;Item.value = a.join(“rn”);Action.value = sAction;Value.value = sValue;submit();oWin.focus();};};function doAction(sAction){switch(sAction){case “paste” : ActionWin(“paste”); return;case “newDir” : ActionWin(“newDir”); return;case “newTextFile” : ActionWin(“newTextFile”); return;};for(var x in SelectedItem){switch(sAction){case “delete”:if(!confirm(‘确定要删除吗?’)) break;case “rename”:case “copy”:case “cut”:ActionWin(sAction);return;case “edit”:window.open(sUrl + ‘?a=e&t=’ + SelectedItem[x].Cc_FilePath,parseInt(Math.random()*100),’menu=0,resizable=1′);break;case “show”:window.open(sUrl + ‘?a=h&t=’ + SelectedItem[x].Cc_FilePath,parseInt(Math.random()*100),”);break;default:window.open(sUrl + ‘?a=d&t=’ + SelectedItem[x].Cc_FilePath,parseInt(Math.random()*100),”);break;};};};function ShowDoAction(n){var sDivName;switch(n){case ‘new’:var sDivName = “divDoActionNew”; break;};var o = oDocument.getElementById(sDivName);oDocument.popDivOpened = o;with(o.style){display = ”;pixelTop = event.y + oDocument.body.scrollTop – event.offsetY – 2;pixelLeft = event.x + oDocument.body.scrollLeft – event.offsetX – 5;};};</script></head><body><div id=”divDoActionNew” style=”position:absolute;height:320;width:100;left:100;top:100;z-index:9;display:none”><div class=”popDivTitle”>新建</div><div class=”popDiv”><div onmouseover=”className=’leftLinkItemOver'” onmouseout=”className=’leftLinkItem'” class=”leftLinkItem” onclick=”doAction(‘newDir’);”>文件夹</div><div onmouseover=”className=’leftLinkItemOver'” onmouseout=”className=’leftLinkItem'” class=”leftLinkItem” onclick=”doAction(‘newTextFile’);”>文本文件</div></div></div><form id=”formAction” method=post target=CcActionWin style=”margin:0″><input type=”hidden” name=”Item”><input type=”hidden” name=”Action”><input type=”hidden” name=”Value”></form><div style=”height:91%;” align=”right”><span class=”panelLeft”><div class=”panelInnerHead” style=”font-weight: bolder”>COCOON Studio<br>Online Disk Manager 4.51</div><div class=”PanelInner”>视图:<a href=”<%=sUrl+”?s=0&”+Request.QueryString%>” class=”leftLink”>图标</a> <a href=”<%=sUrl+”?s=1&”+Request.QueryString%>” class=”leftLink”>列表</a> <a href=”<%=sUrl+”?s=2&”+Request.QueryString%>” class=”leftLink”>详细</a><br><span>操作:<a href=”javascript:doAction();” class=”leftLink”>下载</a> <a href=”javascript:doAction(‘edit’);” class=”leftLink”>编辑</a> <a href=”javascript:doAction(‘show’);” class=”leftLink”>显示</a><br> <a href=”javascript:doAction(‘copy’);” class=”leftLink”>复制</a> <a href=”javascript:doAction(‘cut’);” class=”leftLink”>剪切</a> <a href=”javascript:doAction(‘paste’);” class=”leftLink”>粘贴</a><br> <a href=”javascript:void(0);” onclick=”ShowDoAction(‘new’);” class=”leftLink” onfocus=blur()>新建</a> <a href=”javascript:doAction(‘rename’);” class=”leftLink”>更名</a> <a href=”javascript:doAction(‘delete’);” class=”leftLink”>删除</a></div></span><br><div class=”PanelInner” id=”PanelInner”><% Cc_Dm4.ShowCurrentFolder(sTarget) %></div><div id=”PanelTemplet” style=”display:none”><% Cc_Dm4.ShowCurrentFolder(sTarget) %></div></span><script language=javascript>PanelInner = oDocument.getElementById(“PanelInner”);PanelTemplet = oDocument.getElementById(“PanelTemplet”);</script><span style=”width:78%; height:100%; overflow:auto;text-align:left;overflow-x:hidden”><%switch(sAction){case “f” :/*Folder*/Cc_Dm4.ShowFolderList(sTarget);break;default: Cc_Dm4.ShowDriverList();};%></span></div><div style=”width:100%; height:9%; text-align: center; vertical-align: bottom;”><table style=”width:100%;height:100%;” border=0 cellpadding=”0″ cellspacing=”0″><tr><td valign=”middle” style=”text-align:center”>警告: COCOON Studio 不对使用本工具进行违法行文承担任何责任!<br>COCOON Online Disk Manager 4.51 – COCOON Studio (<a href=”http://www.ccopus.com” target=_blank>www.ccopus.com</a>)<script language=javascript src=”http://www.ccopus.com/_js/dm4_chkupdate.js”></script></td></tr></table></div></body></html>
<!–
COCOON Online Disk Manager 4.51
COCOON Studio
Sunrise_Chen mailto:sunrise_chen@msn.com
2004-7-13
–>
代码如下:
<%@LANGUAGE=”JScript” CODEPAGE=”936″%><%var sSelfPath = Server.MapPath(Request.ServerVariables(“SCRIPT_NAME”)(1)).toLowerCase();var sUrl = Request.ServerVariables(“URL”)(1);var sAction = Request(“a”)+””;var sTarget = (Request(“t”)+””).toLowerCase();var sShowSmall = Request(“s”)+””;var CURRENT_DIRECTORY = Request.Cookies(“Cc_Dm_CurrentFolder”) + “”;if(!isNaN(sShowSmall)){Response.Cookies(“CC_Dm_ShowSmall”)=sShowSmall;sQueryString = “”;var e = new Enumerator(Request.QueryString);for (; !e.atEnd(); e.moveNext()){var x = e.item();if(x!=”s”){sQueryString += x + “=” + Request.QueryString(x) + “&”;};};Response.Redirect(sUrl+”?”+sQueryString);};sShowSmall = Request.Cookies(“CC_Dm_ShowSmall”);if(isNaN(parseInt(sShowSmall))) sShowSmall=”0″;function ShowError(e){Response.write(“<script language=javascript>alert(‘COCOON Online Disk Manager 4.51 \r\n”+ ” Created by: COCOON Studio (www.ccopus.com)\r\n”+ ” Coding by: Sunrise_Chen (sunrise_chen@msn.com)\r\n”+ “提示信息: \r\n\r\n “+ Str4Js(e.description) + “‘);history.back();window.close();</script>”);Response.end();};function Str4Js(s){return (s+”).replace(/\/g,”\\”).replace(/’/g,”'”).replace(/”/g,”"”);};function Cc_DiskManager(){try{this.fso = new ActiveXObject(“Scripting.FileSystemObject”);};catch(e){ShowError(e);};function FormatDateTime(dtDateTime){return new Date(dtDateTime).toLocaleString();};function GetTypeName(s){switch(s){case 0 : return “Unknown”;case 1 : return “3.5 软盘”;case 2 : return “本地硬盘”;case 3 : return “Network”;case 4 : return “CD 驱动器”;case 5 : return “RamDisk”;};};function GetAttribute(nAttrib,b){var a = new Array();if(nAttrib & 128) a[a.length] = (b?”C”:”压缩”);if(nAttrib & 64) a[a.length] = (b?””:”快捷方式”);if(nAttrib & 32) a[a.length] = (b?”A”:”归档”);if(nAttrib & 16) a[a.length] = (b?””:”文件夹”);if(nAttrib & 8) a[a.length] = (b?””:”卷标”);if(nAttrib & 4) a[a.length] = (b?”S”:”系统”);if(nAttrib & 2) a[a.length] = (b?”H”:”隐藏”);if(nAttrib & 1) a[a.length] = (b?”R”:”只读”);if(nAttrib & 2048) a[a.length] = (b?”C”:”压缩”);return a.join((b?””:”, “));};function GetIconByType_Driver(n){/*取得指定驱动器类型的图标*/switch(n){case 0 : return “<font face=’wingdings’ class=’ItemIconStyle’>=</font>”;case 1 : return “<font face=’wingdings’ class=’ItemIconStyle’><</font>”;case 2 : return “<font face=’wingdings’ class=’ItemIconStyle’>;</font>”;case 3 : return “<font face=’wingdings’ class=’ItemIconStyle’>=</font>”;case 4 : return “<font face=’wingdings’ class=’ItemIconStyle’>></font>”;case 5 : return “<font face=’wingdings’ class=’ItemIconStyle’>=</font>”;};};function GetIconByType_File(sFileName){var r = “.” + sFileName;switch(r.substr(r.lastIndexOf(“.”)+1).toLowerCase()){case “txt” :return “<font face=’wingdings’ class=’ItemIconStyle’>2</font>”;case “exe”: case “com”: case “pif”: case “bat”:return “<font face=’wingdings’ class=’ItemIconStyle’>ÿ</font>”;case “jpg”: case “gif”: case “bmp”: case “tiff”: case “jpeg”: case “tif” : case “png” :return “<font face=’webdings’ class=’ItemIconStyle’>Ÿ</font>”;case “mp3”: case “wav”: case”mid” :return “<font face=’webdings’ class=’ItemIconStyle’>¯</font>”;default :return “<font face=’wingdings 2′ class=’ItemIconStyle’>/</font>”;};};function FormatSize(nSize){if(nSize/Math.pow(1024,3)>0.9) return Math.round(nSize/Math.pow(1024,3)*100)/100 + ” GB”;else if(nSize/Math.pow(1024,2)>0.9) return Math.round(nSize/Math.pow(1024,2)*100)/100 + ” MB”;else if(nSize/1024>0.9) return Math.round(nSize/1024*100)/100 + ” KB”;else return “1 KB”;/*nSize + ” Bytes”*/};this.GetDriverList = function(){/*返回驱动器列表的数组*/var fso = this.fso;var a = new Array();var e = new Enumerator(fso.Drives);a[a.length] = new Array(bIsReady/*是否就绪*/, “<font face=’wingdings’ class=’ItemIconStyle’>y</font>”, “<nobr>[Home]</nobr> <nobr>CCDM 4.51</nobr>”, “”, Server.MapPath(“.”), 20, “”, “”, “”, “”,”COCOON Online Disk Manager 4.51.4714″, “Producted by Cocoon Studio (www.ccopus.com)”, “Coding by Sunrise_Chen”);for (; !e.atEnd(); e.moveNext()){var bIsReady = false;var x = e.item();try{bIsReady = x.isReady;};catch(e){bIsReady = false;};if(bIsReady){a[a.length] = new Array(bIsReady/*是否就绪*/, GetIconByType_Driver(x.DriveType)/*图标,用于显示*/, “<nobr>” + GetTypeName(x.DriveType) + “</nobr> <nobr>(” + x.DriveLetter + “:)</nobr>”/*名称,用于显示*/, GetTypeName(x.DriveType) + “(” + x.DriveLetter + “)”, x.RootFolder/*根目录*/, 16/**/, GetTypeName(x.DriveType), “<div align=right>” + FormatSize(x.TotalSize) + “</div>”, “<div align=right>” + FormatSize(x.AvailableSpace) + “</div>”, “”, “路径: ” + x.RootFolder, “类型: ” + GetTypeName(x.DriveType), “文件系统: ” + x.FileSystem, “卷标: ” + x.VolumeName, “总容量: ” + FormatSize(x.TotalSize), “剩余容量: ” + FormatSize(x.AvailableSpace));};else{a[a.length] = new Array(bIsReady, GetIconByType_Driver(x.DriveType), “<nobr>” + GetTypeName(x.DriveType) + “</nobr> <nobr>(” + x.DriveLetter + “:)</nobr>”, GetTypeName(x.DriveType) + “(” + x.DriveLetter + “)”, x.DriveLetter + “:\”, -1, GetTypeName(x.DriveType), “”, “”, “”, “路径: ” + x.DriveLetter + “:\”, “类型: ” + GetTypeName(x.DriveType));};};return a;};/*function GetDriverList;*/this.CurrentFolder = null;this.GetFolderInfo = function(sFolderSpec){if(this.CurrentFolder) return this.CurrentFolder;var fso = this.fso;var a = new Array();try{var x = fso.GetFolder(sFolderSpec);};catch(e){ShowError(e);};a[a.length] = new Array(true, “<font face=’wingdings’ class=’ItemIconStyle’>0</font>”, “<span class=’ItemTitle’><nobr>” + x.name + “</nobr></span>”, x.Name, x.Path, x.Attributes, “路径: “” + x.Path + “””, “属性: ” + GetAttribute(x.Attributes));if(!x.isRootFolder){a[a.length-1]=(new Array).concat(a[a.length-1],Array(“创建时间: ” + FormatDateTime(x.DateCreated), “修改时间: ” + FormatDateTime(x.DateLastModified), “访问时间: ” + FormatDateTime(x.DateLastAccessed)))};try{a[a.length-1]=(new Array).concat(a[a.length-1],Array(“”, “目录数: ” + x.subfolders.count + ” “, “文件数: ” + x.files.count + ” “))};catch(e){a[a.length-1]=(new Array).concat(a[a.length-1],Array(“”, “<span class=error>错误: 没有权限</span>”))};this.CurrentFolder = a;return a;};this.GetFolderList = function(sFolderSpec){var fso = this.fso;var a = new Array();var folder = fso.GetFolder(sFolderSpec);var e = new Enumerator(folder.SubFolders);if(!folder.isRootFolder){a[a.length] = new Array(true, “<font face=’wingdings 3′ class=’ItemIconStyle’>Í</font>”, “<span class=’ItemTitle’><nobr>..</nobr></span>”, “”,folder.ParentFolder,folder.ParentFolder.attributes,””,””,””,””);};else{a[a.length] = new Array(true, “<font face=’wingdings’ class=’ItemIconStyle’>:</font>”, “<span class=’ItemTitle’>..</span>”, “”,””,””,””,””,””,””);};for (; !e.atEnd(); e.moveNext()){var x = e.item();a[a.length] = new Array(true, “<font face=’wingdings’ class=’ItemIconStyle’>0</font>”, “<span class=’ItemTitle’><nobr>” + x.name + “</nobr></span>”, x.Name, x.Path, x.Attributes, “”, x.Type, FormatDateTime(x.DateLastModified), GetAttribute(x.Attributes, true), “路径: “” + x.Path + “””, “属性: ” + GetAttribute(x.Attributes), “创建时间: ” + FormatDateTime(x.DateCreated), “修改时间: ” + FormatDateTime(x.DateLastModified), “访问时间: ” + FormatDateTime(x.DateLastAccessed));};var folder = fso.GetFolder(sFolderSpec);var e = new Enumerator(folder.Files);for (; !e.atEnd(); e.moveNext()){var x = e.item();a[a.length] = new Array(true, GetIconByType_File(x.name), “<span class=’ItemTitle’><nobr>” + x.name + “</nobr></span>”, x.Name, x.Path, x.Attributes, FormatSize(x.size), x.Type, FormatDateTime(x.DateLastModified), GetAttribute(x.Attributes, true), “路径: “” + x.Path + “””, “类型: ” + x.Type, “大小: ” + FormatSize(x.size), “属性: ” + GetAttribute(x.Attributes), “创建时间: ” + FormatDateTime(x.DateCreated), “修改时间: ” + FormatDateTime(x.DateLastModified), “访问时间: ” + FormatDateTime(x.DateLastAccessed));};return a;};this.DownloadFile = function(sTarget){try{var fso = this.fso;var file = fso.GetFile(sTarget);var sFileName = file.name;var sFileSize = file.size;fso = null;var st = new ActiveXObject(“ADODB.Stream”);with(st) { mode=3; type=1; open(); loadFromFile(sTarget); };Response.addHeader(“Content-Disposition”, “attachment; filename=” + sFileName);Response.addHeader(“Content-Length”, sFileSize);Response.charSet = “UTF-8”;Response.contentType = “application/octet-stream”;Response.binaryWrite(st.read());st.close();st = null;};catch(e){ShowError(e);};Response.end();};this.ReadFile = function(sTarget){try{var sBody = “”;var st = new ActiveXObject(“ADODB.Stream”);with(st) { charset=”gb2312″; open(); loadFromFile(sTarget); sBody=st.readText(); close(); };st = null;return sBody;};catch(e){ShowError(e);Response.write(“<script>window.close();</script>”);};};this.WriteFile = function(sTarget,sContent){try{var fso = this.fso;var file = fso.CreateTextFile(sTarget, true);file.write(sContent);file.close();file = fso = null;Response.write(“<script>alert(“保存成功”)</script>”);};catch(e){ShowError(e);Response.end();};};this.CheckFolderExist = function(sTarget){try{return this.fso.FolderExists(sTarget);};catch(e){return false;};};this.CopyFile = function(s,d,b){d = d + “\”;Response.write(“”” + s + “” –> ” + d + ” … “);var fso = this.fso;try{if(fso.FileExists(s))if(b) fso.MoveFile(s,d); else fso.CopyFile(s,d,true);else if(fso.FolderExists(s))if(b) fso.MoveFolder(s,d); else fso.CopyFolder(s,d,true);Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};Response.write(“<br>rn”);Response.Flush();};this.DeleteFile = function(s){Response.write(“删除 “” + s + “” –> … “);var fso = this.fso;try{if(fso.FileExists(s)) fso.DeleteFile(s);else if(fso.FolderExists(s)) fso.DeleteFolder(s);Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};Response.write(“<br>rn”);Response.Flush();};this.Rename = function(s,d){Response.write(“”” + s + “” –> “” + d + “” … “);var fso = this.fso;try{if(fso.FileExists(s)) fso.GetFile(s).Name = d;if(fso.FolderExists(s)) fso.GetFolder(s).Name = d;Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};Response.write(“<br>rn”);Response.Flush();};this.NewDir = function(f,n){Response.write(‘新建文件夹: “‘ + n + ‘” … ‘);var fso = this.fso;try{fso.CreateFolder(f+’\’+n);Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};};this.NewTextFile = function(f,n){Response.write(‘新建文本文件: “‘ + n + ‘” … ‘);var fso = this.fso;try{fso.CreateTextFile(f+’\’+n);Response.write(“[<font color=green>成功</font>]”);};catch(e){Response.write(“[<font color=red>失败</font>]rn” + e.message);};};};function Cc_Dm4() {};Cc_Dm4.ShowItem = function(aItemList){for(var i=0;i<aItemList.length;++i){Response.Write(“<span id=’span_item’ class=’ItemStyle'”);Response.Write(“Cc_FileName='” + aItemList[i][3] + “‘” + ” Cc_FilePath='” + aItemList[i][4] + “‘”+ ” Cc_FileType='” + aItemList[i][5] + “‘”+ ” onclick=’domenu(this,” + i + “)’ ondblclick=’doExec(this)'”+ ” title='”);for(var j=10;j<aItemList[i].length;++j){Response.Write(“
” + aItemList[i][j]);};Response.Write(“‘>” + “<span class=’detail0′ id=’icon_item’>”+ “” + aItemList[i][1]+ ” ” + aItemList[i][2] + “</span>”+ “<span class=’detail1′>” + aItemList[i][6] + “</span>”+ “<span class=’detail2′>” + aItemList[i][7] + “</span>”+ “<span class=’detail3′>” + aItemList[i][8] + “</span>”+ “<span class=’detail4′>” + aItemList[i][9] + “</span>”+ “</span>”);};};Cc_Dm4.ShowCurrentFolder = function(sTarget){if(sAction!=”f”) return;var oDm = new Cc_DiskManager;var aItemList = oDm.GetFolderInfo(sTarget);var i = 0;Response.write(“” + aItemList[i][1] + “<b>” + aItemList[i][2] + “</b>”);Response.Write(“<pre>”);for(var j=6;j<aItemList[i].length;++j){Response.Write(“rn” + aItemList[i][j]);};Response.Write(“</pre>” + “rnrn”);};Cc_Dm4.ShowDriverList = function(){var oDm = new Cc_DiskManager;var aDriverList = oDm.GetDriverList();this.ShowItem(aDriverList);};Cc_Dm4.ShowFolderList = function(sTarget){var oDm = new Cc_DiskManager;var aFolderList = oDm.GetFolderList(sTarget);this.ShowItem(aFolderList);};Cc_Dm4.DownloadFile = function(sTarget){var oDm = new Cc_DiskManager;oDm.DownloadFile(sTarget);};Cc_Dm4.HtmlHead = “”+ “<html><head><title>COCOON Online DiskManager 4.51 – Cocoon Studio (www.ccopus.com)</title>”+ “<meta http-equiv=’Content-Type’ content=’text/html; charset=gb2312′>” + “<style>” + “form{margin:0;font-size:9pt;}; “+ “textarea{font-family:Tahoma;font-size:9pt; padding:5px;};”+ “body{margin:2;border:none;overflow:hidden;background-color:buttonface}; “+ “fieldset{margin:2px;font-size:9pt;height:76px;overflow:auto;}; “+ “input{font-family:Tahoma;font-size:9pt;};”+ “pre{margin:0};”+ “.banner{margin-top:8px;margin-right:10px;text-align:right;font-family:Tahoma;font-weight:bold};”+ “</style>”+ “</head>”+ “<body>”;Cc_Dm4.HtmlFoot = “</body></html>”;Cc_Dm4.EditFile = function(sTarget){var oDm = new Cc_DiskManager;var sBody = oDm.ReadFile(sTarget);Response.write( this.HtmlHead+ “<form style=’width:100%;height:100%;’ method=’post’ action='” + sUrl + “‘>”+ “<textarea name=fileContent style=’width:100%;height:90%;’>” + Server.HTMLEncode(sBody) + “</textarea><br>”+ “<div style=’padding-top:5px’> 文件路径:<input type=’text’ name=t value='” + sTarget + “‘ readonly style=’overflow:visible;’>”+ “<input type=’hidden’ name=a value=s> “+ “<input type=checkbox name=ColseWindow id=chk_closewindow value=close><label for=chk_closewindow checked>保存完毕关闭窗口</label> “+ “<input type=’submit’ name=btnSubmit value=’保存’ style=’width:75px;’ onclick=”form.a.value=’s'”>”+ “<input type=’reset’ name=btnReset value=’恢复’ style=’width:75px;’>”+ “<input type=’button’ name=btnReset value=’清空’ style=’width:75px;’ onclick=”form.fileContent.value=””>”+ “<input type=’button’ name=btnReset value=’关闭’ style=’width:75px;’ onclick=”window.close();”>”+ “</div><div class=banner>COCOON Online Text Editor 1.0 for Cocoon Disk Manager 4.51</div></form>” + this.HtmlFoot);Response.End();};Cc_Dm4.SelectItem = function(){try{var sAction = Request.Form(“Action”)(1);switch(sAction){case “copy”:case “cut”:var sItems = Request.Form(“Item”)(1);Response.Cookies(“Cc_Dm_SelectedItem”) = sItems;Response.Cookies(“Cc_Dm_Action”) = sAction;Response.write(this.HtmlHead+ “<fieldset><div style=’margin:5;’><pre>” + sItems + “</pre></div></fieldset>”+ “<input type=’button’ value='”+(sAction==”copy”?”复制”:”剪切”)+”完成’ “+ “style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);break;case “paste”:sAction = Request.Cookies(“Cc_Dm_Action”)+””;var oDm = new Cc_DiskManager;var sFolder = CURRENT_DIRECTORY;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );if(!oDm.CheckFolderExist(sFolder)){Response.write(“目标文件夹不正确 ” + sFolder);};else{var aItems = (Request.Cookies(“Cc_Dm_SelectedItem”)+”).split(“rn”);for(var i=0;i<aItems.length;++i) oDm.CopyFile(aItems[i],sFolder, sAction==”cut”);};Response.write( “</div></fieldset>”+ “<input type=’button’ value=’粘贴完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);case “delete”:var sItems = Request.Form(“Item”)(1);var oDm = new Cc_DiskManager;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );var aItems = sItems.split(“rn”);for(var i=0;i<aItems.length;++i) oDm.DeleteFile(aItems[i]);Response.write( “</div></fieldset>”+ “<input type=’button’ value=’删除完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);};};catch(e){ShowError(e);Response.write(“<script>window.close();</script>”);};Response.End();};Cc_Dm4.SaveFile = function(sTarget){var oDm = new Cc_DiskManager;oDm.WriteFile(sTarget,Request.Form(“fileContent”)+””);if(Request.Form(“colsewindow”)+””!=”close”){var sRefUrl = Request.ServerVariables(“HTTP_REFERER”);if(sRefUrl){Response.write(“<script>location.href='” + Str4Js(sRefUrl) + “‘;</script>”);Response.end();};};Response.write(“<script>window.close();</script>”);Response.End();};Cc_Dm4.ShowFile = function(sTarget){var st = new ActiveXObject(“ADODB.Stream”);with(st) { mode=3; type=1; open(); loadFromFile(sTarget); Response.binaryWrite(read()); close(); };delete st;Response.end();};Cc_Dm4.NewDir = function(sTarget){var oDm = new Cc_DiskManager;var sFolder = CURRENT_DIRECTORY;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );var sItem = Request.Form(“value”)(1);oDm.NewDir(sFolder, sItem);Response.write( “</div></fieldset>”+ “<input type=’button’ value=’新建完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);Response.end();};Cc_Dm4.NewTextFile = function(sTarget){var oDm = new Cc_DiskManager;var sFolder = CURRENT_DIRECTORY;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );var sItem = Request.Form(“value”)(1);oDm.NewTextFile(sFolder, sItem);Response.write( “</div></fieldset>”+ “<input type=’button’ value=’新建完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);Response.end();};Cc_Dm4.Rename = function(){try{var sItems = Request.Form(“Item”)(1);var sValue = Request.Form(“Value”)(1);var aItems = sItems.split(“rn”);var oDm = new Cc_DiskManager;Response.write( this.HtmlHead + “<fieldset><div style=’margin:5;’>” );for(var i=0;i<aItems.length;++i){if(!i) var NewFileName = sValue.replace(/(*)/g,””);else var NewFileName = sValue.replace(/(*)/g,i+1);oDm.Rename(aItems[i],NewFileName);};Response.write( “</div></fieldset>”+ “<input type=’button’ value=’更名完成, 请刷新主窗口’ style=’width:100%;’ onclick=’window.close();’>”+ this.HtmlFoot);};catch(e){ShowError(e);Response.write(“<script>window.close();</script>”);};Response.end();};/* }; End Of CcDm4 */if(sTarget==sSelfPath){ShowError(new Error(0, “不准碰我!!! >:-<“));};switch(sAction){/*一些需要事先执行的东西!*/case “d” :Cc_Dm4.DownloadFile(sTarget);break;case “h” : Cc_Dm4.ShowFile(sTarget);break;case “e” : Cc_Dm4.EditFile(sTarget);break;case “s” : Cc_Dm4.SaveFile(sTarget);break;case “a” : Cc_Dm4.SelectItem();break;case “r” : Cc_Dm4.Rename();break;case “nd” :Cc_Dm4.NewDir(sTarget);break;case “ntf” :Cc_Dm4.NewTextFile(sTarget);break;case “f” :Response.Cookies(“Cc_Dm_CurrentFolder”) = sTarget;break;};%><html><head><title>COCOON Online Disk Manager 4.51</title><meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″><STYLE>a { color: black; };body,td { font-size: 9pt; font-family: Tahoma; cursor: default; margin:0; overflow: hidden; text-align: left; };form { margin: 0 };input,textarea { font-family: Tahoma; font-size:9pt; inputarea:expression(onselectstart=new Function(“event.cancelBubble=true;”)); };.panelLeft { width: 22%; vertical-align: top; text-overflow: ellipsis; overflow: hidden; text-align: left;propertyarea:expression(onclick=new Function(“event.cancelBubble=true;”));};.panelInnerHead { width:100%; margin: 10px 10px 0px 10px; padding: 5px; overflow: hidden; text-overflow: ellipsis; background-color: #eeeeee;};.panelInner { width:100%; margin: 0px 10px 0px 10px; padding: 5px; overflow: hidden; text-overflow: ellipsis; border:1px solid #eeeeee;};.divMenu { position:absolute; border: 1px solid black; padding: 5px; };.Error { color: red; };#chk_item {display:none;};.ItemStyle{background-color:white;color:black;};.ItemStyleSelected{background-color:gray;color:white;};.popDivTitle { background-color:gray;color:white;width:30px;height:16px;text-align:center; };.popDiv { border:1px solid gray; padding:1pt; background-color: white; };.leftLink{ height: 16px;padding-right: 1px; };.leftLinkItemOver { background-color: gray;color: white; cursor: hand; padding: 2px; };.leftLinkItem{ background-color: white;color: black; cursor: hand; padding: 2px; };</STYLE><STYLE id=”view_2″ <%=(sShowSmall==”2″?””:”disabled”)%>>/*详细样式*/.ItemStyle { width: 100%; height: 18px; text-align: left; margin: 1px; border: 1px sloid white; white-space: nowrap;};.ItemStyleSelected { width: 100%; height: 18px; text-align: left; margin: 1px; border: 1px sloid white; white-space: nowrap;};.ItemIconStyle { font-size: 12pt; vertical-align: baseline; width: 16px; };.ItemTitle { text-overflow: ellipsis; overflow: hidden; width: 90%; text-align: left; };.detail0 { width: 35%; };.detail1 { text-align: right; width: 9%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left:0pt; };.detail2 { text-align: left; width: 24%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left:10pt; };.detail3 { text-align: left; width: 24%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left:0pt; };.detail4 { text-align: left; width: 5%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left:5pt; };</STYLE><STYLE id=”view_1″ <%=(sShowSmall==”1″?””:”disabled”)%>>/*列表样式*/.ItemStyle { width: 240px; height: 18px; text-align: left; margin: 1px; border: 1px sloid white; };.ItemStyleSelected { width: 240px; height: 18px; text-align: left; margin: 1px; border: 1px sloid white; };.ItemIconStyle { font-size: 12pt; vertical-align: baseline; width: 16px; };.ItemTitle { text-overflow: ellipsis; overflow: hidden; width: 85%; text-align: left; };.detail0 { };.detail1, .detail2, .detail3, .detail4 { display: none; };</STYLE><STYLE id=”view_0″ <%=(sShowSmall==”0″?””:”disabled”)%>>/*图标样式*/.ItemStyle { width: 65px; height: 50px; text-align: center; margin: 5px; padding: 3px; border: 1px sloid white; };.ItemStyleSelected { width: 65px; height: 50px; text-align: center; margin: 5px; padding: 3px; border: 1px sloid white; };.ItemIconStyle { font-size: 28pt; vertical-align: baseline; };.ItemTitle { text-overflow: ellipsis; overflow: hidden; width: 100%; };.detail0 { };.detail1, .detail2, .detail3, .detail4 { display: none; };</STYLE><script language=”javascript”>var oDocument = document;var sUrl = “<%=sUrl%>”;SelectedItem = SpanItem = IconItem = PanelInner = PanelTemplet = new Object();InitComplete = false;oDocument.onselectstart = new Function(“event.returnValue = false;”);oDocument.onclick = new Function(“clearSelect();”);window.onload = function init(){SpanItem = oDocument.getElementsByName(“span_item”);IconItem = oDocument.getElementsByName(“icon_item”);PanelInner = oDocument.getElementById(“PanelInner”);PanelTemplet = oDocument.getElementById(“PanelTemplet”);};oDocument.onkeydown = function selectAll(){if((event.keyCode==97||event.keyCode==65)&&event.ctrlKey){clearSelect(true);var b = oDocument.getElementsByName(“span_item”);for(var i=1;i<IconItem.length;++i) ItemSelect(b[i],i);PanelInner.innerHTML = “已选定 ” + (i-1) + ” 个对象。”;};};function getFirstSelectedItem(){var m = Number.POSITIVE_INFINITY;for(var x in SelectedItem) if(parseInt(x)<m) m=parseInt(x);if(m==Number.POSITIVE_INFINITY) return 1;return m;};function ItemSelect(o,n,b){if(b||!o.checked){o.className = “ItemStyleSelected”;o.checked = true;SelectedItem[n] = o;if(!b) PanelInner.innerHTML = “<b>” + IconItem[n].innerHTML + “</b><pre>” + o.title + “</pre>”;};else{o.className = “ItemStyle”;o.checked = false;delete SelectedItem[n];if(!b) PanelInner.innerHTML = PanelTemplet.innerHTML;};};function domenu(o,n){event.cancelBubble = true;if( event.shiftKey ){var x = getFirstSelectedItem();clearSelect(true);var b = oDocument.getElementsByName(o.id);for(var i=Math.min(n,x);i<=Math.max(x,n);++i) ItemSelect(b[i],i,true);PanelInner.innerHTML = “<br><br>已选定 ” + (i-1) + ” 个对象。”;return ;};if( !event.ctrlKey ) clearSelect();ItemSelect(o,n);};function clearSelect(b){for(var x in SelectedItem){SelectedItem[x].checked = false;SelectedItem[x].className = “ItemStyle”;delete SelectedItem[x];};if(!b) PanelInner.innerHTML = PanelTemplet.innerHTML;if(oDocument.popDivOpened){oDocument.popDivOpened.style.display = ‘none’;oDocument.popDivOpened = null;};};function doExec(o){var n = o.Cc_FilePath;var t = parseInt(o.Cc_FileType);if(t<0){alert(‘设备未就绪’);return;};else if(isNaN(t)){/*回首页*/location.href = sUrl;return;};else if(t & 16){/*Folder*/location.href = sUrl + “?a=f&t=” + n;return;};var r = “.” + n;switch(r.substr(r.lastIndexOf(“.”)+1).toLowerCase()){case “txt”: case “bat”: case “ini”: case “inf”: case “log”:case “asp”: case “css”: case “htm”: case “php”: case “cgi”:case “js”: case “vbs”: case “vb”: case “cs”: case “bas” :case “aspx”: case “html”: case “php3”: case “php4”: case “jsp”:case “shtm”: case “shtml”: case “sql”: case “xml” : case “xsl” :doAction(‘edit’);break;case “jpg”: case “gif”: case “bmp”: case “tiff”: case “jpeg”: case “tif” : case “png” :doAction(‘show’);break;default:doAction();};};function ActionWin(sAction){with(oDocument.getElementById(“formAction”)){switch(sAction){case “rename” :var sValue = prompt(‘* 支持按数字顺序批量重命名,模板格式: “NewFileName(*).Ext”‘,’请输新的文件名’);if(!sValue) return;action = “<%=sUrl%>?a=r”;break;case “newDir” :var sValue = prompt(‘新建文件夹’,’请新文件夹名’);if(!sValue) return;action = “<%=sUrl%>?a=nd”;break;case “newTextFile” :var sValue = prompt(‘新建文本文件’,’新建 文本文档.txt’);if(!sValue) return;if(sValue.toLowerCase().indexOf(“.txt”)<0) if(confirm(‘文本文件的扩展名为”.txt”,您刚才输入的文件名中没有包含该后缀。rnrn点击”确定”增加该后缀,点击”取消”保持您输入的文件名’)) sValue += “.txt”; action = “<%=sUrl%>?a=ntf”;break;default : action = “<%=sUrl%>?a=a”;};var a = new Array();var oWin = window.open(‘about:blank’,’CcActionWin’,’width=360,height=80′);for(var x in SelectedItem) a[a.length] = SelectedItem[x].Cc_FilePath;Item.value = a.join(“rn”);Action.value = sAction;Value.value = sValue;submit();oWin.focus();};};function doAction(sAction){switch(sAction){case “paste” : ActionWin(“paste”); return;case “newDir” : ActionWin(“newDir”); return;case “newTextFile” : ActionWin(“newTextFile”); return;};for(var x in SelectedItem){switch(sAction){case “delete”:if(!confirm(‘确定要删除吗?’)) break;case “rename”:case “copy”:case “cut”:ActionWin(sAction);return;case “edit”:window.open(sUrl + ‘?a=e&t=’ + SelectedItem[x].Cc_FilePath,parseInt(Math.random()*100),’menu=0,resizable=1′);break;case “show”:window.open(sUrl + ‘?a=h&t=’ + SelectedItem[x].Cc_FilePath,parseInt(Math.random()*100),”);break;default:window.open(sUrl + ‘?a=d&t=’ + SelectedItem[x].Cc_FilePath,parseInt(Math.random()*100),”);break;};};};function ShowDoAction(n){var sDivName;switch(n){case ‘new’:var sDivName = “divDoActionNew”; break;};var o = oDocument.getElementById(sDivName);oDocument.popDivOpened = o;with(o.style){display = ”;pixelTop = event.y + oDocument.body.scrollTop – event.offsetY – 2;pixelLeft = event.x + oDocument.body.scrollLeft – event.offsetX – 5;};};</script></head><body><div id=”divDoActionNew” style=”position:absolute;height:320;width:100;left:100;top:100;z-index:9;display:none”><div class=”popDivTitle”>新建</div><div class=”popDiv”><div onmouseover=”className=’leftLinkItemOver'” onmouseout=”className=’leftLinkItem'” class=”leftLinkItem” onclick=”doAction(‘newDir’);”>文件夹</div><div onmouseover=”className=’leftLinkItemOver'” onmouseout=”className=’leftLinkItem'” class=”leftLinkItem” onclick=”doAction(‘newTextFile’);”>文本文件</div></div></div><form id=”formAction” method=post target=CcActionWin style=”margin:0″><input type=”hidden” name=”Item”><input type=”hidden” name=”Action”><input type=”hidden” name=”Value”></form><div style=”height:91%;” align=”right”><span class=”panelLeft”><div class=”panelInnerHead” style=”font-weight: bolder”>COCOON Studio<br>Online Disk Manager 4.51</div><div class=”PanelInner”>视图:<a href=”<%=sUrl+”?s=0&”+Request.QueryString%>” class=”leftLink”>图标</a> <a href=”<%=sUrl+”?s=1&”+Request.QueryString%>” class=”leftLink”>列表</a> <a href=”<%=sUrl+”?s=2&”+Request.QueryString%>” class=”leftLink”>详细</a><br><span>操作:<a href=”javascript:doAction();” class=”leftLink”>下载</a> <a href=”javascript:doAction(‘edit’);” class=”leftLink”>编辑</a> <a href=”javascript:doAction(‘show’);” class=”leftLink”>显示</a><br> <a href=”javascript:doAction(‘copy’);” class=”leftLink”>复制</a> <a href=”javascript:doAction(‘cut’);” class=”leftLink”>剪切</a> <a href=”javascript:doAction(‘paste’);” class=”leftLink”>粘贴</a><br> <a href=”javascript:void(0);” onclick=”ShowDoAction(‘new’);” class=”leftLink” onfocus=blur()>新建</a> <a href=”javascript:doAction(‘rename’);” class=”leftLink”>更名</a> <a href=”javascript:doAction(‘delete’);” class=”leftLink”>删除</a></div></span><br><div class=”PanelInner” id=”PanelInner”><% Cc_Dm4.ShowCurrentFolder(sTarget) %></div><div id=”PanelTemplet” style=”display:none”><% Cc_Dm4.ShowCurrentFolder(sTarget) %></div></span><script language=javascript>PanelInner = oDocument.getElementById(“PanelInner”);PanelTemplet = oDocument.getElementById(“PanelTemplet”);</script><span style=”width:78%; height:100%; overflow:auto;text-align:left;overflow-x:hidden”><%switch(sAction){case “f” :/*Folder*/Cc_Dm4.ShowFolderList(sTarget);break;default: Cc_Dm4.ShowDriverList();};%></span></div><div style=”width:100%; height:9%; text-align: center; vertical-align: bottom;”><table style=”width:100%;height:100%;” border=0 cellpadding=”0″ cellspacing=”0″><tr><td valign=”middle” style=”text-align:center”>警告: COCOON Studio 不对使用本工具进行违法行文承担任何责任!<br>COCOON Online Disk Manager 4.51 – COCOON Studio (<a href=”https://www.ccopus.com” target=_blank>www.ccopus.com</a>)<script language=javascript src=”https://www.ccopus.com/_js/dm4_chkupdate.js”></script></td></tr></table></div></body></html>
<!–
COCOON Online Disk Manager 4.51
COCOON Studio
Sunrise_Chen mailto:sunrise_chen@msn.com
2004-7-13
–>
—-想了解更多的linux相关异常处理怎么解决关注<计算机技术网(www.ctvol.com)!!>
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/jspttutorial/52025.html