Beispiel #1
0
        /// <summary>
        /// Get the XmlTree for the Content Tree for the node ID passed in.
        /// </summary>
        /// <param name="nodeID"></param>
        /// <returns></returns>
        public static XmlTree GetNodeData(int?nodeID, CheckboxTree cbTree)
        {
            XmlTree xTree = new XmlTree();

            cbTree.ContentTree.id = (nodeID == null ? cbTree.ContentTree.StartNodeID : nodeID.Value);
            cbTree.ContentTree.Render(ref xTree);
            return(xTree);
        }
Beispiel #2
0
        /// <summary>
        /// Converts an XmlTreeNode to a TreeNode
        /// </summary>
        /// <param name="xNode"></param>
        /// <returns></returns>
        public static TreeNode FromXmlTreeNode(XmlTreeNode xNode, CheckboxTree cbTree)
        {
            TreeNode node = new TreeNode(xNode.Text, xNode.NodeID, cbTree.ImagesRootPath + xNode.Icon, xNode.Action, "");

            node.ImageUrl = "";

            node.PopulateOnDemand = (string.IsNullOrEmpty(xNode.Source) ? false : true);
            //node.SelectAction = (string.IsNullOrEmpty(xNode.Source) ? TreeNodeSelectAction.Select : TreeNodeSelectAction.Expand);
            node.SelectAction = TreeNodeSelectAction.None;

            string nodeMarkup = "";

            //add our custom checkbox
            if (cbTree.ShowCheckBoxes)
            {
                nodeMarkup += string.Format("<span class=\"treeCheckBox\"><input type='checkbox' id='{0}' name='{0}' value='{1}' onclick='{2}(this);' /></span>",
                                            "chk" + node.Value, node.Value, cbTree.OnClientNodeChecked);
            }

            if (xNode.Icon.StartsWith("."))
            {
                nodeMarkup += "<div class=\"sprTree " + xNode.Icon.TrimStart('.') + "\"><img class=\"webfx-tree-icon\" src=\"../images/nada.gif\"/> </div>";
            }
            else
            {
                nodeMarkup += "<span class=\"treeIcon\"><img src=\"" + cbTree.ImagesRootPath + xNode.Icon + "\"/></span>";
            }

            //show the node as being not published
            if (xNode.NotPublished.Value)
            {
                nodeMarkup += string.Format("<span class=\"treeText\" style='color:{0};'>{1}</span>", cbTree.UnpublishedColor, node.Text);
            }
            else
            {
                nodeMarkup += string.Format("<span class=\"treeText\">{0}</span>", node.Text);
            }

            node.Text = nodeMarkup;

            return(node);
        }
Beispiel #3
0
 /// <summary>
 /// Get the XmlTree for the Content Tree for the node ID passed in.
 /// </summary>
 /// <param name="nodeID"></param>
 /// <returns></returns>
 public static XmlTree GetNodeData(int? nodeID, CheckboxTree cbTree)
 {
     XmlTree xTree = new XmlTree();
     cbTree.ContentTree.id = (nodeID == null ? cbTree.ContentTree.StartNodeID : nodeID.Value);
     cbTree.ContentTree.Render(ref xTree);
     return xTree;
 }
Beispiel #4
0
        /// <summary>
        /// Converts an XmlTreeNode to a TreeNode
        /// </summary>
        /// <param name="xNode"></param>
        /// <returns></returns>
        public static TreeNode FromXmlTreeNode(XmlTreeNode xNode, CheckboxTree cbTree)
        {
            TreeNode node = new TreeNode(xNode.Text, xNode.NodeID, cbTree.ImagesRootPath + xNode.Icon, xNode.Action, "");
            node.ImageUrl = "";

            node.PopulateOnDemand = (string.IsNullOrEmpty(xNode.Source) ? false : true);
            //node.SelectAction = (string.IsNullOrEmpty(xNode.Source) ? TreeNodeSelectAction.Select : TreeNodeSelectAction.Expand);
            node.SelectAction = TreeNodeSelectAction.None;

            string nodeMarkup = "";

            //add our custom checkbox
            if (cbTree.ShowCheckBoxes)
                nodeMarkup += string.Format("<span class=\"treeCheckBox\"><input type='checkbox' id='{0}' name='{0}' value='{1}' onclick='{2}(this);' /></span>",
                    "chk" + node.Value, node.Value, cbTree.OnClientNodeChecked);

            if (xNode.Icon.StartsWith(".")) {
                nodeMarkup += "<div class=\"sprTree " + xNode.Icon.TrimStart('.') + "\"><img class=\"webfx-tree-icon\" src=\"../images/nada.gif\"/> </div>";
            } else {
                nodeMarkup += "<span class=\"treeIcon\"><img src=\"" + cbTree.ImagesRootPath + xNode.Icon + "\"/></span>";
            }

            //show the node as being not published
            if (xNode.NotPublished.Value)
                nodeMarkup += string.Format("<span class=\"treeText\" style='color:{0};'>{1}</span>", cbTree.UnpublishedColor, node.Text);
            else {
                nodeMarkup += string.Format("<span class=\"treeText\">{0}</span>", node.Text);
            }

            node.Text = nodeMarkup;

            return node;
        }
Beispiel #5
0
 /// <summary>
 /// Converts an XmlTree to a TreeNodeCollection 
 /// </summary>
 /// <param name="xTree"></param>
 /// <param name="parentNode"></param>
 /// <returns></returns>
 public static TreeNodeCollection FromXmlTree(XmlTree xTree, TreeNode parentNode, CheckboxTree cbTree)
 {
     TreeNodeCollection nodes = new TreeNodeCollection(parentNode);
     foreach (XmlTreeNode xNode in xTree) {
         if (xNode != null) {
             TreeNode node = FromXmlTreeNode(xNode, cbTree);
             nodes.Add(node);
         }
     }
     return nodes;
 }
Beispiel #6
0
        /// <summary>
        /// Converts an XmlTree to a TreeNodeCollection
        /// </summary>
        /// <param name="xTree"></param>
        /// <param name="parentNode"></param>
        /// <returns></returns>
        public static TreeNodeCollection FromXmlTree(XmlTree xTree, TreeNode parentNode, CheckboxTree cbTree)
        {
            TreeNodeCollection nodes = new TreeNodeCollection(parentNode);

            foreach (XmlTreeNode xNode in xTree)
            {
                if (xNode != null)
                {
                    TreeNode node = FromXmlTreeNode(xNode, cbTree);
                    nodes.Add(node);
                }
            }
            return(nodes);
        }