<%@ Page Language="C#" AutoEventWireup="true" Inherits="Web.inherits.UserViewPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>我的消息-<%=WebSiteConfig.SiteTitle%></title>
    <link href="<%path:%>Css/common.css" rel="stylesheet" />
    <link href="<%path:%>Css/user.css" rel="stylesheet" />
    <script src="/Js/jquery-1.8.2.min.js"></script>
    <script src="/Js/data.js"></script>
    <script src="/Js/bx.library.js"></script>
    <script src="<%path:%>js/web.js"></script>
</head>
<body>
    <!--head-->
    <%template:_head.html%>
    <!--body-->
    <div class="body main">
        <div class="split">&nbsp;</div>
        <div class="usercenter">
            <div class="left"><%template:_usermenu.html%></div>
            <div class="right">
                <div class="content">
                    <div class="title">
                        <h3>我的消息</h3>
                    </div>
                    <%var cpage=Request.QueryString["page"]!=null?Convert.ToInt32(Request.QueryString["page"]):1;
                      var mtotal=GetMessageInboxCount();
                    %>
                    <table class="infolist tablelist" id="TableList" border="0" cellpadding="0" cellspacing="0">
                        <thead>
                            <tr>
                                <th>消息</th>
                                <th>状态</th>
                                <th>日期</th>
                            </tr>
                        </thead>
                        <tbody>
                            <%foreach(var row in GetMessageInboxList(page:cpage)){%>
                            <tr>
                                <td>
                                    <%if(row["ReceiveStatus"]==null || row["ReceiveStatus"]==DBNull.Value){%>
                                    <span id='msgtitle_<%=row["MessageID"]%>' style="font-weight:900;cursor:pointer;" onclick='readMessage(<%=row["MessageID"]%>);'>
                                        <%}else{%>
                                        <span>
                                            <%}%>
                                            <%=row["MessageContent"]%>
                                        </span>
                                </td>
                                <td>
                                    <%if(row["ReceiveStatus"]==null || row["ReceiveStatus"]==DBNull.Value){%>
                                    <img src="<%path:%>images/messageicon2.gif" id='msg_<%=row["MessageID"]%>' />
                                    <%}else{%>
                                    <img src="<%path:%>images/messageicon3.gif" id='msg_<%=row["MessageID"]%>' />
                                    <%}%>

                                </td>
                                <td>
                                    <%=row["CreateTime"]%>
                                </td>
                            </tr>
                            <%}%>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="3" class="pagination">
                                    <%=GetPaginationHtml(total:mtotal,page:cpage,link:"?page=@page",maxmumRows:10)%>
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <!--foot-->
    <%template:_foot.html%>
    <script type="text/javascript">
    function readMessage(_msgId) {
        User.readMessage(_msgId,function(result){
            if(result.status=="success"){
                var msgObj=document.getElementById("msg_"+_msgId);
                var msgTitleObj=document.getElementById("msgtitle_"+_msgId);
                if(msgObj!=null){
                    msgObj.src="<%path:%>images/messageicon3.gif";
                    msgTitleObj.style.cssText="";
                }
            }else{
                alert("操作失败!");
            }
        });
    }
    </script>

</body>
</html>