예제 #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;
        }
예제 #2
0
        /// <summary>
        /// This will call the normal Render method by passing the converted XmlTree to an XmlDocument.
        /// This is used only for backwards compatibility of converting normal ITrees to BasicTree's
        /// </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;
			
            foreach (XmlTreeNode node in tree)
            {
                //ensure that the tree type is set for each node
                node.TreeType = this.TreeAlias;
            }
        }
예제 #3
0
        /// <summary>
        /// This will call the normal Render method by passing the converted XmlTree to an XmlDocument.
        /// This is used only for backwards compatibility of converting normal ITrees to BasicTree's
        /// </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;

            foreach (XmlTreeNode node in tree)
            {
                //ensure that the tree type is set for each node
                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;
        }
예제 #5
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;
		}	
        /// <summary>
        /// Returns the serialized data for the nodeId passed in.
        /// </summary>
        /// <remarks>
        /// This may not work with ITrees that don't support the BaseTree structure with TreeService.
        /// If a tree implements other query string data to make it work, this may not function since
        /// it only relies on the 3 parameters.
        /// </remarks>
        /// <param name="alias"></param>
        /// <param name="nodeId"></param>
        /// <returns></returns>
        public string GetSerializedNodeData(string nodeId)
        {
            XmlTree xTree = new XmlTree();
            int     id;

            if (int.TryParse(nodeId, out id))
            {
                this.id = id;
            }
            else
            {
                this.NodeKey = nodeId;
            }

            this.Render(ref xTree);

            return(xTree.ToString());
        }
예제 #7
0
		/// <summary>
		/// Returns the serialized data for the nodeId passed in.
		/// </summary>
		/// <remarks>
		/// This may not work with ITrees that don't support the BaseTree structure with TreeService.
		/// If a tree implements other query string data to make it work, this may not function since
		/// it only relies on the 3 parameters.
		/// </remarks>
		/// <param name="alias"></param>
		/// <param name="nodeId"></param>
		/// <returns></returns>
		public string GetSerializedNodeData(string nodeId)
		{
			XmlTree xTree = new XmlTree();
			int id;
			if (int.TryParse(nodeId, out id))
				this.id = id;
			else
				this.NodeKey = nodeId;

			this.Render(ref xTree);            

			return xTree.ToString();
		}
예제 #8
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();
            }
        }
예제 #9
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;
        }