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

<!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></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/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>
    <style type="text/css">    
    .Page { bottom: 5px; position: absolute; left: 400px; }
        .grid td { text-align: left; }
        .livediv { width: 200; height: 200; margin: 5px 0; display: none; }
        .livediv ul, li { list-style-type: none; margin: 0; padding: 0; }
        .livediv li { width: 222px; text-indent: 1em; }
        .livediv li:hover { background: #E0ECCC; }
        .lightTreeview{ height:350px;}
        .strTree li ul{ display:none;}
    </style>
</head>
<body>
    <form id="form1" runat="server" style="width: 1060px;">
    <div style="width:300px; float:left; height: 355px;" >
        <table class="example" id="dnd-example">
            <thead>
                <tr>
                    <td style="padding-left: 20px;"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("group_gname")%></td>
                    <td style="display: none;"></td>
                </tr>
            </thead>
            <tbody>
                <%=TableTree_CoursewareType.ToString()%>
            </tbody>
        </table>
    </div>
    
    <div  id="Cowtab" class="Cowdiv" style="float:left; padding-left:5px; width:740px; height: 355px;">     
        <div style="width: 730px; height: 350px; position: relative; border: 1px solid #ccc;">
            <div style="width: 200px; height: 350px; border: 1px solid #ccc; float: left;">
                <iframe class="iframe_left" name="target_left" id="target_left" scrolling="auto" frameborder="0" scrolling="yes" width="100%" src="/Training/plan/Plan_Courseware_CourType.aspx" height="100%"></iframe>
            </div>

            <div style="width:520px;float: left; padding-left:3px; " >
                <table class="grid cowtab">
                    <thead>
                        <tr>
                            <td>
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_select")%>
                            </td>
                            <td><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_kechengname")%></td>
                            <td>
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("coursetype")%>
                            </td>
                        </tr>
                    </thead>
                    <tbody id="cwtbody">                    
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="clear"  ></div>
    <div style=" text-align:center; float:left;margin:20px 0 0 400px;">
    
        <input type="button" class="button" value="<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Save")%>" onclick="javascript:saveCust();"  />
    </div>
    </form>

    <script type="text/javascript">
        $(function () {
            //把分页定位到屏幕下面
            divresize(90);
            FixedTableHeader("#table1", $(window).height() - 121);
            GetClickTableValue();
            CowtabShow(null);
        })
        /**
        获取table TD值
        主键ID
        column:列名
        **/
        var Menu_Id = '';
        function GetClickTableValue() {
            $('table tr').not('#td').click(function () {
                $(this).find('td').each(function (i) {
                    if (i == 1) {
                        Menu_Id = $(this).text();
                        CowtabShow(null);
                    }
                });
            });
            $("#dnd-example").treeTable({
                initialState: "collapsed" //collapsed 收缩 expanded展开的
            });
        }

        //选择试卷
        function CowtabShow(ctid) {            
            $.get("/Training/CustomGroup/CustomDist.aspx", {cgid:Menu_Id,ctid: ctid, action: "getcourseware" },
            function (data) {
                $("#cwtbody").html(data);
            });
        }

        //分页
        function CowTabPage(index, typeid) {

            $.get("/Training/CustomGroup/CustomDist.aspx", { cgid: Menu_Id, page: index, action: "getcourseware", ctid: typeid },
            function (data) {
                $("#cwtbody").html(data);
            });
        }

        //选择提示内容
        function saveCust() {
            if (Menu_Id == '') {
                alert("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("group_xzfzname")%>！");
                return;
            }
            var data = "";
            $("input:checked").each(function () {
                if (data == "") {
                    data += $(this).val();
                } else {
                    data += "," + $(this).val();
                }
            });

            $.get("/Training/CustomGroup/CustomDist.aspx", { action: "savecustom", csid: data, cgid: Menu_Id },
            function (data) {
                if (data == 1) { alert("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CG")%>！"); }
                else if (data == 2) { alert("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("SB")%>！"); }
                else if (data == -1) { alert("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("student_index5")%>！"); }
            });
        }

        </script>
</body>
</html>
