<%@ Page Language="C#" AutoEventWireup="True" MasterPageFile="~/Admin/MasterPage.master" Inherits="Kesion.NET.WebSite.Course.Admin.Course.KS_TeacherMessage" Codebehind="KS.TcMessage.aspx.cs" %>


<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
  
 <script>

 	function SetDate() {
 		var today = new Date();
 		if ($("#showdate").is(":hidden")) {
 			$("#showdate").show();
 			$('#<%=TxtBeginDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
 			$('#<%=TxtEndDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
 		}
 		else {
 			$("#showdate").hide();
 			$('#<%=TxtBeginDate.ClientID%>').val('');
      	$('#<%=TxtEndDate.ClientID%>').val('');
 		}
	 }
	 function keyWordFocus() {
	 	if (jQuery("#<%=this.KeyWord.ClientID %>").val() == '请输入关键字！') {
  		jQuery("#<%=this.KeyWord.ClientID %>").val('');
  	}
  }
  function keyWordBlur() {
  	if (jQuery("#<%=this.KeyWord.ClientID %>").val() == '') {
		jQuery("#<%=this.KeyWord.ClientID %>").val('请输入关键字！');
	}
}
function savestatus(i) {
	if (i == 0) { $("#showstatus").html("<span style='color:blue' onclick=\"savestatus(1)\">已审核</span>"); $("#status").val(1); };
	if (i == 1) { $("#showstatus").html("<span style='color:red' onclick=\"savestatus(0)\">未审核</span>"); $("#status").val(0); };
}

 </script> 
     <asp:Panel ID="ListPanel" runat="server" Width="100%">
<%if(istop==0){ %>

<% if (teacherid != 0)
   { %>
 <!--当前讲师信息-->
<div class="courseInfoTop teacherInfoTop">
	<asp:PlaceHolder ID="PlaceHolder1"  runat="server"></asp:PlaceHolder>   
</div>
<div class="clear blank20"></div>
<%} %>
<% if (teacherid == 0)
   { %>
	<div id="manage_top" class="menu_top_fixed">
        <ul class="titleTab">
            <li><a href="KS.TcAchieve.aspx">名师评价</a></li>
            <li class="curr"><a href="KS.TcMessage.aspx">名师留言</a></li>
        </ul>
    </div>
    <div class="menu_top_fixed_height"></div> 
<%}%>
<div class="content-area"> 
     <div class="myTitle clearfix">
        <% if (teacherid != 0)
           { %>
           <div class="tabButton">
            <a href="KS.TcCourse.aspx?teacherid=<%=teacherid %>&from=<%=from %>">课程</a>
            <a href="KS.TcZan.aspx?teacherid=<%=teacherid %>&from=<%=from %>">点赞</a>
            <a href="KS.TcCollect.aspx?teacherid=<%=teacherid %>&from=<%=from %>">收藏</a>
            <a class="on" href="KS.TcMessage.aspx?teacherid=<%=teacherid %>&from=<%=from %>">留言</a>
            <a href="KS.TcAchieve.aspx?teacherid=<%=teacherid %>&from=<%=from %>">评价</a>
            <a href="KS.TcDegreeCertificate.aspx?teacherid=<%=teacherid%>&from=<%=from %>" >学历证书</a>
            <a href="KS.TcProfessionCertificate.aspx?teacherid=<%=teacherid%>&from=<%=from %>">职业资格证书</a>
           </div>
        <%} %>
        名师留言
        <!--<asp:Label ID="LabNav" runat="server"></asp:Label>-->
    </div> 
    <%} %>
    <div class="quickSearch clearfix">
        <div class="SearchBox fl">
            <asp:DropDownList ID="Condition" runat="server" style="margin-right:8px;">
                <asp:ListItem Value="1">留言用户</asp:ListItem>
                <asp:ListItem Value="2">教师</asp:ListItem>
                 <asp:ListItem Value="3">发表内容</asp:ListItem>
            </asp:DropDownList>
            <asp:TextBox onfocus="keyWordFocus();" onblur="keyWordBlur();" Style="color: #ccc" Text="请输入关键字！" CssClass="textbox" ID="KeyWord" runat="server" Width="180px"></asp:TextBox>
    
            <b onclick="SetDate()" style="cursor: pointer" class="link-color">日期范围？</b>
            <span id="showdate" <%if (this.TxtBeginDate.Text == "")
                                  { %> style="display: none" <%} %>>
                <asp:TextBox ID="TxtBeginDate" placeholder="格式：YYYY-MM-DD" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
               <asp:TextBox ID="TxtEndDate" placeholder="格式：YYYY-MM-DD" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>
            </span>
            <asp:Button ID="Button1" runat="server" Text="搜索"  CssClass="button"  onclick="Button1_Click" />
        </div>
        <%if(istop==0){ %>   
        <div class="property">
            <div class="name button ml15">筛选</div>
            <div class="propertyBox">
            	<ul class="tabs clearfix">
                    <span class="screen fl">审核状态：</span>
                    <li <%=KSCMS.S("Type")==""?" class='active'":string.Empty %>><a href="KS.TcMessage.aspx?teacherid=<%=teacherid %>"><span>所有列表</span></a></li>
                    <li <%=KSCMS.S("Type")=="1"?" class='active'":string.Empty %>><a href="KS.TcMessage.aspx?Type=1&teacherid=<%=teacherid %>"><span>未审核</span></a></li>
                    <li <%=KSCMS.S("Type")=="2"?" class='active'":string.Empty %>><a href="KS.TcMessage.aspx?Type=2&teacherid=<%=teacherid %>"><span>已审核</span></a></li>
                </ul>
            </div>
        </div>
        <%} %>
    </div>
    <KS:ksgv id="List" runat="server" AutoGenerateColumns="False" EmptyDataText="没有学员留言!" PagerType="CustomNumeric" Width="99%"  CssClass="CTable" GridLines="None" OnRowDataBound="List_RowDataBound" OnRowCommand="List_RowCommand" OnRowCreated="List_RowCreated">
        <Columns>
        <asp:TemplateField HeaderText="&lt;input type='checkbox' name='chkall' id='chkall' onClick='CheckAll(this.form);'/&gt;">
                <itemstyle horizontalalign="Center" width="30px" />
                <itemtemplate>
                <input type="checkbox"  name="ids" id="ids" value="<%#Eval("chatID") %>" />
                </itemtemplate>
            </asp:TemplateField>

             <asp:TemplateField HeaderText="状态">
                    <ItemStyle Width="30px" HorizontalAlign="Center" />
                    <ItemTemplate>
                         <a href="?action=verify&PJID=<%#Eval("chatID")%>" <%# Convert.ToString(Eval("status"))=="0"?"class='no' title='未审核'":"class='ok' title='已审核'" %>></a>
                    </ItemTemplate>
                </asp:TemplateField>
            <asp:TemplateField HeaderText="留言用户">
               <itemstyle width="60" HorizontalAlign="Center" />
                <itemtemplate>
				<%#Eval("username") %>
               <%--<%# Convert.ToString(Eval("status"))== "1" ?"<font color=green>已审核</font>":"<font color=red>未审核</font>" %>--%>
                </itemtemplate>
            </asp:TemplateField>

             <asp:TemplateField HeaderText="留言内容">
            <itemstyle  horizontalalign="Center" width="450px" />
                <itemtemplate> 
                <%# Eval("chatcontent") %>
                </itemtemplate>
            </asp:TemplateField>
            
             <asp:TemplateField HeaderText="留言时间">
            <itemstyle  horizontalalign="Center" width="100px" />
                <itemtemplate> 
                <%# Eval("adddata") %>
                </itemtemplate>
            </asp:TemplateField>
			<asp:TemplateField HeaderText="教师名称">
               <itemstyle width="60" HorizontalAlign="Center" />
                <itemtemplate>
				<%# Eval("tcname") %>            
                </itemtemplate>
            </asp:TemplateField>

             <asp:TemplateField HeaderText="回复内容">
            <itemstyle  horizontalalign="Center" width="450px" />
                <itemtemplate> 
                <%# getReplay(Utils.StrToInt( Eval("chatid").ToString()))  %>
                </itemtemplate>
            </asp:TemplateField>
            
             <asp:TemplateField HeaderText="回复时间">
            <itemstyle  horizontalalign="Center" width="100px" />
                <itemtemplate> 
                <%# Eval("replaydate") %>
                </itemtemplate>
            </asp:TemplateField>
			    <asp:TemplateField HeaderText="回复状态">
            <itemstyle  horizontalalign="Center" width="100px" />
                <itemtemplate> 
             <%# Convert.ToString(Eval("chatstatus"))== "1" ?"<font color=green>已回复</font>":"<font color=red>未回复</font>" %>
                </itemtemplate>
            </asp:TemplateField>
            
             <asp:TemplateField HeaderText="查看">
                <itemstyle horizontalalign="Center" Width="100"/>
             <itemtemplate>
           <asp:LinkButton runat="server" id="showBtn" CssClass="preview" title="查看详情" commandargument=<%#Eval("chatID") %> commandname="show"></asp:LinkButton>
            </itemtemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="删除">
                <itemstyle horizontalalign="Center" Width="100"/>
             <itemtemplate>
             <asp:LinkButton runat="server"  CssClass="delete" id="delet" commandargument=<%# Eval("chatID") %> commandname="del">删除</asp:LinkButton>
            </itemtemplate>
            </asp:TemplateField>
           
        </Columns>
        <HeaderStyle CssClass="CTitle" />
        <EmptyDataRowStyle CssClass="emptycss" />
    </KS:ksgv>
       <%if(teacherid==0){ %>
       <div class="listedit">
           <asp:Button ID="BtnVerify" CssClass="button" runat="server" OnClick="BtnVerify_Click" OnClientClick="return(GetIDS());" text="批量审核"></asp:Button>
           <asp:Button ID="Btnedit" CssClass="button" runat="server" OnClick="BtnUnVerify_Click" OnClientClick="return(GetIDS());" Text="取消审核"></asp:Button>
           <asp:Button ID="Btndel" CssClass="button" runat="server" OnClientClick="return(GetIDS('del'));" OnClick="delclassbutton_Click" Text="删除"></asp:Button>
       </div>
      <%}%>
     <KS:Page ID="Page1" runat="server" />            
</asp:Panel>
<asp:Panel runat="server" ID="showPannel" Visible="false">

    <!--<KS:TopNav ID="top1" Text="查看留言详情"  runat ="server" />-->
    <div class="content-area mt20"> 
		 <div class="myTitle">查看留言详情</div>
         <table width="99%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable"> 
		    <tr>
                 <td align="right" class="lefttd" style="width: 109px; height: 30px"><strong>编号：</strong></td>
                 <td class="righttd" style="height: 30px;">
				  <input type="text" readonly="true" style="border:none" name="courseID" value="<%=dr["chatID"].ToString() %>" />
                 </td>
             </tr>
             <tr>
                 <td align="right" class="lefttd" style="width: 109px; height: 30px"><strong>留言时间：</strong></td>
                 <td class="righttd" style="height: 30px;"><%=dr["adddata"].ToString() %>
                 </td>
             </tr>
		    <tr>
                 <td align="right" class="lefttd" style="width: 109px; height: 30px"><strong>留言姓名：</strong></td>
                 <td class="righttd" style="height: 30px;"><%=dr["username"].ToString() %>
                 </td>
             </tr>

           
		    <tr>
                 <td align="right" class="lefttd" style="width: 109px; height: 30px"><strong>留言内容：</strong></td>
                 <td class="righttd" style="height: 30px;">
					
					<%= ReplaceBBSFun.ReplaceEmot(dr["chatcontent"].ToString().Replace("\n","<br/>"))%>
                      <br />
                     <% string[] chatimg = Utils.SplitString(dr["ChatImg"].ToString(), ",");
                    string replaceimg = string.Empty;
                    if (dr["ChatImg"].ToString() != "")
                    {
                        for (int i = 0; i < chatimg.Length; i++)
                        {
                            replaceimg += "<div class='imgbox' style='width:25%;float:left;margin-top:10px;overflow:hidden;'><span class='imgAuto' style='margin-right:10px; display:block;position:relative;overflow:hidden;'><img src='" + chatimg[i] + "' onerror=this.src='/sysimg/nopic.gif'  style='width:100%'/></span></div> ";
                        }
                    } 
                     Response.Write(replaceimg);
                    
                    %>
                 </td>
             </tr>
			    <%
                     if (dr["chatstatus"].ToString() == "1")
					 {%>
			     <tr>  
				 <td align="right" class="lefttd" style="width: 109px; height: 30px"><strong>回复时间：</strong></td><td class="righttd" style="height: 30px;">

				 <%=dr["replaydate"].ToString() %>
				                                                                                                </td>
             </tr>
			 <%}
	  %>
		    <tr>
                 <td align="right" class="lefttd" style="width: 109px; height: 30px"><strong>教师姓名：</strong></td>
                 <td class="righttd" style="height: 30px;"><%=dr["tcname"].ToString() %>
                 </td>
             </tr>

           
		    <tr>
                 <td align="right" class="lefttd" style="width: 109px; height: 30px"><strong>回复内容：</strong></td>
                 <td class="righttd" style="height: 30px;">
					 <textarea name="TextArea2" style="width:500px;" cols="20" rows="5"><%=DataFactory.GetOnlyValue("select top 1 replaycontent from KS_CourseReplayChat where chatid= "+dr["chatid"].ToString()).ToString().Replace("\n","<br/>")%></textarea>
					<input type="hidden" name="talkcontent" value="<%=DataFactory.GetOnlyValue("select top 1 replaycontent from KS_CourseReplayChat where chatid= "+dr["chatid"].ToString()).ToString().Replace("\n","<br/>")%>" />
                 </td>
             </tr>
           
       
		    <tr>
                 <td align="right" class="lefttd" style="width: 109px; height: 30px"><strong>状态:</strong></td>
				 
                 <td class="righttd" id="showstatus" style="height: 30px;">
                 <%
                     if (dr["chatstatus"].ToString() == "0")
                     {
                         Response.Write("<span class='redFont' onclick=\"savestatus(0)\">未回复</span>");
                     }
                     else
                     {
                         Response.Write("<span class='greenFont' onclick=\"savestatus(1)\">已回复</span>");
                     }
                  %>
				
                 </td>
             </tr>
     		<input type="hidden" id="status" name="status" value="">
		 </table>

         
    	<KS:Foot ID="Foot1" runat="server" OnSubmit="Foot1_Submit" />
		  
		</div>
		</asp:Panel>
	</div>
</asp:Content>


