<%@ Register TagPrefix="uc1" TagName="UIFrameLeft" Src="Controls/UIFrameLeft.ascx" %>
<%@ Register TagPrefix="uc1" TagName="UIFrameTop" Src="Controls/UIFrameTop.ascx" %>
<%@ Register TagPrefix="uc1" TagName="UIHead" Src="Controls/UIHead.ascx" %>

<%@ Page CodeBehind="Photo_Detail.aspx.cs" Language="c#" AutoEventWireup="True" Inherits="Typhoto.Photo_Detail" enableViewState="False"%>
<%@ Register TagPrefix="webdiyer" Namespace="Wuqi.Webdiyer" Assembly="AspNetPager" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>

<script type="text/javascript" language="javascript" src="js/dialog.js"></script>
<script language="JAVASCRIPT">
function setalbumface()
{
	Init();
	Typhoto.Photo_Detail.SetAlbumFace(document.all.hidalbum.value,document.all.hidalias.value,IssetalbumfaceOpr_callback);
}
function setuserface()
{
	Init();
	Typhoto.Photo_Detail.SetUserFace(document.all.hidalias.value,IssetalbumfaceOpr_callback);
}
function IssetalbumfaceOpr_callback(res)
{
	document.all.loading.innerHTML=document.all.loading.innerHTML.replace("正在处理，请稍候……","操作成功！");
	window.setTimeout("document.all.loading.style.display='none';document.all.loading.innerHTML=document.all.loading.innerHTML.replace('操作成功！','正在处理，请稍候……');",1000);
}
function Init()
{
	document.all.loading.style.top =Math.round((document.body.clientHeight-100)/2)+document.body.scrollTop-50;
	document.all.loading.style.left =Math.round((document.body.clientWidth-100)/2)-100;
	document.all.loading.style.display='';
}
function zoomimg(o)
{ 
	var zoom=parseInt(o.style.zoom, 10)||100;
	zoom+=event.wheelDelta/12;if (zoom>0&&zoom<=500) o.style.zoom=zoom+'%';
	return false;
 }
function zoombig(o)
{ 
	var zoom=parseInt(o.style.zoom, 10)||100;
	zoom+=10;
	if(zoom>0&&zoom<=500)
	o.style.zoom=zoom+'%';
	return false;
 }
function zoomsmall(o)
{ 
	var zoom=parseInt(o.style.zoom, 10)||100;
	zoom-=10;
	if (zoom>0&&zoom<=500)
	o.style.zoom=zoom+'%';
	return false;
 }
function shorturl(url,code)
{
	Typhoto.Photo_Detail.SetShortUrl(url,code,IsurlOpr_callback);
}
function IsurlOpr_callback(res)
{
	var bRet = res.value;
	std_playUrl(bRet);
}
function deletethis()
{
	if (confirm('确定删除本照片？'))
	{
		Typhoto.Photo_Detail.DeletePhoto(getUrlParam('photoid'),document.all.hiddir.value,Isdel_callback);
	}
}
function Isdel_callback(res)
{
	window.location="Album_Photos.aspx?DirID=<%=vAlbumID%>";
}
function getUrlParam(paramName){	
	var s=location.search;
	if(s!=null&&s.length>1){
	var sarr=s.substr(1).split("&");
	var tarr;
	for(i=0;i<sarr.length;i++){
	tarr=sarr[i].split("=");
	if(tarr.length==2&&tarr[0].toLowerCase()==paramName){
	return tarr[1];
	}
	}
	return null;
	}
}
function movephoto(type)
{
	var d = new dialog();d.init();
	d.set('src','');
	d.set('title','剪切/复制');
	d.event('请选择目标相册：'+document.all.divphoto.innerHTML, 'photopro(\''+type+'\')','','');
}
function photopro(type)
{
	Init();
	if (document.all.hidphoto.value=="") document.all.hidphoto.value=document.all.selphoto.value;
	Typhoto.Photo_Detail.MovePhoto(document.all.hiddir.value,document.all.hidphoto.value,getUrlParam('photoid'),type,IsmovephotoOpr_callback);
}
function IsmovephotoOpr_callback(res)
{
	var bRet = res.value;
	document.all.loading.innerHTML=document.all.loading.innerHTML.replace("正在处理，请稍候……","操作成功！");
	window.setTimeout("document.all.loading.style.display='none';document.all.loading.innerHTML=document.all.loading.innerHTML.replace('操作成功！','正在处理，请稍候……');",1000);
}
 function std_playUrl(txt) {
	if(window.clipboardData)
	{
		window.clipboardData.clearData();
		window.clipboardData.setData("Text", txt);
	}
	else if(navigator.userAgent.indexOf("Opera") != -1)
	{
		window.location = txt;
	}
	else if (window.netscape)
	{
		try {
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		}
		catch (e)
		{
			alert("!!被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
		}
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip)
			return;
		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if (!trans)
			return;
		trans.addDataFlavor('text/unicode');
		var str = new Object();
		var len = new Object();
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		var copytext = txt;
		str.data = copytext;
		trans.setTransferData("text/unicode",str,copytext.length*2);
		var clipid = Components.interfaces.nsIClipboard;
		if (!clip)
			return false;
		clip.setData(trans,null,clipid.kGlobalClipboard);
	}
	return true;
}
function editname() {

	var v=document.getElementById("m").innerHTML;
	var s=v;
	var s2=new RegExp("&amp;","gi");
	s=s.replace(s2,"&");
	s2=new RegExp("&quot;","gi");
	s=s.replace(s2,"\"");
	s2=new RegExp("&lt;","gi");
	s=s.replace(s2,"<");
	s2=new RegExp("&gt;","gi");
	s=s.replace(s2,">");
	s2=new RegExp("&nbsp;","gi");
	s=s.replace(s2," ");
	s2=new RegExp("<br>","gi");
	s=s.replace(s2,"\r");
	
	if ((document.getElementById("m").innerHTML.indexOf("<EM>")==-1) && (document.getElementById("m").innerHTML.indexOf("<em>")==-1)) document.getElementById("n").innerHTML="<textarea name='t' id='t' cols='80' rows='5'>"+s+"</textarea><br><input type='button' name='button' id='button' value='保存' onclick=\"Rename()\"><input type='button' name='button2' id='button2' value='取消' onclick=\"RenameOK('"+v+"','')\">";
	else document.getElementById("n").innerHTML="<textarea name='t' id='t' cols='80' rows='5'></textarea><br><input type='button' name='button' id='button' value='保存' onclick=\"Rename()\"><input type='button' name='button2' id='button2' value='取消' onclick=\"RenameOK('"+v+"','')\">";
}
function Rename() {
	Typhoto.Photo_Detail.RenameNote(getUrlParam('photoid'),document.getElementById("t").value,RenameOK(document.getElementById("t").value,'1'));
}
function RenameOK(name,type) {
	var s=name;
	if (type=="1")
	{
		var s2=new RegExp("&","gi");
		s=s.replace(s2,"&amp;");
		s2=new RegExp("\"","gi");
		s=s.replace(s2,"&quot;");
		s2=new RegExp("<","gi");
		s=s.replace(s2,"&lt;");
		s2=new RegExp(">","gi");
		s=s.replace(s2,"&gt;");
		s2=new RegExp(" ","gi");
		s=s.replace(s2,"&nbsp;");
		s2=new RegExp("\r","gi");
		s=s.replace(s2,"<br>");
	}
	document.getElementById("n").innerHTML="<div onMouseOver=\"this.className='editbak'\" onMouseOut=\"this.className='editbak1'\" id='m' title='点击即可编辑' onClick=\"javascript:editname()\">"+s+"</div>";
}
</script>
</HEAD>
<body class=body_1 scroll=no>
<form runat="server">
<div id="loading" style=" BORDER-RIGHT:#dbdce3 1px solid; BORDER-TOP:#dbdce3 1px solid; DISPLAY:none; BORDER-LEFT:#dbdce3 1px solid; BORDER-BOTTOM:#dbdce3 1px solid; POSITION:absolute; BACKGROUND-COLOR:#ffffae"><img src="images/loading.gif" width="32" height="32" align="absMiddle"> <b>正在处理，请稍候……</b></div>
<div id="divphoto" style="DISPLAY:none"><select name="selphoto" id="selphoto" runat=server onChange="javascript:document.all.hidphoto.value=this.value">
          <option selected>请选择</option>
          </select></div><INPUT id=hiddir type=hidden size=1 name=hiddir runat="server">
<table height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
  <tr>
    <td height=60><uc1:uihead id=UIHead1 runat="server"></uc1:uihead></td></tr>
  <tr>
    <td height=10><uc1:uiframetop id=UIFrameTop1 runat="server"></uc1:uiframetop></td></tr>
  <tr>
    <td>
      <table height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0 
      >
        <tr>
          <td class=frame_left_1 vAlign=top width=193><uc1:uiframeleft id=UIFrameLeft1 runat="server"></uc1:uiframeleft></td>
          <td class=frame_body_1 vAlign=top>
            <table height="100%" cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <tr>
                <td class=main_title_1 height=32>
                  <table height="100%" cellSpacing=0 cellPadding=0 width="99%" 
                  border=0>
                    <tr>
                      <td align=left><IMG src="images/icon_album.gif" align=absMiddle >&nbsp; <%=albumtitle%>                                                                                                                                                      -&gt; <%=Album%>                                                                                                                                                      -&gt; <%=vPhotoName%></td>
                      <td align=center><span id=dMessage 
                         runat="server"></span></td>
                      <td align=right><INPUT type=hidden 
                        size=1 name=hidalbum id=hidalbum runat="server"><INPUT id=hidalias 
                        type=hidden size=1 name=hidalias runat="server"><A class=link_4 
                        id=lPrev runat="server">上一张</A> <A 
                        class=link_4 id=lNext runat="server" 
                        >下一张</A> <A href="javascript:history.back();" ><IMG src="images/link_back.gif" align=absMiddle ></A> 
                  </td></tr></table></td></tr>
              <tr>
                <td class=main_content_1 vAlign=top>
                  <table height="100%" cellSpacing=0 cellPadding=0 width="100%" 
                  border=0>
                    <tr>
                      <td class=main_content_1>
                        <div class=main_content_2 style="WIDTH: 100%" 
                        >
                        <table height="100%" width="100%" 
                          >
                          
                          <tr>
                            <td align=center id="ashow" runat="server"><input class=button1 id=bDelete type=button value="修改" onClick="window.location='Photo_Modify.aspx?PhotoID='+getUrlParam('photoid')">&nbsp;
                              <input class=button1 id=bDelete2 type=button value="删除" onClick="deletethis();">&nbsp;
                              <input class=button1 id=bDelete8 type=button value="剪切" onClick="javascript:movephoto('1');">&nbsp;
                              <input class=button1 id=bDelete9 type=button value="复制" onClick="javascript:movephoto('2');">&nbsp;
                              <input class=button1 id=bDelete5 type=button value="设为相册封面" onClick="setalbumface()">&nbsp;
                              <input class=button1 id=bDelete6 type=button value="设为用户头像" onClick="setuserface()">&nbsp;
                              <input class=button1 id=btu type=button value="查看原图" runat="server"></td>
                          </tr>
                          <tr>
                            <td align=center>
                              <a name=photo runat="server" id="aphoto" target=_blank><img name="iPhoto" id=iPhoto 
                               runat="server" onmousewheel='return zoomimg(this)' title='点击图片查看下一张'></a><div><%=Typhoto.DAL.Config.Adv7%></div></td>
                          </tr>
                          
                          <tr id="bshow" runat="server">
                            <td height=24><div align="right"><span class="intro">
                              <input class=button1 id=btu2 type=button value="查看原图" runat="server">
                              <input class=button1 id=fav type=button value="收藏此图" runat="server">
                              用户名：<font color=#3163c0 
                              ><%=lUserName%></font>&nbsp;&nbsp;相册数：<font 
                              color=#3163c0><%=lAlbumCount%></font>&nbsp;&nbsp;</span><span class="intro">照片数：<font 
                              color=#3163c0><%=lPhotoCount%></font>&nbsp;&nbsp;[<a href="user_info.aspx?UserName=<%=lUserName%>">查看资料</a>]&nbsp;&nbsp;[<a href="Share_Album.aspx?username=<%=lUserName%>">查看相册</a>]</span></div></td>
                          </tr>
                          <tr>
                            <td><font color=#3163c0><div id="n"><div onMouseOver="this.className='editbak'" onMouseOut="this.className='editbak1'" id="m" title="点击即可编辑" onClick="javascript:editname()"><%=lPhotoIntro%></div></div></font></td>
                          </tr>
                          <tr>
                            <td class=tilp_1 height=27><IMG src="images/icon_exif.gif" align=absMiddle > <b 
                              >查看照片评论信息</b>&nbsp; &nbsp; 
                              &nbsp; &nbsp; <A href="#photo" >返回照片图像&gt;&gt;</A></td></tr>
                          <tr>
                            <td height=50><asp:datalist id=DataList runat="server" Width="100%" EnableViewState="False" CellPadding="0">
                              <ItemTemplate>
                                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
                                  <tr>
                                    <td width="100%" bgcolor="#ffffff"><TABLE width="100%" border="0" align="center" cellPadding="0" cellSpacing="0">
                                        <TR>
                                          <TD width="100%" colSpan="2"><table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
                                              <tr>
                                                <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                                    <tr>
                                                      <td><table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" class="ListTop">
                                                          <tr>
                                                            <td width="842" height="20"><%# showuser(DataBinder.Eval(Container.DataItem, "ly_user").ToString()) %> [ <%# DataBinder.Eval(Container.DataItem, "ly_time","{0:d}")%> ] </td>
                                                          </tr>
                                                      </table></td>
                                                    </tr>
                                                    <tr>
                                                      <td align="left" class="ListLine" height="1"></td>
                                                    </tr>
                                                </table></td>
                                              </tr>
                                              <tr>
                                                <td><table width="100%" border="0" cellspacing="6" bgcolor="#FFFFFF">
                                                    <tr>
                                                      <td height="20"><%# ShowContent(DataBinder.Eval(Container.DataItem, "ly_content").ToString())%></td>
                                                    </tr>
                                                </table></td>
                                              </tr>
                                          </table></TD>
                                        </TR>
                                    </TABLE></td>
                                  </tr>
                                </table>
                              </ItemTemplate>
                            </asp:datalist>
                            <webdiyer:aspnetpager id=Pager runat="server" PageSize="20" ShowBoxThreshold="21" NumericButtonCount="15" ShowCustomInfoSection="Left" HorizontalAlign="Right" FirstPageText="<font face=webdings>9</font>" PrevPageText="<font face=webdings>3</font>" NextPageText="<font face=webdings>4</font>" LastPageText="<font face=webdings>:</font>" Height="20px" UrlPaging="True" onpagechanged="Pager_PageChanged"></webdiyer:aspnetpager><table width="100%" border="0" id="cshow" runat=server>
                                <tr>
                                  <td width="13%">评论内容：</td>
                                  <td width="87%"><span class="pad">
                                    <textarea class=kuan id=ly_content name=ly_content rows=5 cols=50 runat="server"></textarea>
                                  </span></td>
                                </tr>
                                <tr>
                                  <td>&nbsp;</td>
                                  <td><input class=btn id=Submit1 type=button value="发表评论" name=bsubmit runat="server" onserverclick="Submit1_ServerClick"></td>
                                </tr>
                              </table></td></tr></table>
                  </div></td></tr></table></td></tr></table></td></tr></table></td></tr></table><INPUT id="hidphoto" type="hidden" name="hidphoto"></form>
	</body>
</HTML>
