%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true
Const PurviewLevel=2
Const CheckChannelID=4
Const PurviewLevel_Photo=3
%>
<%
dim strFileName,FileName
const MaxPerPage=20
dim totalPut,CurrentPage,TotalPages
dim i,j
dim keyword,strField
dim sql,rsPhotoList
dim ClassID
dim PurviewChecked
dim strAdmin,arrAdmin
dim tClass,ClassName,RootID,ParentID,Depth,ParentPath,Child,ChildID,tID,tChild,ClassMaster
dim SkinID,LayoutID,BrowsePurview,AddPurview
dim ManageType
ManageType=trim(request("ManageType"))
PurviewChecked=false
FileName="Admin_PhotoManage.asp"
ClassID=Trim(request("ClassID"))
keyword=trim(request("keyword"))
if keyword<>"" then
keyword=ReplaceBadChar(keyword)
end if
strField=trim(request("Field"))
if ClassID="" then
ClassID=0
if strField="" and AdminPurview=2 and AdminPurview_Photo=3 and ManageType<>"MyPhoto" then
set tClass=conn.execute("select ClassName,RootID,ParentID,Depth,ParentPath,Child,ClassMaster,ClassID From PhotoClass where ClassMaster like '%" & AdminName & "%'")
do while not tClass.eof
if CheckClassMaster(tClass(6),AdminName)=true then
ClassName=tClass(0)
RootID=tClass(1)
ParentID=tClass(2)
Depth=tClass(3)
ParentPath=tClass(4)
Child=tClass(5)
ClassMaster=tClass(6)
ClassID=tClass(7)
PurviewChecked=True
exit do
end if
tClass.movenext
loop
end if
else
ClassID=CLng(ClassID)
end if
if ClassID>0 and PurviewChecked=False then
set tClass=conn.execute("select ClassName,RootID,ParentID,Depth,ParentPath,Child,ClassMaster From PhotoClass where ClassID=" & ClassID)
if tClass.bof and tClass.eof then
founderr=True
ErrMsg=ErrMsg & "
找不到指定的栏目
"
Call WriteErrMsg()
response.end
else
ClassName=tClass(0)
RootID=tClass(1)
ParentID=tClass(2)
Depth=tClass(3)
ParentPath=tClass(4)
Child=tClass(5)
ClassMaster=tClass(6)
PurviewChecked=CheckClassMaster(tClass(6),AdminName)
if PurviewChecked=False and ParentID>0 then
set tClass=conn.execute("select ClassMaster from PhotoClass 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 request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
if ManageType="MyPhoto" then
FileName=FileName & "?ManageType=" & ManageType
strFileName=FileName & "&ClassID=" & ClassID & "&strField=" & strField & "&keyword=" & keyword
else
strFileName=FileName & "?ClassID=" & ClassID & "&strField=" & strField & "&keyword=" & keyword
end if
%>
图片管理
<%
sql="select P.PhotoID,P.ClassID,C.ClassName,P.PhotoName,P.Keyword,P.Author,P.UpdateTime,P.Editor,P.Hits,P.PhotoUrl_Thumb,P.PhotoSize,P.OnTop,P.Elite,P.Passed,P.Stars,P.PhotoLevel,P.PhotoPoint from Photo P"
sql=sql & " inner join PhotoClass C on P.ClassID=C.ClassID where P.Deleted=False"
if ClassID>0 then
if Child>0 then
ChildID=""
if Depth<=0 then
set tClass=conn.execute("select ClassID from PhotoClass where ParentID=" & ClassID & " or ParentPath like '" & ClassID & ",%'")
else
set tClass=conn.execute("select ClassID from PhotoClass where ParentID=" & ClassID & " or ParentPath like '" & ParentPath & "," & ClassID & ",%'")
end if
do while not tClass.eof
if ChildID="" then
ChildID=tClass(0)
else
ChildID=ChildID & "," & tClass(0)
end if
tClass.movenext
loop
sql=sql & " and P.ClassID in (" & ChildID & ")"
else
sql=sql & " and P.ClassID=" & ClassID
end if
end if
if ManageType="MyPhoto" then
sql=sql & " and P.Editor='" & AdminName & "' "
else
if keyword<>"" then
select case strField
case "PhotoName"
sql=sql & " and P.PhotoName like '%" & keyword & "%' "
case "PhotoIntro"
sql=sql & " and P.PhotoIntro like '%" & keyword & "%' "
case "Author"
sql=sql & " and P.Author like '%" & keyword & "%' "
case "Editor"
sql=sql & " and P.Editor like '%" & keyword & "%' "
case else
sql=sql & " and P.PhotoName like '%" & keyword & "%' "
end select
end if
end if
sql=sql & " order by P.PhotoID desc"
'response.write sql
'response.end
Set rsPhotoList= Server.CreateObject("ADODB.Recordset")
rsPhotoList.open sql,conn,1,1
if rsPhotoList.eof and rsPhotoList.bof then
totalPut=0
if Child=0 then
response.write "
没有任何图片!
"
else
response.write "
此栏目的下一级子栏目中没有任何图片!
"
end if
else
totalPut=rsPhotoList.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"张图片"
else
if (currentPage-1)*MaxPerPage