<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RaisePlan_Form.aspx.cs" Inherits="RM.Web.Training.plan.RaisePlan_Form" %>

<%@ Register Src="~/UserControl/LoadButton.ascx" TagName="LoadButton" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_zcjhgl")%></title>
    <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/iframeTools.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/TreeTable/jquery.treeTable.js" type="text/javascript"></script>
    <link href="/Themes/Scripts/TreeTable/css/jquery.treeTable.css" rel="stylesheet"
        type="text/css" />
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
</head>
<style>
    .Cowdiv { width: 760px; top: 30px; left: 80px; height: 450px; position: absolute; border: 1px solid #ccc; background-color: White; display: none; }
    .cowtab { width: 100%; }
    #CWlist { overflow-y: scroll; height: 355px; }
    #CWtypelist { overflow-y: scroll; height: 325px; }
    #list_tit { background-color: #2684ff; height: 30px; overflow: hidden; padding: 3px; }
    #list_tit span { display: block; padding: 5px 10px; height: 30px; line-height: 25px; float: left; overflow: hidden; }
    .td1{ width:200px; overflow:hidden;height:20px;}
    .td3{ display:none;}/*没有用*/
    .tab1 { background-color: White; border: 1px #ccc solid; border-bottom: 0; }
    .list_footer { background-color: #f4f4f4; height: 40px; line-height: 40px; overflow: hidden; border: 1px #ccc solid; }
    .Page { bottom: 0px; position: absolute; left: 180px; }
    .grid td { text-align: left; }
    .yeshu{margin-left:100px;}
</style>
<body>
    <form id="form1" runat="server">
    <div class="btnbartitle">
        <div>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_zcjhgl")%>
        </div>
    </div>
    <div class="btnbarcontetn">
        <div style="text-align: right">
            <uc2:LoadButton ID="LoadButton1" runat="server" />
        </div>
    </div>
    <div id="Cowtab" class="Cowdiv">
        <div id="list_tit">
            <span id="tab1" class="tab1" onclick="tabTitLoad(0)">选择课程 </span><span id="tab2"
                onclick="tabTitLoad(1)">选择课程分类</span>
        </div>
        <!--课程-->
        <div id="CWlist">
            <div style="width: 200px; height: 355px; float: left;">
                <iframe id="target_left" name="target_left" scrolling="auto" frameborder="0" scrolling="yes"
                    width="100%" height="100%"></iframe>
            </div>
            <div style="width: 535px; height: 355px; position: relative; float: left">
                <table class="grid cowtab" id="table999">
                    <thead>
                        <tr>
                            <td>
                                <input type="button" data="0" value='<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Quanxuan")%>'
                                    onclick="AllCheck('cwtbody')" />
                            </td>
                            <td>
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Name")%>
                            </td>
                            <td style=""><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("SortIndex")%><img data="1" onclick="sortype(this)" src="/Themes/Images/arrow_up.png" /></td>
                        </tr>
                    </thead>
                    <tbody id="cwtbody">
                    </tbody>
                </table>
            </div>
            <div style="clear: both;">
            </div>
        </div>
        <!--分类-->
        <div style="display: none;" id="CWtypelist">
            <div style="width: 100%; position: relative; float: left; overflow: auto;">
                <!--章节列表-->
                <div id="TypeDiv" class="div-body">
                    <span style="color: Red;">须知：在<a style="color: Blue" href="/Training/LearnToSet/LearnToSet_List.aspx">学习设置中</a>，设置自动添加功能为开启状态。
                        选择分类后。在往后操新增课件时，课件会自动添加到学习计划中。</span>
                    <table class="example" id="dnd-example">
                        <thead>
                            <tr>
                                <td style="padding-left: 20px;">
                                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CertificateType_Class")%>
                                </td>
                                <td style="display: none;">
                                </td>
                               <%-- <td style="padding-left: 20px;">
                                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("MyExamPlan-km")%>
                                </td>--%>
                            </tr>
                        </thead>
                        <tbody id="chapList">
                        </tbody>
                    </table>
                </div>
            </div>
            <div style="clear: both;">
            </div>
        </div>
        <div style="clear: both;">
        </div>
        <div class="list_footer" style="width: auto; bottom: 0px; left: 300px; padding-left: 300px;
            margin-bottom: 10px;">
            <input type="button" value='<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_dete")%>'
                onclick="CowtabHide()" />
            <input type="button" value='<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Close")%>'
                onclick="CowtabHide()" />
        </div>
    </div>
    <div class="div-body">
        <table id="tablebody" border="0" cellpadding="0" cellspacing="0" class="frm">
            <tr>
                <th>
                    <font color="red">*</font>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_pxkechegn")%>:
                </th>
                <td>
                    <input type="botton" value='<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_selcours")%>'
                        class="button" style="height: 25px;" onclick="CowtabShow();" />
                    <div id="cslist" style="display: none; border: 1px solid #ccc; border-top: 0; z-index: 0;
                        width: 660px;">
                        <table id="table1" class="example" style="background-color: White;">
                            <thead>
                                <tr>
                                    <td style="width: 20px; height: 16px; line-height: 16px;">
                                        &nbsp;
                                    </td>
                                    <td style="width: 250px; height: 16px; line-height: 16px;">
                                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Name")%>
                                    </td>
                                    <td style="height: 16px; line-height: 16px;">
                                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Credit_Form_xuefen")%>
                                    </td>
                                    <td style="height: 16px; line-height: 16px;">
                                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_learnType")%>
                                    </td>
                                    <td style="height: 16px; line-height: 16px;">
                                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Button_Form_shunxu")%>
                                    </td>
                                    <td style="height: 16px; line-height: 16px;">
                                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learningtimes")%>
                                    </td>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                    <div id="chapshowlist" style="display: none; border: 1px solid #ccc; border-top: 0;
                        z-index: 0; width: 660px;">
                        <table id="table8" class="example" style="background-color: White;">
                            <thead>
                                <tr>
                                    <td style="width: 20px; height: 16px; line-height: 16px;">
                                        &nbsp;
                                    </td>
                                    <td style="width: 250px; height: 16px; line-height: 16px;">
                                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterIndex_zjlx")%>
                                    </td>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </td>
            </tr>
            <tr>
                <th style="width: 80px;">
                    <font color="red">*</font>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_zcjhmc")%>:
                </th>
                <td>
                    <input id="RaisePlanName" runat="server" type="text" class="txt" datacol="yes" err="众筹计划名"
                        checkexpession="NotNull" style="width: 200px" />
                </td>
            </tr>
            <tr>
                <th style="width: 80px;">
                    <font color="red">*</font>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Mall_img")%>:
                </th>
                <td colspan="3">
                    <asp:FileUpload ID="FileUpload1" runat="server" style=" width:252px;" />
                    <img id="photo" width="50" style="position: absolute; top: 5px; left: 0px; width: 50px;" src="<%=img_url %>" />
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_skfs")%>:
                </th>
                <td>
                    <input type="radio" name="RaisePlanType" value="1" runat="server" id="ws" checked="true" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_wangshou")%>
                    <input type="radio" name="RaisePlanType" value="0" runat="server" id="ms" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_mianshou")%>
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_yapsj")%>:
                </th>
                <td>
                    <input id="RaisePlanStarData" runat="server" type="text" class="txt" datacol="" err="开始时间"
                        onclick="WdatePicker()" style="width: 80px;" />
                    -
                    <input id="RaisePlanEndData" runat="server" datacol="" err="结束时间" type="text" class="txt"
                        onclick="WdatePicker()" style="width: 80px" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_TiemIsNull")%>
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_zccl")%>:
                </th>
                <td>
                    <input type="radio" name="celue" value="buchuli" id="noplay" onclick="getobj(2);" runat="server" checked="true" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_buchuli")%>
                    <input type="radio" name="celue" value="bmzdkq" id="bmzdkq" onclick="getobj(0)" runat="server" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_bmrsmzdkq")%>(<span style="color:Red;"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_rsszxtzdr")%></span>)
                    <input type="radio" name="celue" value="yapkq" id="yapkq" onclick="getobj(1)" runat="server" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_ddydsjzdkq")%>
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_zcrs")%>:
                </th>
                <td>
                        <input id="RaiseUserNum" runat="server" type="text" class="txt" datacol="yes" err="预报名人数" value="0"
                        checkexpession="Num" style="width: 200px" />
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("RaisePlan_zcms")%>：
                </th>
                <td>
                    <script src="/Themes/Scripts/kindeditor/kindeditor-min.js" type="text/javascript"></script>
                    <script type="text/javascript">
                        var editor;
                        KindEditor.ready(function (K) {
                            editor = K.create('#RaisePlanDescribe', {
                                allowFileManager: true,
                                allowUpload: true,
                                uploadJson: '/WeiXin/UploadImage.ashx',
                                minHeight: 360
                            });
                        });
                    </script>
                    <textarea id="RaisePlanDescribe" class="txtRemark" runat="server" style="width: 98%;
                        height: 50px;"></textarea>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
<script type="text/javascript">
        $(function () {
            //把分页定位到屏幕下面
            divresize(63);
               GetClickTableValue();
        });
        var sort="";
        var sorttype ="";
        //排序
        function sortype(obj)
        {            
            sort = "Courseware_SortNo";               
            if($(obj).attr("data") == "1")
            {            
                sorttype ="asc";
                $(obj).attr("data","2");
                $(obj).attr("src","/Themes/Images/arrow_up.png");
            }
            else
            {
                sorttype ="desc";
                $(obj).attr("data","1");
                $(obj).attr("src","/Themes/Images/arrow_down.png");
            }
            CowtabShow();
        }
        var Menu_Id = '';
        function GetClickTableValue() {
            $('table tr').not('#td').click(function () {
                $(this).find('td').each(function (i) {
                    if (i == 1) {
                        Menu_Id = $(this).text();
                    }
                });
            });
            $("#dnd-example").treeTable({
                initialState: "collapsed" //collapsed 收缩 expanded展开的
            });
        }

           $("#target_left").attr("src", "Plan_Courseware_CourType.aspx");
        //选择课程
        function CowtabShow()
        {       
           $("#Cowtab").show();
            $.get("/Training/plan/GetCourseware.ashx", "sort="+sort+"&sorttype="+sorttype,
                          function (data) {
                          
                              $("#cwtbody").html(data);
                          });                          
                          

        }
        //分页
        function CowTabPage(index,typeid)
        {         
           $.get("/Training/plan/GetCourseware.ashx",{page:index,key:typeid,sort:sort,sorttype:sorttype},
                          function (data) {
                            if(data.indexOf("checkbox") < 0)
                                {
                                    showWarningMsg('已经到末尾或此分类为空');
                                    return;
                                }
                              $("#cwtbody").html(data);
                          });
                         
        }
           function CowtabHide()
        {
           $("#Cowtab").hide();
        }
        
        //返回
        function back() {
            Urlhref('/Training/plan/RaisePlan_List.aspx');
        }
        //保存
        function SaveForm() {
            var bool = CheckDataValid('#form1');
            var number = 0;
            if (bool) {
                showConfirmMsg('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("AllotButton_Form_qdm")%>', function (r) {
                    form1.submit();
                });
            }
        }
        //得到课件提示
        function getcstishi() {
            $("#tishics").show();
            var inputvalue = $("#GetCSControlValue").val();
           
        }
        //选择提示内容
        function setcs(obj,csid, csname, csType,score) {
        if ($(obj).attr("checked")) {
         $("#cslist").show();
            addNew(csid, csname, score,"1","1", csType, 0);
            }
        }
        //增加新数据
        var rowindex = 1;
        function addNew(csid, csname, csxue, type, csshi, csType, csCiShu) {
            var xuanxiang = "";
            if (type == 1) {
                xuanxiang = "<option selected='selected' value='1'>'<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_bixiuke")%>'</option><option  value='0'>'<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_xuanxiuke")%>'</option>";
            } else {
                xuanxiang = "<option  value='1'>'<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_bixiuke")%>'</option><option selected='selected' value='0'>'<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_xuanxiuke")%>'</option>";
            }
            var titleObj = $("#PlanName");
            if (jQuery.trim(titleObj.val()) == "") {
                var userGoupName = $('.userGroupInfo').eq(0);
                var userGoupTxt = "";
                if (userGoupName.length > 0)
                    userGoupTxt = userGoupName.text();
                titleObj.val(userGoupTxt + " " + csType + " - " + csname);
            }
            $("#table1 tbody").append("<tr><td><input type='checkbox' checked='checked' name='checkbox_cs' value='" + rowindex + "|" + csid + "'></td><td><input  value='" + csname + "' name='checkbox_name_" + rowindex + "' style='width: 250px;' /></td><td><input  value='" + csxue + "' name='checkbox_score_" + rowindex + "' readonly='readonly'  style='width: 30px;' /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Credit_Form_xuefen")%></td><td><select name='checkbox_select_" + rowindex + "'>" + xuanxiang + "</select></td><td><input style='width: 30px;'  value='" + rowindex + "' name='checkbox_date_" + rowindex + "' /></td><td><input style='width: 30px;'  value='" + csCiShu + "' name='checkbox_Lear_" + rowindex + "' /></td></tr>");
            rowindex++;
        }
   //check选项 1.指定学分 0.指定考试试卷 2.不处理
       function getobj(obj) {
    if (obj==1) {
    $("#PlanId").show();
    $("#context").html("");
    $("#titname").html('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_zdxf")%>:');
    $("#qatishi").hide();
    $("#QuesNaire").attr('onkeyup',"");
    $("#QuesNaire").attr('onchange',ChangValue());
     }else if(obj==0){
      $("#PlanId").show();
      $("#titname").html('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_jyks")%>');
       $("#context").html('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_konggeName")%>');
       $("#qatishi").show();
        $("#QuesNaire").attr('onchange',"");
       $("#QuesNaire").attr('onkeyup',GetQA())
                }else{
        $("#PlanId").hide();
                        }
}
      //得到试卷提示
        function GetQA()
        {
           $("#qatishi").show();
            var inputvalue = $("#QuesNaire").val();
            $.get("/Training/plan/GetExamPlan.ashx", { key: inputvalue },
                          function (data) {
                              $("#qatishi").html(data);

                          });
        }
                //选择试卷的提示内容
        function SelectedExam(ExamId,ExamPlan_Name)
        {
       $("#QuesNaire").val(ExamPlan_Name);
       $("#PlanAssessment").val(ExamId);
       $("#qatishi").hide();
        }
        //输入积分时 将值传递到PlanAssessment控件
        function ChangValue()
        {
          $("#PlanAssessment").val($("#QuesNaire").val());
        }
        //选择提示内容
        function setcs(obj,csid, csname, csType,score) {
        if ($(obj).attr("checked")) {
         $("#cslist").show();
            //alert("a ");
            addNew(csid, csname, score,"1","1", csType, 0);
}
        }
//quan xuan
function AllCheck(id) {
 $("#" + id).find("input[type=checkbox]").each(
         function () {
$(this).attr("checked",true);
$(this).click();
$(this).attr("checked",true);
          }
          );
}
    </script>
    <script type="text/javascript">
    //标签栏切换
        function tabTitLoad(obj) {
            switch (obj) {
                case 0:
                    $("#CWlist").show();
                    $("#CWtypelist").hide();
                    $("#tab1").attr("class","tab1");
                    $("#tab2").attr("class","");
                    break;
                case 1:
                    $("#CWtypelist").show();
                    $("#CWlist").hide();
                    $("#tab1").attr("class","");
                    $("#tab2").attr("class","tab1");
                    break;
            }
        }


        var Chaprowindex = 1;
        function OnChapSelect(obj) {
            var arrayObj = new Array();
            var i = 0;
            ///循环所有 获取tr
            $("#chapList").find("tr").each(
    function () {
        if ($(this).attr("id").indexOf($(obj).attr("id")) >= 0) {
            ///获取所有id
            arrayObj[i] = $(this);
            i++;
        }
    });
            for (var i = 0; i < arrayObj.length; i++) {
                addChapList(arrayObj[i].children('td').eq(1).html(), arrayObj[i].children('td').eq(0).children(".folder").html());
            }
        }        
        function addChapList(chapid, chapnane) {
            $("#chapshowlist").show();
            $("#table8 tbody").append("<tr><td><input type='checkbox' checked='checked' name='checkbox_chap' value='" + Chaprowindex + "|" + chapid + "'></td><td><input  value='" + chapnane + "' name='checkbox_name_chap_" + Chaprowindex + "' style='width: 300px;' /></td></tr>");
            Chaprowindex++;
        }
        <%=getuserlist %>
    </script>
</html>
