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);
                }
            }
        }
        /// <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);

            //xNode = XmlTreeNode.Create(this);
            //xNode.NodeID = "3";
            //xNode.Text = "Settings";
            //xNode.Action = "javascript:openSettings();";
            //xNode.Icon = "cog.png";
            //xNode.NodeType = "GeneralSettings";
            //xNode.Menu.Clear();

            //tree.Add(xNode);
        }
Exemple #3
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());
            }
        }
        public override void Render(ref XmlTree tree)
        {
            // Rendering the child nodes of the jobs folder
            if (this.NodeKey == string.Empty)
            {
                var jobsNode = XmlTreeNode.Create(this);
                jobsNode.NodeID      = "1";
                jobsNode.NodeType    = string.Empty;
                jobsNode.Text        = "Hangfire Jobs";
                jobsNode.Action      = "#";
                jobsNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/jobs/enqueued');";
                jobsNode.Icon        = "~/App_Plugins/Tools/Hangfire/jobs.png";
                jobsNode.HasChildren = true;
                TreeService treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, "HangfireJobs");
                jobsNode.Source = treeService.GetServiceUrl();
                OnBeforeNodeRender(ref tree, ref jobsNode, EventArgs.Empty);
                tree.Add(jobsNode);
                OnAfterNodeRender(ref tree, ref jobsNode, EventArgs.Empty);

                var retriesNode = XmlTreeNode.Create(this);
                retriesNode.NodeID      = "2";
                retriesNode.NodeType    = string.Empty;
                retriesNode.Text        = "Hangfire retries";
                retriesNode.Action      = "#";
                retriesNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/retries');";
                retriesNode.Icon        = "~/App_Plugins/Tools/Hangfire/retries.png";
                retriesNode.HasChildren = false;
                OnBeforeNodeRender(ref tree, ref retriesNode, EventArgs.Empty);
                tree.Add(retriesNode);
                OnAfterNodeRender(ref tree, ref retriesNode, EventArgs.Empty);

                var recurringNode = XmlTreeNode.Create(this);
                recurringNode.NodeID      = "3";
                recurringNode.NodeType    = string.Empty;
                recurringNode.Text        = "Hangfire recurring";
                recurringNode.Action      = "#";
                recurringNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/recurring');";
                recurringNode.Icon        = "~/App_Plugins/Tools/Hangfire/recurring.png";
                recurringNode.HasChildren = false;
                OnBeforeNodeRender(ref tree, ref recurringNode, EventArgs.Empty);
                tree.Add(recurringNode);
                OnAfterNodeRender(ref tree, ref recurringNode, EventArgs.Empty);

                var serversNode = XmlTreeNode.Create(this);
                serversNode.NodeID      = "4";
                serversNode.NodeType    = string.Empty;
                serversNode.Text        = "Hangfire servers";
                serversNode.Action      = "#";
                serversNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/servers');";
                serversNode.Icon        = "~/App_Plugins/Tools/Hangfire/server.png";
                serversNode.HasChildren = false;
                OnBeforeNodeRender(ref tree, ref serversNode, EventArgs.Empty);
                tree.Add(serversNode);
                OnAfterNodeRender(ref tree, ref serversNode, EventArgs.Empty);
            }
            else if (this.NodeKey == "HangfireJobs")
            {
                var enqueuedNode = XmlTreeNode.Create(this);
                enqueuedNode.NodeID      = "5";
                enqueuedNode.NodeType    = string.Empty;
                enqueuedNode.Text        = "Enqueued Jobs";
                enqueuedNode.Action      = "#";
                enqueuedNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/jobs/enqueued');";
                enqueuedNode.Icon        = "~/App_Plugins/Tools/Hangfire/enqueued.png";
                enqueuedNode.HasChildren = false;
                tree.Add(enqueuedNode);

                var scheduledNode = XmlTreeNode.Create(this);
                scheduledNode.NodeID      = "5";
                scheduledNode.NodeType    = string.Empty;
                scheduledNode.Text        = "Scheduled Jobs";
                scheduledNode.Action      = "#";
                scheduledNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/jobs/scheduled');";
                scheduledNode.Icon        = "~/App_Plugins/Tools/Hangfire/scheduled.png";
                scheduledNode.HasChildren = false;
                tree.Add(scheduledNode);

                var processingNode = XmlTreeNode.Create(this);
                processingNode.NodeID      = "6";
                processingNode.NodeType    = string.Empty;
                processingNode.Text        = "Processing Jobs";
                processingNode.Action      = "#";
                processingNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/jobs/processing');";
                processingNode.Icon        = "~/App_Plugins/Tools/Hangfire/processing.png";
                processingNode.HasChildren = false;
                tree.Add(processingNode);

                var succeededNode = XmlTreeNode.Create(this);
                succeededNode.NodeID      = "7";
                succeededNode.NodeType    = string.Empty;
                succeededNode.Text        = "Succeeded Jobs";
                succeededNode.Action      = "#";
                succeededNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/jobs/succeeded');";
                succeededNode.Icon        = "~/App_Plugins/Tools/Hangfire/succeeded.png";
                succeededNode.HasChildren = false;
                tree.Add(succeededNode);

                var failedNode = XmlTreeNode.Create(this);
                failedNode.NodeID      = "8";
                failedNode.NodeType    = string.Empty;
                failedNode.Text        = "Failed Jobs";
                failedNode.Action      = "#";
                failedNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/jobs/failed');";
                failedNode.Icon        = "~/App_Plugins/Tools/Hangfire/failed.png";
                failedNode.HasChildren = false;
                tree.Add(failedNode);

                var deletedNode = XmlTreeNode.Create(this);
                deletedNode.NodeID      = "9";
                deletedNode.NodeType    = string.Empty;
                deletedNode.Text        = "Deleted Jobs";
                deletedNode.Action      = "#";
                deletedNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/jobs/deleted');";
                deletedNode.Icon        = "~/App_Plugins/Tools/Hangfire/deleted.png";
                deletedNode.HasChildren = false;
                tree.Add(deletedNode);

                var awaitingNode = XmlTreeNode.Create(this);
                awaitingNode.NodeID      = "10";
                awaitingNode.NodeType    = string.Empty;
                awaitingNode.Text        = "Awaiting Jobs";
                awaitingNode.Action      = "#";
                awaitingNode.Action      = "javascript:openPage('/umbraco/backoffice/Plugins/hangfire/jobs/awaiting');";
                awaitingNode.Icon        = "~/App_Plugins/Tools/Hangfire/awaiting.png";
                awaitingNode.HasChildren = false;
                tree.Add(awaitingNode);
            }
        }