Ejemplo n.º 1
0
Archivo: Tree.cs Proyecto: 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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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>
        }