<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Plan_Form.aspx.cs" Inherits="RM.Web.Training.plan.Plan_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 id="Head1" runat="server">
    <title>
        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_pxjhgl")%></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; }
    
    .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; }
</style>
<body>
    <form id="form1" runat="server">
    <div class="btnbartitle">
        <div>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_pxjhgl")%>
        </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">
                    <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>
                        </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">
                            <%=TableTree_CoursewareType.ToString()%>
                        </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("user_group")%>:
                </th>
                <td>
                    <script src="/Themes/Scripts/GetuserControl.js" type="text/javascript"></script>
                </td>
            </tr>
            <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("Plan_pxjhName")%>:
                </th>
                <td>
                    <input id="PlanName" runat="server" type="text" class="txt" datacol="yes" err="培训计划名"
                        checkexpession="NotNull" style="width: 200px" />
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_qzsj")%>:
                </th>
                <td>
                    <input id="PlanStarData" runat="server" type="text" class="txt" datacol="" err="开始时间"
                        onclick="WdatePicker()" style="width: 80px;" />
                    -
                    <input id="PlanEndData" 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("Button_Form_shunxu")%>:
                </th>
                <td>
                    <input id="SortIndex" runat="server" type="text" class="txt" datacol="yes" err="显示顺序不能为空"
                        checkexpession="Num" style="width: 200px" value="0" />
                </td>
            </tr>
              <tr >
                <th>
                    <font color="red">*</font>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_hgtj")%>:
                </th>
                <td>
                    <input type="radio" name="hege" value="buxian" id="noplay" onclick="getobj(2);" runat="server" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_buchuli")%>
                    <input type="radio" name="hege" value="kaishi" id="kaoshiplay" onclick="getobj(0)"
                        runat="server" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_kaoshihege")%>
                    <input type="radio" name="hege" value="xuefen" id="xuefenplay" onclick="getobj(1)"
                        runat="server" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_xfjm")%>
                </td>
            </tr>   <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_yqxf")%>:
                </th>
                <td>
                    <input id="Plan_ExamCredit" runat="server" type="text" class="txt" datacol="yes"
                        err="要求学分最少为0" checkexpession="Num" style="width: 200px" value="0" />
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_zhushi")%>
                </td>
            </tr>
          <tr style="display: none;" id='PlanId'>
                <th id="titname">
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_jyks")%>:
                </th>
                <td>
                    <input id="QuesNaire" type="text" autocomplete="off" class="txt" style="width: 200px"
                        onkeyup="GetQA();"  onchange="ChangValue();" runat="server" />
                    <div style="position: relative;">
                        <input id="PlanAssessment" runat="server" type="hidden" class="txt" style="width: 314px;
                            z-index: 0;" />
                        <div id="context">
                        </div>
                        <div id="qatishi" style="display: none; cursor: pointer; position: absolute; width: 316px;
                            background-color: White;">
                            <img src="../../Themes/Images/loading1.gif" />
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Loading")%>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_jhms")%>:
                </th>
                <td>
                    <textarea id="PlanDescribe" class="txtRemark" runat="server" style="width: 452px;
                        height: 143px;"></textarea>
                </td>
            </tr>
        </table>
    </div>
    </form>
    <script type="text/javascript">
        $(function () {
            //把分页定位到屏幕下面
            divresize(63);
               GetClickTableValue();
        });
        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", "",
                          function (data) {
                              $("#cwtbody").html(data);
                          });
        }
        //分页
        function CowTabPage(index,typeid)
        {
           $.get("/Training/plan/GetCourseware.ashx",{page:index,key:typeid},
                          function (data) {
                              $("#cwtbody").html(data);
                          });
        }
           function CowtabHide()
        {
           $("#Cowtab").hide();
        }
        
        //返回
        function back() {
            Urlhref('/Training/plan/Plan_List.aspx');
        }
        //保存
        function SaveForm() {
            var bool = CheckDataValid('#form1');

            var number = 0;
            var r = document.getElementsByName("users");
            for (var i = 0; i < r.length; i++) {
                if (r[i].checked) { number++; }
            }
            //alert(number);
            if (number == 0) {
                showWarningMsg('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("least_groups")%>');
                return;
            }

            number = 0;
            var r = document.getElementsByName("checkbox_cs");
            for (var i = 0; i < r.length; i++) {
                if (r[i].checked) { number++; }
            }
            if (number == 0) {
                showWarningMsg('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_selpeixun")%>');
                return;
            }

            if (bool) {
                showConfirmMsg('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("AllotButton_Form_qdm")%>', function (r) {
                    if (r) {
                        form1.submit();
                    }
                });
            }
        }
        //得到课件提示
        function getcstishi() {
            $("#tishics").show();
            var inputvalue = $("#GetCSControlValue").val();
           
        }
        //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);
}
        }
        //增加新数据
        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++;
        }
   

//quan xuan
function AllCheck(id) {
 $("#" + id).find("input[type=checkbox]").each(
         function () {
$(this).attr("checked",true);
//alert(1);
$(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>
</body>
</html>
