<%@ Page Language="C#" AutoEventWireup="true" Codebehind="photo.aspx.cs" Inherits="JuSNS.Web.system.album.photo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title id="ptitle" runat="server">照片管理</title>
    <link href="../images/css/style.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript" src="../../js/ajax.js"></script>

    <script language="javascript" type="text/javascript" src="../../js/public.js"></script>

    <script language="javascript" type="text/javascript">
    //兼容firefox
    try
    {
	    HTMLElement.prototype.__defineGetter__("children",
	    function () {
	    var returnValue = new Object();
	    var number = 0;
	    for (var i=0; i<this.childNodes.length; i++) {
	    if (this.childNodes[i].nodeType == 1) {
	    returnValue[number] = this.childNodes[i];
	    number++;
	    }
	    }
	    returnValue.length = number;
	    return returnValue;
	    }
	    );
    }
    catch(e){}
    
    function getEvent(){     //同时兼容ie和ff的写法
         if(document.all)    return window.event;        
         func=getEvent.caller;            
         while(func!=null){    
             var arg0=func.arguments[0];
             if(arg0){
                 if((arg0.constructor==Event || arg0.constructor ==MouseEvent)
                     || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation)){    
                     return arg0;
                 }
             }
             func=func.caller;
         }
         return null;
    }
    //搜索
    function Search()
    {
        var event=getEvent();
        var obj=event.srcElement||event.target;
        var form=obj.form;
        var key=form.Key.value;
        var url="?"+location.search.substr(1);
        url=url.replace(/\&?key=[^&]*/gi,"");
        if(url.substr(url.length-1)=="&")
        {
            url=url.substring(0,url.length-1);
        }
        location.href=url+"&key="+escape(key);
    }
    //全选
    function checkall()
    {
        var event=event||window.event;
        var obj=event.srcElement||event.target;
        var form=obj.form;
        try
        {
            var item=form.albumchkedid;
            for(var i=0;i<item.length;i++)
            {
                if(obj.checked)
                {
                    item[i].checked=true;
                }
                else
                {
                    item[i].checked=false;
                }
            }
        }catch(e){}
    }
    
    function hiddennext(obj)
    {
        var nextsib=obj.nextSibling;
        if(window.addEventListener)
        {
            nextsib=obj.nextSibling.nextSibling
        }
        if(nextsib.style.display!="none")
        {
            nextsib.style.display="none";
        }
        else
        {
            nextsib.style.display="";
        }
        var tab=obj.parentNode;
        var nodes=tab.children;
        for(var i=0;i<nodes.length;i++)
        {
            if(nodes[i]!=nextsib&&nodes[i].className!="maintablelist"&&nodes[i].className!="maintablehead")
            {
                nodes[i].style.display="none";
            }
        }
    }
    </script>

</head>
<body>
    <table width="99%" border="0" align="center" cellpadding="5" cellspacing="1">
        <tr>
            <td width="120" align="center" valign="top">
                <div class="menu">
                    <ul>
                        <%=this.GetSystemMenu(sort)%>
                    </ul>
                </div>
            </td>
            <td valign="top">
                <div class="navip">
                    <a href="index.aspx">相册管理</a> &nbsp;<span class="Blue"><a href="photo.aspx">照片管理</a></span>
                </div>
                <div id="DivErr" runat="server">
                </div>
                <form id="form1" runat="server">
                    <div id="mainbody">
                        <asp:Repeater runat="server" ID="RptData">
                            <HeaderTemplate>
                                <table width="100%" border="0" cellpadding="3" cellspacing="1" class="maintable">
                                    <tr class="maintablehead">
                                        <td align="center" style="width: 10%;">
                                            编号</td>
                                        <td align="center" style="width: 20%;">
                                            照片描述</td>
                                        <td align="center" style="width: 10%;">
                                            创建人</td>
                                        <td align="center" style="width: 10%;">
                                            所属相册</td>
                                        <td align="center" style="width: 15%;">
                                            查看次数</td>
                                        <td align="center" style="width: 15%;">
                                            上传时间</td>
                                        <td align="center" style="width: 20%;">
                                            操作<input type="checkbox" value="1" onclick="javascript:checkall();" /></td>
                                    </tr>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <tr class="maintablelist" onclick="hiddennext(this)" onmouseover="this.style.backgroundColor='#ebf4f4';this.style.color='Blue';"
                                    onmouseout="this.style.backgroundColor='';this.style.color='';">
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "PhotoID")%>
                                    </td>
                                    <td align="center">
                                        <a href="../../home/Album/AlbumView.aspx?r[0]=<%# DataBinder.Eval(Container.DataItem, "AlbumID")%>&r[1]=<%# DataBinder.Eval(Container.DataItem, "UploadUser")%>"
                                            target="_blank"><a href="../../home/album/photoview.aspx?r[0]=<%# DataBinder.Eval(Container.DataItem, "PhotoID")%>"
                                                title="点击打开照片" target="_blank">
                                                <img src="../../uploads/photo/aa0/<%# DataBinder.Eval(Container.DataItem, "FilePath")%>"
                                                    style="width: 50px; border: 1px solid #eeeeee;padding:2px;" /></a> </a>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "UserName")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "AlbumTitle")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "Views")%>
                                    </td>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "PostTime")%>
                                    </td>
                                    <td align="center">
                                        锁定：<%# isno(DataBinder.Eval(Container.DataItem, "isLock"))%> &nbsp; 
                                        <input type="checkbox" name="albumchkedid" value="<%# DataBinder.Eval(Container.DataItem, "PhotoID")%>" />
                                    </td>
                                </tr>
                                <tr style="display: none;">
                                    <td colspan="7">
                                        <table width="100%">
                                            <tr>
                                                <td width="70">
                                                    照片描述：
                                                </td>
                                                <td colspan="7">
                                                    <%# DataBinder.Eval(Container.DataItem, "Description")%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    用户：
                                                </td>
                                                <td width="272">
                                                    <%# DataBinder.Eval(Container.DataItem, "UserName")%>
                                                </td>
                                                <td width="90">
                                                    查看次数：
                                                </td>
                                                <td width="228">
                                                    <%# DataBinder.Eval(Container.DataItem, "Views")%>
                                                </td>
                                                <td width="87">
                                                    文件大小：
                                                </td>
                                                <td width="153">
                                                    <%# viewFileSize(DataBinder.Eval(Container.DataItem, "FileSize"))%>
                                                </td>
                                                <td width="80">
                                                    &nbsp;</td>
                                                <td width="205">
                                                    &nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    状态：
                                                </td>
                                                <td>
                                                    <%# DataBinder.Eval(Container.DataItem, "State")%>
                                                </td>
                                                <td>
                                                    是否封面：
                                                </td>
                                                <td>
                                                    <%# isno(DataBinder.Eval(Container.DataItem, "isCover"))%>
                                                </td>
                                                <td>
                                                    评论数：
                                                </td>
                                                <td>
                                                    <%# DataBinder.Eval(Container.DataItem, "Comments")%>
                                                </td>
                                                <td>
                                                    发表时间：
                                                </td>
                                                <td>
                                                    <%# DataBinder.Eval(Container.DataItem, "PostTime")%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    发表IP：
                                                </td>
                                                <td>
                                                    <%# DataBinder.Eval(Container.DataItem, "PostIP")%>
                                                </td>
                                                <td>
                                                    是否锁定：
                                                </td>
                                                <td>
                                                    <%# isno(DataBinder.Eval(Container.DataItem, "isLock"))%>
                                                </td>
                                                <td>
                                                    头像/照片
                                                </td>
                                                <td>
                                                    <%# DataBinder.Eval(Container.DataItem, "PhotoType")%>
                                                </td>
                                                <td>
                                                    宽度：
                                                </td>
                                                <td>
                                                    <%# DataBinder.Eval(Container.DataItem, "Width")%>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    高度：
                                                </td>
                                                <td>
                                                    <%# DataBinder.Eval(Container.DataItem, "Height")%>
                                                </td>
                                                <td>
                                                    文件名：
                                                </td>
                                                <td>
                                                    <%# DataBinder.Eval(Container.DataItem, "FilePath")%>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </ItemTemplate>
                            <FooterTemplate>
                                </table>
                            </FooterTemplate>
                        </asp:Repeater>
                        <table width="100%" border="0" cellpadding="3" cellspacing="1">
                            <tr>
                                <td>
                                    <div class="pagination" runat="server" id="DivPage" style="text-align: center;">
                                    </div>
                                </td>
                                <td align="right" style="padding-right: 15px;">
                                    <asp:Button ID="lockPhoto" runat="server" Text="锁定" OnClick="lockPhoto_Click" />&nbsp;&nbsp;
                                    <asp:Button ID="unlockPhoto" runat="server" Text="解锁" OnClick="unlockPhoto_Click" />&nbsp;&nbsp;<asp:Button
                                        ID="setCover" runat="server" Text="封面" OnClick="setCover_Click" />&nbsp;&nbsp;<asp:Button
                                            ID="delPhoto" runat="server" Text="删除" OnClick="delPhoto_Click" /></td>
                            </tr>
                        </table>
                        <table width="100%" border="0" cellpadding="3" cellspacing="1">
                            <tr class="maintablepage">
                                <td>
                                    <div style="text-align: center;">
                                        搜索照片
                                        <asp:TextBox ID="Key" runat="server" Width="200"></asp:TextBox>&nbsp;&nbsp;<input
                                            type="button" value="搜索" onclick="javascript:Search();" />
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </form>
            </td>
        </tr>
    </table>
</body>
</html>
