<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file="Ex_Cls/Ex_CommonCls.asp"-->
<!--#include file="Ex_Cls/Ex_SplitPageCls.asp"-->
<!--#include file="Ex_Cls/Ex_ImgCls.asp"-->
<!--#include file="Ex_Cls/Ex_FsoCls.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="inc/main.js"></script>
<script src="inc/jquery.js"></script>
<script type="text/javascript" src="AienUpload/init.js"></script>
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css" />
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor" >
<%
Dim ExComm,ExImg,ExFso
Set ExComm=new Ex_CommonCls
ExComm.IsAdLogin 
ExComm.IsIpAllow
Set ExImg=new Ex_ImgCls
Set ExFso=new Ex_FsoCls
dim action
action=request.querystring("action")
select case action
	Case "clsaddf"
		ClsAddF
		RefreshPhotos
	Case "clsshow"
		ClsChangeF
	Case "clsadd"
		ClsAdd
		RefreshPhotos
	Case "clsdel"
		ClsDel
		RefreshPhotos
	Case "clschange"
		ClsChange
		RefreshPhotos
	Case "photoaddf"
		PhotoAddF
	Case "photoadd"
		PhotoAdd
		RefreshPhotos
	Case "photoshow"
		PhotoShow
	Case "photodel"
		photoDel
		RefreshPhotos
	Case "photochangef"
		PhotoChangeF
	Case "photochange"
		photochange
		RefreshPhotos
	Case "photodo"
		photodo
		RefreshPhotos
	Case "refreshphotos"
		RefreshPhotos
		ExComm.ShowMsg "相册更新完成",""
end Select
sub RefreshPhotos
	ExComm.GetConfigCache("*")
	Dim Rs,FlashView,pics,links,texts,I
	I=0
	Set Rs=server.CreateObject("adodb.recordset")
	Rs.open "select top 6 * from Ex_photos order by id desc",conn,1,1
		If Not Rs.eof And Not Rs.bof Then
			Do While Not Rs.eof 
				If InStr(Rs("photourl"),"http://")=0 Then 
					If Trim(Rs("sphotourl"))="" Or IsEmpty(Rs("sphotourl")) Or IsNull(Rs("sphotourl")) Then 
						pics=pics&Application(sn&"blogurl")&Replace(Rs("photourl"),"\","/")&"|"
						texts=texts&Rs("photoname")&"|"
					Else 
						pics=pics&Application(sn&"blogurl")&Replace(Rs("sphotourl"),"\","/")&"|"
						texts=texts&Rs("photoname")&"|"
					End If 
				Else 
					pics=pics&Rs("photourl")&"|"
					texts=texts&Rs("photoname")&"|"
				End If 
				links=links&Application(sn&"blogurl")&"Photos.asp?action=view单张"&Rs("id")&"|"
			Rs.movenext
			I=I+1
			Loop 
			If Trim(pics)<>"" Then 
				pics=Mid(pics,1,Len(pics)-1)
			End If 
			If Trim(links)<>"" Then 
				links=Mid(links,1,Len(links)-1)
			End If 
			If Trim(texts)<>"" Then 
				texts=Mid(texts,1,Len(texts)-1)
			End If 
			FlashView=FlashView&"var pics='"&pics&"';"&vbcrlf
			FlashView=FlashView&"var links='"&links&"';"&vbcrlf
			FlashView=FlashView&"var texts='"&texts&"';"&vbcrlf
			
			FlashView=FlashView&"var focus_width=160;"&vbcrlf
			FlashView=FlashView&"var focus_height=160"&vbcrlf
			FlashView=FlashView&"var text_height=20;"&vbcrlf
			FlashView=FlashView&"var swf_height = focus_height+text_height;"&vbcrlf
			FlashView=FlashView&"var swf_width = 160;"&vbcrlf
			
			ExFso.CreateFile "js/Photos.js",FlashView

			FlashView=FlashView&"document.write('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" ');"&vbcrlf
			FlashView=FlashView&"document.write('codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"" ');"&vbcrlf
			FlashView=FlashView&"document.write('width=""'+ swf_width +'"" height=""'+ swf_height +'"">');"&vbcrlf
			FlashView=FlashView&"document.write('<param name=""movie"" value="""&Application(sn&"blogurl")&"pixviewer.swf""><param name=""quality"" value=""high"">');"&vbcrlf
			FlashView=FlashView&"document.write('<param name=""menu"" value=""false""><param name=wmode value=""opaque"">');"&vbcrlf
			FlashView=FlashView&"document.write('<param name=""FlashVars"" value=""TitleBgPosition=1&bcastr_file='+pics+'&bcastr_link='+links+'&bcastr_title='+texts+'"">');"&vbcrlf
			FlashView=FlashView&"document.write('<embed src=""pixviewer.swf"" wmode=""opaque"" ');"&vbcrlf
			FlashView=FlashView&"document.write('FlashVars=""TitleBgPosition=1&bcastr_file='+pics+'&bcastr_link='+links+'&bcastr_title='+texts+'& ');"&vbcrlf
			FlashView=FlashView&"document.write('menu=""false"" quality=""high"" width=""'+ swf_width +'"" height=""'+ swf_height +'"" type=""application/x-shockwave-flash"" ');"&vbcrlf
			FlashView=FlashView&"document.write('pluginspage=""http://www.macromedia.com/go/getflashplayer"" />');"&vbcrlf
			FlashView=FlashView&"document.write('</object>'); "

			ExFso.CreateFile "js/Photo.js",FlashView
		End If 
		ExComm.ClearCaches(sn)
End Sub 
'保存图片
Function  ImgSave(formname,sUploadDir)
	Dim  oFile, sFileExt, sFileName,osize
	ExFso.CreateRoute(sUploadDir)
	' 建立上传对象
	' 取得上传数据,限制最大上传
	Set oFile = ExUpload.File(formname)
	sFileExt = UCase(oFile.FileExt)
	osize = oFile.Filesize
	Dim sRnd
	Randomize
	sRnd = Int(900 * Rnd) + 100
	sFileName = year(now) & month(now) & day(now) & hour(now) & minute(now) & second(now) & sRnd & "." & sFileExt
	If oFile.FileSize=0 Then 
		ImgSave=""
	Else 
		oFile.SaveToFile Server.Mappath(sUploadDir & "\"& sFileName)
		ImgSave=sUploadDir & "\"& sFileName
	End If 
	Set oFile = Nothing
End Function  
Sub ClsAddF()
%>
<script>
function check(){
	var o=document.getElementById('addclassname');
	if(o.value==''){
		alert('请填写相册分类名称');
		return false;
	}
}
</script>
<form action="?action=clsadd&exup=photo" method="post" name="form1" id="form1" onSubmit="return check()">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <td height="24" colspan="6" class="topbg"><CENTER>
        相册分类添加
      </CENTER></td>
    </tr>
    <tr class="tdbg">
      <td width="10%">
	  <CENTER>
	    分类名称：
      </CENTER>	  </td>
      <td width="22%"><input type="text" name="addclassname" id="addclassname"size="25" maxlength="25"/></td>
      <td width="11%">封面图地址：</td>
      <td width="34%"><input name="addclassimg" type="text" id="addclassimg" style="width:200px;"></td>
      <td width="12%"><CENTER>
        <input type="button" value="上传本地图片" onClick="showUpload(null,'addclassimg','cache/uploads',1,'');">
      </CENTER>        <div align="center"></div></td>
      <td width="11%"><div align="center">
        <input type="submit" name="Submit2" value="提交" />
      </div></td>
    </tr>
  </table>
</form>
<%end Sub
Sub ClsChangeF()
dim ImgSql,imgRs
imgSql="select * from Ex_PhotoCls order by ClsOrder asc"
Set imgRs=server.CreateObject("adodb.recordset")
imgRs.Open imgSql,conn,1,1
%>
<form action="?action=clschange" method="post" name="form1" id="form1">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <td height="24" colspan="9" class="topbg"><CENTER>
        相册分类管理
      </CENTER></td>
    </tr>
	<%
	If Not imgRs.eof And Not imgRs.bof Then 
		Do While Not imgRs.eof 
	%>
    <tr class="tdbg"><input type="hidden" name="ids" value="<%=imgRs("id")%>">
	<input type="hidden" name="clsphoto<%=imgRs("id")%>" value="<%=imgRs("ClsPhoto")%>">
      <td width="11%"><CENTER>
        分类名称：
      </CENTER></td>
      <td width="19%"><input type="text" name="classname<%=imgRs("id")%>" id="classname<%=imgRs("id")%>"size="25" maxlength="25" value="<%=imgRs("ClsName")%>"/></td>
      <td width="12%"><center>
        封面地址：
      </center></td>
      <td width="19%">
        <input name="imgurl<%=imgRs("id")%>" type="text" style="width:150px" id="imgurl<%=imgRs("id")%>" value="<%=imgRs("clsphoto")%>">
		<input name="oldimgurl<%=imgRs("id")%>" type="hidden">
      <td width="12%"><input name="按钮" type="button" value="上传本地图片" onClick="showUpload(null,'imgurl<%=imgRs("id")%>','cache/uploads',1,'');"></td>
      <td width="7%"><CENTER>
        <a href="<%=imgRs("ClsPhoto")%>" target="_blank">查看</a>
      </CENTER>        <div align="center"></div></td>
      <td width="8%"><div align="center">排序：</div></td>
      <td width="7%"><div align="center">
        <input type="text"style="width:25px" name="clsorder<%=imgRs("id")%>" id="clsorder<%=imgRs("id")%>" maxlength="25" value="<%=imgRs("ClsOrder")%>" onBlur="if(isNumber(this.value)==false){alert('序号必须为数字');this.value='0'}"/>
      </div></td>
      <td width="5%"><div align="center"><a href="?action=clsdel&id=<%=imgRs("id")%>&f=<%=imgRs("ClsPhoto")%>" onClick="return confirm('确实要删除此分类?删除后此分类下的图片也将被删除.')">删除</a></div></td>
    </tr>
	<%
		imgRs.movenext
		Loop 
	End If 
	%>
    <tr class="tdbg">
      <td colspan="9"><label>
        <div align="center">
          <input type="submit" name="Submit3" value="修改">
        </div>
      </label></td>
    </tr>
  </table>
 <br> 提示：排序中的数字越大在分类显示的时候越靠前。<a href="http://www.ex123.net/bbs" target="_blank"><font color="red">如果您对相册分类的添加和管理存在疑问，请点此查看易心博客使用教程</font></a>
</form>
<%end Sub
Sub ClsAdd()
	Dim addclassname,addclassimg,imgurl,imgSql
	addclassname=ExComm.G(Request.Form("addclassname"))
	addclassimg=ExComm.G(Request.Form("addclassimg"))
	If InStr(addclassimg,"/")<>0 And InStr(addclassimg,"http://")=0 Then 
		addclassimg="http://"&addclassimg
	End If 
	If InStr(addclassimg,"/")=0 And addclassimg<>"" Then
		imgurl="Photo/Covers/"&addclassimg
		ExFso.CopyOneFile "cache/uploads/"&addclassimg,imgurl
	ElseIf InStr(addclassimg,"/")<>0 And InStr(addclassimg,"http://")<>0  Then 
		ExImg.imgPath="Photo/Covers"
		imgurl=ExImg.ReplaceUrl(addclassimg)
	Else 
		ExComm.Showmsg "相册分类添加失败，请查看图片网址是否正确",""
	End If 
	If InStr(imgurl,"http://")=0 Then 
		ExImg.changeImgSize server.mappath(imgurl),server.mappath(imgurl),180
	End If 
	imgSql="insert into Ex_PhotoCls (ClsName,ClsPhoto,ClsOrder) values ('"&addclassname&"','"&imgurl&"',0)"
	Conn.Execute imgSql
	ExComm.ShowMsg "相册分类添加成功",Request.servervariables("http_referer")
End Sub
Sub ClsDel()
	Dim id,p,R
	p=ExComm.G(request("f"))
	id=CInt(Request("id"))
	Set R=Conn.Execute("select id,photourl,sphotourl from Ex_Photos where clsid="&id)
	Do While Not R.eof
		P=R("photourl")
		If InStr(p,"http://")=0 Then 
			ExFso.DelFile(p)
		End If
		P=R("sphotourl")
		If IsNull(P)=False And Trim(P)<>"" Then 
			If InStr(p,"http://")=0 Then 
				ExFso.DelFile(p)
			End If
		End If 
		Conn.Execute "delete from Ex_Photos where id="&R("id")
		R.Movenext
	Loop 
	Conn.Execute "delete from Ex_PhotoCls where id="&id
	If InStr(p,"http://")=0 Then 
		ExFso.DelFile(p)
	End If 
	ExComm.ShowMsg "分类删除成功",Request.servervariables("http_referer")
End Sub 
Sub ClsChange()
	Dim clsname,imgurl,oldimgurl,tempurl,ids,imgSql,i,clsorder,tempimg
	ids=ExComm.G(Request.Form("ids"))
	ids=Split(ids,",")
	For i=0 To UBound(ids)
		ClsName=ExComm.G(Request.Form("classname"&Trim(ids(i))))
		imgurl=ExComm.G(Request.Form("imgurl"&Trim(ids(i))))
		Clsorder=ExComm.G(Request.Form("Clsorder"&Trim(ids(i))))
		oldimgurl=ExComm.G(Request.Form("oldimgurl"&Trim(ids(i))))
		tempurl=Replace(lcase(imgurl),"photo/covers/","")
		If InStr(tempurl,"/")<>0 And InStr(tempurl,"http://")=0 Then 
			imgurl="http://"&imgurl
		End If 
		If InStr(imgurl,"/")=0 And Trim(imgurl)<>"" Then
			tempimg=imgurl
			imgurl="Photo/Covers/"&imgurl
			ExFso.CopyOneFile "cache/uploads/"&tempimg,imgurl
			ExFso.DelFile oldimgurl
			ExImg.changeImgSize server.mappath(imgurl),server.mappath(imgurl),180
		ElseIf InStr(imgurl,"/")<>0 And InStr(imgurl,"http://")<>0  Then 
			ExImg.imgPath="Photo/Covers"
			imgurl=ExImg.ReplaceUrl(addclassimg)
			If InStr(oldimgurl,"http://")=0 Then 
				ExFso.DelFile oldimgurl
			End If
			If InStr(imgurl,"http://")=0 Then 
				ExImg.changeImgSize server.mappath(imgurl),server.mappath(imgurl),180
			End If 
		End If
		imgSql="update Ex_PhotoCls set Clsname='"&ClsName&"',Clsphoto='"&imgurl&"',ClsOrder="&Clsorder&" where id="&Trim(ids(i))
		Conn.Execute imgSql
	Next 
	ExComm.ShowMsg "相册分类修改成功",Request.servervariables("http_referer")
End Sub
Sub PhotoAddF()
%>
<script>
var upnum=10;//最大上传数量
function count(){//计算上传数量
	var n=0;
	for(var i=1;i<=10;i++){
		var musicurl=document.getElementById("imgurl"+i).value;
		document.getElementById("cls"+i).style.display='none';
		if(musicurl==''){
			n=n+1;
		}
	}
	upnum=n;
}
function uploadpic(obj){
	for(var m=0;m<obj.length;m++){
		var flag=0;
		for(var i=1;i<=10;i++){
			var musicurl=document.getElementById("imgurl"+i).value;
			document.getElementById("cls"+i).style.display='';
			if(musicurl=='' && flag==0){
				var localname=obj[m].localname;
				localname=localname.split('.');
				localname=localname[0];
				document.getElementById("photoname"+i).value=localname;
				document.getElementById("imgurl"+i).value=obj[m].name;
				flag=1;
			}
		}
	}
}
$(document).ready(function(){
	$('.photoname').mouseover(function(e){
		var id=this.id.toString();
		id=id.replace('photoname','');
		var photourl=$('#imgurl'+id).val();
		if(photourl!=''){
			var phtml="<img src='cache/uploads/"+photourl+"' style='width:200px'>";
			if(photourl.indexOf(":")!=-1){
				phtml="<img src='"+photourl+"' style='width:200px'>";
			}
			$("#preimg").html(phtml);
			$("#preimg").css('top',(e.clientY+10)+'px');
			$("#preimg").show();
		}
	})
	$('.photoname').mouseout(function(e){
		$("#preimg").hide();
	})
}
)
</script>
<div id="preimg" style="display:none;position:absolute;width:200px;height:auto;background:#E4EDF9;left:25px;border:1px solid #003399;padding:5px">
</div>
	<form action="?action=photoadd" method="post" name="form1" id="form1">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <td height="24" colspan="7" class="topbg"><CENTER>
        相册照片添加
      </CENTER></td>
    </tr>
	<%
	Dim i
	For I=1 To 10
	%>
    <tr class="tdbg">
      <td width="12%"><CENTER>
        照片名称：
      </CENTER></td>
      <td width="18%"><input type="text" name="photoname<%=I%>" class="photoname" id="photoname<%=I%>"size="25" maxlength="25"/></td>
      <td width="10%"><div align="center">所属分类：</div></td>
      <td width="10%"><select name="Cls<%=I%>" id="cls<%=I%>">
        <%=ExComm.GetPhotoClassSelectCache(0)%>
      </select></td>
      <td width="11%"><center>
        <div align="center">照片地址：</div>
      </center></td>
      <td width="23%">
        <input name="imgurl<%=I%>" type="text" id="imgurl<%=I%>" style="width:200px">        </td>
      <td><CENTER>
        <input type="button" value="上传本地图片" onClick="count();showUpload(null,'photoname1','cache/uploads',upnum,function(obj){uploadpic(obj);});">
      </CENTER>
      <div align="center"></div>        <div align="center"></div></td>
    </tr>
	<%
	Next 
	%>
    <tr class="tdbg">
      <td colspan="7"><div align="center">
        <input type="submit" name="Submit" value="提交">
      </div></td>
    </tr>
  </table>
</form>
<br>
<a href="http://www.ex123.net/bbs" target="_blank"><font color="red">如果您对相册照片的添加和管理还有什么疑问,点此查看易心博客使用教程</font></a>
<%
End Sub
Sub PhotoAdd()
	Dim i,photoName,imgUrl,imgPath,simgUrl,Clsid,isResize,imgSql
	For i=1 To 10
		PhotoName=ExComm.G(Request.Form("photoname"&I))
		Clsid=CInt(Request.Form("cls"&I))
		imgurl=ExComm.G(Request.Form("imgurl"&I))
		If Trim(imgurl)<>"" Then 
			If InStr(imgurl,"http://")<>0 Then 
				ExImg.imgPath="photo/"&Year(Now())&"/"&Month(Now())&""
				ExFso.CreateRoute(ExImg.imgPath)
				imgurl=ExImg.ReplaceUrl(imgurl)
				simgurl=Replace(imgurl,"photo/"&Year(Now())&"/"&Month(Now())&"/","photo\"&Year(Now())&"/"&Month(Now())&"/s")
				If InStr(imgurl,"http://")=0 Then 
					isResize=ExImg.changeImgSize (server.mappath(imgurl),server.mappath(simgurl),180)
				End If 
				If isResize Then 
					imgSql="insert into Ex_Photos (photoName,ClsId,PhotoUrl,sPhotoUrl) values ('"&PhotoName&"',"&ClsId&",'"&imgurl&"','"&simgurl&"')"
				Else
					imgSql="insert into Ex_Photos (photoName,ClsId,PhotoUrl) values ('"&PhotoName&"',"&ClsId&",'"&imgurl&"')"
				End If 
			End If
			If InStr(imgurl,"/")=0 Then 
				imgPath="photo/"&Year(Now())&"/"&Month(Now())
				ExFso.CreateRoute(imgPath)
				ExFso.CopyOneFile "cache/uploads/"&imgurl,imgPath&"/"&imgurl
				simgurl=imgPath&"/s"&imgurl
				isResize=ExImg.changeImgSize (server.mappath(imgPath&"/"&imgurl),server.mappath(simgurl),180)
				If isResize Then 
					imgSql="insert into Ex_Photos (photoName,ClsId,PhotoUrl,sPhotoUrl) values ('"&PhotoName&"',"&ClsId&",'"&imgPath&"/"&imgurl&"','"&simgurl&"')"
				Else
					imgSql="insert into Ex_Photos (photoName,ClsId,PhotoUrl) values ('"&PhotoName&"',"&ClsId&",'"&imgPath&"/"&imgurl&"')"
				End If 
			End If 
			Conn.Execute imgSql
		End If 
	Next 
	RefreshPhotos
	ExComm.ShowMsg "相片添加完成",Request.servervariables("http_referer")
End Sub 
Sub PhotoShow()
	%>
	<script>
	function DrawImage(ImgD)
	{ 
		var image=new Image(); 
		image.src=ImgD.src; 
		if (image.width<image.height)
		{
			ImgD.height=115;
		}
	}
	$(document).ready(function (){
		$("#clsid").change(function (){
			document.location='Admin_Photo.asp?action=photoshow&clsid='+this.value;
		})
		$("option[value='<%=request("clsid")%>']").attr("selected", true);
	})
</script>
	<%
	Dim ClsId,photourl,PRs
	Clsid=CLng(request("clsid"))
	Dim ExPages,page
	Set ExPages=new  Ex_SplitPageCls
	Expages.letConn=Conn
	Expages.letColumns="select *"
	ExPages.letDataFrom="from Ex_Photos"
	If clsid<>0 Then 
		ExPages.LetWhere="where clsid="&clsid
	End If 
	ExPages.LetOrder="order by id desc"
	Set PRs=server.CreateObject("adodb.recordset")
	Expages.letPageSize="18"
	If ExComm.G(request("page"))="" Then
		page=1
	Else
		page=ExComm.G(request("page"))
	End if
	ExPages.letPage=CInt(page)
	ExPages.letStrPage="&action=photoshow"
	ExPages.Execute()
	Set PRs=ExPages.getRs
	Response.Write "<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" bgcolor=""#FFFFFF"" class=""border"">"
	Response.Write "<form action='?action=photodo' method='post'>"
	Response.Write "<tr><td height=""32"" class=""topbg""><CENTER>"
	Response.Write "相册照片管理</CENTER></td></tr>"
	Response.Write "<tr><td height=""32"" style='background:#E4EDF9'>"
	Response.Write "&nbsp;&nbsp;请选择要显示的相册分类：<select id='clsid'><option value='0'>全部显示</option>"&ExComm.GetPhotoClassSelectCache(0)&"</select></td></tr>"
	If ExPages.getRsCount<>0 Then
		Response.Write "<tr class=""tdbg""><td><div align=""center"">"
		Do While Not PRs.eof
			If Trim(PRs("sphotourl"))<>"" Then 
				photourl=PRs("sphotourl")
			Else 
				photourl=PRs("photourl")
			End If 
			Response.Write "<div style=""float:left;width:120px;height:140px;margin:5px;""><a href="""&PRs("photourl")&""" title="""&PRs("photoname")&""" target=""_blank""><div style=""height:120px;""><img src="""&photourl&""" style=""width:120px;border:0px"" onload=""DrawImage(this)""></a></div><div><input type='hidden' name='s"&PRs("id")&"' value='"&PRs("sphotourl")&"'>选择<input type='hidden' name='b"&PRs("id")&"' value='"&PRs("photourl")&"'><input type='checkbox' name='ids' value='"&PRs("id")&"'>&nbsp;&nbsp;&nbsp;&nbsp;<a href=""?action=photochangef&id="&PRs("id")&""">编辑</a></div></div>"
			PRs.movenext
		Loop
	End If	
	Response.Write "</div></td></tr>"
	Response.Write "<tr><td height=""32"" style='background:#E4EDF9'><INPUT TYPE='radio' NAME='dotype' value='del'>删除&nbsp;<INPUT TYPE='radio' NAME='dotype' value='changecls' checked>移动到&nbsp;<select id='clsid' name='clsid'>"&ExComm.GetPhotoClassSelectCache(0)&"</select>"
	Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE='submit' value='操作'></td></tr>"
	Response.Write"</form></table>"

	Response.Write "<div style=""text-align:center"">"
	Response.write ExPages.Show
	Response.Write "</div>"
End Sub
Sub PhotoChangeF()
	Dim id,Rs
	Set Rs=server.CreateObject("adodb.recordset")
	id=CLng(Request("id"))
	Rs.open "select * from Ex_photos where id="&id,conn,1,1
%>
<form action="?action=photochange&id=<%=id%>" method="post" name="form1" id="form1">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <input type="hidden" name="referer" value="<%=Request.servervariables("http_referer")%>">
      <td height="24" colspan="7" class="topbg"><center>
        相册照片修改
      </center></td>
    </tr>

    <tr class="tdbg">
      <td width="18%"><div align="center">照片名称：</div></td>
      <td><input type="text" name="photoname" id="photoname"size="25" maxlength="25" value="<%=Rs("photoname")%>"/></td>
      <td width="13%"><div align="center">照片分类：</div></td>
      <td><select name="clsid" id="clsid">
          <%=ExComm.GetPhotoClassSelectCache(Rs("clsid"))%>
      </select></td>
      <td><center>
        照片地址：
              </center>
            <div align="center" id="photofile"></div></td>
      <td><input name="imgurl" type="text" id="imgurl" value="<%=Rs("photourl")%>" readonly></td>
      <td width="10%"><div align="center">
          <input type="submit" name="Submit22" value="修改" />
      </div></td>
    </tr>
  </table>
</form>
<%
End Sub
Sub photoChange()
	Dim photoname,id,clsid
	photoname=request("photoname")
	id=request("id")
	clsid=request("clsid")
	Conn.Execute "update ex_photos set clsid="&clsid&",photoname='"&photoname&"' where id="&id
	RefreshPhotos
	ExComm.ShowMsg "相片修改成功",request("referer")
End Sub 
Function photodo()
	Dim dotype,clsid,ids,a,b,i
	dotype=request("dotype")
	ids=request("ids")
	ids=Split(ids,",")
	If dotype="del" Then 
		For i=0 To UBound(ids)
			a=request("s"&ids(i))
			b=request("b"&ids(i))
			Conn.Execute "delete from Ex_photos where id="&Trim(ids(i))
			If Trim(a)<>"" Then 
				ExFso.DelFile(a)
			End If 
			If Trim(b)<>"" And InStr(b,"http://")=0 Then 
				ExFso.DelFile(b)
			End If 
		Next 
		ExComm.ShowMsg "相片删除成功",Request.servervariables("http_referer")
	Else
		clsid=CInt(request("clsid"))
		For i=0 To UBound(ids)
			response.write "update Ex_photos set clsid="&clsid&" where id="&Trim(ids(i))
			Conn.Execute "update Ex_photos set clsid="&clsid&" where id="&Trim(ids(i))
		Next 
		ExComm.ShowMsg "相片分类转移成功",Request.servervariables("http_referer")
	End If 
End Function 
%>
</body>
</html>
