<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="extcoursedefaultcourse.aspx.cs" Inherits="Us.Web.Extend.admin.extcourse.extcoursedefaultcourse" %>



<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>课程选择</title>
    <link href="../style/default/style.css" rel="stylesheet" type="text/css" />
    <script language="javascript" src="/admin/js/System.js" type="text/javascript"></script>
    <%--<link rel="StyleSheet" href="/admin/js/tree/dtree.css" type="text/css" />--%>
    <%=ImportScriptStr %>
    <asp:Literal ID="litScript" runat="server"></asp:Literal>
    <style type="text/css">
        input[type="checkbox"] {
            width: 12px;
            height: 12px;
            margin: 0px;
            padding: 0px;
            border: 0px none #009999;
        }
    </style>

    <link rel="stylesheet" href="../mtree/css/zTreeStyle/zTreeStyle.css" type="text/css">
    
    <script type="text/javascript" src="../mtree/js/jquery.ztree.core-3.5.js"></script>
    <script type="text/javascript" src="../mtree/js/jquery.ztree.excheck-3.5.js"></script>
    <script type="text/javascript" src="../mtree/js/jquery.ztree.exedit-3.5.js"></script>

    <script type="text/javascript">
		<!--
    var setting = {
        check: {
            enable: true,
            chkboxType : { "Y" : "", "N" : "" }
        },
        view: {
            dblClickExpand: false,
            showLine: true
        },
        data: {
            simpleData: {
                enable: true
            }
        }
    ,
        callback: {
            onClick: onClick,
            onCheck: zTreeOnCheck

        }
    };

        <% =TreeHTML %>

        function onClick(e, treeId, treeNode) {
            if (treeNode.id != "0") {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo");
                zTree.expandNode(treeNode);
            }
            
        }
        function zTreeOnCheck(event, treeId, treeNode) {
            //alert(treeNode.tId + ", " + treeNode.name + "," + treeNode.checked);
            CheckTempSave();
            if(checkType==1||checkType==3)
            {
                var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
                treeObj.checkAllNodes(false);
                //var checked = treeObj.getNodes()[0].checked;
                treeNode.checked=true;
            }

        };
        $(document).ready(function () {
            $.fn.zTree.init($("#treeDemo"), setting, zNodes);
            //$("#callbackTrigger").bind("change", {}, setTrigger);
        });
        //-->
    </script>

    <script language="javascript" type="text/javascript">
        //1 单选  2 多选 3 单选
        var checkType =2;

   
        function SaveTreeValue1(info)
        {
            // alert(info);
            art.dialog.data("retndata", info);
            // alert(info);
            art.dialog.close();
            return false;
        }

        function CheckTempSave()
        {
            GetListID();
            $("#txtSelectList").val(pidlist);
        }

        var pidlist = "";
        function GetListID()
        {
            var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
            var nodes = treeObj.getCheckedNodes(true);
            var idlist = "", namelist = "";
            var iCount = 0;
            var sname = "";
            for (var i = 0; i < nodes.length; i++) {
                idlist += nodes[i].id + ",";
                sname = nodes[i].name;
                sname = sname.split(":")[2];
                namelist += sname + ",";
                iCount++;
            }
            //alert(idlist + namelist);
            if (idlist == "") {
                alert("对不起，您必须至少选择一项才可以提交！");
                return false;
            }
            if (checkType == 1 || checkType == 3) {
                if (iCount != 1) {
                    alert("对不起，您只能选择一项才可以提交！");
                    return false;
                }
            }
            idlist = idlist.substr(0, idlist.length - 1);
            pidlist = idlist;
            namelist = namelist.substr(0, namelist.length - 1);
           
            var s1 = idlist + "#" + namelist;
            return s1;
        }

        function SaveTreeValue()
        {
            var s1 = GetListID();
            SaveTreeValue1(s1);
            return false;
        }

        var bState= true;
        function skySelectCheckList()
        {
            var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
            var nodes = treeObj.getNodes();
            treeObj.checkAllNodes(bState);
            bState=!bState;
        
        }



    </script>



</head>
<body>
    <form id="Form1" method="post" runat="server">


        <table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%">
            <tr>
                <td width="100%" valign="top">
                    <div class="divTbg">
                        <div class="divTbgL"></div>
                        <div class="divTbgInfo">
                            <div class="divTbgTitle">课程选择</div>
                        </div>
                    </div>
                    <div class="divTbgF"></div>
                    <div class="divSearchBoth">
                    </div>
                    <div class="divInfo">
                        <div class="divSearch">
                            <div id="searchBox" class="clearsearch">
                                <p class="nodisplay">
                                    <label for="txtSelectList">选中课程：</label><asp:TextBox ID="txtSelectList" runat="server" ToolTip="选中课程" Text=""></asp:TextBox>
                                </p>
                                <p>
                                    <label for="txtCourseName">课程信息：</label><asp:TextBox ID="txtCourseName" runat="server" ToolTip="课程信息" Text=""></asp:TextBox>
                                </p>
                                <p>
                                    <label for="drpCourseType">课程类型：</label><asp:DropDownList runat="server" ID="drpCourseType" ToolTip="课程类型">
                                        <asp:ListItem Value="CourseType" Text="code"></asp:ListItem>
                                    </asp:DropDownList>
                                </p>
                                <p>
                                    <label for="drpCourseSType">学习类型：</label><asp:DropDownList runat="server" ID="drpCourseSType" ToolTip="学习类型">
                                        <asp:ListItem Value="CourseSType" Text="code"></asp:ListItem>
                                    </asp:DropDownList>
                                </p>
                                <p id="searchSubmit">
                                    <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="确认搜索" CssClass="SkyButtonFocus" />
                                </p>
                            </div>
                        </div>
                    </div>

                    <div class="divInfo">
                        <div class="divAutoHeight" id="ScroLeft" style="height: 420px">
                            <ul id="treeDemo" class="ztree"></ul>
                        </div>
                    </div>
                    <div class="divInfo">
                        <%=SelectHTML %>
                       
                    </div>
                    <%--<div style="padding-left:10px;"><input type="checkbox" name="chkselect" id="chkselect" onclick="skySelectCheckList();"/><label for="chkselect">[全选/全不选]</label></div>--%>
                    <div class="divSave">

                        <asp:Button ID="btnSubmit" runat="server" Text="保存(S)" CssClass="SkyButtonFocus" />
                    </div>
                </td>


            </tr>
        </table>
    </form>

</body>
</html>
