<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Manager_MProject.aspx.cs" Inherits="MYAPP.Manage.Project.Design.MProject.Manager_MProject" %>
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="/CSS/main.css" rel="stylesheet" type="text/css" />
    <link href="splitterStyle.css" type="text/css" rel="stylesheet" />
    <link href="treeStyle.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="/js/coe.js"></script>
     <script language="JavaScript" type="text/javascript">
         var node_id = 0;
         var Dictionary_Class_ID = 0;

         function resizeTree(DomElementId, NewPaneHeight, NewPaneWidth) {
             TV_Tree.Render();
         }

         function nodeSelect(node) {
             node_id = node.GetProperty('Value');
             //alert(node_id);
         }

         function addNode() {

             mainBEFrame.location = "AD_MarkerType_Info.aspx?action=add&MarkerType_ID=0&MT_UpID=" + node_id;
         }

         function delNode() {
             if (node_id == 0) {
                 alert('请先选择节点');
                 return false;
             }
             delete_confirm();

             res = MYAPP.Manage.OMap.MarkerType.ManageMarkerType.DelMarkerType(node_id);

             if (res.value > 0) {
                 mainBEFrame.location = "a.html";
                 Command_DelChildNode();
                 this.location = this.location;
             }
             else {
                 alert("节点被锁定不允许直接删除!!");
             }

         }

         function Command_AddChildNode(_text, _value, _image, _up_value) {
             //alert(_up_value);
             TV_Tree.beginUpdate();
             var newNode = new ComponentArt.Web.UI.TreeViewNode();
             newNode.set_text(_text);
             newNode.set_value(_value);
             if (_image != "") {
                 newNode.set_imageUrl(_image);
             }
             newNode.set_expanded(true);
             TV_Tree.findNodeByProperty("Value", _up_value).get_nodes().add(newNode);
             TV_Tree.endUpdate();
         }

         function Command_EditChildNode(_text, _value, _image, _up_value) {

             TV_Tree.beginUpdate();
             var newNode = TV_Tree.findNodeByProperty("Value", _value);

             try {

                 if (_up_value == newNode.get_parentNode().get_value()) {

                     newNode.set_text(_text);
                     newNode.set_value(_value);
                     if (_image != "") {
                         newNode.set_imageUrl(_image);
                     }
                 }
                 else {
                     //alert(3);
                     TV_Tree.findNodeByProperty("Value", _value).remove();
                     newNode.set_text(_text);
                     newNode.set_value(_value);
                     if (_image != "") {
                         newNode.set_imageUrl(_image);
                     }
                     newNode.set_expanded(true);
                     TV_Tree.findNodeByProperty("Value", _up_value).get_nodes().add(newNode);
                 }
             }
             catch (err) {
                 newNode.set_text(_text);
                 newNode.set_value(_value);
             }
             TV_Tree.endUpdate();
         }

         function Command_DelChildNode() {
             TV_Tree.get_selectedNode().remove();
         }
    </script>
</head>
<body>
  <form id="form1" runat="server">
    <table width="100%" cellspacing="2" border="1" align="center" cellpadding="0" bordercolor="#CCCCCC"
        class="board_kong">
        <tr>
            <td>
                <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="1">
                    <tr>
                        <td style="border-bottom: #CCCCCC 1px solid; height: 24px">
                            <table class="title_table">
                                <tr>
                                    <td align="left" class="l_title">
                                       <%=_XPath %>
                                    </td>
                                    <td width="180" align="right" class="l_title">
                                        <input id="addbut" type="button" value="增加节点" onclick="addNode()" />&nbsp;&nbsp;<input 
                                            id="delbut" type="button" value="删除节点"  onclick="delNode()" /></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <ComponentArt:Splitter runat="server" ID="sp" FillHeight="true" FillWidth="true"
                                ImagesBaseUrl="images/Splitter/">
                                <Layouts>
                                    <ComponentArt:SplitterLayout>
                                        <Panes Orientation="Horizontal" SplitterBarCssClass="HorizontalSplitterBar" SplitterBarActiveCssClass="ActiveSplitterBar"
                                            SplitterBarWidth="5">
                                            <ComponentArt:SplitterPane PaneContentId="TreeViewContent" Width="180" MinWidth="180"
                                                ClientSideOnResize="resizeTree" CssClass="SplitterPane" />
                                            <ComponentArt:SplitterPane>
                                                <Panes Orientation="Vertical" SplitterBarCollapseImageUrl="splitter_verCol.gif" SplitterBarCollapseHoverImageUrl="splitter_verColHover.gif"
                                                    SplitterBarExpandImageUrl="splitter_verExp.gif" SplitterBarExpandHoverImageUrl="splitter_verExpHover.gif"
                                                    SplitterBarCollapseImageWidth="116" SplitterBarCollapseImageHeight="5" SplitterBarCssClass="VerticalSplitterBar"
                                                    SplitterBarCollapsedCssClass="CollapsedVerticalSplitterBar" SplitterBarActiveCssClass="ActiveSplitterBar"
                                                    SplitterBarWidth="5">
                                                    <ComponentArt:SplitterPane PaneContentId="MainContent" CssClass="SplitterPane" />
                                                </Panes>
                                            </ComponentArt:SplitterPane>
                                        </Panes>
                                    </ComponentArt:SplitterLayout>
                                </Layouts>
                                <Content>
                                    <ComponentArt:SplitterPaneContent ID="TreeViewContent">
                                        <ComponentArt:TreeView ID="TV_Tree" Height="100%" Width="100%" EnableViewState="true"
                                            KeyboardEnabled="false" ShowLines="true" DisplayMargin="false" NodeCssClass="TreeNode" ClientSideOnNodeSelect="nodeSelect"
                                            SelectedNodeCssClass="SelectedTreeNode" MultipleSelectedNodeCssClass="MultipleSelectedTreeNode"
                                            HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit" CutNodeCssClass="CutTreeNode"
                                            MarginWidth="20" DefaultMarginImageWidth="24" DefaultMarginImageHeight="20" LineImageWidth="19"
                                            LineImageHeight="20" NodeLabelPadding="3" ParentNodeImageUrl="folders.gif" LeafNodeImageUrl="folder.gif"
                                            CollapseImageUrl="exp.gif" ExpandImageUrl="col.gif" ExpandCollapseImageWidth="19"
                                            ExpandCollapseImageHeight="20" ImagesBaseUrl="images/tree/" LineImagesFolderUrl="images/lines/"
                                            runat="server">
                                        </ComponentArt:TreeView>
                                    </ComponentArt:SplitterPaneContent>
                                    <ComponentArt:SplitterPaneContent ID="MainContent">
                                        <iframe src="" id="mainBEFrame" name="mainBEFrame" width="100%" height="100%" scrolling="auto"
                                            frameborder="0"></iframe>
                                    </ComponentArt:SplitterPaneContent>
                                </Content>
                            </ComponentArt:Splitter>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
