<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%
if not WS_S.ChkObjInstalled("Scripting.FileSystemObject") then HX_GoBack "对不起,此服务器不支持FSO,所以不能使用此功能!",""
action=request("action"):FolderId=request("FolderId")
select case action
  case "addnew"
     FolderName = trim(Request.Form("FolderName")):FolderMemo = trim(Request.Form("FolderMemo")):FolderPriv=trim(Request.Form("FolderPriv"))
	 ColumnName="":Tablename="HX_NetDiskFolderOrFile":Orderby=""	 
     set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
	 rs.addnew:rs("WS_NetDiskFolderName")=FolderName:rs("WS_NetDiskFolderDate")=now:rs("WS_NetDiskFolderMemo")=FolderMemo:rs("WS_NetDiskFolderPriv")=FolderPriv:rs("WS_NetDiskEmpId")=loginuid:if WS_S.HX_ISNUM(FolderId) then rs("WS_FileID")=FolderId end if:rs.update:folderdir=rs("WS_FDID")
	 WS_S.CheckDir folderdir,True:WS_S.HX_RSClose rs:WS_S.HX_Redirect "netdisk.asp"
  case "DeleteFolder":if WS_S.HX_ISNUM(FolderId) then  conn.execute("delete from HX_NetDiskFolderOrFile where WS_FDID="&FolderId):WS_S.CheckFolder FolderId,True :WS_S.HX_Redirect "netdisk.asp"
  case "EditFolder"
     if WS_S.HX_ISNUM(FolderId) then
     FolderName = trim(Request.Form("FolderName")):FolderMemo = trim(Request.Form("FolderMemo")):FolderPriv=trim(Request.Form("FolderPriv"))
	 ColumnName="":Tablename="HX_NetDiskFolderOrFile":Orderby=" where WS_FDID="&FolderId	 
     set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
	 rs("WS_NetDiskFolderName")=FolderName:rs("WS_NetDiskFolderDate")=now:rs("WS_NetDiskFolderMemo")=FolderMemo:rs("WS_NetDiskFolderPriv")=FolderPriv:rs("WS_NetDiskEmpId")=loginuid:rs.update
	 WS_S.HX_RSClose rs:WS_S.HX_Redirect "netdisk.asp"
	 end if
  case "ViewFolder"
      TotalFileNum = 0:TotalFolderSize = 0
	  ColumnName="":Tablename="HX_NetDiskFolderOrFile":Orderby=" WHERE (WS_NetDiskFolderPriv=0 or WS_NetDiskEmpId="&loginuid&") and WS_FileID="&FolderId	
	  if WS_S.HX_ISNUM(FolderId) then
	   set rs=WS_S.HX_SetRSD("",Tablename,Orderby)
	   if rs.recordcount>0 then
	    FolderName=Rs("WS_NetDiskFolderName"):FolderMemo=Rs("WS_NetDiskFolderMemo"):FolderPriv=rs("WS_NetDiskFolderPriv")
	   end if			
	  end if
  case "DeleteFile"
	  ColumnName="":Tablename="HX_NetDiskFolderOrFile":Orderby=" WHERE WS_FDID="&FolderId	
	  if WS_S.HX_ISNUM(FolderId) then
	   set rs=WS_S.HX_SetRSD("",Tablename,Orderby)	
	   if rs.recordcount>0 then  
	    FileID=rs("WS_FDID"):FolderId=rs("WS_FileID"):NetDiskFolderEXT=rs("WS_NetDiskFolderEXT")
		filepath=FolderId&"/"&FileID&"."&NetDiskFolderEXT
		filepath=server.mappath(filepath)
	    conn.execute("update HX_NetDiskFolderOrFile set WS_NetDiskFileNum=WS_NetDiskFileNum-1 where WS_FDID="&FolderId)	   
	    rs.delete	
		WS_S.CheckFile filepath,True 
	   end if
	   WS_S.HX_RSClose rs:WS_S.HX_Redirect "netdisk.asp?action=ViewFolder&FolderId="&FolderId
	  end if
  case else
  	  TotalFileNum = 0:TotalFolderSize = 0
	  ColumnName="":Tablename="HX_NetDiskFolderOrFile":Orderby=" WHERE WS_FileID=0 and (WS_NetDiskFolderPriv=0 or WS_NetDiskEmpId="&loginuid&")"	
	  if WS_S.HX_ISNUM(FolderId) then
	   set rs=WS_S.HX_SetRSD("",Tablename,Orderby&" and WS_FDID="&FolderId)
	   if rs.recordcount>0 then
	      filepath=RS("WS_FileID")&"/"&RS("WS_FDID")&"."&Rs("WS_NetDiskFolderEXT"):WS_S.CheckFile filepath,True
	      FolderName=Rs("WS_NetDiskFolderName"):FolderMemo=Rs("WS_NetDiskFolderMemo"):FolderPriv=rs("WS_NetDiskFolderPriv")
	   end if
	  else
	    set rs=WS_S.HX_SetRSD("",Tablename,Orderby)	
	  end if 	  
end select
response.Write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>网络硬盘</title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'><script src='../hxinclude/hx_function.js'></script></head><body topmargin='20' leftmargin='0' bottommargin='0'><table width='700'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8 background='../HXIMAGES/titlelinebg.gif'><table width='595'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>网络硬盘</font></td></tr></table><table width='100%'  border='0' cellspacing='1' cellpadding='0' bgcolor=FFFBE8><tr bgcolor='#FFFBE8'><td><table width='100%'  border='0' cellspacing='0' cellpadding='0' bgcolor='FFFBE8'><tr><td width='66%' valign='top'><table cellSpacing='1' cellPadding='2' width='100%' border='0' bgcolor='#BF9B73'>"
if action="ViewFolder" then  response.write "<tr bgcolor='#FFFBE8'><td height='20' colspan='6'><a href='netdisk.asp' title='返回目录列表'><img border='0' src='../HXIMAGES/FileIcon/up.gif'></a></td></tr>" 
    if rs.recordcount>0 then
	  if rs("WS_FileID")=0 then
	    response.write "<tr bgcolor='#431E07' class='td4'><td width='36' height='20'><div align='center'>类 型</div></td><td width='147'><div align='center'>名 称</div></td><td width='63'><div align='center'>文件数</div></td><td width='64'><div align='center'>大 小</div></td><td width='64'><div align='center'>日 期</div></td><td width='54'><div align='center'>操 作</div></td></tr>"
	    Do until Rs.Eof
		TotalFileNum = TotalFileNum + rs("WS_NetDiskFileNum"):FolderSize = WS_S.ShowFolderSize(rs("WS_FDID")):TotalFolderSize = TotalFolderSize + FolderSize
	    response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td><div align='center'>"
	     if rs("WS_NetDiskFolderEXT")<>"" then response.write "<img src='../hximages/FileIcon/"&rs("WS_NetDiskFolderEXT")&".gif'>" else response.write "<img src='../hximages/FileIcon/folder.gif'>" end if
	     response.Write "</div></td><td height='26'><a title='修改' href='netdisk.asp?FolderId="&rs("WS_FDID")&"'>"&rs("WS_NetDiskFolderName")&"</a> ["
	     if rs("WS_NetDiskFolderPriv")=0 then response.write "<font color=red>公用</font>" else response.Write "<font color=blue>私用</font>" end if
	     response.Write "]</td><td><div align='center'>"&rs("WS_NetDiskFileNum")&"</div></td><td><div align='center'>"&WS_S.GetSize(FolderSize,"B")&"</div></td><td><div align='center'>"&formatdatetime(rs("WS_NetDiskFolderDate"),2)&"</div></td><td><div align='center'><a href='netdisk.asp?action=ViewFolder&FolderId="&rs("WS_FDID")&"' title='浏览该文件夹下文件'><img border='0' src='../hximages/FileIcon/brow.gif'></a>"
	     if rs("WS_NetDiskEmpId")=cint(loginuid) then response.Write " <a href='netdisk.asp?action=DeleteFolder&FolderId="&rs("WS_FDID")&"' title='删除该文件夹及其下的文件'><img border='0' src='../hximages/FileIcon/delete.gif'></a>"
		 response.Write "</div></td></tr>"		 
	    Rs.MoveNext
	    Loop
     else
		  TotalFolderSize=0:TotalFileNum=0
	  	  response.write "<tr bgcolor='#431E07' class='td4'><td width='36' height='20'><div align='center'>类 型</div></td><td width='147'><div align='center'>名 称</div></td><td width='63'><div align='center'>文件数</div></td><td width='64'><div align='center'>大 小</div></td><td width='64'><div align='center'>日 期</div></td><td width='54'><div align='center'>操 作</div></td></tr>"
	      Do until Rs.Eof
		     filepath=rs("WS_FileID")&"/"&rs("WS_FDID")&"."&rs("WS_NetDiskFolderEXT")
		     dim objFTemp,fso
		     set fso=Server.CreateOBject("Scripting.FileSystemObject")		  
		     if fso.fileexists(server.mappath(filepath)) then
		      Set objFTemp=FSO.GetFile(server.mappath(filepath))
		      FileSize=objFTemp.size:TotalFolderSize=TotalFolderSize+FileSize		  
		     end if
             set fso=nothing:TotalFileNum=TotalFileNum+1
		     response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td><div align='center'>"
			if rs("WS_NetDiskFolderEXT")<>"" then response.write "<img src='../hximages/FileIcon/"&rs("WS_NetDiskFolderEXT")&".gif'>" else response.write "<img src='../hximages/FileIcon/folder.gif'>"
			response.Write "</div></td><td height='26'><a href='"&filepath&"' target='_blank' title='查看或下载文件'>"&rs("WS_NetDiskFolderName")&"</a></td><td><div align='center'>"&TotalFileNum&"</div></td><td><div align='center'>"&WS_S.GetSize(FileSize,"B")&"</div></td><td><div align='center'>"&formatdatetime(rs("WS_NetDiskFolderDate"),2)&"</div></td><td><div align='center'><a href='"&rs("WS_FileID")&"/"&rs("WS_FDID")&"."&rs("WS_NetDiskFolderEXT")&"' target='_blank' title='查看或下载文件'><img border='0' src='../hximages/FileIcon/brow.gif'></a>"
			if rs("WS_NetDiskEmpId")=cint(loginuid) then response.Write " <a href='netdisk.asp?action=DeleteFile&FolderId="&rs("WS_FDID")&"' title='删除该文件夹及其下的文件'><img border='0' src='../hximages/Other/close.gif'></a>"
			response.Write "</div></td></tr>"
	     Rs.MoveNext
	     Loop
     end if
else	 
 response.write "<tr bgcolor='#431E07' class='td4'><td width='36' height='20'><div align='center'>类 型</div></td><td width='147'><div align='center'>名 称</div></td><td width='63'><div align='center'>文件数</div></td><td width='64'><div align='center'>大 小</div></td><td width='64'><div align='center'>日 期</div></td><td width='54'><div align='center'>操 作</div></td></tr><tr bgcolor='#431E07'><td height='20' bgcolor='FFFBE8' align='center' colspan='6'>没有文件</td></tr>"
end if 
		response.Write "<tr bgcolor='#FFFBE8'><td></td><td height='26'>总计</td><td><div align='center'>"&TotalFileNum&"</div></td><td><div align='center'>"&WS_S.GetSize(TotalFolderSize,"B")&"</div></td><td></td><td></td></tr><tr bgcolor='#FFFBE8'><td height='5' colspan='6'></td></tr><tr bgcolor='#431E07' class='td4'><td height='26' colspan='6'> 上传文件（文件大小请尽量保持在1M左右！） </td></tr><tr bgcolor='#FFFBE8'><td height='26' colspan='6'><iframe name='upload' frameborder=0 width=80% height=30 scrolling=no src='UploadDoc.asp?FolderId="&FolderId&"&filepath=./"&FolderId&"/'></iframe></td></tr></table></td><td width='2%'>&nbsp;</td><td width='32%' valign='top' bgcolor='#FFFBE8'><table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr><td><table cellSpacing='1' cellPadding='2' width='100%' border='0' bgcolor='#431E07'><form name='frmAdd' method='post' action='?action=addnew' onsubmit='javascript:return checkadd();'><tr><td height='20' colspan='2' align='center' bgcolor='#431E07'><font color='#FFFBE8'>新 建 文 件 夹</font></td></tr><tr bgcolor='#FFFBE8'><td width='80'>文件夹名称：</td><td width='120'><input type='text' name='FolderName' style='width:130px;'></td></tr><tr bgcolor='#FFFBE8'><td>文件夹权限：</td><td><input type='radio' name='FolderPriv' value='0' class='radio' checked style='background-color:FFFBE8;'>公用   <input type='radio' name='FolderPriv' value='1' class='radio' style='background-color:FFFBE8;'>私用		</td></tr><tr bgcolor='#FFFBE8'><td>文件夹描述：</td><td><textarea name='FolderMemo' style='width:130px;height:60px;'></textarea></td></tr><tr><td height='20' colspan='2' align='center' bgcolor='#FFFBE8'><input type='submit' name='btnNewFolder' class='btnA' value='新建' style='width:60px;' "
		if action="ViewFolder" then response.write "disabled"
		response.write "> <input type='reset' name='btnCancel' class='btnA' value='取消' style='width:60px;'></td></tr></form></table></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellSpacing='1' cellPadding='2' width='100%' border='0' bgcolor='#431E07'><form name='frmEdit' method='post' action='?action=EditFolder&FolderId="&FolderId&"'><tr><input type='hidden' name='FolderId' value='"&FolderId&"'><td height='19' colspan='2' align='center' bgcolor='#431E07'><font color='#FFFBE8'>编 辑 文 件 夹</font></td></tr><tr bgcolor='#FFFBE8'><td>文件夹名称：</td><td><input type='text' name='FolderName' value='"&FolderName&"' style='width:130px;'></td></tr><tr bgcolor='#FFFBE8'><td>文件夹权限：</td><td><input type='radio' name='FolderPriv' value='0' class='radio' "
		if FolderPriv=0 then response.write "checked"
		response.Write " style='background-color:FFFBE8;'>公用   <input type='radio' name='FolderPriv' value='1' class='radio' "
		if FolderPriv=1 then response.write "checked"
		response.Write " style='background-color:FFFBE8;'>私用		</td></tr><tr bgcolor='#FFFBE8'><td>文件夹描述：</td><td><textarea name='FolderMemo' style='width:130px;height:60px;'>"&FolderMemo&"</textarea></td></tr><tr><td height='20' colspan='2' align='center' bgcolor='#FFFBE8'><input type='button' name='btnEditFolder' onclick=""javascript:DoFolder('edit');"" class='btnA' value='修改' style='width:60px;'"
		if not WS_S.HX_ISNUM(FolderId) or action="ViewFolder" then response.write "disabled"
		response.Write "> <input type='reset' name='btnCancel' class='btnA' value='取消' style='width:60px;'></td></tr></form></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table>"
		WS_S.HX_RSClose rs%>