Esempio n. 1
0
        /// <summary>
        /// creates a new XmlTreeNode with the default parameters for the BaseTree root node
        /// </summary>
        /// <param name="bTree"></param>
        /// <returns></returns>
        public static XmlTreeNode CreateRoot(BaseTree bTree)
        {
            XmlTreeNode xNode = new XmlTreeNode();

            xNode.NodeID   = bTree.StartNodeID.ToString();
            xNode.Source   = bTree.GetTreeServiceUrl();
            xNode.Menu     = bTree.RootNodeActions.FindAll(delegate(IAction a) { return(true); });        //return a duplicate copy of the list
            xNode.NodeType = bTree.TreeAlias;
            xNode.Text     = BaseTree.GetTreeHeader(bTree.TreeAlias);
            //by default, all root nodes will open the dashboard to their application
            xNode.Action = "javascript:" + ClientTools.Scripts.OpenDashboard(bTree.app);
            xNode.IsRoot = true;
            //generally the tree type and node type are the same but in some cased they are not.
            xNode.m_treeType = bTree.TreeAlias;
            return(xNode);
        }
Esempio n. 2
0
        /// <summary>
        /// creates a new XmlTreeNode with the default parameters for the BaseTree root node
        /// </summary>
        /// <param name="bTree"></param>
        /// <returns></returns>
        public static XmlTreeNode CreateRoot(BaseTree bTree)
        {
            XmlTreeNode xNode = new XmlTreeNode();

            xNode.NodeID   = bTree.StartNodeID.ToString();
            xNode.Source   = bTree.GetTreeServiceUrl();
            xNode.Menu     = bTree.RootNodeActions.FindAll(delegate(IAction a) { return(true); });        //return a duplicate copy of the list
            xNode.NodeType = bTree.TreeAlias;
            xNode.Text     = BaseTree.GetTreeHeader(bTree.TreeAlias);

            // By default the action from the trees.config will be used, if none is specified then the apps dashboard will be used.
            var appTreeItem = umbraco.BusinessLogic.ApplicationTree.getByAlias(bTree.TreeAlias);

            xNode.Action = appTreeItem == null || String.IsNullOrEmpty(appTreeItem.Action) ? "javascript:" + ClientTools.Scripts.OpenDashboard(bTree.app) : "javascript:" + appTreeItem.Action;

            xNode.IsRoot = true;
            //generally the tree type and node type are the same but in some cased they are not.
            xNode.m_treeType = bTree.TreeAlias;
            return(xNode);
        }
        /// <summary>
        /// Converts an ITree into a BaseTree. This is used for Legacy trees that don't inherit from BaseTree already.
        /// </summary>
        /// <param name="tree"></param>
        /// <param name="alias"></param>
        /// <param name="appAlias"></param>
        /// <param name="iconClosed"></param>
        /// <param name="iconOpened"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static BaseTree FromITree(ITree tree, string alias, string appAlias, string iconClosed, string iconOpened, string action)
        {
            TreeService treeSvc = new TreeService(null, alias, null, null, TreeDialogModes.none, appAlias);
            //create the generic XmlTreeNode and fill it with the properties from the db
            NullTree    nullTree = new NullTree(appAlias);
            XmlTreeNode node     = XmlTreeNode.CreateRoot(nullTree);

            node.Text     = BaseTree.GetTreeHeader(alias);;
            node.Action   = action;
            node.Source   = treeSvc.GetServiceUrl();
            node.Icon     = iconClosed;
            node.OpenIcon = iconOpened;
            node.NodeType = "init" + alias;
            node.NodeType = alias;
            node.NodeID   = "init";
            node.Menu     = BaseTree.GetDefaultRootNodeActions();

            //convert the tree to a LegacyTree
            LegacyTree bTree = new LegacyTree(tree, appAlias, node);

            return(bTree);
        }