Esempio n. 1
0
        /// <summary>
        /// This will call the normal Render method by passing the converted XmlTree to an XmlDocument.
        /// TODO: need to update this render method to do everything that the obsolete render method does and remove the obsolete method
        /// </summary>
        /// <param name="tree"></param>
        public override void Render(ref XmlTree tree)
        {
            XmlDocument xDoc = new XmlDocument();

            xDoc.LoadXml(tree.ToString(SerializedTreeType.XmlTree));
            Render(ref xDoc);
            tree = SerializableData.Deserialize(xDoc.OuterXml, typeof(XmlTree)) as XmlTree;
            //ensure that the tree type is set! this wouldn't need to be done if BaseTree was implemented properly
            foreach (XmlTreeNode node in tree)
            {
                node.TreeType = this.TreeAlias;
            }
        }
        public Dictionary <string, string> GetInitAppTreeData(string app, string treeType, bool showContextMenu, bool isDialog, TreeDialogModes dialogMode, string functionToCall, string nodeKey)
        {
            AuthorizeRequest(app, true);

            var treeCtl = new TreeControl()
            {
                ShowContextMenu = showContextMenu,
                IsDialog        = isDialog,
                DialogMode      = dialogMode,
                App             = app,
                TreeType        = string.IsNullOrEmpty(treeType) ? "" : treeType, //don't set the tree type unless explicitly set
                NodeKey         = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey,
                StartNodeID     = -1,                                             //TODO: set this based on parameters!
                FunctionToCall  = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall
            };

            var returnVal = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(treeType))
            {
                //if there's not tree type specified, then render out the tree as per normal with the normal
                //way of doing things
                returnVal.Add("json", treeCtl.GetJSONInitNode());
            }
            else
            {
                var tree = LegacyTreeDataConverter.GetLegacyTreeForLegacyServices(Services.ApplicationTreeService, treeType);

                tree.ShowContextMenu = showContextMenu;
                tree.IsDialog        = isDialog;
                tree.DialogMode      = dialogMode;
                tree.NodeKey         = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey;
                tree.FunctionToCall  = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall;
                //this would be nice to set, but no parameters :(
                //tree.StartNodeID =

                //now render it's start node
                var xTree = new XmlTree();
                xTree.Add(tree.RootNode);

                returnVal.Add("json", xTree.ToString());
            }

            returnVal.Add("app", app);
            returnVal.Add("js", treeCtl.JSCurrApp);

            return(returnVal);
        }
Esempio n. 3
0
        public Dictionary <string, string> GetInitAppTreeData(string app, string treeType, bool showContextMenu, bool isDialog, TreeDialogModes dialogMode, string functionToCall, string nodeKey)
        {
            Authorize();

            TreeControl treeCtl = new TreeControl()
            {
                ShowContextMenu = showContextMenu,
                IsDialog        = isDialog,
                DialogMode      = dialogMode,
                App             = app,
                TreeType        = string.IsNullOrEmpty(treeType) ? "" : treeType, //don't set the tree type unless explicitly set
                NodeKey         = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey,
                StartNodeID     = -1,                                             //TODO: set this based on parameters!
                FunctionToCall  = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall
            };

            Dictionary <string, string> returnVal = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(treeType))
            {
                //if there's not tree type specified, then render out the tree as per normal with the normal
                //way of doing things
                returnVal.Add("json", treeCtl.GetJSONInitNode());
            }
            else
            {
                //get the tree that we need to render
                var tree = TreeDefinitionCollection.Instance.FindTree(treeType).CreateInstance();
                tree.ShowContextMenu = showContextMenu;
                tree.IsDialog        = isDialog;
                tree.DialogMode      = dialogMode;
                tree.NodeKey         = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey;
                tree.FunctionToCall  = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall;
                //this would be nice to set, but no parameters :(
                //tree.StartNodeID =

                //now render it's start node
                XmlTree xTree = new XmlTree();
                xTree.Add(tree.RootNode);
                returnVal.Add("json", xTree.ToString());
            }

            returnVal.Add("app", app);
            returnVal.Add("js", treeCtl.JSCurrApp);

            return(returnVal);
        }
Esempio n. 4
0
        /// <summary>
        /// This checks to see which request parameters have been set for the Tree xml service
        /// to run. If there is no Tree Type specified, then this will return the xml structure
        /// of the initial tree nodes for all trees required for the current application. Otherwise
        /// this will return thre required tree xml based on the request parameters specified.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(m_treeParams.TreeType))
            {
                if (!string.IsNullOrEmpty(m_treeParams.Application))
                {
                    LoadAppTrees(m_treeParams.Application);
                }
                else
                {
                    LoadNullTree();
                }
            }
            else
            {
                LoadTree(m_treeParams.TreeType);
            }

            Response.Write(m_xTree.ToString(SerializedTreeType.XmlTree));
        }
Esempio n. 5
0
        /// <summary>
        /// Returns the JSON markup for the first node in the tree
        /// </summary>

        public string GetJSONInitNode()
        {
            if (!m_IsInit)
            {
                Initialize();
            }

            //if there is only one tree to render, we don't want to have a node to hold sub trees, we just want the
            //stand alone tree, so we'll just add a TreeType to the TreeService and ensure that the right method gets loaded in tree.aspx
            if (m_ActiveTrees.Count == 1)
            {
                m_TreeService.TreeType = m_ActiveTreeDefs[0].Tree.Alias;

                //convert the menu to a string
                //string initActions = (TreeSvc.ShowContextMenu ? Action.ToString(m_ActiveTrees[0].RootNodeActions) : "");

                //Since there's only 1 tree, render out the tree's RootNode properties
                XmlTree xTree = new XmlTree();
                xTree.Add(m_ActiveTrees[0].RootNode);
                return(xTree.ToString());
            }
            else
            {
                //If there is more than 1 tree for the application than render out a
                //container node labelled with the current application.
                XmlTree     xTree = new XmlTree();
                XmlTreeNode xNode = XmlTreeNode.CreateRoot(new NullTree(GetCurrentApp()));
                xNode.Text     = ui.Text("sections", GetCurrentApp(), UmbracoEnsuredPage.CurrentUser);
                xNode.Source   = m_TreeService.GetServiceUrl();
                xNode.Action   = "javascript:" + ClientTools.Scripts.OpenDashboard(GetCurrentApp());
                xNode.NodeType = m_TreeService.App.ToLower();
                xNode.NodeID   = "-1";
                xNode.Icon     = ".sprTreeFolder";
                xTree.Add(xNode);
                return(xTree.ToString());
            }
        }
Esempio n. 6
0
        public Dictionary <string, string> GetInitAppTreeData(string app, string treeType, bool showContextMenu, bool isDialog, TreeDialogModes dialogMode, string functionToCall, string nodeKey)
        {
            Authorize();

            var treeCtl = new TreeControl()
            {
                ShowContextMenu = showContextMenu,
                IsDialog        = isDialog,
                DialogMode      = dialogMode,
                App             = app,
                TreeType        = string.IsNullOrEmpty(treeType) ? "" : treeType, //don't set the tree type unless explicitly set
                NodeKey         = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey,
                //StartNodeID = -1, //TODO: set this based on parameters!
                FunctionToCall = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall
            };

            var returnVal = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(treeType))
            {
                //if there's not tree type specified, then render out the tree as per normal with the normal
                //way of doing things
                returnVal.Add("json", treeCtl.GetJSONInitNode());
            }
            else
            {
                //since 4.5.1 has a bug in it, it ignores if the treeType is specified and will always only render
                //the whole APP not just a specific tree.
                //this is a work around for this bug until it is fixed (which should be fixed in 4.5.2

                //get the tree that we need to render
                var tree = TreeDefinitionCollection.Instance.FindTree(treeType).CreateInstance();
                tree.ShowContextMenu = showContextMenu;
                tree.IsDialog        = isDialog;
                tree.DialogMode      = dialogMode;
                tree.NodeKey         = string.IsNullOrEmpty(nodeKey) ? "" : nodeKey;
                tree.FunctionToCall  = string.IsNullOrEmpty(functionToCall) ? "" : functionToCall;

                //now render it's start node
                var xTree = new XmlTree();

                //we're going to hijack the node name here to make it say content/media
                var node = tree.RootNode;
                if (node.Text.Equals("[FilteredContentTree]"))
                {
                    node.Text = ui.GetText("content");
                }
                else if (node.Text.Equals("[FilteredMediaTree]"))
                {
                    node.Text = ui.GetText("media");
                }
                xTree.Add(node);

                returnVal.Add("json", xTree.ToString());
            }

            returnVal.Add("app", app);
            returnVal.Add("js", treeCtl.JSCurrApp);

            return(returnVal);
        }