コード例 #1
0
ファイル: TreeService.cs プロジェクト: nozebra/Umbraco-CMS
        /// <summary>
        /// static method to return the tree init url with the specified parameters
        /// </summary>
        /// <param name="startNodeID"></param>
        /// <param name="treeType"></param>
        /// <param name="showContextMenu"></param>
        /// <param name="isDialog"></param>
        /// <param name="dialogMode"></param>
        /// <param name="app"></param>
        /// <param name="nodeKey"></param>
        /// <param name="functionToCall"></param>
        /// <returns></returns>
        public static string GetInitUrl(int?startNodeID, string treeType, bool?showContextMenu,
                                        bool?isDialog, TreeDialogModes dialogMode, string app, string nodeKey, string functionToCall)
        {
            TreeService treeSvc = new TreeService(startNodeID, treeType, showContextMenu, isDialog, dialogMode, app, nodeKey, functionToCall);

            return(treeSvc.GetInitUrl());
        }
コード例 #2
0
        /// <summary>
        /// Returns the tree service url to return the tree xml structure from the node passed in
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetTreeServiceUrl(int id)
        {
            // updated by NH to pass showcontextmenu, isdialog and dialogmode variables
            TreeService treeSvc = new TreeService(id, TreeAlias, this.ShowContextMenu, this.IsDialog, this.DialogMode, "");

            return(treeSvc.GetServiceUrl());
        }
コード例 #3
0
        public override void Render(ref XmlTree tree)
        {
            if (this.NodeKey == string.Empty)
            {

                var seasons = _repository.GetAll().OrderBy(s => s.Year);
                foreach (var season in seasons) {
                    var node = XmlTreeNode.Create(this);
                    node.NodeID = season.Id.ToString();
                    node.Text = season.Name;
                    node.Icon = "calendar.png";
                    node.Action = "javascript:openSeasonTemplates(" + season.Id + ")";
                    node.NodeType = "season";

                    TreeService treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, string.Format("Season-{0}", season.Id));
                    node.Source = season.Races.Count() > 0 ? treeService.GetServiceUrl() : "";

                    node.Menu.Clear();
                    node.Menu.AddRange(new List<IAction> { ActionNew.Instance, ActionDelete.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance });

                    tree.Add(node);
                }

            } else {

                string keyType = this.NodeKey.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[0];
                int keyId = int.Parse(this.NodeKey.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[1]);

                switch (keyType) {
                    case "Season":

                        var season = _repository.GetById(keyId);

                        if (season != null) {

                            foreach (var race in season.Races)
                            {
                                var node = XmlTreeNode.Create(this);
                                node.NodeID = race.Id.ToString();
                                node.Text = race.Circuit.Name;
                                node.Icon = "map_go.png";
                                node.NodeType = "seasonRace";
                                node.Action = "javascript:openSeasonRace(" + race.Id + "," + season.Id + ")";

                                node.Menu.Clear();
                                if (race.GetQualificationResults().Count() == 0 && race.GetRaceResults().Count() == 0)
                                    node.Menu.Add(ActionDelete.Instance);

                                tree.Add(node);
                            }
                        }

                        break;
                }
            }
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
ファイル: BaseTree.cs プロジェクト: phaniarveti/Experiments
        /// <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;
        }
コード例 #6
0
ファイル: BaseTree.cs プロジェクト: phaniarveti/Experiments
 /// <summary>
 /// Returns the tree service url to render tree xml structure from the node passed in, in dialog mode.
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public virtual string GetTreeDialogUrl(int id)
 {
     TreeService treeSvc = new TreeService(id, TreeAlias, false, true, this.DialogMode, "");
     return treeSvc.GetServiceUrl();
 }
コード例 #7
0
ファイル: BaseTree.cs プロジェクト: phaniarveti/Experiments
		/// <summary>
		/// Returns the tree service url to return the tree xml structure based on a string node key.
		/// </summary>
		/// <param name="nodeKey"></param>
		/// <returns></returns>
		public string GetTreeServiceUrl(string nodeKey)
		{
			TreeService treeSvc = new TreeService(-1, TreeAlias, this.ShowContextMenu, this.IsDialog, this.DialogMode, "", nodeKey);
			return treeSvc.GetServiceUrl();
		}
コード例 #8
0
ファイル: BaseTree.cs プロジェクト: phaniarveti/Experiments
        /// <summary>
        /// Returns the tree service url to return the tree xml structure from the node passed in
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetTreeServiceUrl(int id)
        {
			// updated by NH to pass showcontextmenu, isdialog and dialogmode variables
			TreeService treeSvc = new TreeService(id, TreeAlias, this.ShowContextMenu, this.IsDialog, this.DialogMode, "");
			return treeSvc.GetServiceUrl();            
        }
コード例 #9
0
        /// <summary>
        /// Returns the tree service url to return the tree xml structure based on a string node key.
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <returns></returns>
        public string GetTreeServiceUrl(string nodeKey)
        {
            TreeService treeSvc = new TreeService(-1, TreeAlias, this.ShowContextMenu, this.IsDialog, this.DialogMode, "", nodeKey);

            return(treeSvc.GetServiceUrl());
        }
コード例 #10
0
		/// <summary>
		/// static method to return the tree init url with the specified parameters
		/// </summary>
		/// <param name="startNodeID"></param>
		/// <param name="treeType"></param>
		/// <param name="showContextMenu"></param>
		/// <param name="isDialog"></param>
		/// <param name="dialogMode"></param>
		/// <param name="app"></param>
		/// <param name="nodeKey"></param>
		/// <param name="functionToCall"></param>
		/// <returns></returns>
		public static string GetInitUrl(int? startNodeID, string treeType, bool? showContextMenu,
		   bool? isDialog, TreeDialogModes dialogMode, string app, string nodeKey, string functionToCall)
		{
			TreeService treeSvc = new TreeService(startNodeID, treeType, showContextMenu, isDialog, dialogMode, app, nodeKey, functionToCall);
			return treeSvc.GetInitUrl();
		}
コード例 #11
0
ファイル: loadResults.cs プロジェクト: robgray/f1speedguides
        protected void PopulateSeasons(ref XmlTree tree)
        {
            var seasons = _seasonRepository.GetAll().OrderBy(s => s.Year);

            foreach (var season in seasons)
            {

                var node = XmlTreeNode.Create(this);
                node.NodeID = season.Id.ToString();
                node.Text = season.Name;
                node.Icon = "folder.gif";
                node.OpenIcon = "folder_o.gif";

                var treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, string.Format("Season-{0}", season.Id));
                node.Source = treeService.GetServiceUrl();

                node.Menu.Clear();
                node.Menu.Add(ActionRefresh.Instance);

                tree.Add(node);

            }
        }
コード例 #12
0
ファイル: treeInit.aspx.cs プロジェクト: jracabado/justEdit-
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     TreeParams = TreeRequestParams.FromQueryStrings().CreateTreeService();
     DataBind();
 }
コード例 #13
0
        private void RenderCalendar(ref XmlTree tree)
        {
            if (null != this._db)
            {
                var calendars = this._db.Query<ECalendar>("SELECT * FROM ec_calendars");

                foreach (var c in calendars)
                {
                    XmlTreeNode node = XmlTreeNode.Create(this);

                    node.NodeID = c.Id.ToString();
                    node.NodeType = "CalendarEntry";
                    node.Text = c.Calendarname;
                    node.Icon = "calendar.png";
                    node.Action = "javascript:openCalendar(" + c.Id.ToString() + ")";

                    var treeService = new TreeService(c.Id, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, "CalendarEntry-"+c.Id.ToString());
                    node.Source = treeService.GetServiceUrl();

                    node.Menu.Clear();
                    //node.Menu.Add(ActionNew.Instance);
                    node.Menu.Add(ActionDelete.Instance);

                    tree.Add(node);
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// Render the top Root Nodes.
        /// - Calendar -> The Root of all Calendars
        /// - Locations -> The Root of all Locations
        /// </summary>
        /// <param name="tree">The current tree</param>
        private void PopulateRootNodes(ref XmlTree tree)
        {
            XmlTreeNode xNode = XmlTreeNode.Create(this);
            xNode.NodeID = "1";
            xNode.Text = "Calendar";
            //xNode.Action = "javascript:openCustom('" + "1" + "');";
            xNode.Icon = "calendar.png";
            xNode.OpenIcon = "folder_o.gif";
            xNode.NodeType = "EventCalendarBase";

            var treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, "CalendarBase");
            xNode.Source = treeService.GetServiceUrl();

            xNode.Menu.Clear();
            xNode.Menu.Add(ActionNew.Instance);
            xNode.Menu.Add(ActionRefresh.Instance);

            tree.Add(xNode);

            xNode = XmlTreeNode.Create(this);
            xNode.NodeID = "2";
            xNode.Text = "Locations";
            //xNode.Action = "javascript:openCustom('" + "1" + "');";
            xNode.Icon = "map.png";
            xNode.OpenIcon = "folder_o.gif";
            xNode.NodeType = "EventLocationBase";

            treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, "LocationBase");
            xNode.Source = treeService.GetServiceUrl();

            xNode.Menu.Clear();
            xNode.Menu.Add(ActionNew.Instance);
            xNode.Menu.Add(ActionRefresh.Instance);

            tree.Add(xNode);
        }
コード例 #15
0
        /// <summary>
        /// Returns the tree service url to render the tree
        /// </summary>
        /// <returns></returns>
        public string GetTreeInitUrl()
        {
            TreeService treeSvc = new TreeService(this.StartNodeID, TreeAlias, null, null, TreeDialogModes.none, "");

            return(treeSvc.GetInitUrl());
        }
コード例 #16
0
ファイル: TreeControl.ascx.cs プロジェクト: elrute/Triphulcas
 /// <summary>
 /// Can be set explicitly which will override what is in query strings or what has been set by properties.
 /// Useful for rendering out a tree dynamically with an instance of anoterh TreeService.
 /// By using this method, it will undo any of the tree service public properties that may be set
 /// on this object.
 /// </summary>
 public void SetTreeService(TreeService srv)
 {
     m_TreeService = srv;
     Initialize();
 }
コード例 #17
0
ファイル: TreeControl.ascx.cs プロジェクト: elrute/Triphulcas
        /// <summary>
        /// Initializes the control and looks up the tree structures that are required to be rendered.
        /// Properties of the control (or SetTreeService) need to be set before pre render or calling
        /// GetJSONContextMenu or GetJSONNode
        /// </summary>
        protected void Initialize()
        {
            //use the query strings if the TreeParams isn't explicitly set
            if (m_TreeService == null)
            {
                m_TreeService = TreeRequestParams.FromQueryStrings().CreateTreeService();
            }
            m_TreeService.App = GetCurrentApp();

            // Validate permissions
            if (!BasePages.BasePage.ValidateUserContextID(BasePages.BasePage.umbracoUserContextID))
                return;
            UmbracoEnsuredPage page = new UmbracoEnsuredPage();
            if (!page.ValidateUserApp(GetCurrentApp()))
                throw new ArgumentException("The current user doesn't have access to this application. Please contact the system administrator.");

            //find all tree definitions that have the current application alias that are ACTIVE.
            //if an explicit tree has been requested, then only load that tree in.
            m_ActiveTreeDefs = TreeDefinitionCollection.Instance.FindActiveTrees(GetCurrentApp());
            if (!string.IsNullOrEmpty(this.TreeType))
            {
                m_ActiveTreeDefs = m_ActiveTreeDefs
                    .Where(x => x.Tree.Alias == this.TreeType)
                    .ToList(); //this will only return 1
            }

            //find all tree defs that exists for the current application regardless of if they are active
            List<TreeDefinition> appTreeDefs = TreeDefinitionCollection.Instance.FindTrees(GetCurrentApp());

            //Create the BaseTree's based on the tree definitions found
            foreach (TreeDefinition treeDef in appTreeDefs)
            {
                //create the tree and initialize it
                BaseTree bTree = treeDef.CreateInstance();
                bTree.SetTreeParameters(m_TreeService);

                //store the created tree
                m_AllAppTrees.Add(bTree);
                if (treeDef.Tree.Initialize)
                    m_ActiveTrees.Add(bTree);
            }

            m_IsInit = true;
        }
コード例 #18
0
        /// <summary>
        /// Returns the tree service url to render tree xml structure from the node passed in, in dialog mode.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual string GetTreeDialogUrl(int id)
        {
            TreeService treeSvc = new TreeService(id, TreeAlias, false, true, this.DialogMode, "");

            return(treeSvc.GetServiceUrl());
        }
コード例 #19
0
ファイル: BaseTree.cs プロジェクト: phaniarveti/Experiments
 /// <summary>
 /// Returns the tree service url to render the tree
 /// </summary>
 /// <returns></returns>
 public string GetTreeInitUrl()
 {
     TreeService treeSvc = new TreeService(this.StartNodeID, TreeAlias, null, null, TreeDialogModes.none, "");
     return treeSvc.GetInitUrl();
 }
コード例 #20
0
 public void GetNodes()
 {
     XmlTree xTree = new XmlTree();
     ITreeService treeParams = new TreeService(1099, "content", false, false, TreeDialogModes.none, null);
     TreeDefinition tree = TreeDefinitionCollection.Instance.FindTree("content");
     BaseTree instance = tree.CreateInstance();
     instance.SetTreeParameters((ITreeService)treeParams);
     instance.Render(ref xTree);
     Response.ContentType = "application/json";
     Response.Write(((object)xTree).ToString());
 }
コード例 #21
0
ファイル: TrainerSection.cs プロジェクト: smashraid/Work
 /// <summary>
 /// Converts the tree parameters to a tree service object
 /// 
 /// </summary>
 /// 
 /// <returns/>
 public TreeService CreateTreeService()
 {
     TreeService treeService = new TreeService();
     treeService.ShowContextMenu = this.ShowContextMenu;
     treeService.IsDialog = this.IsDialog;
     treeService.DialogMode = this.DialogMode;
     treeService.App = this.Application;
     treeService.TreeType = this.TreeType;
     treeService.NodeKey = this.NodeKey;
     treeService.StartNodeID = this.StartNodeID;
     treeService.FunctionToCall = this.FunctionToCall;
     return treeService;
 }