ASP源码.NET源码PHP源码JSP源码JAVA源码DELPHI源码PB源码VC源码VB源码Android源码

web文件管理器的后续开发

来源:网络整理     时间:2016-06-18     关键词:

本篇文章主要介绍了" web文件管理器的后续开发",主要涉及到方面的内容,对于ASPjrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播感兴趣的同学可以参考一下: web文件管理器的后续开发。。。 选择自 iuhxq 的 Blog 关键字 web文件管理器的后续开发。。。 出处 今天看了一下cc...

web文件管理器的后续开发。。。     选择自 iuhxq 的 Blog  
关键字   web文件管理器的后续开发。。。 
出处    
 今天看了一下ccopus的DM45,做的很不错,在这之前我也想做一个了,做一个跟windows资源管理器非常类似的程序。看到dm45以后觉得自己还是放弃吧,WEB方式的文件管理无论如何都是在权限允许内操作,而且大家实现的也都差不多,无非是在外观上,易操作上做文章,文件管理本来作用也不是很大,如果是多用户的权限比较难控制,既然别人做了,我想还是不要重复劳动的好,况且也不见得能做的好。下面的代码贴出来留个纪念,实现了文件的本地排序。但目录之间的层次还没有搞好。有兴趣的可以拿去参考,理论上应该可以实现跟windows资源管理器极类似的界面和操作方式。整个界面都采取无刷新方式。用XMLHTTP来执行后台代码,用JS来修改前台显示。这里体现了一种思想,希望对初学者能有个帮助。
代码如下:
WEB文件管理器2.0版 http://asp2004.net

url = temp(UBound(temp))
Const pass = ""'登陆密码
'登陆验证
Set fso = CreateObject("Scripting.FileSystemObject")
        Path = Request("foldername")
        If Path = "" Then Path = server.MapPath("./")
        ShowFolderList(Path)
Set fso = Nothing
'列出文件和文件夹
Function ShowFolderList(folderspec)
    temp = Request.ServerVariables("HTTP_REFERER")
    temp = Left(temp, Instrrev(temp, "/"))
    temp1 = Len(folderspec) - Len(server.MapPath("./")) -1
    If temp1>0 Then
        temp1 = Right(folderspec, CInt(temp1)) + "\"
    ElseIf temp1 = -1 Then
        temp1 = ""
    End If
    tempurl = temp + Replace(temp1, "\", "/")
    uppath = "./" + Replace(temp1, "\", "/")
    upfolderspec = fso.GetParentFolderName(folderspec&"\")
    Set f = fso.GetFolder(folderspec)
%>

function File(Name, Size, Type, DateCreated, DateLastAccessed, DateLastModified, Attributes)
{
 this.Name = Name;
 this.Size = Size;
 this.Type = Type;
 this.DateCreated = DateCreated;
 this.DateLastAccessed = DateLastAccessed;
 this.DateLastModified = DateLastModified;
 this.Attributes = Attributes;
}
function Tree(id, name)
{
 this.id = id;
 this.name = name;
 this.root = new Array();
 this.length = 0;
 this.Add = function(file)
 {
  this.root.push(file);
  this.length += 1;
 }
 this.max = function(f1, f2, field)
 {
  switch( field )
  {
   case "Name":
    return f1.Name.toLowerCase()>f2.Name.toLowerCase()? true:false;
   case "Size":
    return f1.Size>f2.Size? true:false;
   case "Type":
    //if (field == '???t?D') return false;
    return f1.Type>f2.Type? true:false;
   case "DateCreated":
    return f1.DateCreated>f2.DateCreated? true:false;
   case "DateLastAccessed":
    return f1.DateLastAccessed>f2.DateLastAccessed? true:false;
   case "DateLastModified":
    return f1.DateLastModified>f2.DateLastModified? true:false;
   case "Attributes":
    return f1.Attributes>f2.Attributes? true:false;
   default:
    return false;
  }
 }
 this.sort=function(field, order)
 {
 //order:desc asc
 //field:Name Size
  var len = this.root.length;
  if( len < 2 ) return;
  var tmp;
  for(var i=0; i
  {
   for(var j=i+1; j
   {
    if( order == "desc")
    {
     if( !this.max( this.root[i], this.root[j], field ) )
     {
      tmp = this.root[i];
      this.root[i] = this.root[j];
      this.root[j] = tmp;
     }
    }
    else if ( order == "asc")
    {
     if( this.max( this.root[i], this.root[j], field ) )
     {
      tmp = this.root[i];
      this.root[i] = this.root[j];
      this.root[j] = tmp;
     }
    }
   }
  }
 }
}
function fieldcode(field)
{
 if (order == 'desc')
 {
  order = 'asc';
 }
 else
 {
  order = 'desc';
 }
 tree.sort(field, order);
}
function show()
{
//for (var i=0;i
 str = '\
  \
  操作\
  
\
  
\
  
\
  
\
  \
  \
  \
  ';
 var f;
 for(i=0;i
 {
  f = tree.root[i];
  str += '
   
\
   '+f.Name+'\
   '+f.Size+'\
   '+f.Type+'\
   '+f.DateCreated+'\
   '+f.DateLastAccessed+'\
   '+f.DateLastModified+'\
   '+f.Attributes+'\
   ';
 }
 str += '';
 eval(list).innerHTML = str;
}
var field = 'Name';
var order = 'desc';
var str;






<%
Response.Write(""&vbcrlf)
Response.Write("var tree = new Tree('"&jscode(f.path)&"','"&jscode(f.name)&"');"&vbcrlf)
Set fc = f.SubFolders
For Each f1 in fc
 Response.Write("tree.Add(new File('"&f1.name&"',"&f1.size&",'"&f1.Type&"','"&f1.DateCreated&"','"&f1.DateLastAccessed&"','"&f1.DateLastModified&"','"&f1.Attributes&"'));"&vbcrlf)
Next
set fc = f.Files
For Each f1 in Fc
 Response.Write("tree.Add(new File('"&f1.name&"',"&f1.size&",'"&f1.Type&"','"&f1.DateCreated&"','"&f1.DateLastAccessed&"','"&f1.DateLastModified&"','"&f1.Attributes&"'));"&vbcrlf)
Next
Response.Write("")
End Function
function jscode(s)
 jscode = replace(s,"\","\\\\")
end function
%> 
  
 

以上就介绍了 web文件管理器的后续开发,包括了方面的内容,希望对ASPjrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播有兴趣的朋友有所帮助。

本文网址链接:http://www.codes51.com/article/detail_1749034.html

上一篇上一篇,下一篇过程代码 下一篇ASP错误处理

相关图片

相关文章