예제 #1
0
파일: Tree.cs 프로젝트: Jobu/n2cms
        public static void AppendExpanderNode(TreeNode tn, string target)
        {
            Li li = new Li();

            li.Text = "{url:" + ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Content/Navigation/LoadTree.ashx?target=" + target + "&selected=" + HttpUtility.UrlEncode(tn.Node.Path)) + "}";

            tn.UlClass = "ajax";
            tn.Controls.Add(li);
        }
예제 #2
0
파일: Tree.cs 프로젝트: cherylhanlon/Tigers
        public static void AppendExpanderNode(TreeNode tn, string target)
        {
            Li li = new Li();

            //TODO respect EditInterfaceUrl setting
            li.Text = "{url:" + Url.ToAbsolute("~/N2/Content/Navigation/LoadTree.ashx?target=" + target + "&selected=" + HttpUtility.UrlEncode(tn.Node.Path)) + "}";

            tn.UlClass = "ajax";
            tn.Controls.Add(li);
        }
예제 #3
0
        public void CanRender_TreeNode()
        {
            PageItem item = CreateOneItem<PageItem>(1, "name", null);
            TreeNode tn = new TreeNode(item);

            StringBuilder sb = new StringBuilder();
            using (HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(sb)))
            {
                tn.RenderControl(writer);
            }

            Assert.AreEqual("<ul><li><a href=\"/name.aspx\">name</a></li></ul>", sb.ToString());
        }
예제 #4
0
        public void CanRender_TreeNode_WithChildNode()
        {
            PageItem root = CreateOneItem<PageItem>(1, "root", null);
            PageItem item = CreateOneItem<PageItem>(1, "item", root);
            TreeNode tn = new TreeNode(root);
            tn.Controls.Add(new TreeNode(item));

            StringBuilder sb = new StringBuilder();
            using (HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(sb)))
            {
                tn.RenderControl(writer);
            }

            Assert.AreEqual("<ul><li><a href=\"/root.aspx\">root</a><ul><li><a href=\"/item.aspx\">item</a></li></ul></li></ul>", sb.ToString());
        }
예제 #5
0
        public void CanRender_ChildNode_WithoutRendereringParent()
        {
            PageItem root = CreateOneItem<PageItem>(1, "root", null);
            PageItem item = CreateOneItem<PageItem>(1, "item", root);
            TreeNode tn = new TreeNode(root);
            tn.Controls.Add(new TreeNode(item));
            tn.ChildrenOnly = true;

            StringBuilder sb = new StringBuilder();
            using (HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(sb)))
            {
                tn.RenderControl(writer);
            }

            Assert.AreEqual("<li><a href=\"/item\">item</a></li>", sb.ToString());
            //<li><a href="/item.aspx">item</a></li>]]!=
            //<li><a href="/item.aspx">item</a></li><ul><li><a href="/root.aspx">root</a><ul><li><span>item</span></li></ul></li></ul>
        }