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

<!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("ChapterPlan_Form_title")%></title>
 <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
 <link href="/Themes/Scripts/TreeTable/css/jquery.treeTable.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/FunctionJS.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/TreeTable/jquery.treeTable.js" type="text/javascript"></script>    
    <style type="text/css">
        #promptBg ul, #promptBg li { padding: 0; margin: 0; list-style: none; }
        .promptLink { display: block; padding: 0 3px; font-size: 10pt; }
        .activeLink { background-color: #e0f5bc; }
        .activePrompt { background-color: #E0ECCC; }
        .promptLink span { float: right; font-size: 10pt; }
        .Cowdiv { width: 760px; top: 30px; left: 80px; height: 450px; position: absolute; border: 1px solid #ccc; background-color: White; display: none; }
        .list_footer{ background-color:#f4f4f4; height:40px; line-height:40px; overflow:hidden; border:1px #ccc solid;}
        .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; }  
    
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="Cowtab" class="Cowdiv">
        <div id="list_tit">
            <span id="tab1" class="tab1">选择章节 </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>
                               章节名
                            </td>
                        </tr>
                    </thead>
                    <tbody id="cwtbody">
                    </tbody>
                </table>
            </div>
            <div style="clear: both;">
            </div>
        </div>
          <div class="list_footer" style=" width:auto; bottom: 10px; padding-left: 450px;">
                <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>
    <table id="tablebody" border="0" cellpadding="0" cellspacing="0" class="frm">
        <tr>
            <th style="width: 80px;">
                <font color="red">*</font><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_zjjhmc")%>:
            </th>
            <td>
                <input id="CP_name" runat="server" type="text" class="txt" datacol="yes" err="考试计划名"
                    checkexpession="NotNull" style="width: 200px" />
                    <span style="margin-left:100px;">上传图片:</span>
                    <asp:FileUpload ID="FileUpload1" runat="server" Style="width: 200px;" onchange="PreviewImg(this)" />                    
            </td>
        </tr>
        <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>
                    <div style="float:right;margin-top:-80px;margin-right:200px;"><img id="imglogo" runat="server" style="width:75px;height:75px;">
                </div>
                </td>
        </tr>
         <tr>
            <th>
                <font color="red">*</font> <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("user_group")%>:
            </th>
             <td>
                    <input type="botton" onclick="CowtabShow();" style="height: 25px;" class="button" value="手选章节">
                </td>
        </tr>
        <tr style="display:none;">
            <th>
                <font color="red">*</font> <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_xzzj")%>:
            </th>
            <td>
                <div style="position: ;">
                        <input id="GetCSControlValue" autocomplete="off" type="text" class="txt" style="width: 314px;
                            z-index: 0;" onkeyup="getcstishi()" /><span style="color:Red;">
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_srzjmc")%></span>
                        
                        <div id="tishics" style="display: none; cursor: pointer; position: absolute; width: 316px;
                            background-color: White;">
                            <img src="../../Themes/Images/loading1.gif" />
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_zzcx")%>...
                           
                        </div>
                    </div>
            </td>
        </tr>
        <tr>
            <th>
            </th>
            <td style=" height:150px;">
                <div id="cslist" style=" background-color:White; height:150px; overflow-y:scroll; border: 1px solid #ccc; border-top: 0; z-index: 0;
                        width: 560px;">
                        <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: 350px; height: 16px; line-height: 16px;">
                                         <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_zjm")%>
                                    </td>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_qzsj")%>:
            </th>
            <td>
                <input id="PlanStarData" runat="server" type="text" class="txt" datacol="yes"
                    err="开始时间" checkexpession="DateOrNull" onclick="WdatePicker()" style="width: 80px;" />
                -
                <input id="PlanEndData" runat="server" datacol="yes" err="结束时间" checkexpession="DateOrNull"
                    type="text" class="txt" onclick="WdatePicker()" style="width: 80px" /><span style="color:Red;">
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_rqbtxbsbgq")%></span>
            </td>
        </tr>
        <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_jhms")%>:
                </th>
                <td>
                    <textarea id="CP_Describe" class="txtRemark" runat="server" style="width: 452px;
                        height: 43px;"></textarea>
                </td>
            </tr>
    </table>
    <div class="frmbottom">
        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="return SaveForm();"
            OnClick="Save_Click"><span class="l-btn-left">
            <img src="/Themes/Images/disk.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Save")%></span></asp:LinkButton>
        <a class="l-btn" href="javascript:void(0)" onclick="OpenClose();"><span class="l-btn-left">
            <img src="/Themes/Images/cancel.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Close")%></span></a>
    </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", "/Training/plan/Plan_Courseware_CourType.aspx");
        //选择课程
        function CowtabShow()
        {
           $("#Cowtab").show();
            $.get("GetChapter.ashx", "action=a",
                          function (data) {
                              $("#cwtbody").html(data);
                          });
        }
        //分页
        function CowTabPage(index,typeid)
        {
           $.get("GetChapter.ashx",{page:index,ckey:typeid,action:'a'},
                          function (data) {
                            if(data.indexOf("checkbox") < 0)
                                {
                                    showWarningMsg('已经到末尾或此分类为空');
                                    return;
                                }
                              $("#cwtbody").html(data);
                          });
        }
         function AllCheck(id) {
            $("#" + id).find("input[type=checkbox]").each(
         function () {
             $(this).attr("checked", true);
             //alert(1);
             $(this).click();
             $(this).attr("checked", true);
         }
          );
        }
         
        function CowtabHide()
        {
           $("#Cowtab").hide();
        }
        
        //返回
        function back() {
            Urlhref('/Training/Chapter/ChapterPlan_List.aspx');
        }
        //保存
        function SaveForm() {
                    
            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 false ;
            }

            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("ChapterPlan_Form_nxyzsxz")%>！");
                return false;
            }

              if (!CheckDataValid('#form1')) return false;
            return true;

//            if (CheckDataValid('#form1')) {
//                showConfirmMsg('注：确认要保存此操作吗？', function (r) {
//                    if (r) {
//                        form1.submit();
//                    }
//                });
//            }
        }
        //得到章节提示提示
        function getcstishi() {
            $("#tishics").show();
            var inputvalue = $("#GetCSControlValue").val();
            $.get("/Training/Chapter/GetChapter.ashx", { key: inputvalue },
                 function (data) {
                              $("#tishics").html(data);
            });
        }
       function setcs(obj,csid,csname) {
        if ($(obj).attr("checked")) {
         //$("#cslist").show();            
            addNew(csid, csname);
        }
        }
        //增加新数据
        var rowindex = 1;
        function addNew(csid, csname) {
            $("#cslist").show();
            $("#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></tr>");
            rowindex++;
            $("#tishics").hide();
        }
        <%=getuserlist %>
    </script>
</body>
</html>
