📄 classalbum.asp
字号:
else
sql="insert into comment (picid,name,content,signdate) values "&_
"("&clng(photoid)&",'"&membername&"','"&comment&"',now())"
conn.execute(sql)
rURL="ClassAlbum.asp?Action=ShowPhoto&PhotoID="&clng(photoid)
rtitle="发表评论成功"
rmsg="<FONT COLOR="&TableContentcolor&">本页面将在2秒后自动返回班级留言页面<br><ul>"&_
"<li><a href=ClassAlbum.asp?Action=ShowPhoto&PhotoID="&clng(photoid)&"><font color="&TableContentcolor&">返回班级相册</font></a></li>"&_
"</ul>"
redirect 2,rurl,rtitle,rmsg
end if
end sub
sub showphoto()
dim rs,sql
photoid=request("photoid")
if photoid="" then
Errmsg=Errmsg+"<br>"+"<li>操作失败!请选择要查看的照片。"
call error("Critical",errmsg)
exit sub
end if
sql = "select * from [photo] where picid="&clng(photoid)
set rs=conn.Execute(sql)
if rs.Eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>操作失败!该相片不存在。"
founderr=true
elseif not sysadmin and rs("classid")<>clng(clsid) then
Errmsg=Errmsg+"<br>"+"<li>操作失败!您无权查看其他班级的相片。"
founderr=true
end if
if founderr=true then
call error("Exclamation",errmsg)
exit sub
end if
sql="update [photo] set visitcount=visitcount+1 where picid="&clng(photoid)
conn.Execute(sql)
if rs("width")>630 then
acturalwidth=630
else
acturalwidth=rs("width")
end if
if rs("depth")<=8 then depth=2^cint(rs("depth")) else depth=rs("depth")&"b"
iconame="images/"&rs("format")&".gif"
lsql="select top 1 picid from photo where type='"&rs("type")&"' and classid="&_
clsid&" and picid>"&clng(photoid)&" order by picid"
set lrs=conn.execute(lsql)
if lrs.eof and lrs.bof then pfoto=0 else pfoto=lrs(0)
lsql="select top 1 picid from photo where type='"&rs("type")&"' and classid="&_
clsid&" and picid<"&clng(photoid)&" order by picid desc"
set lrs=conn.execute(lsql)
if lrs.eof and lrs.bof then nfoto=0 else nfoto=lrs(0)
set lrs=nothing
response.write "<script language=JavaScript src=script/zoom.js></script>"&_
"<table width=700 border=0 align=center bgcolor="&tablebodycolor1&"><tr><td>"&_
"<table><TR><TD align=middle height=10></TD></TR></table>"&_
"<TABLE cellSpacing=1 cellPadding=2 width=632 border=0 align=center>"&_
"<TR>"&_
"<TD height=24 >『"&rs("title")&"』</TD>"&_
"<TD class=novdn align=right><A href=Profile.asp?Action=showdetail&Name="&rs("name")&_
" target=_blank>"&getrealname(rs("name"))&"</A> "&rs("uptime")&"</TD>"&_
"</TR>"&_
"<TR>"&_
"<TD colSpan=2 height=23><HR size=1 width=""100%""> "&rs("remark")&"</TD>"&_
"</TR>"&_
"</TABLE>"&_
"<table><TR><TD align=middle height=10></TD></TR></table>"&_
"<TABLE cellSpacing=0 cellPadding=0 width=90% border=0 align=center>"&_
"<TR>"&_
"<TD align=middle height=300 valign=center>"&_
"<A href="&PhotoPath&rs("filename")&" target=_blank>"&_
"<IMG src="&PhotoPath&rs("filename")&" width="&acturalwidth&" border=0 alt=点击看全图 name=photo></a>"&_
"</TD>"&_
"</TR>"&_
"<table>"&_
"<table><TR><TD align=middle height=10></TD></TR></table>"&_
"<TABLE cellSpacing=0 cellPadding=0 width=90% border=0 align=center height=40 valign=top>"&_
"<TR>"&_
"<TD align=left class=novdn>"&_
"<img src="&iconame&" hspace=2 align=absmiddle>"&_
rs("width")&"x"&rs("height")&"x"&depth&" "&photosize(rs("filesize"))&_
"</TD>"&_
"<TD width=""50%"" align=right>"
if pfoto<>0 then
response.write "<a href=ClassAlbum.asp?Action=ShowPhoto&PhotoID="&pfoto&"><IMG src=images/p_pre.gif border=0 hspace=1 align=absmidle alt=上一张></a> "
end if
if nfoto<>0 then
response.write "<a href=ClassAlbum.asp?Action=ShowPhoto&PhotoID="&nfoto&"><IMG src=images/p_next.gif border=0 hspace=1 align=absmidle alt=下一张></a> "
end if
response.write "<A href="&PhotoPath&rs("filename")&" target=_blank>"&_
"<IMG src=images/p_full.gif border=0 hspace=1 align=absmidle alt=全图></A> "&_
"<A href=""javascript:fitpage("&rs("width")&","&rs("height")&")"">"&_
"<IMG src=images/p_fit.gif border=0 hspace=1 align=absmidle alt=最合适大小></A> "&_
"<A href=""javascript:zoomin()"">"&_
"<IMG src=images/p_zoomin.gif border=0 hspace=1 align=absmidle alt=放大></A> "&_
"<A href=""javascript:zoomout()"">"&_
"<IMG src=images/p_zoomout.gif border=0 hspace=1 align=absmidle alt=缩小></A> "
if rs("name")=membername or bisclsadm<>0 or sysadmin then
response.write "<a onclick=""javascript:if(confirm('确定要删除这张相片吗?')){return true;}else{return false;}"""&_
" href=ClassAlbum.asp?Action=DelPhoto&PhotoID="&photoid&">"&_
"<img src=images/p_del.gif hspace=1 border=0 align=absmiddle alt=删除></a> "&_
"<A href=ClassAlbum.asp?Action=EditPhoto&PhotoID="&photoid&">"&_
"<IMG src=images/p_edit.gif border=0 hspace=1 align=absmiddle alt=编辑></A> "
end if
response.write "</TD>"&_
"</TR>"&_
"</table>"&_
"<TABLE cellSpacing=0 cellPadding=0 width=90% border=0 align=center>"&_
"<TR bgColor="&tablebodycolor2&">"&_
"<TD height=20> <IMG src=images/comment.gif hspace=4 align=absmiddle>相关评论</TD>"&_
"</TR>"&_
"<tr><td>"
call showcomment(photoid)
response.write "</td>"&_
"</tr>"&_
"</TABLE>"&_
"<table><TR><TD align=middle height=10></TD></TR></table>"&_
"<TABLE cellSpacing=1 cellPadding=0 width=90% border=0 align=center bgcolor=#ffffff>"&_
"<form action=ClassAlbum.asp method=post name=cmt onsubmit=""return submitonce(this)"">"&_
"<input type=hidden name=Action value=SaveComment>"&_
"<input type=hidden name=photoid value="&photoid&">"&_
"<TR bgColor="&tablebodycolor2&">"&_
"<Th height=20 align=left> <IMG src=images/nav.gif hspace=4>发表评论</Th>"&_
"</TR>"&_
"<TR bgColor="&tablebodycolor2&">"&_
"<TD align=center valign=center height=135><TEXTAREA style=""WIDTH: 450px;HEIGHT:100px"" name=comment></TEXTAREA></TD>"&_
"</TR>"&_
"<TR bgColor="&tablebodycolor1&">"&_
"<TD align=center><table width=450 align=center><tr><td align=right>"&_
"<input type=submit value=发表评论></td></tr></table></TD>"&_
"</TR>"&_
"</TABLE><BR>"&_
"</td></tr></table>"
end sub
sub showcomment(photoid)
dim sql,rs
sql="select name,content,signdate,id from comment where picid="&clng(photoid)&" order by id desc"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
response.write "<table width=""100%""><TR><TD colSpan=2 height=1>目前尚无评论!</TD></TR></table>"
else
response.write "<table width=""100%"">"
i=1
do until rs.eof
if i<>1 then
response.write "<TR height=1><TD colpsna=2><table width=""100%"">"&_
"<TR bgcolor=#ffffff><TD></TD></TR></table></TD></TR>"
end if
response.write "<tr><td height=50 colspan=2>"&htmlencode(rs(1))&"</td></tr>"
response.write "<tr><td align=left valign=top>"
if rs(0)=membername or bisclsadm<>0 or sysadmin then
response.write "<a onclick=""javascript:if(confirm('确定要删除这个评论吗?')){return true;}else{return false;}"" href=ClassAlbum.asp?Action=DelComment&PhotoID="&clng(photoid)&"&ID="&rs(3)&"><img src=images/delete.gif border=0 hspace=1 align=absmiddle width=13>删除</a>"
end if
st=FormatDateTime(rs(2),2)&" "&FormatDateTime(rs(2),4)
response.write "</td><td align=right>"&getrealname(rs(0))&" "&st&"</td></tr>"
rs.movenext
i=0
loop
response.write "</table>"
end if
end sub
sub showalbum()
dim catalog
dim rs,sql
catalog=request("catalog")
if not isinteger(catalog) then
catalog=0
else
catalog=cint(catalog)
if catalog<0 then catalog=0
if catalog>ubound(fototype) then catalog=ubound(fototype)
end if
%>
<!--#INCLUDE FILE=script/popup.inc -->
<%response.write "<BR><BR><TABLE border=0 align=center width=""100%"">"&_
"<form action=ClassAlbum.asp>"&_
"<tr bgcolor="&tablebodycolor1&"><td><input type=hidden name=catalog value="&catalog&">"&_
"<input type=hidden name=action value=add>"&_
"<input type=submit value=上传照片>"&_
"</td><td align=right>照片分类:"&_
"<select name=phototype onchange=location.href='ClassAlbum.asp?Action=ShowAlbum&Catalog='+options[this.selectedIndex].value+'';>"
for i=0 to ubound(fototype)
response.write "<option value="&i
if i=catalog then response.write " selected"
response.write ">"&fototype(i)&"</option>"
next
response.write "</select></td></tr></form></table>"
response.write "<TABLE border=0 align=center width=""100%"" bgcolor="&tablebodycolor2&">"&_
"<TR><TD align=center height=170><TABLE border=0 width=""100%"">"
Set rs = server.CreateObject("ADODB.Recordset")
sql="select filename,title,picid,name,uptime,filesize,width,height,depth,visitcount "&_
"from photo where classid="&clsid&" and type='"&fototype(catalog)&"' order by picid desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write " 还没有任何照片:("
response.write "</td></tr></table>"
else
rs.pagesize=12
totalpages=rs.pagecount
currentpage=request("Page")
if currentpage="" then currentpage=1
if not isInteger(currentpage) then
currentpage=1
elseif Cint(currentpage)>totalpages then
currentpage=totalpages
end if
currentpage=Cint(currentpage)
rs.absolutepage=currentpage
total=0
do until total=12 or rs.eof
if total mod 4=0 then response.write "<TR>"
response.write "<TD align=center width=""25%"" height=""160"">"
if rs(8)<=8 then depth=2^(rs(8)) else depth=rs(8)&"b"
altinfo="上传:"&getrealname(rs(3))&"<BR> "&_
"时间:"&formatdatetime(rs(4),2)&"<BR> "&_
"人气:"&rs(9)&"<BR> "&_
"属性:"&rs(6)&"x"&rs(7)&"x"&depth
response.write "<TABLE style=""BORDER-RIGHT: #555555 1px solid; BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #555555 1px solid"" cellSpacing=0 cellPadding=0 width=120 border=0>"&_
"<TBODY><TR>"&_
"<TD height=120 onmouseover=""this.style.cursor='hand'"" onclick=""javascript:ShowPic('"&rs(2)&"')"""&_
"align=middle height=86>"&_
"<table border=0 cellspacing=0 cellpadding=0 style=""BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #555555 1px solid; BORDER-LEFT: #555555 1px solid; BORDER-BOTTOM: #ffffff 1px solid"">"&_
"<tr><td><IMG src="&PhotoPath&rs(0)&" "&sizeadjust(rs(6),rs(7),100)&" border=0 onmouseout=kill() onmouseover=""popup('"&altinfo&"','"&tablebodycolor1&"')""></td></tr></table></TD>"&_
"</TR></TBODY></TABLE>"&_
"<TABLE cellspacing=1><TR><TD></TD></TR></TABLE>"&_
"<TABLE cellSpacing=1 cellPadding=0 width=120 border=0 bgcolor="&tablebordercolor&"><TBODY>"&_
"<TR><TD align=middle width=130 bgcolor="&tablebodycolor1&">"&htmlencode(CutStr(rs(1),16))&"</TD></TR></TBODY></TABLE>"&_
"</TD>"
total=total+1
rs.movenext
if rs.eof or total mod 4=0 then response.write "</TR>"
loop
response.write "</TABLE>"
%>
</td></tr></table>
<table width=100% align="center" bgcolor=<%=tablebodycolor1%>>
<tr><td align=left valign=center>
<%
if currentpage=0 then currentpage=1
if not (currentpage=1 or totalpages=0) then
response.write " <a href=?Action=ShowAlbum&Page="¤tpage-1&"&Catalog="&Catalog&"><img src=images/left.gif border=0> 上一页</a>"
end if
if not (currentpage=totalpages or totalpages=0) then
response.write " <a href=?Action=ShowAlbum&Page="¤tpage+1&"&Catalog="&Catalog&"><img src=images/right.gif border=0> 下一页</a>"
end if
%></td>
<td align=right valign=center>
<%
response.write "页 "¤tpage&" / "&totalpages&" 去第"
%> <input type=hidden name=catalog value="<%=catalog%>"><input type=text name=targetPage size=2 style="height:16px;width:20px;"> 页</td>
<td width=15 align=right style="cursor:hand" onclick="document.location.href='ClassAlbum.asp?Action=ShowAlbum&Catalog='+catalog.value+'&Page='+targetPage.value;">
<img src=images/btngo.gif width=13 height=15>
</td></tr></table>
<%
end if
set rs=nothing
end sub
sub albumlist()
dim totalPages,currentPage
currentPage=request.querystring("page")
stats=ordername
set rs=conn.execute("select sum(filesize) from photo where classid="&clsid)
if rs.eof and rs.bof then
ratio=1
crtsize=0
elseif isnull(rs(0)) then
ratio=1
crtsize=0
else
ratio=(rs(0)/(MaxAlbumSize*1024*1024))*180
crtsize=rs(0)
end if
set rs=nothing
%><BR><BR>
<table border=0 width=90% align=center bgcolor=<%=tablebodycolor2%>>
<tr><td colspan=2><IMG SRC="IMAGES/classalbum.gif"></td></tr>
<tr><td width=50%>
</td><td align=right>
<TABLE cellSpacing=1 cellPadding=1 width=180 border=0 bgcolor=#555555><TBODY>
<TR height=10><TD height=10 width="<%=ratio%>" bgcolor="#ffcc00"></TD>
<td height=10 bgcolor=#ffffff></td></TR>
</TBODY></TABLE><BR><IMG height=11 src="images/tuli_y.gif" width=13 align=absMiddle> 已用<%=photosize(crtsize)%>
<IMG height=11 src="images/tuli_w.gif" width=13 align=absMiddle> 剩余<%=photosize(maxalbumsize*1024*1024-crtsize)%></td>
</tr>
<tr><td colspan=2 height=30 align=right valign=bottom>容量:<font color=brown><B><%=maxalbumsize%></B></font>M 共<font color=brown><B><%=photonum%></B></font>张照片</td></tr>
<tr><td colspan=2>
<table width=100% border=0 align=center>
<%
for i=0 to ubound(fototype)
if i mod 4=0 then response.write "<tr>"
response.write "<td align=center height=150 valign=top>"&_
"<TABLE cellSpacing=0 cellPadding=6 width=102 border=0><TBODY>"&_
"<TR><TD width=102 height=105 background=images/bg_big.gif align=center valign=bottom>"&_
"<table valign=bottom border=0 cellspacing=0 cellpadding=0 width=85 height=75><tr><td align=center onmouseover=this.style.cursor='hand' onclick=location.href='ClassAlbum.asp?Action=ShowAlbum&Catalog="&i&"'>"
set lastfoto=conn.execute("select top 1 title,width,height,filename from photo where type='"&fototype(i)&"' and classid="&clsid&" order by picid desc")
if not (lastfoto.eof and lastfoto.bof) then
w=lastfoto(1)
h=lastfoto(2)
imgTitle=lastfoto(0)
showlast=PhotoPath&lastfoto(3)
response.write "<IMG src="&showlast&" title="&imgTitle&" border=0 align=center "&sizeadjust(w,h,80)&">"
end if
set lastfoto=nothing
%>
</td></tr></table></TD></TR>
</TBODY></TABLE>
<BR><%=fototype(i)%>
<%
sql="select count(picid) from photo where type='"&fototype(i)&"' and classid="&clsid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -