<%@ Page Language="C#" AutoEventWireup="false" %>
<%@ 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>
    <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>
</head>
<body>
    <form id="form1" runat="server">
        <div>
          
            <div class="PageTitleArea">
                <div class="PageTitle">
                    <asp:Literal ID="lblPageTitle" runat="server" Text="<%$ Resources:ManageLeaveComments, IDS_PageTitle %>"></asp:Literal>
                </div>
                <div style="width: 80%;">
                    <asp:Literal ID="lblPageDesc" runat="server"  Text="<%$ Resources:ManageLeaveComments, IDS_PageDesc %>"></asp:Literal>
                </div>
            </div>
            
            <Hishop:ManageLeaveComments ID="ManageLeaveComments" runat="server">
                <SkinTemplate>
                
 <script type="text/javascript">
    function ResetPager(sender, eventArgs) {
        CB_Pager.callback();
    }
    
    $(document).ready(function(){
 
        var $_txtTitle=$('#txtTitle');
        var $_txtContent=$('#txtContent');
        var $_txtLeaveId=$('#ManageLeaveComments_txtLeaveId');
        
        jQuery.myfn={
           OpenWindow: function(leaveId,leaveTitle)
           {
             if (DialogLeaveComment.get_isShowing()) {
                DialogLeaveComment.Close();			
             }
             else {
                $_txtTitle.attr({'value':'Re: '+leaveTitle});
				$_txtLeaveId.attr({'value':leaveId});
				$_txtContent.attr({'value':''});
                DialogLeaveComment.Show();
             }
           },
           LeaveRefer:function(){
                var titleLength=$_txtTitle.attr('value').replace(/[^x00-xFF]/g,'**').length;
                var contentLength=$_txtContent.attr('value').replace(/[^x00-xFF]/g,'**').length;

                if (titleLength>60 || titleLength==0)
                {
                  alert("标题不能为空,同时长度限制在1-60个字符之间");
                  return;
                }
                if (contentLength>1000 || contentLength==0)
                {
                  alert("内容不能为空,同时长度限制在1-1000个字符之间");
                  return;
                }
                
	            CB_dlstLeaveComments.callback("ReplyRefer",$_txtLeaveId.attr('value'),$_txtTitle.attr('value'),$_txtContent.attr('value'));
	            DialogLeaveComment.Close();
	            
           },     
           LeaveDelete:function(leaveId){
	            if (confirm("请确定要删除此留言及留言的回复吗？删除以后不可恢复！"))
                {
	                 CB_dlstLeaveComments.callback("LeaveDelete",leaveId);
	            }
           },
           ReplyDelete:function(replyId){
	            if (confirm("请确定要删除此留言回复吗？删除以后不可恢复！"))
                {
	                CB_dlstLeaveComments.callback("ReplyDelete",replyId);
	            }
           }  
        };
    }
  );

	
</script>
                
                <asp:RadioButton id="radiobtnOpenLeave" runat="server" Text="<%$ Resources:ManageLeaveComments, IDS_Field_OpenLeave %>" GroupName="IsOpenLeave" /> 
                <asp:RadioButton id="radiobtnCloseLeave" runat="server" Text="<%$ Resources:ManageLeaveComments, IDS_Field_CloseLeave %>" GroupName="IsOpenLeave" />
                <div Id="divLeaveComments" runat="server" class="PageTitleArea">     
                        <UI:CallBack id="CB_dlstLeaveComments" ClientSideOnCallbackComplete="ResetPager" CacheContent="false" runat="server" PostState="true" Debug="false">
                        <Content>
                            <UI:TemplatedList runat="server" DataKeyField="LeaveId" Id="dlstLeaveComments" RunningMode="Callback" Width="100%" >   
                                <ItemTemplate>   
                                    <table style="width:100%;">
                                    <tr>
                                        <td>
                                            <div style="border:1px #e2d9c1 solid;background-color:#f4f3ea; padding:4px;">
                                                <table border="0" cellpadding="0" cellspacing="0">
                                                    <tr><td>
                                                        <span style="color:#ff9000;">
                                                            <asp:Literal Text='<%# Eval("UserName") %>' runat="server"></asp:Literal></span> 
                                                            <asp:Literal Text='<%$ Resources:ManageLeaveComments, IDS_Mg_Tell %>' runat="server"></asp:Literal>：<span style="color:#5b5b5b; font-size:11px;"><Hishop:FormatedTimeLabel time='<%# Eval("PublishDate") %>' runat="server" /></span>
                                                            <input type="button" class="inp_L1" value="回复" onclick="$.myfn.OpenWindow(<%# Eval("LeaveId") %>,'<%# Eval("Title") %>')" />
                                                            <input type="button" class="inp_L1" value="删除" onclick="$.myfn.LeaveDelete(<%# Eval("LeaveId") %>)"/> 
                                                    </td></tr>
                                                    <tr><td style="padding-top:8px;width:900px;">
                                                        <span style="word-break:break-all"><strong><asp:Literal Text='<%# Eval("Title") %>' runat="server"></asp:Literal></strong></span>
                                                    </td></tr>
                                                    <tr><td style="width:900px;">
                                                        <span style="word-break:break-all"><asp:Literal Text='<%# Eval("PublishContent") %>' runat="server"></asp:Literal></span>
                                                    </td></tr>
                                                </table>
                                            </div>
                                        </td>
                                   </tr>
                                   <tr>
                                        <td>
                                            <asp:DataList ID="dtlistLeaveCommentsReply" runat="server" Width="100%"
                                                DataSource='<%# DataBinder.Eval(Container, "DataItem.LeaveCommentReplays") %>'>
                                                <ItemTemplate>
                                                    <div style="border:1px #dedede solid;background-color:#ffffff;padding-left:30px;">
                                                        <table >
                                                            <tr><td>
                                                                <span style="color:#3366cc;"><asp:Literal Text='<%# Eval("ReplyUserName") %>' runat="server"></asp:Literal></span>：
                                                                <span style="color:#5b5b5b; font-size:11px;"><Hishop:FormatedTimeLabel time='<%# Eval("ReplyDate") %>' runat="server" /></span>
                                                                <input type="button" class="inp_L1" value="删除" onclick="$.myfn.ReplyDelete(<%# Eval("ReplyId") %>)" /> 
                                                            </td></tr>
                                                            <tr><td style="width:900px;">
                                                                <span style="word-break:break-all"><strong><asp:Literal ID="Literal6" Text='<%# Eval("ReplyTitle") %>' runat="server"></asp:Literal></strong></span>
                                                            </td></tr>
                                                            <tr><td style="width:900px;">
                                                                <span style="word-break:break-all"><asp:Literal ID="Literal7" Text='<%# Eval("ReplyContent") %>' runat="server"></asp:Literal></span>
                                                            </td></tr>
                                                        </table>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:DataList>
                                        </td>
                                   </tr>
                                   </table>   
                               </ItemTemplate>
                            </UI:TemplatedList>
                        </Content>
                        </UI:CallBack>
                        <div style="margin-top:10px; height:24px; vertical-align:middle; border-top:solid 1px #ffffff; padding-top:6px; padding-left:6px;">
                            <UI:CallBack id="CB_Pager" CacheContent="false" PostState="true" Debug="false" runat="server" >
                            <Content>
                                <UI:Pager runat="server" ID="pager" ListToPaging="dlstLeaveComments" ListToCallBackID="CB_dlstLeaveComments" RunningMode="Callback"  />
                            </Content>
                            </UI:CallBack>
                        </div>
                    </div>
                </div>

        <UI:Dialog AnimationType="Live" ShowTransition="Fade" AnimationSlide="ExponentialDecelerate"
            CloseTransition="Fade" AnimationDuration="600" Modal="false"
            AllowDrag="true" Alignment="MiddleCentre" Title="<%$ Resources:ManageLeaveComments, IDS_Title_Reply %>"
            ID="DialogLeaveComment" runat="server" Width="500">
            <Content>
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td valign="top" style="padding: 10px;">
                            <table style="width:450px;">
                                <tr>
                                    <td style="width:36px;"><asp:Literal Text="<%$ Resources:ManageLeaveComments, IDS_Field_Title %>" runat="server"></asp:Literal>：</td>
                                    <td>
                                        <input type="text" id="txtTitle" style="width:370px;"  />
                                        <input type="text" id="txtLeaveId" runat="server" style="display:none;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="vertical-align:top;"><asp:Literal Text="<%$ Resources:ManageLeaveComments, IDS_Field_Content %>" runat="server"></asp:Literal>：</td>
                                    <td >
                                         <textarea id="txtContent" rows="2" cols="20" id="Textarea1" style="height:100px;width:370px;"></textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td><input type="button" id="btnRefer" class="inp_L1" Value="回复" onclick='$.myfn.LeaveRefer();'  /></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td valign="bottom" style="padding-bottom: 10px;padding-right: 10px;" align="right">
                            <input type='button' class="inp_L1" onclick='DialogLeaveComment.Close("Close click");' value='Close' />
                        </td>
                    </tr>
                </table>
            </Content>
        </UI:Dialog>
        
    

                </SkinTemplate>
            </Hishop:ManageLeaveComments>
            
        </div>
        <br />
        <div class="botCopyInfo">
            <hr style="width:500px;" />
            <Hishop:SiteCopyright runat="server" />
        </div>
        <br />
        <Hishop:ValidatorContainer runat="server" ID="ValidatorContainer" />
    </form>
</body>
</html>
 
 
