<%@ Control Language="C#" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="Kesion.Components" %>
<script runat="server" type="text/C#">
    dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息，
    bool isLoadPage = true;  //定义页面是否加载
    public  DataRow drr;
    public  int TcId = 0;
    public int RoomClassID = 0;
    public  string RoomID = "0";
    public  string sqlParam = string.Empty;
    public  int Provinceid = 0;
    public  int CityId = 0;
    public  string DefaultPic = string.Empty;
    public string TName = string.Empty;
    public string ClassName = string.Empty;
    public string ClassStyle = string.Empty;
    public string Board = string.Empty;
    public string Intro = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        RoomID = KSCMS.S("roomid");
        if (Utils.StrToInt( RoomID) > 0)
        {
            RoomClassID = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 classid from KS_CosClassRoom where roomid=" + RoomID + ""));
        }
        if (__user.GroupID == 3)
        {
            Course.CheckMVCVerify();//判断权限
            string courseclass = DataFactory.GetOnlyValue("select top 1 courseclass from KS_Enterprise where userid=" + new TemporaryVar().UserID + "");
            ClassName = GetClassOption(courseclass, 0, RoomClassID);
        }
        else if (__user.GroupID == 4)
        {
            string sql = "select top 1 * from KS_CosTeacher where Field='" + __user.UserName + "'";
            using (DataTable dt = DataFactory.GetDataTable(sql))
            {
                DataRow dr;
                if (dt.Rows.Count > 0)
                {
                    dr = dt.Rows[0];
                    if (Utils.StrToInt(dr["verify"].ToString()) == 0)
                    {
                        Msg.Alert("对不起，审核未通过不能进入!！", BasicField.GetUserUrl("teacher/Teacher"));
                        isLoadPage = false;
                        return;
                    }
                    TcId = Utils.StrToInt(dr["tcid"].ToString());

                    TName = dr["TName"].ToString();
                    ClassName = GetClassOption(dr["courseClass"].ToString() == "" ? "0" : dr["courseClass"].ToString(), 0, RoomClassID);
                }
                else
                {
                    Msg.Alert("对不起，您还未完善个人资料!", BasicField.GetUserUrl("teacher/Teacher"));
                    isLoadPage = false;
                    return;
                }
            }
        }
        ClassStyle = GetStyle(0);     //添加班级风格初始化
        string DoMethod = KSCMS.S("do");
        switch (DoMethod)
        {
            case "modify":
                initialEdit(Utils.StrToInt(RoomID)); //编辑
                break;
            case "del":
                deleteClassRoom(RoomID.ToString()); //删除
                break;
            case "save":

                break;
        }
        if (KSCMS.S("action").Equals("save"))
        {
            SaveChange();
        }
    }
    protected void SaveChange()
    {
        if (string.IsNullOrEmpty(KSCMS.S("teacher")) && __user.GroupID == 3)
        {
            Msg.Alert("对不起，请选择已有个人账号班主任");
            return;
        }
        Hashtable ht = new Hashtable();
        //  ht.Add("ClassID", classId);
        ht.Add("title", KSCMS.S("TxtName"));
        ht.Add("verify", Utils.StrToInt(KSCMS.S("RadioButtonList1")));
        ht.Add("BuyCount", Utils.StrToInt(KSCMS.S("TextBox3")));
        //	ht.Add("tcid", KSCMS.S("teacherlist"));
        ht.Add("DefaultPic", Utils.ChkSQL(KSCMS.S("photourl")));//图片
        string proids = string.Empty;
        if (Utils.StrToInt(RoomID) > 0)
        {
            proids = DataFactory.GetOnlyValue("select top 1 courseids from ks_cosClassRoom where roomid=" + RoomID);
        }
        //  ht.Add("CourseIDs", KSCMS.S("MoreCourseList")); //添加课程
        ht.Add("CourseCount", string.IsNullOrEmpty(proids) ? 0 : Utils.StrToInt(proids.Split(',').Length));
        ht.Add("intro", Utils.RemoveXss((KSCMS.S("TxtTarget"))));
        ht.Add("IsPublic", Utils.StrToInt(KSCMS.S("RadioButtonList2")));//是否免费
        ht.Add("IsBuy", Utils.StrToInt(KSCMS.S("RadioButtonList3")));
        ht.Add("AllowAdd", Utils.StrToInt(KSCMS.S("RadioButtonList4")));
        ht.Add("classid", KSCMS.S("classids"));
        ht.Add("SkinID", Utils.StrToInt(KSCMS.S("templateid")));
        string teacher = KSCMS.S("teacher");
        if (string.IsNullOrEmpty(teacher))
        {
            teacher = new TemporaryVar().UserName;

        }

        ht.Add("teacher", teacher);
        if (__user.GroupID == 4)
        {
            ht.Add("BanzhuRenID", TcId);
            ht.Add("userid", new TemporaryVar().UserID);
        }
        else
        {
            TcId = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 tcid from KS_CosTeacher where Field='" + teacher + "'"));
            ht.Add("banzhurenid",TcId );
            ht.Add("userid", UserManage.GetUserInfo(teacher).UserID);
        }



        //  Msg.Alert(KSCMS.S("teacher"));
        float price = Utils.StrToFloat(KSCMS.S("PriceMember"));
        if (price <= 0)
        {
            ht.Add("IsFree", 0);//是否免费 0免费 
            price = 0;
        }
        else
        {
            ht.Add("IsFree", 1);//是否免费 1收费
        }
        ht.Add("Price_Member", price);//售价
        ht.Add("Money", Utils.StrToFloat(KSCMS.S("money")));//原价
        ht.Add("Announce", Utils.RemoveXss(Utils.RemoveHtml(KSCMS.S("Announce"))));
        if (KSCMS.S("do").Equals("add"))
        {
            ht.Add("inputer", new TemporaryVar().UserName);
            Kesion.Controls.CustomFields.DoSchoolFieldSave(ref ht);

            DateTime _time = DateTime.Now;
            ht.Add("addTime", _time);
            CommonData.Insert("KS_CosClassRoom", ht);
            Msg.Alert("恭喜,班级添加成功!", BasicField.GetUserUrl("teacher/TcClassRoom"));
            isLoadPage = false;
            return;
        }
        else
        {
            CommonData.Update("KS_CosClassRoom", ht, "where RoomID=" + RoomID.ToString());
            Msg.Alert("恭喜,班级修改成功!", BasicField.GetUserUrl("teacher/TcClassRoom"));
            isLoadPage = false;
            return;
        }
    }
    private void initialEdit(int CourseId)
    {
        SqlParam[] param = new SqlParam[1];
        param[0] = new SqlParam("RoomID", CourseId);

        using (DataTable dt = CommonData.GetDataTable("[KS_CosClassRoom]", "*", param))
        {
            if (dt.Rows.Count > 0)
            {
                drr = dt.Rows[0];
                ClassStyle = GetStyle(Utils.StrToInt(drr["SkinID"]));       //当前班级风格
            }
        }
    }
    private void deleteClassRoom(string RoomID)
    {
        if (RoomID == null || RoomID == "0") return;
        if (string.IsNullOrEmpty(RoomID))
        {
            RoomID = KSCMS.S("ids");
        }
        RoomID = Utils.FilterIDs(RoomID);
        using (DataTable dt = DataFactory.GetDataTable("select RoomID from KS_CosClassRoom Where "+GetSqlParam()+" And RoomID in(" + RoomID + ")"))
        {
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    int id = Utils.StrToInt(dr["RoomID"].ToString());
                    Hashtable ht = new Hashtable();
                    ht.Add("RoomID", id.ToString());
                    CommonData.Delete("[KS_CosClassRoom]", ht);

                    Kesion.Course.CourseUserPowerCache.CleanClassRoomUserJson(id);              //清除学生缓存
                    DataFactory.ExecuteNonQuery("delete from KS_CosHomeWork where classroomid=" + id + "");//删除班级的作业
                    DataFactory.ExecuteNonQuery("delete from KS_CosClassStudent where roomid=" + id + "");//删除班级的学员
                    DataFactory.ExecuteNonQuery("delete from KS_CoursePJ where courseid=" + id + "");//删除班级的评分
                    DataFactory.ExecuteNonQuery("delete from KS_AskTopic where courseid=" + id + "");//删除班级的提问
                }
            }
        }
        Msg.Alert("恭喜,班级删除成功!", KSCMS.GetComeUrl());
        isLoadPage = false;
        return;
    }
    public string GetParam(string Fields)
    {
        string result = string.Empty;
        if (drr != null)
        {
            result = drr[Fields].ToString();
        }
        return result;
    }
    private string initial(string selectedid)
    {
        StringBuilder sb = new StringBuilder();

        using (DataTable dt = DataFactory.GetDataTable("select top 50 CourseID,Name from KS_Course where TeachWay=1 and username='" + (new TemporaryVar()).UserName + "' and system=2 and verify=1 and IsOff=1  order by CourseID "))
        {
            if (dt != null)
            {

                foreach (DataRow dr in dt.Rows)
                {
                    string choose = "";
                    if (("," + selectedid + ",").IndexOf("," + dr[0].ToString() + ",") != -1)
                    {
                        choose = "selected";
                    }
                    sb.AppendFormat("<option value=\"{0}\" {2}>{1}</option>", dr[0].ToString(), dr[1].ToString(), choose);
                }
            }
        }
        return sb.ToString();
    }
    public string GetEpTeacher(string name)
    {
        string result = "";

        using (DataTable dt= DataFactory.GetDataTable("select a.Field,Tname from KS_CosTeacher a inner join KS_User b on a.Field=b.username where groupid=4 and Locked=0 and a.schoolid=" + __user.UserID + ""))
        {
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string selected = "";
                    if (dr["Field"].ToString() == name)
                    {
                        selected = "selected";
                    }
                    result += "<option "+selected+" value=\"" + dr["field"].ToString() + "\">" + dr["Tname"].ToString() + "</option>";

                }
            }
        }
        return result;
    }

    public string GetClassOption(string nametype, int num, int classid)
    {
        #region 分类
        DataTable dt = MyCache.GetCosClass(0);  //0网授课程分类
        if (num == 1)
        {
            dt = MyCache.GetCosClass(1);//1面授课程分类
        }
        else if (num == 2)
        {
            dt = MyCache.GetCacheSJCategoryTable();       //考试分类         
        }
        StringBuilder sb = new StringBuilder();
        if (!string.IsNullOrEmpty(nametype))
        {
            DataView dv = dt.DefaultView;
            dv.RowFilter = " classid in(" + nametype + ")";
            //  dv.Sort = "root,orderid";
            dt = dv.ToTable();
        }
        int depth = 1;
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                string str = string.Empty;
                depth = Utils.StrToInt(dr["depth"].ToString());
                if (depth == 2)
                {
                    str = "　├ ";
                }
                if (depth == 3)
                {
                    str = "　   　├ ";
                }
                nametype = "," + nametype + ",";

                sb.AppendFormat(@"<option value ='{0}' {2}>{1}</option>", dr["classid"].ToString(), str + dr["classname"].ToString(), (Utils.StrToInt(dr["classid"].ToString())==classid?"selected":""));

            }

        }
        dt.Dispose();
        return "<select name='classids'>" + sb.ToString() + "</select>";
        #endregion
    }

    public string GetStyle(int templateid)
    {
        StringBuilder sb = new StringBuilder();
        sb.Append(@"<select name=""templateid"">");
        sb.Append(@"<option value =""0""" + (templateid==0?"selected":"") + ">--请选择班级风格--</option>");
        using (DataTable dt = DataFactory.GetDataTable("select * from KS_Template where TemplateType = 5"))
        {
            if(dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    sb.AppendFormat(@"<option value ='{0}' {2}>{1}</option>",dr["TemplateId"].ToString(), dr["TemplateName"].ToString(), (Utils.StrToInt(dr["TemplateId"].ToString())==templateid?"selected":""));
                }
            }
        }
        sb.Append("</select>");
        return sb.ToString();
    }
    /// <summary>
    /// 得到SQL语句的查询条件
    /// </summary>
    /// <returns></returns>
    public string GetSqlParam()
    {
        string banzhurenid = string.Empty;
        if (__user.GroupID == 4)
        {
            banzhurenid = TcId.ToString();
        }
        else
        {
            using (DataTable dt = DataFactory.GetDataTable("select tcid from KS_CosTeacher where SchoolName='" + new TemporaryVar().UserName + "'"))
            {
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (string.IsNullOrEmpty(banzhurenid))
                        {
                            banzhurenid = dr["tcid"].ToString();
                        }
                        else
                        {
                            banzhurenid += "," + dr["tcid"].ToString();
                        }
                    }
                }
                else
                {
                    banzhurenid = "0";
                }
            }
        }
        string sqlParam = " (inputer='" + new TemporaryVar().UserName + "' or schoolID=" + new TemporaryVar().UserID + " or banzhurenid in (" + banzhurenid + ")  or ','+tcid+',' like '%," + banzhurenid + ",%')";
        return sqlParam;

    }

</script>
<%
    if (!isLoadPage) return;
%>
<script>

    $(document).ready(function () {
        setprice();
    })
    function CheckForm() {
        if (jQuery('#Label1').val() == "0") {
            KesionJS.Alert('请选择班级类型!', "jQuery('#Label1').focus()");
            return false;
        }
        if (jQuery('#TxtName').val() == '') {
            KesionJS.Alert('班级名称必须输入!', "jQuery('#TxtName').focus()");
            return false;
        }

        var checkrad = jQuery("#RadioButtonList2 :radio[checked]").val();
        if (checkrad == "1") {
            if ($('#Money').val() == "") {
                KesionJS.Alert("请设置参考价格！", "jQuery('#Money').focus()");
                return false;
            }
            if ($('#Price_Member').val() == "") {
                KesionJS.Alert("请设置课程价格！", "jQuery('#Price_Member').focus()");
                return false;
            }
            if (parseFloat($('#Price_Member').val()) > parseFloat($('#Money').val())) {
                KesionJS.Alert("课程价格不能大于参考价格！", "jQuery('#Price_Member').focus()");
                return false;
            }
        }
        var idArr = new Array();
        var dest = document.getElementById('LstB1');
        for (var i = 0; i < dest.options.length; i++) {
            dest.options[i].selected = "true";
            idArr.push(dest.options[i].value);
        }
        return true;
    }
    function setprice() {
        if ($("#Radio4").attr("checked") == "checked") {//允许购买
            $("#tbody1").show();
            $("#tbody2").hide();
        }
        else {
            $("#tbody1").hide();
            $("#tbody2").show();
        }
    }

</script>

<%if (!KSCMS.S("do").Equals("modify") && !KSCMS.S("do").Equals("add")){ %>
<div class="t_tybox">
    <form name="myform" action="<%=BasicField.GetUserUrl("teacher/TcClassRoom") %>" method="post" id="myform">
        <div class="tytitle clearfix">
            <h4 class="common-title lf">班级</h4>
            <a href="<%=BasicField.GetUserUrl("teacher/TcClassRoom","do-add") %>" class="addbtn">+添加班级</a>
            <div class="top_c_sc mt10">
                <span>班级名称：</span>

                <input name="TextBox1" type="text" id="TextBox1" class="textbox" />
                <input type="submit" name="Button4" value=" 搜索 " id="Button4" class="button" />

            </div>
        </div>
        <div class="photo_box">
            <ul class="photo_box_list clearfix">
              <%
                  int pagesize = 12;
                  int recordcount, pagecount;
                  int CurrPage = new BasicField().GetCurrPage;

                  string sqlParam = "KS_CosClassRoom Where  "+GetSqlParam();
                  if (!string.IsNullOrEmpty(KSCMS.S("TextBox1")))
                  {
                      sqlParam += " and title like '%" + KSCMS.S("TextBox1") + "%'";
                  }
                  using (DataTable dt = DataFactory.GetPage("*", sqlParam, "RoomID", "order by  addTime desc", CurrPage, pagesize, out recordcount, out pagecount))
                  {
                      if (dt.Rows.Count > 0)
                      {
                          foreach (DataRow dr in dt.Rows)
                          {
                              KSCMS.W("<li class=\"photo_box_list_li\">" +
                                      "<span class=\"checkbtn_box border\"><input type=\"checkbox\"  class=\"checkbtn\" name=\"ids\" id=\"ids\" value=\"" + dr["RoomID"].ToString() + "\" /></span>" +
                                      "<div class=\"infos-pic\"><a href=\""+BasicField.GetRewriteUrl("roomview", Utils.StrToInt(dr["RoomID"].ToString()))+"\" target=\"_blank\"><img src=\"" + dr["DefaultPic"].ToString()+"\" onerror=\"this.src='/sysimg/nopic.gif'\"></a></div>"+
                          "<div class=\"infoConBox\">" +
                          "<div class=\"infos-title\"><h2 class=\"h5\" onmouseover=\"jQuery('#a" + dr["RoomID"] + "').show();\" onmouseout=\"jQuery('#a" + dr["RoomID"] + "').hide();\">" +
                          "<a href=\"" + BasicField.GetRewriteUrl("roomview", Utils.StrToInt(dr["RoomID"].ToString())) + "\" title=\"前台页\" target=\"_blank\">" +
Convert.ToString(dr["title"]) +
                          "</a><span class=\"type\">" + (Convert.ToString(dr["verify"]) == "0" ? "<a class=\"redBg\">未审</a>" : "<a>已审</a>") + "</span><div class=\"rf\">");
                              if (__user.GroupID == 3 || Utils.StrToInt(DataFactory.GetOnlyValue("select count(*) from KS_CosClassroom where BanzhuRenID in (select tcid from KS_CosTeacher where Userid =" + new TemporaryVar().UserID + ") and RoomID =" + dr["RoomID"].ToString())) > 0)
                              {
                                  KSCMS.W("<span><a title=\"编辑\" href=\"" + BasicField.GetUserUrl("teacher/TcClassRoom", "do-modify,RoomID-" + dr["roomid"].ToString()) + "\" class=\"grayFont\">编辑</a></span>");
                                  KSCMS.W("<span><a onclick=\"return(confirm(确定删除该班级以及该班级下的作业吗?));\" title=\"删除\" href=\"" + BasicField.GetUserUrl("teacher/TcClassRoom", "do-del,RoomID-" + dr["roomid"].ToString()) + "\" class=\"grayFont\">删除</a></span>");
                              }
                              else
                              {
                                  KSCMS.W("<span class=\"grayFont\">无权限</span>");
                                  KSCMS.W("<span class=\"grayFont\">无权限</span>");
                              }
                              KSCMS.W("</div></h2></div>" +

                              "<div class=\"infoTitle\"><span class=\"price\">" + (Utils.StrToDecimal(dr["price_member"].ToString()) == 0 ? "<font class=\"green\">免费</font>" : "<font>￥" + Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["price_member"].ToString()))) + "</font></span></div>" +
                              "<div class=\"btns\"><span><a>时间：" + Convert.ToDateTime(dr["addTime"].ToString()).ToString("yyyy-MM-dd") + "</a></span>" +
                              "<span><a>分类：" + MyCache.GetCosClass(Utils.StrToInt(dr["classid"]), "ClassName", 0) + "</a></span>" +
                              "</div>" +
                              "<div class=\"op-btns\"><span><a href=\"" + BasicField.GetUserUrl("teacher/AddTcClassCourse", "RoomID-" + dr["RoomID"].ToString() + "") + "\">" + dr["CourseCount"].ToString() + "&nbsp;门课程&nbsp;>></a></span>");
                              if (CommonJsonCache.CheckYunAPPHasAllow("plus.group"))
                              {
                                  KSCMS.W("<span><a href=\"" + BasicField.GetUserUrl("teacher/TcClassCourse", "RoomID-" + dr["RoomID"].ToString() + ",type-board") + "\">" + (string.IsNullOrEmpty(dr["BoardID"].ToString()) ? 0 : dr["BoardID"].ToString().Split(',').Length) + "&nbsp;个小组&nbsp;>></a></span>");
                              }

                              if (BaseFun.CheckModulePower("checkpackage")) {

                                  KSCMS.W("<span><a href=\"" + BasicField.GetUserUrl("teacher/TcClassCourse", "RoomID-" + dr["RoomID"].ToString() + ",type-pack") + "\">" + (string.IsNullOrEmpty(dr["PackID"].ToString()) ? 0 : dr["PackID"].ToString().Split(',').Length) + "&nbsp;个考核&nbsp;>></a></span>");
                              }

                              KSCMS.W("<span><a href=\"" + BasicField.GetUserUrl("teacher/TcClassRoomPj", "RoomID-" + dr["RoomID"].ToString() + "") + "\">" + DataFactory.GetOnlyValue("select count(1) from kS_CoursePJ where  OrderType=6 and courseid="+dr["roomid"])+ "&nbsp;条评价&nbsp;>></a></span>");
                              if (CommonJsonCache.CheckYunAPPHasAllow("plus.ask"))
                              {
                                  KSCMS.W("<span><a href=\"" + BasicField.GetUserUrl("teacher/TcClassStudent", "RoomID-" + dr["RoomID"].ToString() + "") + "\">" + DataFactory.GetOnlyValue("select count(StudentID) from KS_CosClassStudent where RoomID=" + dr["RoomID"].ToString()) + "&nbsp;名学员&nbsp;>></a></span>");
                              }
                              KSCMS.W("<span><a href=\"" + BasicField.GetUserUrl("teacher/TcClassRoomAskList", "RoomID-" + dr["RoomID"].ToString() + "") + "\">" + dr["AskCount"].ToString() + "&nbsp;条问答&nbsp;>></a></span>");
                              KSCMS.W("<span><a href=\"" + BasicField.GetUserUrl("teacher/TcClassRoomNotice", "RoomID-" + dr["RoomID"].ToString() + "") + "\">" + dr["NoticeNum"].ToString() + "&nbsp;条公告&nbsp;>></a></span><span><a title=\"作业\" href=\"" + BasicField.GetUserUrl("teacher/TcHomeWork", "RoomID-" + dr["roomid"].ToString()) + "\" class=\"grayFont\">"+DataFactory.GetOnlyValue("select top 1 Count(1) from KS_CosHomeWork where classroomid="+dr["RoomID"].ToString()+"")+"份作业&nbsp;>></a></span>"+
                              "</div></div></li>");
                          }
                      }
                      else
                      {
                          KSCMS.W("<div class=\"empty\">没有添加任何班级信息</div>");
                      }
                  }%>
    
              <script>
                  $(function () {
                      if ($(".price_cor font").text() == "免费") {
                          $(".price_cor font").css("color", "green");
                      }
                  })
              </script>
    
            </ul>
		</div>
        <div class="cz_btn">
            <input type="hidden" value="method" id="domethod" name="do" />
            <input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);" class="checkbtn" /><label for="chkall">全选</label>
            <input type="submit" value="批量删除" onclick="return (GetIDS());" id="BtnDel" class="button" />
        </div>

        <script>
            function GetIDS() {
                $("#domethod").val("del");
            }

        </script>
        <div class="fy_box">
		  <%
            #region 分页
            string PageStr = "[KS:PageStr1]";
            BasicField.ReplaceFilterPage(ref PageStr, CurrPage, pagesize, pagecount, recordcount);
            KSCMS.W(PageStr);
            #endregion
         %>
        </div>
        <div class="clearfix"></div>
    </form>

    <%}else{ %>
    <div class="t_tybox">
        <div class="tytitle">
            <h4 class="h4">添加班级信息</h4>
        </div>
        <div class="clear"></div>
        <script src="/ks_inc/DatePicker/WdatePicker.js"></script>
        <script src="../../ks_inc/weiboApi.js"></script>
        <div class="tab-page" id="sjPanel">
            <form name="myform" action="<%=BasicField.GetUserUrl("teacher/TcClassRoom","do-"+KSCMS.S("do")) %>" method="post" id="Form1">
                <input type="hidden" value="save" name="action" />
                <input type="hidden" value="<%=KSCMS.S("roomid") %>" name="RoomID" />
                <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="border">
                    <tr>
                        <td class="lefttd" height="30" align="right"><font color="red">*</font>班级类型:</td>
                        <td class="tag_left">
                            <span id="Label1"><%=ClassName %></span>
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd" height="30" align="right">班级风格:</td>
                        <td class="tag_left">
                            <span id="Label2"><%=ClassStyle %></span>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="lefttd" height="30"><font color="red">*</font>班级名称:</td>
                        <td class="tag_left">
                            <input name="TxtName" type="text" id="TxtName" value="<%=GetParam("title") %>" class="textbox" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="lefttd">班级图片:</td>
                        <td class="tag_left">
                            <input name="photourl" type="text" id="photourl" value="<%=GetParam("DefaultPic") %>" class="textbox" style="float: left" />

                            <%=Kesion.APPCode.UploadAPI.EchoUpload("courseUserPic","photourl") %>      
                        </td>
                    </tr>

                    <tr>
                        <td align="right" class="lefttd" height="30">是否显示:</td>
                        <td class="tag_left">
                            <table id="RadioButtonList1" border="0">
                                <tr>
                                    <td class="bo-min">
                                        <input id="RadioButtonList1_0" class="radiobtn" type="radio" name="RadioButtonList1" value="1" <%=GetParam("verify")=="1"?"checked":"" %> /><label for="RadioButtonList1_0">显示</label></td>
                                    <td class="bp-min">
                                        <input id="RadioButtonList1_1" class="radiobtn" type="radio" name="RadioButtonList1" value="0" <%=Utils.StrToInt(GetParam("verify"))==0?"checked":"" %> /><label for="RadioButtonList1_1">隐藏</label><span class="tips">如果隐藏则班级将无法在前台预览</span></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="lefttd" height="30">是否允许其他学员进入:</td>
                        <td class="tag_left">
                            <table id="Table1" border="0">
                                <tr>
                                    <td class="bo-min">
                                        <input id="Radio2" type="radio" class="radiobtn" name="RadioButtonList2" value="0" <%=Utils.StrToInt(GetParam("IsPublic"))==0?"checked":"" %> /><label for="RadioButtonList2_1">允许</label></td>
                                    <td class="bo-min">
                                        <input id="Radio1" type="radio" class="radiobtn" name="RadioButtonList2" value="1" <%=GetParam("IsPublic")=="1"?"checked":"" %> /><label for="RadioButtonList2_0">不允许</label><span class="tips">如果不允许则本班以外的学员无法进入班级</span></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="lefttd" height="30">是否允许购买:</td>
                        <td class="tag_left">
                            <table id="Table2" border="0" onclick="setprice()">
                                <tr>
                                    <td class="bo-min">
                                        <input id="Radio4" type="radio" class="radiobtn" name="RadioButtonList3" value="1" <%=GetParam("IsBuy")=="1"?"checked":"" %> /><label for="RadioButtonList2_0">允许</label></td>
                                    <td class="bo-min">
                                        <input id="Radio3" type="radio" class="radiobtn" name="RadioButtonList3" value="0" <%=Utils.StrToInt(GetParam("IsBuy"))==0?"checked":"" %> /><label for="RadioButtonList2_1">不允许</label></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tbody id="tbody1">
                        <tr>
                            <td align="right" class="lefttd" height="30">班级原价:</td>
                            <td class="tag_left">
                                <input name="Money" type="text" value="<%=Public.ReturnShopPrice(GetParam("Money")) %>" id="Money" class="textbox" style="width: 50px;" />元
                            </td>
                        </tr>
                        <tr>
                            <td align="right" class="lefttd" height="30">班级购买价格:</td>
                            <td class="tag_left">
                                <input name="PriceMember" type="text" value="<%=Public.ReturnShopPrice(GetParam("Price_Member")) %>" id="PriceMember" class="textbox" style="width: 50px;" />元（设置为0表示免费）
                            </td>
                        </tr>
                    </tbody>
                    <tbody id="tbody2">
                        <tr>
                            <td align="right" class="lefttd" height="30">是否允许申请加入:</td>
                            <td class="tag_left">
                                <table id="Table3" border="0" onclick="setprice()">
                                    <tr>
                                        <td class="bo-min">
                                            <input id="Radio5" type="radio" class="radiobtn" name="RadioButtonList4" value="1" <%=GetParam("AllowAdd")=="1"?"checked":"" %> /><label for="RadioButtonList2_0">不允许</label></td>
                                        <td class="bp-min">
                                            <input id="Radio6" type="radio" class="radiobtn" name="RadioButtonList4" value="0" <%=Utils.StrToInt(GetParam("AllowAdd"))==0?"checked":"" %> /><label for="RadioButtonList2_1">允许</label></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </tbody>

                    <%if (__user.GroupID == 3)//机构
                      { %>

                    <tr>
                        <td align="right" class="lefttd" height="30"><font color="red">*</font>选择班主任:</td>
                        <td class="tag_left">
                            <select name="teacher">
                                <%=GetEpTeacher(GetParam("teacher")) %>
                            </select>
                        </td>
                    </tr>
                    <%}else{ %>
                    <tr>
                        <td align="right" class="lefttd" height="30"><font color="red">*</font>班主任:</td>
                        <td class="tag_left">
                            <%if (KSCMS.S("do").Equals("add"))
                              { %>
                            <input name="teacher" type="text" value="<%=new TemporaryVar().UserName%>" disabled="disabled" class="textbox" />
                            <%}
                              else
                              { %>
                            <input name="teacher" type="text" value="<%=GetParam("teacher")%>" id="Teacher" disabled="disabled" class="textbox" />
                            <%} %>
                        </td>
                    </tr>

                    <%} %>

                    <tr style="display: none">
                        <td align="right" class="lefttd" height="30">其他教师:</td>
                        <td class="tag_left">
                            <select size="4" name="teacherlist" multiple="multiple" id="teacherlist" style="height: 120px; width: 262px;">
                                <%
                                StringBuilder sb = new StringBuilder();
                                string tcid = GetParam("tcid");
                                string teachersql = "select top 200 TcID,TName from ks_costeacher  where verify=1   order by tcid desc";

                                using (DataTable dt = DataFactory.GetDataTable(teachersql))
                                {
                                    if (dt.Rows.Count > 0)
                                    {
                                        foreach (DataRow dr in dt.Rows)
                                        {
                                            string selected = "";
                                            if (("," + tcid + ",").IndexOf("," + dr["tcid"].ToString() + ",") != -1)
                                            {
                                                selected = "selected";
                                            }
                                            sb.AppendFormat("<option value=\"{1}\" {2}>{0}</option>", dr["TName"].ToString(), dr["TcID"].ToString(), selected);
                                        }
                                    }
                                }

                                KSCMS.W(sb.ToString());
                                %>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="lefttd" height="30"><strong>班级介绍：</strong></td>
                        <td class="tag_left">
                            <textarea name="TxtTarget" rows="2" cols="20" id="TxtTarget" style="height: 200px; width: 80%;"><%=Utils.RemoveXss(GetParam("intro")) %></textarea>
                            <% Kesion.APPCode.EditorAPI.EchoHead(); Kesion.APPCode.EditorAPI.EchoEditor("editor", "TxtTarget", "Basic", 0, false, true, true, false);     %>
                        </td>
                    </tr>
                    <tr style="display: none">
                        <td align="right" class="lefttd" height="30"><strong>班级公告：</strong></td>
                        <td class="tag_left">
                            <textarea name="Announce" rows="2" cols="20" id="Announce" style="height: 200px; width: 80%;"><%=Utils.RemoveXss(GetParam("Announce")) %></textarea>
                            <% Kesion.APPCode.EditorAPI.EchoHead(); Kesion.APPCode.EditorAPI.EchoEditor("editor", "Announce", "Basic", 0, false, true, true, false);     %>
                        </td>
                    </tr>
                </table>
                <div class="cz_btn nofloat" style="padding: 5px 0px 20px 195px;">
                    <span>
                        <input type="submit" name="Button2" value="确定保存" onclick="return (CheckForm());" id="Button2" class="button" /></span>
                    <span>
                        <input type="button" class="button" onclick="window.history.go(-1);" value=" 返 回 "></span>
                </div>

            </form>
        </div>
        <script>
           $('#upframe').css('height','60px')
        </script>
        <%} %>
    </div>
