<%@ Page Language="C#" ValidateRequest="false" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_UserMessage" Title="站内消息管理" Codebehind="KS.UserMessage.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">

 <asp:Panel ID="Panel1" runat="server">    
<div class="content-area mt20">
	
	 <div class="myTitle">
    	站内短消息管理
     </div> 
     <div class="quickSearch clearfix">
        <div class="SearchBox fl">
            <asp:TextBox ID="TxtKeyWord" runat="server" CssClass="textbox" Width="200px" />
            <asp:DropDownList ID="DrpSearchType" runat="server" style="margin-right:8px;">
                 <asp:ListItem Value="0">接收者</asp:ListItem>
                 <asp:ListItem Value="1">发送者</asp:ListItem>
                 <asp:ListItem Value="2">标题</asp:ListItem>
                 <asp:ListItem Value="3">消息内容</asp:ListItem>
             </asp:DropDownList>
             <asp:RadioButtonList ID="RdbStatus" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                  <asp:ListItem Value="0" Selected="True">所有</asp:ListItem>
                  <asp:ListItem Value="1">已读</asp:ListItem>
                  <asp:ListItem Value="2">未读</asp:ListItem>
             </asp:RadioButtonList>
             <asp:Button ID="BtnSearch" runat="server" CssClass="button" Text=" 开始搜索 " OnClick="BtnSearch_Click" />
         </div>
         <input type="button" value="发送站内消息" onclick="location.href='KS.UserMessage.aspx?action=send';" class="fr button button_on" />
     </div>  
 	 <div>
        <KS:KSGV ID="MessageView" cssclass="CTable" runat="server" AutoGenerateColumns="False" DataKeyNames="FieldID" GridLines="None"
            OnRowDataBound="FieldListView_RowDataBound" OnRowCommand="list_RowCommand" PagerType="CustomNumeric" Width="99%" EnableTheming="True" HorizontalAlign="Center" EmptyDataText="找不到短消息发送记录!">
            <Columns>
                <asp:TemplateField HeaderText="选择">
                <itemstyle horizontalalign="Center" width="50px" />
                <itemtemplate>
                    <input type="checkbox"  name="ids" id="ids" value='<%#Eval("id") %>' />
                </itemtemplate>
              </asp:TemplateField>
              <asp:TemplateField HeaderText="标题">
                <ItemTemplate>
                <span style="cursor:pointer" onmousedown='parent.openWin("查看短消息详情","<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/user/KS.UserMessageShow.aspx?ID="+<%# Eval("ID") %>,false);return false;'><%# Eval("MsgTitle") %></span>
                </ItemTemplate>
              </asp:TemplateField>
               
                <asp:BoundField DataField="fromusername" HeaderText="发送者">
                  <itemstyle horizontalalign="Center" width="80px" />
                </asp:BoundField>
                <asp:BoundField DataField="tousername" HeaderText="接收者">
                  <itemstyle horizontalalign="Center" width="80px" />
                </asp:BoundField>

                <asp:BoundField DataField="adddate" HeaderText="发送时间">
                <itemstyle horizontalalign="Center" width="120px" />
                </asp:BoundField>
               <asp:TemplateField HeaderText="已读">
                <itemstyle horizontalalign="Center" width="50px" />
                <itemtemplate>
                    <a href="javascript:;" <%# Convert.ToString(Eval("readtf"))=="1"?"class='ok' title='已读'":"class='no' title='未读'" %>></a>

                </itemtemplate>
               </asp:TemplateField>
            
            <asp:TemplateField HeaderText="修改">
              <itemstyle width="30px" horizontalalign="Center"/>
              <itemtemplate>
                      <asp:LinkButton CssClass="edit" ToolTip="修改" ID="LinkButton1" runat="server" commandargument=<%#Eval("id") %> commandname="modify"></asp:LinkButton>
              </itemtemplate>
            </asp:TemplateField>

                <asp:TemplateField HeaderText="删除">
                <itemstyle width="30px" horizontalalign="Center"/>
                <itemtemplate>
                      <asp:LinkButton CssClass="delete" ToolTip="删除" runat="server" id="delete" commandargument=<%#Eval("id") %> commandname="del"></asp:LinkButton>
               </itemtemplate>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle CssClass="CTitle" />
            <EmptyDataRowStyle CssClass="emptycss" />
        </KS:KSGV>
        <asp:Panel ID="Panel3" runat="server" Height="30px">
           <div class="listedit">
                <input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);"/><label for="chkall">全选</label>
                <input type="button" value="删除选中的消息" class="button" onclick="if (GetIDS('del')){this.form.action='?action=del';this.form.submit()}" id="Button1" />
                
            </div>
</asp:Panel>  

        </div>
        
          <KS:Page ID="Page1" runat="server" />
           
         
    <div style="border:1px dashed #cccccc; background-color:#f0f9fe; margin-top:10px ;padding:10px; text-align: left; font-size: 12px;">
     <strong>特别提醒：</strong> 如果短消息表记录太多，影响了系统性能，可以删除一定时间段前的记录以加快速度。 
     <div>
     <strong>删除范围：</strong><asp:RadioButtonList ID="RdbDelType" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
      <asp:ListItem Value="1">10天前</asp:ListItem>
      <asp:ListItem Value="2">1个月前</asp:ListItem>
      <asp:ListItem Value="3">2个月前</asp:ListItem>
      <asp:ListItem Value="4">3个月前</asp:ListItem>
      <asp:ListItem Value="5">6个月前</asp:ListItem>
      <asp:ListItem Value="6" Selected>1年前</asp:ListItem>
         </asp:RadioButtonList>
         
         <asp:CheckBox ID="chkReadTF" runat="server" Text="包括未读的消息" />
         <asp:Button ID="BtnDel" runat="server" Text="执行删除" OnClick="BtnDel_Click" CssClass="button" /></div>
     </div>
         
        <script type="text/javascript">
            showtips('<span class="state"><strong>说明：</strong><br /></span>这里可以查看站内会员的消息发送情况，不建议随便修改或是删除会员的消息内容!');
		</script>
 
 </asp:Panel>
 </div>
 <asp:Panel ID="Panel2" runat="server" Visible="false">
<div class="content-area mt20">
	 <div class="myTitle"><a href='KS.UserMessage.aspx' class="fr button mr20">返回</a>发送站内短消息</div>
     <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable"> 
          <tr>
            <td class="lefttd" height="30" align="right" style="width: 146px"><b>收件人选择：</b></td>
            <td class="righttd">
                <input type="radio" name="optype" onclick="jQuery('#grouparea').hide(); jQuery('#classinfo').hide(); jQuery('#departarea').hide();" value="1"<%=string.IsNullOrEmpty(KSCMS.S("userid"))?" checked":"" %> />所有会员(<span style="color:red"><%=DataFactoryUser.GetOnlyValue("select count(1) From KS_User") %></span>位)<br />
                <input type="radio" name="optype" onclick="jQuery('#grouparea').show(); jQuery('#classinfo').hide(); jQuery('#departarea').hide();" value="2" />指定会员组<br />
                <div id="grouparea" style="display:none">
                <%=BaseFun.GetUserGroup_CheckBox("groupid",4,"0") %>
                </div>   
                <input type="radio" name="optype" onclick="jQuery('#grouparea').hide(); jQuery('#departarea').show(); jQuery('#classinfo').hide(); " value="5" />指定部门<br />
                <div id="departarea" style="display:none">
                    <select name="departid">
                    <%=BaseFun.GetSQLOption("select DepartID,DepartMentName from KS_UserDepartment ","0") %>
                    </select>
                </div>
                <%if (BaseFun.CheckModulePower("edu")) { %>
                <input type="radio" name="optype" onclick="jQuery('#grouparea').hide(); jQuery('#classinfo').show(); jQuery('#departarea').hide();"  value="6" />指定班级<br />
                <div id="classinfo" style="display:none">
                    <select name="classroomid">
                    <%=BaseFun.GetSQLOption("select RoomID,Title from KS_CosClassRoom ","0") %>
                    </select>
                </div>
                <%} %>
                <input type="radio" name="optype" onclick="jQuery('#grouparea').hide(); jQuery('#classinfo').hide(); jQuery('#departarea').hide();" value="3"<%=!string.IsNullOrEmpty(KSCMS.S("userid"))?" checked":"" %> />指定用户名&nbsp;&nbsp;<asp:TextBox ID="ToUserName" runat="server" Width="246px" CssClass="textbox"></asp:TextBox><span class="tips">多个用户名间请用<font class="redFont">英文的逗号</font>分隔</span></td>
          </tr>
         <tr>
             <td align="right" class="lefttd" height="30" style="width: 146px">
                 <strong>消息标题：</strong></td>
             <td class="righttd">
                 <asp:TextBox CssClass="textbox" ID="Subject" runat="server" Width="500px"></asp:TextBox>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="请输入消息标题" ControlToValidate="Subject"></asp:RequiredFieldValidator></td>
         </tr>
         <tr>
             <td align="right" class="lefttd" height="30" style="width: 146px">
                 <strong>消息内容：</strong>
                 <div class="tips">
                 <strong>可用标签：</strong><br />
                 {$UserName} -用户名<br />
                 {$RealName} -姓名<br />
                 {$Sex} -先生或是女士<br />
                 {$SiteName} -网站名称<br />
                 {$SendTime} -发送时间<br />
                 {$SendDate} -发送日期<br />
                 </div>

             </td>
             <td class="righttd">
                    <asp:TextBox ID="Content" TextMode="multiLine" style="width:95%;height:250px;" runat="server"></asp:TextBox>
                    <% Kesion.APPCode.EditorAPI.EchoEditor("editor", this.Content.ClientID, "Common");%>

             </td>
         </tr>
         <tr>
             <td align="right" class="lefttd" height="30" style="width: 146px">
                 <strong>发件人：</strong></td>
             <td class="righttd">
                 系统消息</td>
         </tr>

        </table>
    <br />
    <KS:Foot ID="Foot1" runat="server" SubmitButtonText="开始发送(0)" OnSubmit="Foot1_Submit" />
  </asp:Panel>
</div>  
  
   <asp:Panel ID="Panel4" runat="server" Visible="false">
    <!--<KS:TopNav ID="TopNav3" runat="server" Text="修改站内短消息" />-->
<div class="content-area mt20">    
     <div class="myTitle">修改站内短消息</div>
     <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable"> 
          <tr>
            <td class="lefttd" height="30" align="right" style="width: 146px"><b>收件人：</b></td>
            <td class="righttd">
            <asp:Label ID="LabToUser" runat="server"></asp:Label>
            </td>
          </tr>
          <tr>
            <td class="lefttd" height="30" align="right" style="width: 146px"><b>发件人：</b></td>
            <td class="righttd">
            <asp:Label ID="LabFromUser" runat="server"></asp:Label>
            </td>
          </tr>
          <tr>
            <td class="lefttd" height="30" align="right" style="width: 146px"><b>发件时间：</b></td>
            <td class="righttd">
            <asp:Label ID="LabAddDate" runat="server"></asp:Label>
            </td>
          </tr>
         <tr>
             <td align="right" class="lefttd" height="30" style="width: 146px">
                 <strong>消息标题：</strong></td>
             <td class="righttd">
                 <asp:TextBox ID="TxtMsgTitle" CssClass="textbox" runat="server" Width="308px"></asp:TextBox>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="请输入消息标题" ControlToValidate="TxtMsgTitle"></asp:RequiredFieldValidator></td>
         </tr>
         <tr>
             <td align="right" class="lefttd" height="30" style="width: 146px">
                 <strong>消息内容：</strong></td>
             <td class="righttd">
                   <asp:TextBox ID="TxtMsgContent" TextMode="multiLine" style="width:95%;height:250px;" runat="server"></asp:TextBox>
                    <% Kesion.APPCode.EditorAPI.EchoEditor("editor", this.TxtMsgContent.ClientID, "Common");%>

             </td>
         </tr>


        </table>
    <asp:HiddenField ID="HidField" runat="server" Value="0" />
    <KS:Foot ID="Foot2" runat="server" SubmitButtonText="确定修改(0)" OnSubmit="Foot2_Submit" />
  </asp:Panel>
 </div> 
</asp:Content>

