%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
option explicit
response.buffer=true
Const PurviewLevel=2
Const CheckChannelID=3
Const PurviewLevel_Soft=3
%>
<%
dim SoftID,Action,sqlDel,rsDel,FoundErr,ErrMsg,PurviewChecked,ObjInstalled
dim ClassID,tClass,ClassName,RootID,ParentID,Depth,ParentPath,Child,ChildID,tID,tChild,ClassMaster
SoftID=trim(request("SoftID"))
Action=Trim(Request("Action"))
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
FoundErr=False
if Action="" then
FoundErr=True
ErrMsg=ErrMsg & "
参数不足!"
end if
if FoundErr=False then
if Action="Del" then
call DelSoft()
elseif Action="ConfirmDel" then
call ConfirmDel()
elseif Action="ClearRecyclebin" then
call ClearRecyclebin()
elseif Action="Restore" then
call Restore()
elseif Action="RestoreAll" then
call RestoreAll()
elseif Action="DelFromSpecial" then
call DelFromSpecial()
end if
end if
if FoundErr=False then
call CloseConn()
response.Redirect ComeUrl
else
call WriteErrMsg()
call CloseConn()
end if
sub DelSoft()
if SoftID="" then
FoundErr=True
ErrMsg=ErrMsg & "
请先选定软件!"
exit sub
end if
if instr(SoftID,",")>0 then
SoftID=replace(SoftID," ","")
sqlDel="select * from Soft where SoftID in (" & SoftID & ")"
else
SoftID=Clng(SoftID)
sqlDel="select * from Soft where SoftID=" & SoftID
end if
Set rsDel= Server.CreateObject("ADODB.Recordset")
rsDel.open sqlDel,conn,1,3
do while not rsDel.eof
PurviewChecked=False
ClassID=rsDel("ClassID")
if AdminPurview=1 or AdminPurview_Soft<=2 or (rsDel("Editor")=AdminName and rsDel("Passed")=False) then
PurviewChecked=True
else
set tClass=conn.execute("select ClassName,RootID,ParentID,Depth,ParentPath,Child,ClassMaster From SoftClass where ClassID=" & ClassID)
if tClass.bof and tClass.eof then
founderr=True
ErrMsg=ErrMsg & "
找不到指定的栏目"
else
ClassName=tClass(0)
RootID=tClass(1)
ParentID=tClass(2)
Depth=tClass(3)
ParentPath=tClass(4)
Child=tClass(5)
ClassMaster=tClass(6)
PurviewChecked=CheckClassMaster(ClassMaster,AdminName)
if PurviewChecked=False and ParentID>0 then
set tClass=conn.execute("select ClassMaster from SoftClass where ClassID in (" & ParentPath & ")")
do while not tClass.eof
PurviewChecked=CheckClassMaster(tClass(0),AdminName)
if PurviewChecked=True then exit do
tClass.movenext
loop
end if
end if
end if
if PurviewChecked=False then
FoundErr=True
ErrMsg=ErrMsg & "
删除" & rsDel("SoftID") & "失败!原因:没有操作权限!"
else
rsDel("Deleted")=True
rsDel.update
end if
rsDel.movenext
loop
rsDel.close
set rsDel=nothing
end sub
sub ConfirmDel()
if AdminPurview=2 and AdminPurview_Soft>1 then
FoundErr=True
ErrMsg=ErrMsg & "
对不起,你的权限不够!"
exit sub
end if
if SoftID="" then
FoundErr=True
ErrMsg=ErrMsg & "
请先选定软件!"
exit sub
end if
SoftID=replace(SoftID," ","")
sqlDel="select SoftID,SoftPicUrl,DownloadUrl1 from Soft where SoftID in (" & SoftID & ")"
Set rsDel= Server.CreateObject("ADODB.Recordset")
rsDel.open sqlDel,conn,1,3
do while not rsDel.eof
if left(rsDel(1),len("UploadSoftPic"))="UploadSoftPic" then
call DelFiles(rsDel(0) & "")
end if
if left(rsDel(1),len("UploadSoft"))="UploadSoft" then
call DelFiles(rsDel(1) & "")
end if
rsDel.movenext
loop
rsDel.close
set rsDel=nothing
conn.execute("delete from Soft where SoftID in (" & SoftID & ")")
conn.execute("delete from SoftComment where SoftID in (" & SoftID & ")")
end sub
sub ClearRecyclebin()
if AdminPurview=2 and AdminPurview_Soft>1 then
FoundErr=True
ErrMsg=ErrMsg & "
对不起,你的权限不够!"
exit sub
end if
SoftID=""
sqlDel="select SoftID,SoftPicUrl,DownloadUrl1 from Soft where Deleted=True"
Set rsDel= Server.CreateObject("ADODB.Recordset")
rsDel.open sqlDel,conn,1,3
do while not rsDel.eof
if SoftID="" then
SoftID=rsDel(0)
else
SoftID=SoftID & "," & rsDel(0)
end if
if left(rsDel(1),len("UploadSoftPic"))="UploadSoftPic" then
call DelFiles(rsDel(1) & "")
end if
if left(rsDel(1),len("UploadSoft"))="UploadSoft" then
call DelFiles(rsDel(2) & "")
end if
rsDel.movenext
loop
rsDel.close
set rsDel=nothing
if SoftID<>"" then
conn.execute("delete from Soft where Deleted=True")
conn.execute("delete from SoftComment where SoftID in (" & SoftID & ")")
end if
end sub
sub Restore()
if AdminPurview=2 and AdminPurview_Soft>1 then
FoundErr=True
ErrMsg=ErrMsg & "
对不起,你的权限不够!"
exit sub
end if
if SoftID="" then
FoundErr=True
ErrMsg=ErrMsg & "
请先选定软件!"
exit sub
end if
SoftID=replace(SoftID," ","")
conn.execute("update Soft set Deleted=False where SoftID in (" & SoftID & ")")
if instr(SoftID,",")>0 then
SoftID=replace(SoftID," ","")
sqlDel="select * from Soft where SoftID in (" & SoftID & ")"
else
SoftID=Clng(SoftID)
sqlDel="select * from Soft where SoftID=" & SoftID
end if
Set rsDel= Server.CreateObject("ADODB.Recordset")
rsDel.open sqlDel,conn,1,3
do while not rsDel.eof
rsDel("Deleted")=False
rsDel.update
rsDel.movenext
loop
rsDel.close
set rsDel=nothing
end sub
sub RestoreAll()
if AdminPurview=2 and AdminPurview_Soft>1 then
FoundErr=True
ErrMsg=ErrMsg & "
对不起,你的权限不够!"
exit sub
end if
sqlDel="select * from Soft where Deleted=True"
Set rsDel= Server.CreateObject("ADODB.Recordset")
rsDel.open sqlDel,conn,1,3
do while not rsDel.eof
rsDel("Deleted")=False
rsDel.update
'if rsDel("Passed")=True then
' conn.execute("update [User] set SoftCount=SoftCount+1,SoftChecked=SoftChecked+1 where UserName='" & rsDel("Editor") & "'")
'else
' conn.execute("update [User] set SoftCount=SoftCount+1 where UserName='" & rsDel("Editor") & "'")
'end if
rsDel.movenext
loop
rsDel.close
set rsDel=nothing
end sub
sub DelFromSpecial()
if AdminPurview=2 and AdminPurview_Soft>1 then
FoundErr=True
ErrMsg=ErrMsg & "
对不起,你的权限不够!"
exit sub
end if
SoftID=replace(SoftID," ","")
conn.execute("update Soft set SpecialID=0 where SoftID in (" & SoftID & ")")
end sub
%>