<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Controls" Assembly="Hishop.Web.Controls" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Management" Assembly="Hishop.Web.Management" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Validator" Assembly="Hishop.Web.Validator" %>
<%@ Register TagPrefix="UI" Namespace="ASPNET.WebControls" Assembly="ASPNET.WebControls" %>
<%@ Import Namespace="Hishop.SystemServices" %>
<!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">
    <Hishop:HeadContainer ID="HeadContainer1" runat="server" />
    <Hishop:PageTitle ID="PageTitle1" runat="server" />
    <link rel="stylesheet" href="../../utility/validate/pagevalidator.css" type="text/css" />
    <link rel="stylesheet" href="../css/Hishopv5.css" type="text/css" />
    <script type="text/javascript" src="../../utility/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="../../utility/validate/pagevalidator.js"></script>
    
    <script type="text/javascript" src="../js/Hishopv5.js"></script>
    
<style type="text/css">

body{
  font:lighter 12px/150% Tahoma;
}
form,p{
  margin:0;padding:0;
}
input{
  vertical-align:middle;
}
textarea{
  vertical-align:top;
}
p{
  margin:0px auto;
}
label{
  display:inline-block;width:5em;text-align:right;
}
</style>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div class="PageTitleArea">
                <div class="PageTitle">
                    <asp:Literal ID="lblPageTitle" runat="server" Text="<%$ Resources:ReceiveMessages,IDS_PageTitle %>"></asp:Literal>
                </div>
                <div style="width: 80%;">
                    <asp:Literal ID="lblPageDesc" runat="server" Text="<%$ Resources:ReceiveMessages,IDS_PageDesc %>"></asp:Literal>
                </div>
            </div>
            <Hishop:ReceivedMessages ID="ReceiveMessages" runat="server">
            <SkinTemplate>

           
            
 <script type="text/javascript">
 
    function ResetPager(sender, eventArgs) {
        PagerCallBack.callback();
    }              
      
    $(document).ready(function(){
        
        
        var $_txtMessageId=$('#ReceiveMessages_txtMessageId');
        var $_txtAddresserId=$('#ReceiveMessages_txtAddresserId');
        var $_txtAddresser=$('#txtAddresser');
        var $_txtTitle=$('#txtTitle');
        var $_txtPublishContent=$('#txtPublishContent');
        var $_txtPublishDate=$('#txtPublishDate');
        
        var $_txtReplyTitle=$('#txtReplyTitle');       
        var $_txtReplyContent=$('#txtReplyContent');
        
        jQuery.myfn={
           OpenWindow: function(messageId,addreser,title,publishDate,publishContent,addreserId)
           {
             if (dialogMessage.get_isShowing()) {
                dialogMessage.Close();			
             }
             else {
                
                $_txtMessageId.attr({'value':messageId});
                $_txtAddresserId.attr({'value':addreserId});
                $_txtAddresser.attr({'value':addreser});
                $_txtTitle.attr({'value':title});
                $_txtPublishDate.attr({'value':publishDate});
                $_txtPublishContent.attr({'value':publishContent.replace(/<br\/>/g,'\n')});
                $_txtReplyTitle.attr({'value':'RE:'+title});
                GridCallBack.callback("MessageIsRead",messageId);
                $_txtReplyContent.attr({'value':''});
                CB_MessageReply.callback("ShowMessageReply",messageId);
                dialogMessage.Show();
             }
           },
           MessageRefer:function(){
	            GridCallBack.callback("MessageRefer",$_txtMessageId.attr('value'),$_txtReplyTitle.attr('value'),$_txtReplyContent.attr('value'),$_txtAddresserId.attr('value'));
	            dialogMessage.Close();
	            
           },     
           MessageDelete:function(messageId){
	            if (confirm("请确定要删除此消息吗？删除以后不可恢复！"))
                {
	                 GridCallBack.callback("MessageDelete",messageId);
	            }
           }
        };
    }
  );

	
</script>
        <div class="grdHeaderStyle">
            <ul>
                <li class="userGroupCheckAll">
                    <asp:LinkButton ID="Button2" runat="server" OnClientClick="CheckClickAll();return false;"
                        Text="<%$ Resources:ProductInStock, IDS_Button_CheckAll %>" />
                </li>
                <li class="spirtLines">|</li>
                <li class="userGroupReverseCheck">
                    <asp:LinkButton ID="CheckReverse" runat="server" OnClientClick="CheckReverse();return false;"
                        Text="<%$ Resources:ProductInStock, IDS_Button_CheckReverse %>" />
                </li>
                <li class="spirtLines">|</li>
                <li class="userGroupDelCheck">
                    <Hishop:DeleteImageLinkButton Id="btnDeleteSelect" runat="server"  Text="<%$ Resources:Resources, IDS_Button_Delete %>" />
                </li>
            </ul>
        </div>

        <UI:CallBack id="GridCallBack" ClientSideOnCallbackComplete="ResetPager" CacheContent="false" PostState="true" Debug="false" runat="server">
            <Content>
        <UI:Grid ID="messagesList" runat="server" AutoGenerateColumns="False" CssClass="GridNoBorder"  DataKeyNames="ReceiveMessageId"
                    CellPadding="4" ForeColor="#333333" GridLines="None" AllowSorting="true" HeaderStyle-CssClass="GridViewHeaderStyle"
                    Width="100%" RunningMode="Callback" >
                    <Columns>
                        <Hishop:CheckBoxColumn />
                        <asp:TemplateField HeaderText="编号" ItemStyle-Width="100">
                            <ItemTemplate>
                                <asp:Label runat="server" Id="lblMessage" Text='<%# Eval("ReceiveMessageId") %>' Visible="false" ></asp:Label>
                                <asp:Label runat="server" Text='<%# Eval("Id")%>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                         <asp:TemplateField HeaderText="标题">
                            <ItemTemplate>
                                <a href="#" Style=" color:Blue;" onclick="$.myfn.OpenWindow('<%# Eval("ReceiveMessageId")%>','<%# Eval("Addresser")== null?123:Eval("Addresser") %>','<%# Eval("Title")%>','<%# Eval("PublishDate")%>','<%#(Eval("PublishContent")).ToString().Replace("\r\n", "<br/>")%>','<%# Eval("AddresserId")%>');" ><asp:Label runat="server" Text='<%# Eval("Title")%>'></asp:Label></a>
                            </ItemTemplate>
                        </asp:TemplateField>    
                        <asp:TemplateField HeaderText="发件人">
                            <ItemTemplate>
                                <Hishop:Link_User runat="server" Text='<%# Eval("Addresser")%>' UserId='<%# Eval("AddresserID") %>' Style=" color:Blue;" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="时间" SortExpression="PublishDate">
                            <ItemTemplate>
                                <%#Eval("PublishDate") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="已读" SortExpression="IsRead">
                            <ItemTemplate>
                                <img src='<%# Eval("IsRead").ToString()=="False"? Globals.ApplicationPath+"/utility/pics/false.gif":Globals.ApplicationPath+"/utility/pics/true.gif" %>'  />
                            </ItemTemplate>
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="<%$ Resources:Resources, IDS_Header_Options %>">
                            <ItemStyle/>
                            <ItemTemplate>
                               <a href="#" class="SmallCommonTextButton" onclick="$.myfn.OpenWindow('<%# Eval("ReceiveMessageId")%>','<%# Eval("Addresser")== null?123:Eval("Addresser") %>','<%# Eval("Title")%>','<%# Eval("PublishDate")%>','<%# (Eval("PublishContent")).ToString().Replace("\r\n", "<br/>")%>','<%# Eval("AddresserId")%>');" >回复</a>
                               <a href="#" class="SmallCommonTextButton" onclick="$.myfn.MessageDelete('<%# Eval("ReceiveMessageId")%>');" >删除</a>
                            </ItemTemplate>
                        </asp:TemplateField>
                    
                    </Columns>
                    <RowStyle CssClass="grdrow" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                    <HeaderStyle BackColor="#EEF8FF" Height="25" CssClass="GridViewHeaderStyle" Font-Bold="True"
                        ForeColor="#314E9F" />
                    <AlternatingRowStyle BackColor="White" />
                </UI:Grid>
                </Content>
                </UI:CallBack>
        <br  />
        <hr />
        
        <div style="text-align:left">
            <UI:CallBack id="PagerCallBack" CacheContent="false" PostState="true" Debug="false" runat="server">
            <Content>
                <UI:Pager runat="server" ListToPaging="messagesList" ListToCallBackID="GridCallBack" RunningMode="Callback" ID="pager" />
            </Content>
            </UI:CallBack>
        </div>
        
        <UI:Dialog AnimationType="Live" ShowTransition="Fade" AnimationSlide="ExponentialDecelerate"
            CloseTransition="Fade" AnimationDuration="600" Modal="true"
            AllowDrag="true" Alignment="MiddleCentre" Title="查看信息"
            ID="dialogMessage" runat="server" Width="500">
            <Content>
                <input type="text" id="txtMessageId" runat="server" style="display:none;" />
                <input type="text" id="txtAddresserId" runat="server" style="display:none;" />
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td style="padding: 10px;">
                            <div style="width:450px; height:136px; border:solid 1px #ccc;">
                                 <p><label>发件人：</label><input type="text" ID="txtAddresser" readonly="readonly"  style="border:0px 0px 0px 0px;width:370px; " /></p>
                                 <p><label>标题：</label><input type="text" readonly="readonly"  ID="txtTitle" style="border:0px 0px 0px 0px;width:370px;" /></p>
                                 <p><label>时间：</label><input type="text" readonly="readonly"  ID="txtPublishDate" style="border:0px 0px 0px 0px;width:370px;" /></p>
                                 <p><label>内容：</label><textarea rows="2" cols="20" id="txtPublishContent" readonly="readonly" style="height:40px;width:370px;"></textarea></p>
                            </div>
                            
                            <div style="width:450px; border:solid 1px #ccc;height:86px;overflow:scroll;overflow-x:hidden; margin-top:10px;">                     
                                <UI:CallBack id="CB_MessageReply" CacheContent="false" runat="server" PostState="true" Debug="false">
                                <Content>
                                    <UI:TemplatedList runat="server" ID="dlstMessageReply" Width="100%" style="vertical-align:top;" >   
                                        <ItemTemplate>   
                                             <p><label>回复：</label><asp:Literal Text='<%# Eval("Title") %>' runat="server"></asp:Literal> 时间：<span style="color:#5b5b5b; font-size:11px;"><asp:Literal ID="Literal5" Text='<%# Eval("PublishDate") %>' runat="server"></asp:Literal></span></p>
                                             <p><label></label><textarea rows="2" cols="20" id="Textarea1" readonly="readonly" style="height:40px;width:350px;vertical-align:top;"><%# Eval("PublishContent") %></textarea></p>
                                       </ItemTemplate>
                                    </UI:TemplatedList>
                                  </Content>
                               </UI:CallBack>
                            </div>
                            
                            <table style="width:450px; margin-top:6px;">
                                <tr>
                                    <td><strong>快速回复</strong></td>
                                </tr>
                                 <tr>
                                    <td>回复标题：</td>
                                    <td><input type="text" id="txtReplyTitle" style="width:370px;"  /></td>
                                </tr>
                                <tr>
                                    <td style="vertical-align:top; padding-top:6px;">回复内容：</td>
                                    <td><textarea id="txtReplyContent" rows="2" cols="20" style="height:40px;width:370px;"></textarea></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td><input type="button" id="btnRefer" Value="回复" onclick='$.myfn.MessageRefer();'  /></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </Content>
        </UI:Dialog>
                
            </SkinTemplate>
            </Hishop:ReceivedMessages>
            
        </div>
        <br />
        <div style="text-align:center">
            <hr style="width:500px;" />
            <Hishop:SiteCopyright runat="server" />
        </div>
        <br />
        <Hishop:ValidatorContainer runat="server" ID="ValidatorContainer" />
    </form>
</body>
</html>
