<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_RubbishMessage, 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 id="Head1" 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="RubbishMessage.aspx?strid="+strid+"&type=dels&page="+page;
        }
    }
     //整体撤销
        function updataAll(){
            document.getElementById("hid_type").value="updataAll";
            document.getElementById("hid_page").value=page;
            var cbs= document.getElementsByName('cb_delete');
            var strcb="";
            for(i=0;i<cbs.length;i++)
            {
                if(cbs[i].checked==true)
                {
                    strcb+=1+",";
                }else{
                    strcb+=0+",";
                }
            }
            document.getElementById('hid_checkbox').value=strcb;
            document.getElementById("form1").submit();
        }
        //单个编辑
        function edit(id){
             window.location.href="RubbishMessage.aspx?id="+id+"&type=update&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="RubbishMessage.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="RubbishMessage.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><a href="ReceiveMessage.aspx"><span>收信箱</span></a></li>
                <li><a href="SendMessage.aspx"><span>发信箱</span></a></li>
                <li class="current"><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" >
                    <input type="hidden" id="hid_checkbox" name="hid_checkbox" />
                    <input type="hidden" id="hid_page" name="hid_page" />
                    <input type="hidden" id="hid_type" name="hid_type" />
                    <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);"/><input type="button" id="btnSou" class="btn-search" onclick="getSelect()" />
                        </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="16%">
                            发信人
                        </th>
                        <th width="17%">
                            收信人
                        </th>
                        <th width="20%">
                            标题
                        </th>
                        <th width="25%">
                            内容
                        </th>
                        <th width="12%">
                            发信时间
                        </th>
                        <th width="5%">
                            撤销
                        </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>
                            <%
                                if (!ds.Tables[0].Rows[i]["FromUserId"].ToString().Contains("a"))
                                {
                                    dsUser = getName(ds.Tables[0].Rows[i]["FromUserId"].ToString());
                                    for (int k = 0; k < dsUser.Tables[0].Rows.Count; k++)
                                    {
                            %>
                            <a href="RubbishMessage.aspx?uFid=<%=ds.Tables[0].Rows[i]["FromUserId"] %>" title="查看用户信息">
                                <%=dsUser.Tables[0].Rows[k]["username"].ToString() %>
                            </a>
                            <%
                                }
                            }
                            else
                            {
                            %>
                            <a href="RubbishMessage.aspx?uFid=<%=ds.Tables[0].Rows[i]["FromUserId"] %>" title="查看用户信息">
                                <%=getAdminName(ds.Tables[0].Rows[i]["fromUserId"].ToString()).Admin_username %>
                            </a>
                            <%
                                }
                            %>
                        </td>
                        <td>
                            <%
                                if (!ds.Tables[0].Rows[i]["ToUserId"].ToString().Contains("a"))
                                {
                                    dsUser = getName(ds.Tables[0].Rows[i]["toUserId"].ToString());
                                    for (int k = 0; k < dsUser.Tables[0].Rows.Count; k++)
                                    {
                            %>
                            <a href="RubbishMessage.aspx?uTid=<%=ds.Tables[0].Rows[i]["ToUserId"] %>" title="查看用户信息">
                                <%=dsUser.Tables[0].Rows[k]["username"].ToString() %>
                            </a>
                            <%
                                }
                            }
                            else
                            { %>
                            <a href="RubbishMessage.aspx?uTid=<%=ds.Tables[0].Rows[i]["ToUserId"] %>" title="查看用户信息">
                                <%=getAdminName(ds.Tables[0].Rows[i]["ToUserId"].ToString()).Admin_username %>
                            </a>
                            <%} %>
                        </td>
                        <td>
                            <a href="ReadMessage.aspx?sendId=<%=ds.Tables[0].Rows[i]["mid"] %>" title="阅读">
                                <%=ds.Tables[0].Rows[i]["mtitle"].ToString() %>
                            </a>
                        </td>
                        <td>
                            <a href="ReadMessage.aspx?sendId=<%=ds.Tables[0].Rows[i]["mid"] %>" title="阅读">
                                <%=getStr(ConvertType.checkStr(ds.Tables[0].Rows[i]["mcontent"].ToString()))%>
                            </a>
                        </td>
                        <td>
                            <a href="ReadMessage.aspx?sendId=<%=ds.Tables[0].Rows[i]["mid"] %>" title="阅读">
                                <%=ds.Tables[0].Rows[i]["sendtime"] %>
                            </a>
                        </td>
                        <td>
                            <a href='javascript:edit(<%=ds.Tables[0].Rows[i]["mid"] %>)'>撤销</a>
                        </td>
                    </tr>
                    <%} %>
                    <tr>
                        <td colspan="7" class="list-foot">
                            <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>
