<%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true	
Const PurviewLevel=2
Const CheckChannelID=4
Const PurviewLevel_Photo=3
%>
<!--#include file="inc/conn1.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="Admin_ChkPurview.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/ubbcode.asp"-->
<!--#include file="inc/admin_code_Photo.asp"-->
<%
dim PhotoID,sql,rs,FoundErr,ErrMsg,PurviewChecked,PurviewChecked2
dim ClassID,tClass,ClassName,RootID,ParentID,ParentPath,Depth,ClassMaster,ClassChecker
PhotoID=trim(request("PhotoID"))
FoundErr=False
PurviewChecked=False
PurviewChecked2=False

call main()
if FoundErr=True then
	WriteErrMsg()
end if
call CloseConn()

sub main()
if PhotoId="" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>参数不足</li>"
	exit sub
else
	PhotoID=Clng(PhotoID)
end if
sql="select * from Photo where Deleted=False and PhotoID=" & PhotoID & ""
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.bof and rs.eof then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>找不到文章</li>"
else
	ClassID=rs("ClassID")
	set tClass=conn.execute("select ClassName,RootID,ParentID,Depth,ParentPath,ClassMaster,ClassChecker From PhotoClass where ClassID=" & ClassID)
	if tClass.bof and tClass.eof then
		founderr=True
		ErrMsg=ErrMsg & "<br><li>找不到指定的栏目</li>"
	else
		ClassName=tClass(0)
		RootID=tClass(1)
		ParentID=tClass(2)
		Depth=tClass(3)
		ParentPath=tClass(4)
		ClassMaster=tClass(5)
		ClassChecker=tClass(6)
	end if
	set tClass=nothing
end if
if FoundErr=True then
	rs.close
	set rs=nothing
	exit sub
end if
if AdminPurview=1 or AdminPurview_Photo<=2 then
	PurviewChecked=True
else
	PurviewChecked=CheckClassMaster(ClassMaster,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
	PurviewChecked2=CheckClassMaster(ClassChecker,AdminName)
	if PurviewChecked2=False and ParentID>0 then
		set tClass=conn.execute("select ClassMaster from PhotoClass where ClassID in (" & ParentPath & ")")
		do while not tClass.eof
			PurviewChecked2=CheckClassMaster(tClass(0),AdminName)
			if PurviewChecked2=True then exit do
			tClass.movenext
		loop
	end if
end if
%>
<html>
<head>
<title><%=rs("PhotoName")%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_Style.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1" bgcolor="#D6D5D9"></td>
    <td height="34" align=left bgcolor="#F8F8F9"><strong>&nbsp;&nbsp;管理导航：</strong><a href="Admin_PhotoManage.asp">图片管理</a>&nbsp;|&nbsp;<a href="Admin_PhotoAdd.asp">添加图片</a>&nbsp;| <a href="Admin_PhotoRecyclebin.asp">图片回收站管理</a>&nbsp;|&nbsp;<a href="Admin_PhotoComment.asp">图片评论管理</a></td>
    <td width="1" bgcolor="#D6D5D9"></td>
  </tr>
  <tr>
    <td width="1" bgcolor="#F8F8F9"></td>
    <td height="1" bgcolor="#D6D5D9" ></td>
    <td width="1" bgcolor="#F8F8F9"></td>
  </tr>
</table>
<table width="100%" height="8" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<TABLE 
width="100%" height="40" border=0 align=center cellPadding=2 cellSpacing=0>
  <TBODY>
    <TR>
      <TD align=left><%
response.write "您现在的位置：&nbsp;<a href='Admin_PhotoManage.asp'>图片管理</a>&nbsp;&gt;&gt;&nbsp;"
if ParentID>0 then
	dim sqlPath,rsPath
	sqlPath="select ClassID,ClassName From PhotoClass where ClassID in (" & ParentPath & ") order by Depth"
	set rsPath=server.createobject("adodb.recordset")
	rsPath.open sqlPath,conn,1,1
	do while not rsPath.eof
		response.Write "<a href='Admin_PhotoManage.asp?ClassID=" & rsPath(0) & "'>" & rsPath(1) & "</a>&nbsp;&gt;&gt;&nbsp;"
		rsPath.movenext
	loop
	rsPath.close
	set rsPath=nothing
end if
response.write "<a href='Admin_PhotoManage.asp?ClassID=" & ClassID & "'>" & ClassName & "</a>&nbsp;&gt;&gt;&nbsp;"
response.write "<a href='Admin_PhotoShow.asp?PhotoID=" & rs("PhotoID") & "'>" & dvhtmlencode(rs("PhotoName")) & "</a>"
%>
      </TD>
    </TR>
  </TBODY>
</TABLE>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1" bgcolor="#F8F8F9"></td>
    <td height="1" bgcolor="#D6D5D9" ></td>
    <td width="1" bgcolor="#F8F8F9"></td>
  </tr>
  <tr>
    <td width="1" bgcolor="#D6D5D9"></td>
    <td height="30" align=center bgcolor="#F8F8F9"><strong>图片相关信息</strong></td>
    <td width="1" bgcolor="#D6D5D9"></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="8" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td width="100" align="center" bgcolor="#FFFFFF"><strong>&nbsp;图片标题：</strong></td>
    <td bgcolor="#FFFFFF"><%= dvhtmlencode(rs("PhotoName")) %></td>
    
    <td width="241" rowspan="9" align="center" bgcolor="#FFFFFF"><%
					  if FoundErr<>True then
						  response.write "<a href='Photo_show.asp?PhotoID=" & rs("PhotoID") & "' target=_blank><img src='" & rs("PhotoUrl_Thumb") & "' border=0></a>"
					  else
						  response.write "<img src='" & rs("PhotoUrl_Thumb") & "' border=0>"
					  end if%></td>
  </tr>
 
  <tr>
    <td align="center" bgcolor="#FFFFFF"><strong>&nbsp;更新时间：</strong></td>
    <td bgcolor="#FFFFFF"><%= rs("UpdateTime") %></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF"><strong>&nbsp;推荐等级：</strong></td>
    <td bgcolor="#FFFFFF"><%= string(rs("Stars"),"★") %></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF"><strong>&nbsp;查看次数：</strong></td>
    <td bgcolor="#FFFFFF"><%=rs("Hits")%></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF"><strong>&nbsp;图片添加：</strong></td>
    <td bgcolor="#FFFFFF"><%= rs("Editor") %></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF"><strong>&nbsp;图片简介：</strong></td>
    <td bgcolor="#FFFFFF"><%= ubbcode(dvhtmlencode(rs("PhotoIntro"))) %></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF"><strong>&nbsp;图片属性：</strong></td>
    <td bgcolor="#FFFFFF"> <%
			if rs("OnTop")=true then
				response.Write "<font color=blue>顶</font> "
			else
				response.write "&nbsp;&nbsp;&nbsp;"
			end if
			if rs("Hits")>=HitsOfHot then
				response.write "<font color=red>热</a> "
			else
				response.write "&nbsp;&nbsp;&nbsp;"
			end if
			if rs("Elite")=true then
				response.write "<font color=green>荐</a>"
			else
				response.write "&nbsp;&nbsp;"
			end if
			%> </td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF"><strong>&nbsp;相关评论：</strong></td>
    <td  bgcolor="#FFFFFF"><a href='admin_photocomment.asp?showphotoid=<%=rs("photoID")%>'> 管理此图片的点评</a></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF"><strong>&nbsp;可用操作：</strong></td>
    <td bgcolor="#FFFFFF"><%
if (rs("Editor")=AdminName and rs("Passed")=False) or PurviewChecked=True then
	response.write "<a href='Admin_PhotoModify.asp?PhotoID=" & rs("PhotoID") & "'>修改</a>&nbsp;&nbsp;"
    response.write "<a href='Admin_PhotoDel.asp?Action=Del&PhotoID=" & rs("PhotoID") & "'>删除</a>&nbsp;&nbsp;" 
end if

if PurviewChecked=True then
  	if rs("OnTop")=false then
   		response.write "<a href='Admin_PhotoProperty.asp?Action=SetOnTop&PhotoID=" & rs("PhotoID") & "'>固顶</a>&nbsp;&nbsp;"
   	else
		response.write "<a href='Admin_PhotoProperty.asp?Action=CancelOnTop&PhotoID=" & rs("PhotoID") & "'>解固</a>&nbsp;&nbsp;" 
   	end if
  	if rs("Elite")=false then
   		response.write "<a href='Admin_PhotoProperty.asp?Action=SetElite&PhotoID=" & rs("PhotoID") & "'>设为推荐</a>"
   	else
		response.write "<a href='Admin_PhotoProperty.asp?Action=CancelElite&PhotoID=" & rs("PhotoID") & "'>取消推荐</a>"
    end if
end if
%>    </td>
  </tr>
</table>
</body>
</html>
<%
end sub
%>