<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_ReceiveMessage, LebiMall" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Import Namespace="Control" %>
<!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 runat="server">
    <title>收信箱</title>
    <link href="css/css.css" rel="stylesheet" type="text/css" />
    <link href="css/tipswindown.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" language="javascript" src="js/topHead.js"></script>
    <script type="text/javascript" src="../images/js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="js/checked.js"></script>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/tipswindown.js" type="text/javascript"></script>
    <script src="js/ryjs.js" type="text/javascript"></script>
    <script type="text/javascript">
    var page='<%=page %>';
    function deleteAll(){
        var list= document.getElementsByName('cb_delete');
        var strid="";
        if (confirm("确认要删除？")) {
             for(i=0;i<list.length;i++)
            {
                if(list[i].checked==true){
                    strid+=list[i].value+",";
                }
            } 
            if(strid!="")
            window.location.href="ReceiveMessage.aspx?strid="+strid+"&type=dels&page="+page;
        }
    }
    function getSelect()
    {
        var dateFrom=document.getElementById("dateFrom").value;
        var dateTo=document.getElementById("dateTo").value;
        var values=document.getElementById("txtSelectInfo").value;
        window.location.href="ReceiveMessage.aspx?selectInfo="+escape(values)+"&dateFrom="+dateFrom+"&dateTo="+dateTo;
    }
    function SelectValue(){
        var selectInfo='<%=selectInfo %>';
        var fromtime='<%=fromtime %>';
        var totime='<%=totime %>';
        document.getElementById("txtSelectInfo").value=selectInfo; 
        document.getElementById("dateFrom").value=fromtime;
        document.getElementById("dateTo").value=totime;
    }
    </script>

</head>
<body onload="SelectValue()">
    <form id="form1" runat="server">
        <script>header(5,3,"images/");</script>
        <div class="blank clearfix">
        </div>
        <script type="text/javascript">
            var $=jQuery;
            var f="<%=returnValue %>";
            var i=2;
            if(f=="true"){
                tipsWindown('操作结果','text:操作成功！','250','100','true','2000','true','text');
                setInterval("fun()", 1000);
            }
            if(f=="false"){
                tipsWindown('操作结果','text:操作失败！','250','100','true','2000','true','text');
            }
            function fun() {
                if (i == 1) {
                window.location.href="ReceiveMessage.aspx";
                }
            i--;
            }
        </script>
        <div class="tabmenus mainwidth">
            <ul>
                <li><a href="AdminMessage_List.aspx"><span>所有信息</span></a></li>
                <li><a href="WriteMessage.aspx"><span>写信息</span></a></li>
                <li class="current"><a href="ReceiveMessage.aspx"><span>收信箱</span></a></li>
                <li><a href="SendMessage.aspx"><span>发信箱</span></a></li>
                <li><a href="RubbishMessage.aspx"><span>垃圾箱</span></a></li>
            </ul>
        </div>
        <div class="tab-mainbody">
            <div class="tab-mainbody2">
                <div class="functionHandleArea clearfix"  style="padding:3px 0 3px 4px">
                 <table cellpadding="0" cellspacing="0" >
                    <tr><td>
                        <input type="text" name="dateFrom" id="dateFrom" runat="server" size="12" class="texttime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" onkeydown="quickQueryCust(event);"/>
                        -
                        <input type="text" name="dateTo" id="dateTo" runat="server" size="12" class="texttime" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" onkeydown="quickQueryCust(event);"/>
                        <input type="text" id="txtSelectInfo" name="txtSelectInfo" runat="server" class="input" onkeydown="quickQueryCust(event);" style="width:150px;"/><input type="button" id="btnSou" class="btn-search" onclick="getSelect()" /><br />
                    </td>
                    </tr>
                    <tr><td style="height:30px;"><input type="image" name="Submit" title=" 删除 " onclick="deleteAll();return false;" src="images/bt_delete.gif" align="absmiddle" />
                        <input type="image" title=" 返回 " onclick="history.back();return false;" src="images/bt_bak.gif" align="absmiddle" /></td></tr>
                    </table>
            </div>
                <div id="datalist">
                <table cellspacing="0" width="100%" cellpadding="0" id="list">
                    <tr>
                        <th  width="5%" title="全选" onclick="CheckedAllInfo()">
                            选择
                        </th>
                        <th  width="20%">
                            发信人
                        </th>
                        <th  width="23%">
                            标题
                        </th>
                        <th  width="32%">
                            内容
                        </th>
                        <th  width="13%">
                            收信时间
                        </th>
                        <th  width="7%">
                            状态
                        </th>
                    </tr>
                    <% 
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                    %>
                    <tr>
                        <td>
                            <input type="checkbox" id="cb_delete<%=ds.Tables[0].Rows[i]["mid"] %>" name="cb_delete"
                                value="<%=ds.Tables[0].Rows[i]["mid"] %>" />
                        </td>
                        <td>
                            <%
                                dsUser = getName(int.Parse(ds.Tables[0].Rows[i]["fromUserid"].ToString()));
                                for (int j = 0; j < dsUser.Tables[0].Rows.Count; j++)
                                { %>
                            <a href="ReceiveMessage.aspx?uid=<%=ds.Tables[0].Rows[i]["fromUserid"].ToString() %>"
                                title="查看用户信息">
                                <%=getString(dsUser.Tables[0].Rows[j]["username"].ToString()) %>
                            </a>
                            <%} %>
                        </td>
                        <td>
                            <%=getString(ds.Tables[0].Rows[i]["mtitle"].ToString()) %>
                        </td>
                        <td>
                            <%=getString(ConvertType.checkStr(ds.Tables[0].Rows[i]["mcontent"].ToString())) %>
                        </td>
                        <td>
                            <%=ds.Tables[0].Rows[i]["sendtime"] %>
                        </td>
                        <td>
                            <% if (ds.Tables[0].Rows[i]["isread"].ToString() == "1")
                               { %>
                            <a href="ReadMessage.aspx?id=<%=ds.Tables[0].Rows[i]["mid"] %>" title="阅读">已读</a>
                            <%}
                              else
                              { %>
                            <a href="ReadMessage.aspx?id=<%=ds.Tables[0].Rows[i]["mid"] %>" title="阅读">未读</a>
                            <%} %>
                        </td>
                    </tr>
                    <%} %>
                    <tr>
                        <td colspan="6" class="list-foot" style="height: 27px">
                            <div style="float: left; padding-top: 3px;">
                                </div>
                                <div id="divAsp" runat="server" style="float: right; padding-top: 3px;">
                                    <webdiyer:AspNetPager CssClass="pages" CurrentPageButtonClass="cpb" ID="AspNetPager1"
                                        runat="server" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页"
                                        PrevPageText="上一页" PageSize="20" UrlPaging="True" CustomInfoClass="pages1" CurrentPageButtonPosition="Center" ShowBoxThreshold="50"
                                        ShowFirstLast="true" NumericButtonCount="4" BackColor="Transparent" ShowDisabledButtons="False" EnableViewState="False">
                                    </webdiyer:AspNetPager>
                                </div>
                        </td>
                    </tr>
                </table>

                <script type="text/javascript">tdshowm("list");</script>

            </div>
            </div>
        </div>
    </form>
</body>
</html>
