<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_Label_CourseList" Title="课程列表标签" Codebehind="KS.Label.CosList.aspx.cs" %>
<%@ Register Src="~/Config/Control/manage/LabelJS.ascx" TagName="LabelJS" TagPrefix="uc1" %>
<%@ Import Namespace="Kesion.Cache"%>
<%@ Import Namespace="Kesion.BLL"%>
<%@ Import Namespace="Kesion.Publics"%>

<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
<uc1:LabelJS ID="LabelJS1" runat="server"/>
<script type="text/javascript">
    function selectclassid(v) {
        var va = v.split(',');
        for (var i = 0; i < jQuery("#<%=this.LstClassID.ClientID %>")[0].options.length; i++) {
            for (var n = 0; n < va.length; n++) {
                if (va[n] == jQuery("#<%=this.LstClassID.ClientID %>")[0].options[i].value) {
                    jQuery("#<%=this.LstClassID.ClientID %>")[0].options[i].selected = true;
                }
            }
        }
    }

  function checkform()
  {
   if (jQuery("#<%=this.LabelName.ClientID%>").val()=="")
   {
   KesionJS.Alert('请输入标签名称!',"jQuery('#<%=this.LabelName.ClientID%>').focus();");
   return false;
   }
   

      var ajax = 0;
   
      if (jQuery("#<%=this.ChkAjax.ClientID %>")[0].checked) ajax = 1;
      var autoarea = 0;
   if (jQuery('#<%=this.CkbArea.ClientID %>')[0].checked) autoarea = 1;
   var classid='';
   jQuery("#<%=this.LstClassID.ClientID %> option:selected").each(function() {
		if (jQuery(this).val()!='0')
			if (classid=='') 
				 classid=jQuery(this).val() 
			else
				 classid+=","+jQuery(this).val();
		})
   if (classid=='') classid='0';


   var recommends = 0;
   if (jQuery("#<%=this.Attribute.ClientID %>_0")[0].checked)
       recommends = 1;
   var popular = 0;
   if (jQuery("#<%=this.Attribute.ClientID %>_1")[0].checked)
       popular = 1;
   var istop = 0;
   if (jQuery("#<%=this.Attribute.ClientID %>_2")[0].checked)
       istop = 1;
      var huandeng = 0;
   if (jQuery("#<%=this.Attribute.ClientID %>_3")[0].checked)
       huandeng = 1;
      var is3g = 0;
   if (jQuery("#<%=this.Attribute.ClientID %>_4")[0].checked)
          is3g = 1;
      var isgeneralize = 0;
      if (jQuery("#<%=this.Attribute.ClientID %>_5")[0].checked)
          isgeneralize = 1;
      var LiveState = 0;
      if (jQuery("#<%=this.LiveState.ClientID %>").checked)
          LiveState = 1;
   var childclass=0;
   if (jQuery('#<%=this.ChildClass.ClientID %>')[0].checked) childclass = 1;
      var IsCharge = $("#<%=this.RdbIsCharge.ClientID %> :radio[checked]").val();
   var isEp=0;
      if (jQuery('#<%=this.IsEp.ClientID %>')[0].checked) isEp = 1;
      var courseType = $("#<%=this.RdbCourseType.ClientID%> :radio[checked]").val();
   
    var str = '{KS:Label Type="coslist"'
        + ' IsCustom="' + $("#custom").val() + '"'//是否使用自定义字段
        + ' ClassID="' + classid + '"'
        + ' ChildClass="' + childclass + '"'
        + ' Recommend="' + recommends + '"'
        + ' autocosarea="' + autoarea + '"'
        + ' LiveState="' + LiveState + '"'
        + ' popular="' + popular + '"'
        + ' istop="' + istop + '"'
        + ' courseType="' + courseType + '"'
        + ' huandeng="' + huandeng + '"'  //
        + ' isgeneralize="' +isgeneralize + '"'
         + ' is3g="' + is3g + '"'
        + ' IsCharge="' + IsCharge + '"'
        + ' IsEp="' + isEp + '"'
        + ' Order="' + jQuery('#<%=this.Order.ClientID %>').val() + '"'
        + ' Num="' + jQuery('#<%=this.Num.ClientID %>').val() + '"'
        + ' SQLCondition="' + jQuery('#<%=this.SQLCondition.ClientID %>').val() + '"'
        + ' Ajax="' + ajax + '" TeachWay="' + jQuery("#<%=this.DrpTeachWay.ClientID%> option:selected").val() + '"'
        + ' ProvinceID="' + jQuery("#<%=this.DrpProvince.ClientID %> option:selected").val() + '"'
        + ' Promotion="' + jQuery("#<%=this.drpPromotion.ClientID %> option:selected").val() + '"'
        + '}' + jQuery('#<%=this.LoopBody.ClientID%>').val() + '{/KS:Label}';
    jQuery("#<%=this.LabelContent.ClientID %>").val(str); 
  }
  function purview() {
      parent.openWin("自动编号变量样式预览", "../admin/include/autoid.html", false, 650, 230);
  }

  var pos = null;
  function setPos() {
      if (document.all) {
          jQuery("#<%=this.LoopBody.ClientID %>").focus();
          pos = document.selection.createRange();
      } else {
          pos = jQuery("#<%=this.LoopBody.ClientID %>")[0].selectionStart;
      }
  }
  //插入到循环体
  function InsertValue(Val) {
      if (pos == null) { KesionJS.Alert( '请先定位插入位置!', null); return false; }
      if (document.all) {
          pos.text = Val;
      } else {
          var obj = jQuery("#<%=this.LoopBody.ClientID %>");
          var lstr = obj.val().substring(0, pos);
          var rstr = obj.val().substring(pos);
          obj.val(lstr + Val + rstr);
      }
  }

  function InsertLabel(fieldname, fieldtype) {
      dragclear();
      if (pos == null) { KesionJS.Alert( '请先定位插入位置!', null); return false; }
      var link="<%=MyCache.GetCacheConfig(0)+MyCache.GetCacheConfig(4)%>/label/KS.GetFieldParam.aspx?m_fieldname=" + fieldname + "&fieldtype=" + fieldtype;
      parent.openWin('插入字段标签', link, false, 420, 250);
  }


  var fieldname, fieldtype;
  function DragStart() {
      dragclear();
      window.drag = 1;
      dragspan = document.createElement('div');
      dragspan.style.position = "absolute";
      dragspan.className = "div";
      var mousePos = mouseCoords(window.event);
      dragspan.style.left = mousePos.x + 10;
      dragspan.style.top = mousePos.y + 8;
      fieldname = window.event.srcElement.id;
      fieldtype = window.event.srcElement.fieldtype;
      dragspan.appendChild(document.createTextNode(window.event.srcElement.innerHTML));
      document.body.appendChild(dragspan);
  }
  function SetValue() {
      setPos();
      var link="<%=MyCache.GetCacheConfig(0)+MyCache.GetCacheConfig(4)%>/label/KS.GetFieldParam.aspx?m_fieldname=" + fieldname + "&fieldtype=" + fieldtype;
      parent.openWin('插入字段标签', link, false, 420, 250);
      if (window.drag) {
          window.drag = 0;
          window.event.returnValue = true;
      }

  }
  function dragend() {
      if (window.drag) {
          document.body.removeChild(dragspan);
          SetValue();
      }
  }
  function mouseCoords(ev) {
      if (ev.pageX || ev.pageY) {
          return { x: ev.pageX, y: ev.pageY };
      }
      return {
          x: ev.clientX + document.documentElement.scrollLeft - document.body.clientLeft,
          y: ev.clientY + document.documentElement.scrollTop - document.body.clientTop
      };
  }
  function dragclear() {
      if (window.drag) {
          document.body.removeChild(dragspan);
          window.drag = 0;
          window.event.returnValue = true;
      }

  }
  function dragmove() {
      if (window.drag) {
          var ev = ev || window.event;
          var mousePos = mouseCoords(ev);
          ev.returnValue = false;
          dragspan.style.left = mousePos.x + 10;
          dragspan.style.top = mousePos.y + 8;
      }
  }
  function movePoint() {
      if (window.drag) {
          var rng = event.srcElement.createTextRange();
          rng.moveToPoint(event.x, event.y);
          rng.select();
      }
  }
    function getKS() {
        var t = $("#<%=this.DrpTeachWay.ClientID%> option:selected").val();
      if (t == 5) {
          jQuery("#livelabel").show();
      } else {
          jQuery("#livelabel").hide();
      }
  }
    $(function () {
        getKS();
    });
</script>

<!--<KS:TopNav runat="server" Text="创建课程列表标签" ID="TopNav1" />-->
  <div class="content-area mt20">
    <div class="myTitle">创建课程列表标签</div>
    <table style="margin:6px" width="98%" align="center" cellpadding="0" cellspacing="0" class="CTable no-borderTable">
    	<tbody>
        <tr>
            <td class="lefttd" style="height: 30px; text-align: right">
                <strong>标签名称：</strong></td>
            <td runat="server" class="righttd" style="height: 30px; text-align: left">
                <span style="color: #000066"></span><asp:TextBox CssClass="noborder" ID="LabelName" runat="server" Width="250px"></asp:TextBox> &nbsp; <font color="#FF0000">*</font> &nbsp; <span class="tips"> 调用格式：{KS_标签名称}</span><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="LabelName"
                    Display="Dynamic" ErrorMessage="标签名称必须输入"></asp:RequiredFieldValidator></td>
        </tr>
    <tr>
     <td class="lefttd" style="text-align: right; height: 30px;">
         <strong>标签目录：</strong></td>
     <td class="righttd" style="text-align: left; height: 30px;"><span  id="classidarea" runat="server"></span></td>
    </tr>
   
   
        <tr>
            <td class="lefttd" style=" text-align: right">
                <strong>是否AJAX输出：</strong></td>
            <td runat="server" class="righttd"  style="height: 30px; text-align: left">
                    <asp:CheckBox runat="server" ID="ChkAjax" Text="AJAX输出" />
           
           		 <span> &nbsp; &nbsp; 课程地区：</span>              
               <asp:DropDownList ID="DrpProvince" runat="server">
                <asp:ListItem Value="0">--选择省份--</asp:ListItem>
               </asp:DropDownList> 
            或 <asp:CheckBox ID="CkbArea" runat="server" Checked="true" Text="自动识别地区" />
              </td>

       </tr>
       <tr>        
              <td class="lefttd" style=" text-align: right">课程类型：</td>
              <td>
                  <asp:DropDownList ID="DrpTeachWay" runat="server" onchange="getKS(this.value)">
                       <asp:ListItem Value="-1">--不限--</asp:ListItem>
                  </asp:DropDownList>
        	  
                <span> &nbsp; &nbsp; 促销类型：</span>
                <asp:DropDownList ID="drpPromotion" runat="server">
                 <asp:ListItem Value="-1"> 不限 </asp:ListItem>
                 <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:ListItem Value="4">混合购买</asp:ListItem>
                </asp:DropDownList> 
                     <span style="display:none" id="livelabel">  &nbsp; &nbsp; 
                         <!--
                <asp:CheckBox ID="LiveState" runat="server"  Text="正在直播课程" />
                         直播类型：
                         <asp:RadioButtonList ID="RdbCourseType" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                             <asp:ListItem Value="0" Selected="True">不限</asp:ListItem>
                             <asp:ListItem Value="1">默认直播</asp:ListItem>
                             <asp:ListItem Value="2">V名师（1对1）</asp:ListItem>
                             <asp:ListItem Value="3">V名师（小班级）</asp:ListItem>
                             <asp:ListItem Value="4">V名师（大班课直播）</asp:ListItem>
                             <asp:ListItem Value="5">V名师（纯语音直播）</asp:ListItem>
                       </asp:RadioButtonList>
                             -->
                    </span>
             </td>
            </tr>
            <tr>
                <td class="lefttd" style="text-align: right">在机构主页调用：</td>

                <td valign="top" <%=Kesion.Course.Course.IsMoreEdu() == true?"":" style='display:none'" %>>
                    <strong>在机构主页调用</strong>
                    <asp:CheckBox ID="IsEp" runat="server" onclick="selectClass()" />
                </td>
            </tr>
            <tr id="showclass" style="display: none">
              
            <td align="right" class="lefttd" height="30">
                <strong>课程分类：</strong></td>
            <td class="righttd">
                &nbsp;<table border="0" width="100%" cellpadding="0" cellspacing="0">
                 <tr>
                  <td valign="top">
                    <table border="0" cellpadding="0" cellspacing="0">                       
                      <tr >
                       <td><asp:ListBox ID="LstClassID" runat="server" SelectionMode="Multiple">
                <asp:ListItem Value="0">--课程分类不限--</asp:ListItem>
                <asp:ListItem Value="-1" style='color:red'>调用当前同类的课程</asp:ListItem>
                <asp:ListItem Value="-2" style='color:green' title="说明：父分类为顶级时，调用同类">调用当前同父类的课程</asp:ListItem>
                </asp:ListBox><br />
                            <a class="textarea_min" href="javascript:zoomtextarea(-5,'<%=this.LstClassID.ClientID %>');"></a>
                   <a class="textarea_max" href="javascript:zoomtextarea(5,'<%=this.LstClassID.ClientID %>');"></a>
                       </td>
                       <td valign="top" style="padding:4px"><asp:CheckBox ID="ChildClass" runat="server" Checked="true" Text="允许列出子分类课程(仅对单选有效)" />
                           <br />如果同时要调用多个<br />分类下的课程，可以按键盘<br />的<font color=red>Ctrl</font>键多选。</td>
                      </tr>
                    </table>
                </td>
               
                </table>
             
              </td>
        </tr>
        <tr>
        	<td align="right" class="lefttd" height="30">
                <strong>属性限制：</strong></td>
        	<td>
                 <asp:CheckBoxList ID="Attribute" runat="server" RepeatDirection="Horizontal" onclick="selectGeneralize()">
                      <asp:ListItem Value="1">推荐</asp:ListItem>
                      <asp:ListItem Value="2">精彩</asp:ListItem>
                      <asp:ListItem Value="3">头条</asp:ListItem>
                      <asp:ListItem Value="4">幻灯</asp:ListItem>
                      <asp:ListItem Value="5">手机同步</asp:ListItem>
                     <asp:ListItem Value="6">仅显示推广的课程</asp:ListItem>
                  </asp:CheckBoxList>
             
             </td>
        </tr>
        
        <tr>
                <td class="lefttd" style="height: 30px; text-align: right">
                    <span style="background-color: #f0f9fe"></span><strong>查询条数：</strong></td>
                <td id="Td3" runat="server" class="righttd" colspan="2" style="height: 30px; text-align: left">
                    <asp:TextBox style="text-align:center" CssClass="textbox" ID="Num" runat="server" Width="41px">10</asp:TextBox>条&nbsp;
                     &nbsp; &nbsp; 排序方式：<asp:DropDownList ID="Order" runat="server">
                    <asp:ListItem Value="a.CourseID desc">课程ID降序</asp:ListItem>
                    <asp:ListItem Value="a.CourseID asc">课程ID升序</asp:ListItem>
                    <asp:ListItem Value="addTime desc">更新时间降序</asp:ListItem>
                    <asp:ListItem Value="addTime asc">更新时间升序</asp:ListItem>
                    <asp:ListItem Value="lookcount desc">浏览数降序</asp:ListItem>
                    <asp:ListItem Value="lookcount asc">浏览数升序</asp:ListItem>
                    <asp:ListItem Value="buycount desc">销量降序</asp:ListItem>
                    <asp:ListItem Value="buycount asc">销量升序</asp:ListItem>
                     <asp:ListItem Value="newid()">随机显示</asp:ListItem>
                     <asp:ListItem Value="generalizecost desc">推广佣金降序</asp:ListItem>
                     <asp:ListItem Value="generalizecost asc">推广佣金升序</asp:ListItem>
                     <asp:ListItem Value="generalizetimes desc">推广次数降序</asp:ListItem>
                     <asp:ListItem Value="generalizeTtimes asc">推广次数升序</asp:ListItem>
                  </asp:DropDownList>
                
                 &nbsp; &nbsp; SQL附加条件：<asp:TextBox ID="SQLCondition" CssClass="textbox" runat="server" Width="150px"></asp:TextBox> 可留空，如: and UserName='admin'
                   
                </td>
            </tr>
            <tr>
            	<td align="right" class="lefttd" height="30">
                <strong>收费：</strong></td>
                <td>
               			<asp:RadioButtonList ID="RdbIsCharge" 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>
                
                </td>
            </tr> 
        <!-- <tr>
            <td class="lefttd" style="height: 30px; text-align: right"><strong>启用版式：</strong></td>
            <td><input name="format" type="checkbox" value="" class="drag-checkbox" style="display:none;" checked="checked" /></td>
        </tr>
        <tr id="select-format">
            <td class="lefttd" style="height: 30px; text-align: right">
                <strong>选择版式：</strong></td>
            
              <td class="righttd" colspan="2" style="height: 30px; text-align: left" id="Td5">
                    <div class="frame-format">
                        <div id="formatCarousel">
                            <ul></ul>
                        </div>
                    </div>
              </td>
        </tr> -->

            <tr>
                <td class="lefttd" style="height: 30px; text-align: right">
                    <strong>可用字段：</strong><br />
                    <strong>启用自定义字段：<input name="custom" id="custom" type="checkbox" value="<%=custom %>"  onclick="selectCustom()" <%= (custom != 0 ? "checked='checked'":"") %> /></strong>
                </td>
                <td class="righttd" colspan="2" style="height: 30px; text-align: left">

                    <table width="95%" cellspacing="0" cellpadding="0" border="0">
                        <tr>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CourseID}')" class="field" style="cursor: pointer">课程ID</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CourseUrl}');" class="field" style="cursor: pointer">课程链接(URL)</div>
                            </td>
                            <td align="center">
                                <div onmousedown="DragStart()" id="Name" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">课程名称</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CourseBuyUrl}');" class="field" style="cursor: pointer">立即购买(URL)</div>
                            </td>
                            <td align="center">
                                <div onmousedown="DragStart()" id="ShortName" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">短标题</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CourseClassName}')" class="field" style="cursor: pointer">分类名称</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CourseClassURL}')" class="field" style="cursor: pointer">分类URL</div>
                            </td>
                        </tr>
                        <tr>
                             <td align="center">
                                  <div onmousedown="DragStart()" id="PhotoUrl" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">封面图片</div>

                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:Money}')" class="field" style="cursor: pointer">市场价</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:Price_Member}')" class="field" style="cursor: pointer">会员价</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:zhekou}')" class="field" style="cursor: pointer">课程折扣</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:GradeId}')" class="field" style="cursor: pointer">赠送积分</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:BuyCount}')" class="field" style="cursor: pointer">销售量</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CoursePF}')" class="field" style="cursor: pointer">课程评分</div>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <div onmousedown="DragStart()" id="AddTime" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">添加时间</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:LookCount}')" class="field" style="cursor: pointer">浏览量</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CollectCount}')" class="field" style="cursor: pointer">收藏量</div>
                            </td>
                            <td align="center">
                                <div onmousedown="DragStart()" id="pfnum" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">评价数</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:LiveState}')" title="0未开始 1直播中 2已结束" class="field" style="cursor: pointer">直播状态</div>
                            </td>
                             <td align="center">
                                <div onclick="InsertValue('{KS:Field:TeachWay}')" title="5直播，1点播，3专栏等" class="field" style="cursor: pointer">课程类型标识</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:Promotion}')" title="0 普通课程 1 限时抢购 2 课程团购 3 积分兑换 4 混合购买(积分+资金)等" class="field" style="cursor: pointer">促销类型标识</div>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <div onmousedown="DragStart()" id="Intro" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">课程简介</div>
                            </td>
                            <td align="center">
                                <div onmousedown="DragStart()" id="Target" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">课程目标</div>
                            </td>
                            <td align="center">
                                <div onmousedown="DragStart()" id="Notice" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">课程公告</div>
                            </td>
                            <td align="center">
                                <div onmousedown="DragStart()" id="CountPid" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">课时数</div>
                            </td>
                              <td align="center">
                                <div onmousedown="DragStart()" id="UserName" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">课程录入</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CoursePublisher}')" class="field" style="cursor: pointer">课程发布人（推荐)</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CoursePriceInfo}')" class="field" style="cursor: pointer">价格信息（推荐 ）</div>
                            </td>
                         
                        </tr>
                        <tr>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CosTeacherFace}')" class="field" style="cursor: pointer">主讲头像(带链接）</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CosTeacherFaceName}')" class="field" style="cursor: pointer">主讲头像(带链接+名称）</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CosTeacher}')" class="field" style="cursor: pointer">主讲教师(带链接）</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:Teacher}')" class="field" style="cursor: pointer">主讲教师</div>
                            </td>
                               <td align="center">
                                <div onmousedown="DragStart()" id="TeacherName" fieldtype="0" onclick="InsertLabel(this.id,this.fieldtype)" class="field" style="cursor: pointer">其它老师</div>
                            </td>
                             <td align="center">
                                <div onclick="InsertValue('{KS:Field:ProvinceName}')" class="field" style="cursor: pointer">所属省份</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:CityName}')" class="field" style="cursor: pointer">所属城市</div>
                            </td>
                        </tr>
                        <tr>
                            
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:StudentNum}')" class="field" style="cursor: pointer">学习人数</div>
                            </td>
                              <td align="center">
                                <div onclick="InsertValue('{KS:Field:LearnCount}')" class="field" style="cursor: pointer">学习人数+购买人数(推荐）</div>
                            </td>
                             <%if (BaseFun.CheckModulePower("school"))
                                { %>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:SchoolName}')" class="field" style="cursor: pointer">机构名称</div>
                            </td>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:EphomeUrl}')" class="field" style="cursor: pointer">机构主页</div>
                            </td>

                            <%} %>
                          <td align="center">
                                <div onmousedown="DragStart()" id="BmBeginTime" class="field" style="cursor: pointer" onclick="InsertLabel(this.id,this.fieldtype)" >直播报名开始时间</div>
                            </td>
                             <td align="center">
                                <div onmousedown="DragStart()" id="BmEndTime" class="field" style="cursor: pointer" onclick="InsertLabel(this.id,this.fieldtype)" >直播报名结束时间</div>
                            </td>
                             <td align="center">
                                <div onclick="InsertValue('{KS:Field:PureCosPrice}')" class="field" style="cursor: pointer">价格(不带VIP信息)</div>
                            </td>
                            
                            
                        </tr>
                         <tr>
                               <td align="center">
                                <div onclick="InsertValue('{KS:Field:CosVipTips}')" class="field" style="cursor: pointer">VIP信息</div>
                            </td>

                         </tr>
                        <tbody id="generalize" style="display:none">
                            <tr>
                            <td align="center">
                                <div onclick="InsertValue('{KS:Field:GeneralizeCost}')" class="field" style="cursor: pointer">推广佣金</div>
                            </td>
                              <td align="center">
                                <div onclick="InsertValue('{KS:Field:GeneralizeTimes}')" class="field" style="cursor: pointer">推广次数</div>
                            </td>
                             </tr>
                        </tbody>
                        <tbody id="CustomFile">
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="lefttd" style="height: 30px; text-align: right">
                    <strong>样式循环体：</strong><br />
                    自动编号变量<font color=red>{$Auto(n)}</font><br />
                    n取值范围0-6之间,<a href='#' onclick="purview();return false;"><font color=blue>预览</font></a>
                    &nbsp;&nbsp;
                    </td>
                <td id="Td10" runat="server" class="righttd" colspan="2" style="height: 30px; text-align: left">
                     <asp:TextBox CssClass="textbox textarea" Height="150px" ID="LoopBody" onmouseup="dragend()" onmousemove="movePoint()" onclick='setPos()' onkeyup='setPos()' runat="server" Rows="6" TextMode="MultiLine" Width="92%"></asp:TextBox>
                    <a class="textarea_min" href="javascript:zoomtextarea(-5,'<%=this.LoopBody.ClientID %>');"></a>
                   <a class="textarea_max" href="javascript:zoomtextarea(5,'<%=this.LoopBody.ClientID %>');"></a>
                   </td>
            </tr>
            <tr>
                        <td class="lefttd" style="height: 30px; text-align: right">
                            <strong>简要描述：</strong></td>
                        <td runat="server" class="righttd" colspan="2" style="height: 30px; text-align: left" id="Td8">
                           <span style="color: #6666ff">1、Loop使用规则</span><br />
循环体格式：[loop times="n"]循环标签的内容[/loop]<br />
其中n表示循环次数，且n满足n>=0。loop为循环关键字，此循环体可以重复使用,但是不能嵌套。 <br />
                            <span style="color: #6666ff">2、字段标签规则说明</span><br />
                                格式：{$Field(FieldName,OutType,Len)}<br/>
FieldName  --数据库表的字段名称<br />
OutType    --输出格式，支持文本(text),日期(date),对象(url)<br />
Len        --输出长度<br />

<span style="color: #6666ff">3、上面的字段标签在课程列列表页模板通用。</span><br />
</td>
                    </tr>
            </tbody>
      </table>

      <script src="/ks_inc/kesion.assembly.js"></script>
      <script src="/admin/drag/js/frame.format.js"></script>
      <script>
		  GetLabelStyle("course@coslist", "<%=LoopBody.ClientID%>");		  
          selectCustom();
          selectClass();//是否显示分类
          selectGeneralize();
          function selectClass() {
              if ($("#ctl00_KSContent_IsEp").attr("checked")) {
                  $("#showclass").hide();
              } else {
                   $("#showclass").show();
              }
          }
          function selectGeneralize() {//是否显示推广的佣金和次数的字段
              //var generalize = $("#ctl00_KSContent_Attribute_5").prop("checked");
             if (jQuery("#<%=this.Attribute.ClientID %>_5")[0].checked) {
                  $("#generalize").show();
              } else {
                  $("#generalize").hide();
              }
          }
          function selectCustom()
          {
              if ($("#custom").attr("checked")) { 
                  if ($("#CustomFile").html() != "") {
                      //判断自定义字段是否显示    没有加载
                      $.ajax({
                          type: 'Post',
                          datatype: 'text',
                          url: "?action=getCustom",
                          success: function (msg) {
                              var json = jQuery.parseJSON(msg);
                              if (json.type == "success") {
                                  var content = "";
                                  for (var i = 0; i < json.data.length; i++) {
                                      if (i == 0) {
                                          content += "<tr>";
                                      } else if(i%5==0&&i!=0){ //换行操作
                                          content += "</tr><tr>";
                                      }
                                      var custom = json.data[i];
                                      content += "<td align=\"center\">";
                                      content += "<div onclick=\"InsertValue('{KS:Field:" + custom.fieldname + "}')\" class=\"field\" style=\"cursor: pointer\">" + custom.fieldorthername + "</div>";
                                      content += "</td>";
                                  }
                                  content += "</tr>"; 
                                  $("#CustomFile").html(content);
                                  $("#custom").val("1");
                                  $("#CustomFile").show();
                              }
                              else {
                                  $("#CustomFile").html("暂无自定义字段信息！");
                              }
                          }
                      })
                  }
                  else
                  {
                      $("#custom").val("1");
                      //判断自定义字段是否显示    有的话隐藏 
                      $("#CustomFile").show();
                  }
              } else { 
                  $("#custom").val("0");
                  //隐藏
                  $("#CustomFile").hide();
              }

          }

	  </script>

     <div style="text-align:center">
      <asp:HiddenField ID="HidTemplateID" runat="server" Value="0" />
     <KS:Foot ID="Foot1" runat="server" OnSubmit="Button1_Click"  />
     
       <asp:TextBox ID="LabelContent" runat="server" Height="87px" TextMode="MultiLine" Width="445px"></asp:TextBox>
     
     </div>

    </div>
</asp:Content>

