<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_UserFeePackages" Title="Untitled Page" Codebehind="KS.FeePackages.aspx.cs" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="Kesion.Cache" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="Server">
    <asp:Panel ID="ListPanel" runat="server" Width="100%">
        <div class="listedit">
            <ul>
                <%if(KSCMS.S("action").Equals("detail")){ %>
                <a href="KS.FeePackages.aspx?usetype=1" class="button">返回营销卡列表</a>
                <%} else{ %>
                <div class="floatLeft allCheck">
                <input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);"/><label for="chkall">全选</label>
            </div>
                <!--<li id='p4'><asp:LinkButton ID="editclassbutton" runat="server" OnClick="editclassbutton_Click">编辑营销卡</asp:LinkButton></li>-->
                <asp:LinkButton ID="delclassbutton" runat="server" OnClick="delclassbutton_Click" CssClass="button">删除营销卡</asp:LinkButton>
                <%} %>
            </ul>
        </div>
       
        <div class="content-area mt20">
            <asp:Panel ID="Panel1" runat="server" Width="100%">
                <div class="tabs_header">
                    <ul class="tabs">
                        <li <%=Utils.StrToInt( KSCMS.S("usetype"))==0?" class='active'":string.Empty %>><a href="KS.FeePackages.Aspx"><span>线下营销卡</span></a></li>
                        <li <%=KSCMS.S("usetype")=="1"?" class='active'":string.Empty %>><a href="KS.FeePackages.Aspx?usetype=1"><span>线上营销卡</span></a></li>
                    </ul>
                </div>
                <div class="quickSearch clearfix">
                    <asp:LinkButton ID="addclassbutton" runat="server" OnClick="addclassbutton_Click" CssClass="fr button  button_on ml15">添加营销卡</asp:LinkButton>
                    <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:DropDownList>
                        <asp:TextBox onfocus="keyWordFocus();" onblur="keyWordBlur();" Style="color: #ccc" Text="" CssClass="textbox" ID="KeyWord" runat="server" Width="180px"></asp:TextBox>
                        <asp:Button ID="Button4" runat="server" CssClass="button" OnClick="Button1_Click" Text="开始搜索" />
                    </div>
                </div>
                <KS:KSGV ID="List" CssClass="CTable" runat="server" GridLines="None" AutoGenerateColumns="False" EmptyDataText="没有添加任何营销卡" PagerType="CustomNumeric" Width="99%" OnRowDataBound="List_RowDataBound" OnRowCreated="List_RowCreated" OnRowCommand="List_RowCommand" HorizontalAlign="Center">
                    <Columns>
                        <asp:TemplateField HeaderText="选择">
                            <ItemTemplate>
                                <input type="checkbox" name="ids" id="ids" value="<%#Eval("id") %>" />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Height="30px" Width="60px" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="id" HeaderText="ID" Visible="false">
                            <ItemStyle HorizontalAlign="Center" Width="25px" />
                        </asp:BoundField>

                        
                     	<asp:TemplateField HeaderText="营销卡名称">
                            <ItemStyle HorizontalAlign="Left" Width="200px" />
                            <ItemTemplate>
                            	<%#Eval("title") %>
                                
                            </ItemTemplate>
                        </asp:TemplateField>
						<asp:TemplateField HeaderText="充值卡类型">
                            <ItemStyle HorizontalAlign="Center" Width="60px" />
                            <ItemTemplate>
                                <%# Utils.StrToInt( Eval("cardtype").ToString())==0?"套餐卡":"充值卡" %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="开通有效期">
                            <ItemStyle HorizontalAlign="Center" Width="300px" />
                            <ItemTemplate>
                                <%# GetExpireDate(Convert.ToString(Eval("BeginDate")),Convert.ToString(Eval("EndDate")),Utils.StrToInt(Eval("usetype")))%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="营销卡有效天数">
                            <ItemStyle HorizontalAlign="Center" Width="60px" />
                            <ItemTemplate>
                                <span>
                                 <%#Eval("days") %>
                                 <%#Utils.StrToInt(Eval("cardtype").ToString())==0?Utils.StrToInt(Eval("GiveVIPDay").ToString())==0?"":"<span class='grayFont f12'>(赠送VIP:"+Utils.StrToInt(Eval("GiveVIPDay").ToString())+")</span>":"" %> 
                                </span>
                            </ItemTemplate>
                        </asp:TemplateField>
						
                        <asp:TemplateField HeaderText="营销卡数量">
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                                <%#Eval("usetype").ToString()=="1"? "--":""%>
                                <span style="display: <%#Eval("usetype").ToString()=="1"? "none":""%>"><a class="redFont" href="KS.FeePackagesItem.aspx?id=<%# Eval("id")%>"><%# GetTotal(Utils.StrToInt(Eval("id")))%></a> 张 <a class="greenFont" href="KS.FeePackagesItem.aspx?id=<%# Eval("id")%>">（查看）</a>
                                    <a href="KS.FeePackages.aspx?id=<%#Eval("id") %>&action=Excel" class="greenFont">导出Excel</a>
                                </span>
                            </ItemTemplate>
                        </asp:TemplateField>

                        
                        <asp:TemplateField HeaderText="使用方式">
                            <ItemStyle Width="160px" HorizontalAlign="Center" />
                            <ItemTemplate>
                                <%#Eval("usetype").ToString()=="1"?"线上购买":"线下开通" %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="状态">
                            <ItemStyle Width="60px" HorizontalAlign="Center" />
                            <ItemTemplate>
                                <a href="?action=status&id=<%#Eval("id")%>" <%# Convert.ToString(Eval("status"))=="1"?"class='greenFont' title='正常销售'":"class='redFont' title='停止销售'" %>><%# Convert.ToString(Eval("status"))=="1"?"正常":"停止" %></a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="销售价">
                            <ItemStyle Width="160px" HorizontalAlign="Center" />
                            <ItemTemplate>
                                <%# MyCache.GetCurrencySymbol+ Kesion.APPCode.Public.ReturnShopPrice(Convert.ToString(Eval("price")))+ MyCache.GetCurrencyUnit %>
                            </ItemTemplate>
                        </asp:TemplateField>
                     
                            <asp:TemplateField HeaderText=" 已销售份数">
                            <ItemTemplate>
                                <span  style="color:green">
                                <%# GetUserNum(Convert.ToInt32(Eval("ID"))) %>
                                    </span>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="80px" />
                        </asp:TemplateField>
						<asp:TemplateField HeaderText="生成卡号">
                            <ItemStyle Width="100px" HorizontalAlign="Center" />
                            <ItemTemplate>
                                <a href="?action=pub&id=<%#Eval("id").ToString()%>" class='greenFont'>生成</a>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="编辑">
                            <ItemStyle HorizontalAlign="Center" Width="25px" />
                            <ItemTemplate>
                                <asp:LinkButton CssClass="edit" ToolTip="编辑" ID="LinkButton1" runat="server" CommandArgument='<%#Eval("id") %>' CommandName="modify"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <asp:TemplateField HeaderText="删除">
                            <ItemTemplate>
                                <asp:LinkButton CssClass="delete" ToolTip="删除" runat="server" ID="delete" CommandArgument='<%#Eval("id") %>' CommandName="del"></asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="25px" />
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataRowStyle CssClass="emptycss" />
                    <HeaderStyle CssClass="CTitle" />
                </KS:KSGV>
            </asp:Panel>

            <asp:Panel ID="Panel2" Visible="false" runat="server" Width="100%">
                <div class="myTitle">营销卡购买列表</div>
                <KS:KSGV ID="ChargeList" CssClass="CTable" runat="server" GridLines="None" AutoGenerateColumns="False" EmptyDataText="没有何购买记录" PagerType="CustomNumeric" Width="99%" HorizontalAlign="Center">
                    <Columns>
                        <asp:TemplateField HeaderText=" 用户ID">
                            <ItemTemplate>
                                <%# Eval("userid") %>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="80px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText=" 用户名">
                            <ItemTemplate>
                                <%# Eval("username") %>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="80px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText=" 购买日期">
                            <ItemTemplate>
                                <%# Utils.StrToDateTime(Eval("packbegindate")).ToLongDateString() %>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="80px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="营销卡有时间">
                            <ItemTemplate>
                                <%# Eval("packdays").ToString() %>天
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="80px" />
                        </asp:TemplateField>

                    </Columns>
                    <EmptyDataRowStyle CssClass="emptycss" />
                    <HeaderStyle CssClass="CTitle" />
                </KS:KSGV>

            </asp:Panel>

            <KS:Page ID="Page1" runat="server" />

        </div>
    </asp:Panel>
 
    <asp:Panel ID="AddPanel" runat="server" Width="100%" Visible="false">
        <!--<KS:TopNav ID="TopNav1" runat="server" Text="新增收费营销卡" />-->
        <style>
        #upframe{height:36px !important; vertical-align:middle;}
        </style>
        <script>
            <%=BaseFun.CheckModulePower("exam")?"":" $(function(){ $('#ctl00_KSContent_shoeExam').hide(); })" %>
            	<%=BaseFun.CheckModulePower("exam")?"":" $(function(){ $('#ctl00_KSContent_shoeTrang').hide(); })" %>
			 <%=BaseFun.CheckModulePower("edu")?"":" $(function(){ $('#ctl00_KSContent_shoeCourse').hide(); })" %>
        </script>
        <div class="content-area mt20 md20">
            <div class="myTitle">新增收费营销卡</div>
            <table width="99%" align="center" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable">
               
                  <tbody>  
				   <tr>
                        <td align="right" class="lefttd" height="30" style="width: 102px">
                            <strong>基本信息：</strong></td>
                        <td class="righttd">
                            <div class="message">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="sTable" width="100%">
        <tr>
                    <td align="right" class="lefttd" style="width: 158px; height: 30px">
                        <strong>营销卡类型：</strong></td>
                    <td class="righttd" style="height: 30px">
                        <asp:RadioButtonList ID="IsRecharge" runat="server" RepeatDirection="Horizontal" onclick="IsRecharge()">
                            <asp:ListItem Value="0" Selected="True">套餐卡</asp:ListItem>
                            <asp:ListItem Value="1">充值卡</asp:ListItem>
                        </asp:RadioButtonList></td>
                </tr>
     
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 158px"><b>收费营销卡名称：</b></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtTitle" runat="server" Width="268px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtTitle" ErrorMessage="请填写收费营销卡名称!" Display="Dynamic"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td align="right" class="lefttd" height="30" style="width: 158px">
                        <strong>营销卡简要介绍：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtDescript" runat="server" Height="89px" TextMode="MultiLine" Width="325px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td align="right" class="lefttd" height="30" style="width: 158px">
                        <strong>营销卡图片：</strong></td>
                    <td class="righttd">
                        <table border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td width="470px">
                                    &nbsp;<asp:TextBox ID="PhotoUrl" CssClass="textbox" runat="server" Width="360px"></asp:TextBox><input type="button" class="button" onclick="SelectFiles('<%=this.PhotoUrl.ClientID%>	',0);" value="选择图片" />
                                </td>
                                <td style="width: 120px; text-align: center"><%=Kesion.APPCode.UploadAPI.EchoUpload("classpic",this.PhotoUrl.ClientID) %></td>
                            </tr>
                        </table>
                    </td>
                </tr>
       <tr>
                    <td align="right" class="lefttd" style="width: 158px; height: 30px">
                        <strong>营销卡状态：</strong></td>
                    <td class="righttd" style="height: 30px">
                        <asp:RadioButtonList ID="RdbStatus" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="1" Selected="True">正常使用</asp:ListItem>
                            <asp:ListItem Value="0">停止使用</asp:ListItem>
                        </asp:RadioButtonList></td>
                </tr>
             
    </table></div></td></tr> 

                  </tbody>

                  <tr>
                    <td align="right" class="lefttd" height="30" style="width: 198px">
                        <strong>使用方式：</strong>
                    </td>
                    <td class="righttd">
                        <asp:RadioButtonList onclick="showprice()" ID="UseType" runat="server" RepeatDirection="horizontal">
                            <asp:ListItem Selected Value="0">线下开通</asp:ListItem>
                            <asp:ListItem Value="1">线上购买</asp:ListItem>
                        </asp:RadioButtonList>
                   <%--     <span class="tips">已生成的营销卡无法线上销售</span>--%>
                    </td>
                </tr>

                <tbody>  
				  <tr>
                        <td align="right" class="lefttd" height="30" style="width: 102px"><strong>属性设置：</strong></td>
                        <td class="righttd">
                            <div class="message">
                                <table align="center" border="0" cellpadding="0" cellspacing="0" class="sTable" width="100%">
                                    <tr>
                                        <td align="right" class="lefttd" height="30" style="width: 158px">
                                            <strong>售价：</strong></td>
                                        <td class="righttd"><asp:TextBox ID="TxtPrice" runat="server" CssClass="textbox" Text="100" Width="60px" Style="text-align: center"></asp:TextBox>
                                            <%=MyCache.GetCurrencyUnit %>   <strong id="rechargedays">有效使用：</strong>
                                            <asp:TextBox ID="TxtDays" runat="server" Text="30" CssClass="textbox" Width="60px" Style="text-align: center"></asp:TextBox>天<br />
                    
                                            <div id="yingvip" style="display:none">赠送vip： <asp:TextBox ID="TxtGiveVipDay" runat="server" Text="30" CssClass="textbox" Width="60px" Style="text-align: center"></asp:TextBox>天<span class="tips">(这个天数不能大于有效天数,否则无效）</span>
                     </div>
                    
                                        </td>
                                    </tr>
                                    <tr group="recharge">
                                        <td align="right" class="lefttd" height="30" ><strong>营销卡点数、资金：</strong></td>
                                         <td class="righttd"><asp:TextBox ID="PointNumber" CssClass="textbox" runat="server" Width="60px" Text="50"></asp:TextBox>
                                             <asp:DropDownList ID="PointType" runat="server">
                                                  <asp:ListItem Value="1" >点</asp:ListItem>
                                                  <asp:ListItem Value="2" Selected>元</asp:ListItem>
                                                  <asp:ListItem Value="3">积分</asp:ListItem>
                                                  <asp:ListItem Value="4" Enabled="false">天</asp:ListItem>
                                             </asp:DropDownList>
                                             
                                             <span class="tips">购买人可以得到的点数、资金和积分</span>
                                         </td>
                                     </tr>
                                     <tbody id="nocharge" style="display: none">
                                        <tr>
                                            <td align="right" class="lefttd" height="30" style="width: 198px">
                                                <strong>营销卡前缀：</strong></td>
                                            <td class="righttd"><asp:TextBox CssClass="textbox" ID="TxtCardPrefix" Text="XXK2016" runat="server"  Width="170px" MaxLength="8"></asp:TextBox>
                                                <span style="color: #ff0000">*</span>
                                            </td> 
                                        </tr>
                                        <tr>
                                            <td align="right" class="lefttd" height="30" style="width: 198px">
                                                <strong>有效日期：</strong>
                                            </td>
                                            <td class="righttd">
                                                <asp:TextBox CssClass="textbox Wdate" ID="TxtBeginDate" Width="170px" runat="server" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"></asp:TextBox>至
                                  
                                             
                                                <asp:TextBox CssClass="textbox Wdate" ID="TxtEndDate" Width="170px" runat="server" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"></asp:TextBox>&nbsp;
                                        		<div class="tips Lheight36">过了这个期限学员就不能再激活营销卡</div></td>
                                        </tr>
                                    </tbody>
                                    <tbody group="rehide" id="charge">
                                        <tr>
                                            <td align="right" class="lefttd" height="30" style="width: 158px">
                                                <strong>用户组购买折扣：</strong></td>
                                            <td class="righttd">
                    
                                                <asp:Label ID="LabGroup" runat="server"></asp:Label>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
    						</div>
                        </td>
                   </tr> 
                  <!--用户组设置-->
                 <tbody>  
				   <tr>
                        <td align="right" class="lefttd" height="30" style="width: 102px"><strong>用户组设置：</strong></td>
                        <td class="righttd">
                            <div class="message">
                            	<table align="center" border="0" cellpadding="0" cellspacing="0" class="sTable">
                                    <tr>
                                        <td align="right" class="lefttd">
                                            <strong>允许使用此充值卡的用户组：</strong></td>
                                        <td class="righttd"> 
                                            <asp:Label ID="GroupId" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" class="lefttd" height="30"><strong>购买或开通自动归入用户组：</strong></td>
                                        <td class="righttd">
                                            <asp:DropDownList ID="UsedGroupId" runat="server"></asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" class="lefttd" height="30"><strong>到期自动归入用户组：</strong></td>
                                        <td class="righttd">
                                            <asp:DropDownList ID="EndGroupId" runat="server">
                                            </asp:DropDownList>
                    
                                        </td>
                                    </tr>
                        		</table>
                             </div>
                        </td>
                   </tr>
                  </tbody>



                               
                <!--权限相关设置-->

  <tbody group="rehide">  
				   <tr>
                        <td align="right" class="lefttd" height="30" style="width: 102px">
                            <strong>权限设置：</strong></td>
                        <td class="righttd">
                            <div class="message">
<table>

                <tr group="rehide">
                    <td align="right" class="lefttd" style="width: 158px; height: 30px">
                        <strong>权限设置：</strong></td>
                    <td class="righttd" style="height: 30px">
                        <asp:RadioButtonList ID="RdbLimit" runat="server" onclick="showpurview()">
                            <asp:ListItem Value="1" Selected="True">在有效期内可以查看所有需要收费的内容</asp:ListItem>
                            <asp:ListItem Value="0">按模块设置权限</asp:ListItem>
                        </asp:RadioButtonList>
                        <table border="0" id="purview" runat="server" cellpadding="2" cellspacing="3">
                            <tr>
                                <td>
                                    <strong>内容模型权限：</strong>
                                </td>
                                <td>
                                    <asp:RadioButtonList ID="RdbContentTF" runat="server" onclick="showcontentclass()">
                                        <asp:ListItem Selected="True" Value="0">无权限</asp:ListItem>
                                        <asp:ListItem Value="1">拥有所有权限</asp:ListItem>
                                        <asp:ListItem Value="2">指定有权限查看的栏目</asp:ListItem>
                                    </asp:RadioButtonList>
                                </td>
                                <td>
                                    <div style="border: 5px solid #E7E7E7;" id="contentclass" runat="server">
                                        <strong>详细指定栏目权限</strong>
                                        <table border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td>
                                                    <select name="classid" id="classid" multiple="multiple" size="10" style="width: 300px">
                                                        <%=MyCache.GetClassOptionList(0)%>
                                                    </select>

                                                    <div class="tips">
                                                        可以按CTRL或Shift键多选。
                                                    </div>

                                                    <script>
                                                        function selectclassid(v) {
                                                            var va = v.split(',');
                                                            for (var i = 0; i < jQuery("#classid")[0].options.length; i++) {
                                                                for (var n = 0; n < va.length; n++) {
                                                                    if (va[n] == jQuery("#classid")[0].options[i].value) {
                                                                        jQuery("#classid")[0].options[i].selected = true;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    </script>
                                                </td>
                                            </tr>

                                        </table>

                                    </div>

                                </td>
                            </tr>
              
                            <tr id="shoeExam">
                                <td>
                                    <strong>考试系统权限：</strong>
                                </td>
                                <td>
                                    <asp:RadioButtonList ID="RdbExamTF" runat="server" onclick="showexamclass()">
                                        <asp:ListItem Selected="True" Value="0">无权限</asp:ListItem>
                                        <asp:ListItem Value="1">拥有所有权限</asp:ListItem>
                                        <asp:ListItem Value="2">指定有权限查看的栏目</asp:ListItem>
                                        <asp:ListItem Value="3">限制购买以下试卷使用</asp:ListItem>
                                    </asp:RadioButtonList>
                                </td>
                                <td>

                                    <div style="border: 5px solid #E7E7E7;" id="examclass" runat="server">
                                        <strong>详细指定栏目权限</strong>
                                        <table border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td>
                                                    <asp:ListBox ID="LstSJClassID" Rows="10" runat="server" Style="width: 300px" SelectionMode="Multiple"></asp:ListBox>
                                                    <div class="tips">
                                                        可以按CTRL或Shift键多选。
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>

                                    <div style="border: 0px solid #E7E7E7; display: none" id="examlist" runat="server">
                                        <strong>试卷限制：</strong>
                                        <table border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <%--	<td align="right" class="lefttd" height="30" style="width: 198px">
													</td>--%>
                                                <td class="righttd">
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                <asp:ListBox ID="ExamLists" runat="server" Width="300px" Height="160px" SelectionMode="Multiple"></asp:ListBox>
                                                            </td>
                                                            <td style="line-height: 35px;">
                                                                <input type="button" class="button" value="添加试卷" onclick='parent.openWin("添加试卷", "Exam/KS.AddSj.aspx", false, 800, 400);' />
                                                                <br />
                                                                <input type="button" class="button" value="移除选中试卷" onclick="removeOption(2)" />
                                                                <br />
                                                                <input type="button" class="button" value="全部移除" onclick="removeAllOption(2)" />
                                                            </td>

                                                        </tr>
                                                    </table>
                                                    <div class="tips">
                                                        可以按CTRL或Shift键多选。
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>

                            </tr>

                                          
                            <tr id="shoeTrang">
                                <td>
                                    <strong>练习系统权限：</strong>
                                </td>
                                <td>
                                    <asp:RadioButtonList ID="RdbTrangTF" runat="server" onclick="showtrangclass()">
                                        <asp:ListItem Selected="True" Value="0">无权限</asp:ListItem>
                                        <asp:ListItem Value="1">拥有所有权限</asp:ListItem>
                                        <asp:ListItem Value="2">指定有权限查看的栏目</asp:ListItem>
                                        <%--<asp:ListItem Value="3">限制购买以下试卷使用</asp:ListItem>--%>
                                    </asp:RadioButtonList>
                                </td>
                                <td>

                                    <div style="border: 5px solid #E7E7E7;" id="trangclass" runat="server">
                                        <strong>详细指定栏目权限</strong>
                                        <table border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td>
                                                    <asp:ListBox ID="tranglist" Rows="10" runat="server" Style="width: 300px" SelectionMode="Multiple"></asp:ListBox>
                                                    <div class="tips">
                                                        可以按CTRL或Shift键多选。
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>                             
                                </td>

                            </tr>

                      
                            <tr id="shoeCourse">
                                <td>
                                    <strong>课程系统权限：</strong>
                                </td>

                                <td class="righttd">
                                    <asp:RadioButtonList ID="RdbCourseTF" onclick="showtypes()" runat="server">
                                        <asp:ListItem Selected="True" Value="0">无权限</asp:ListItem>
                                        <asp:ListItem Value="1">拥有所有权限(仅限在线课程）</asp:ListItem>
                                        <asp:ListItem Value="2">按在线课程分类限制</asp:ListItem>
                                        <asp:ListItem Value="3">限制购买以下课程才可以使用</asp:ListItem>
                                    </asp:RadioButtonList></td>
                                <td>
                                    
                                    <div style="border: 0px solid #E7E7E7; display: none" id="showClass" runat="server">
                                        <strong><span style="background-color: #f0f9fe">在线课程分类限制</span>：</strong>
                                        <table border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td class="righttd">
                                                    <select name="ClassIDs" id="ClassIDs" style="width: 300px; height: 120px;" multiple="multiple" size="10">
                                                         <%if (BaseFun.CheckModulePower("edu"))
                                                             { %>
                                                        <%=GetCourseClass("0") %>
                                                        <%} %>
                                                    </select>
                                                    <br />
                                                    <div class="tips">
                                                        可以按CTRL或Shift键多选。
                                                    </div>
                                                </td>
                                            </tr>

                                        </table>
                                    </div>

                                    <div style="border: 0px solid #E7E7E7; display: none" id="showPro" runat="server">
                                        <strong>课程限制：</strong>
                                        <table border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td class="righttd">
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                <asp:ListBox ID="LsbLimitIds" runat="server" Width="300px" Height="160px" SelectionMode="Multiple"></asp:ListBox>
                                                            </td>
                                                            <td style="line-height: 35px;">

                                                                <input type="button" class="button" value="添加在线课程" onclick='parent.openWin("添加网授课程", "Course/KS.AddCourse.aspx?type=0&action=feepackages", false, 800, 400);' />
                                                                <br />
                                                                 <input type="button" class="button" value="添加面授课程" onclick='parent.openWin("添加面授课程", "Course/KS.AddCourse.aspx?type=1", false, 800, 400);' />
                                                                <br />
                                                                <input type="button" class="button" value="移除选中在线课程" onclick="removeOption(0)" />
                                                                <br />
                                                                <input type="button" class="button" value="全部移除" onclick="removeAllOption(0)" />
                                                            </td>

                                                        </tr>

                                                    </table>
                                                    <div class="tips">
                                                        可以按CTRL或Shift键多选。
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                    
                                   
                                    
                                </td>
                            </tr>
                          
                        </table>
                    </td>
                </tr>
            
                          
                        </table>
                    </td>
                </tr>

                <tbody group="rehide" id="buyagreement">
                      <tr>
                        <td align="right" class="lefttd" style="width: 158px; height: 30px">
                            <strong>是否开启升级模式：</strong></td>
                        <td onclick="funIsUp()" class="righttd" style="height: 30px">
                            <asp:RadioButtonList ID="IsUp" runat="server" RepeatDirection="Horizontal">
                                <asp:ListItem Selected="True" Value="0">关闭</asp:ListItem>
                                <asp:ListItem Value="1">开启</asp:ListItem>
                            </asp:RadioButtonList>
                            <span class="tips">开启升级后，用户购买的营销卡必须逐级递增</span>
                        </td>
                    </tr>
                    <tr id="truporder">
                        <td align="right" class="lefttd" style="width: 158px; height: 30px">
                            <strong>升级顺序：</strong></td>
                        <td class="righttd" style="height: 30px">
                            <asp:DropDownList ID="UpOrder" runat="server">
                                <asp:ListItem Value="0" Selected="True">选择顺序</asp:ListItem>
                            </asp:DropDownList>
                            <span class="tips">序号越大，级别越高</span>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="lefttd" style="width: 158px; height: 30px">
                            <strong>是否开启协议：</strong></td>
                        <td class="righttd" style="height: 30px" onclick="IsOnidentity()">
                            <asp:RadioButtonList ID="Identity" runat="server" RepeatDirection="Horizontal">
                                <asp:ListItem Value="0" Selected="True">关闭</asp:ListItem>
                                <asp:ListItem Value="1">开启</asp:ListItem>
                            </asp:RadioButtonList>
                            <span class="tips">开启协议后，用户购买营销卡需要填写个人信息</span>
                        </td>
                    </tr>
                    <tr id="agreement">
                        <td align="right" class="lefttd" height="30"><strong>购买协议：</strong></td>
                        <td class="righttd">
                            <asp:TextBox ID="TxtTarget" TextMode="MultiLine" Width="700px" Height="500px" runat="server"></asp:TextBox>
                            <% Kesion.APPCode.EditorAPI.EchoEditor("editor", this.TxtTarget.ClientID, "Basic");%>
                              <br />
                            <span class="tips">需要用户输入的内容用<span style="color:red">{#input1},{#input2},{#input3}...{#input100}</span>来标识，最高允许用户输入100个文本内容</span>
                        </td>
                    </tr>
                </tbody>

       </table></div></td></tr> 

      </tbody>
             



            </table>
            <!--权限设置相关脚本-->
            <script type="text/javascript">
             
      //权限设置
           function showpurview() {
               var checkrad = jQuery("#<%=this.RdbLimit.ClientID %> :radio[checked]").val();
               if (checkrad == "1") {
                   jQuery("#<%=this.purview.ClientID%>").hide();
               } else {
               jQuery("#<%=this.purview.ClientID%>").show();
               }
           }
                //内容模型权限设置
           function showcontentclass() {
               var checkrad = jQuery("#<%=this.RdbContentTF.ClientID %> :radio[checked]").val();
               if (checkrad == "2") {
                   jQuery("#<%=this.contentclass.ClientID%>").show();
               } else {
               jQuery("#<%=this.contentclass.ClientID%>").hide();
               }
           }
                //考试系统权限设置
           function showtrangclass() {
               var checkrad = jQuery("#<%=this.RdbTrangTF.ClientID %> :radio[checked]").val();
               if (checkrad == "2") {
               	jQuery("#<%=this.trangclass.ClientID%>").show(); 
            	
               }           
               else {
               	jQuery("#<%=this.trangclass.ClientID%>").hide();
            
               }
           }
                //考试系统权限设置
                function showexamclass() {
                    var checkrad = jQuery("#<%=this.RdbExamTF.ClientID %> :radio[checked]").val();
               if (checkrad == "2") {
                   jQuery("#<%=this.examclass.ClientID%>").show(); 
                   jQuery("#<%=this.examlist.ClientID%>").hide(); 
               }
               else if (checkrad == "3")
               {
                   jQuery("#<%=this.examclass.ClientID%>").hide(); 
                   jQuery("#<%=this.examlist.ClientID%>").show(); 
               }
               else {
                   jQuery("#<%=this.examclass.ClientID%>").hide();
                   jQuery("#<%=this.examlist.ClientID%>").hide(); 
               }
       }
                //课程系统权限设置
       	function showtypes() {
       		
       		var checkrad = jQuery("#<%=RdbCourseTF.ClientID %> :radio[checked]").val();
       
                  if (checkrad == 2) {
                    
                      jQuery("#<%=this.showClass.ClientID%>").show();
                      jQuery("#<%=this.showPro.ClientID%>").hide();                 
                    

                } else if (checkrad == 3) {
                    //在线课程
                       
                      jQuery("#<%=this.showClass.ClientID%>").hide();
                      jQuery("#<%=this.showPro.ClientID%>").show();
                     
                }
                else {
                    
					jQuery("#<%=this.showClass.ClientID%>").hide();
                    jQuery("#<%=this.showPro.ClientID%>").hide();
				}
                }
                function showFaceSelect(s) {
                 //面授
                    if (s == '') return;
                    var idArr = s.split(',');
                    for (var i = 0; i < idArr.length; i++) {
                        jQuery("#FaceClassIDs option[value=" + idArr[i] + "]").attr("selected", true);
                    }
                }
                function showSelect(s) {
                    if (s == '') return;
                    var idArr = s.split(',');
                    for (var i = 0; i < idArr.length; i++) {
                        jQuery("#ClassIDs option[value=" + idArr[i] + "]").attr("selected", true);
                    }
                }

           jQuery(document).ready(function() {
               showpurview();
               showcontentclass();
               showexamclass();
               showtrangclass();
               showtypes();
               funIsUp();
           });

                //选择模块下的指定项目
			  function addOption(str, id) {
                  if (id == 0) {
                      if (str != '') {
                          var arr = str.split(',');
                          var ostr = '';
                          for (var i = 0; i < arr.length; i++) {
                              var oarr = arr[i].split('|');
                              var has = false;
                              jQuery("#<%=this.LsbLimitIds.ClientID%> option").each(function () {
                                  if (jQuery(this).val() == oarr[0]) {
                                      has = true;
                                  }
                              });
                              if (has == false) {
                                  ostr += "<option value='0|" + oarr[0] + "'>" + oarr[1] + "</option>";
                              }
                          }
                          jQuery("#<%=this.LsbLimitIds.ClientID %>").append(ostr);
                      }
                      jQuery("#<%=this.LsbLimitIds.ClientID%> option").attr("selected", true);
                      parent.box.close();
                  }
                    else if (id == 1) {
			  		if (str != '') {
			  			var arr = str.split(',');
			  			var ostr = '';
			  			for (var i = 0; i < arr.length; i++) {
			  				var oarr = arr[i].split('|');
                              var has = false;
                              jQuery("#<%=this.LsbLimitIds.ClientID%> option").each(function () {
						  	    if (jQuery(this).val() == oarr[0]) {
						  	        has = true;
						  	    }
						  	});
						  	if (has == false) {
						  	    ostr += "<option value='1|" + oarr[0] + "'>" + oarr[1] + "</option>";
						  	}
                          }
                          jQuery("#<%=this.LsbLimitIds.ClientID %>").append(ostr);
			  		}
                   jQuery("#<%=this.LsbLimitIds.ClientID%> option").attr("selected", true);
			  	    parent.box.close();
                    }
			     	else if (id == 2) {   //考试

			  	    if (str != '') {
			  	        var arr = str.split(',');
			  	        var ostr = '';
                            for (var i = 0; i < arr.length; i++) {
                                var oarr = arr[i].split('|');
                                var has = false;
                                jQuery("#<%=this.ExamLists.ClientID%> option").each(function () {
                                    if (jQuery(this).val() == oarr[0]) {
                                        has = true;
                                    }
                                });
                                if (has == false) {
                                    ostr += "<option value='" + oarr[0] + "'>" + oarr[1] + "</option>";
                                }

                            }
                        jQuery("#<%=this.ExamLists.ClientID %>").append(ostr);
			  		}
                      jQuery("#<%=this.ExamLists.ClientID%> option").attr("selected", true);
			  	    parent.box.close();

			  	}
			  }
                //删除模块下的指定项目
          function removeOption(id) {
              if (id == 0) {
                  //在线
                  var dest = document.getElementById('<%=this.LsbLimitIds.ClientID%>');
                  for (var i = dest.options.length - 1; i >= 0; i--) {
                      if (dest.options[i].selected) {
                          dest.options[i] = null;
                      }
                  }
                  jQuery("#<%=this.LsbLimitIds.ClientID%>>option").attr("selected", true);
              }
              else if (id ==2) {
                  //考试
                  var dest = document.getElementById('<%=this.ExamLists.ClientID%>');
                  for (var i = dest.options.length - 1; i >= 0; i--) {
                      if (dest.options[i].selected) {
                          dest.options[i] = null;
                      }
                  }
                  jQuery("#<%=this.ExamLists.ClientID%>>option").attr("selected", true);
              } 
          }
                //删除所有模块下的指定项目
    function removeAllOption(id) {
        if (id == 0) {
            jQuery("#<%=this.LsbLimitIds.ClientID%>").empty();
        }
        else if (id ==2) {
            jQuery("#<%=this.ExamLists.ClientID%>").empty();
        }
        
}

            </script>

            <script>
                //套餐包与充值卡判断
                function IsRecharge() {
                    var checkrad = jQuery("#<%=IsRecharge.ClientID %> :radio[checked]").val();
                    if (checkrad == 1) {
                        $("#rechargedays").html("赠送vip：");
                        $("#yingvip").hide();
                        $("tbody").each(function(){
                            if($(this).attr("group")=="recharge")
                            {
                                $(this).show();
                            }
                            if($(this).attr("group")=="rehide")
                            {
                                $(this).hide();
                            }
                        })
                        $("tr").each(function(){
                            if($(this).attr("group")=="recharge")
                            {
                                $(this).show();
                            }
                            if($(this).attr("group")=="rehide")
                            {
                                $(this).hide();
                            }
                        })

                    } else {
                        $("#rechargedays").html("营销卡有效使用天数");
                        $("#yingvip").show();
                        $("tbody").each(function(){
                            if($(this).attr("group")=="recharge")
                            {
                                $(this).hide();
                            }
                            if($(this).attr("group")=="rehide")
                            {
                                $(this).show();
                            }
                        })
                        $("tr").each(function(){
                            if($(this).attr("group")=="recharge")
                            {
                                $(this).hide();
                            }
                            if($(this).attr("group")=="rehide")
                            {
                                $(this).show();
                            }
                        })
                    }
                    showprice();
                 }
                //线上与线下判断
                function showprice() {
                    var checkrad = jQuery("#<%=UseType.ClientID %> :radio[checked]").val();
                       if (checkrad == 1) {
                           jQuery("#nocharge").hide();
                           if(jQuery("#<%=IsRecharge.ClientID %> :radio[checked]").val()!=1){//充值卡不显示charge的内容
                               jQuery("#charge").show();
                           }     
                           $("#buyagreement").show();//协议
                       } else {
                               jQuery("#charge").hide();
                               jQuery("#nocharge").show();
                               $("#buyagreement").hide();//协议
                       }
                     
                   }

                //是否开启升级模式
                function funIsUp() {
                    var checkrad = jQuery("#<%=this.IsUp.ClientID %> :radio[checked]").val();
			        if (checkrad == "1") {
			            jQuery("#truporder").show();
			        } else {
			            jQuery("#truporder").hide();
			        }
                }
                //是否开启协议
                function IsOnidentity()
                {
                    var checkrad = jQuery("#<%=this.Identity.ClientID %> :radio[checked]").val();
                    if (checkrad == "1") {
                        jQuery("#agreement").show();
                    } else {
                        jQuery("#agreement").hide();
                    }
                }

            </script>
               <script>
                
                   $(document).ready(function () {
                       IsRecharge();
                       showprice();
                       IsOnidentity();
    	  
    	});
    
    </script>

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

    </div>  
</asp:Content>

