/// <summary> /// Get nodes for custom trees /// </summary> /// <param name="id">Node Id</param> /// <param name="queryStrings">FormDataCollection</param> /// <returns>Nodes for custom tree</returns> protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { var nodes = new TreeNodeCollection(); var settings = _settingsService.GetSettings(); if (id == PackageConstants.FirstNodeId && settings != null && !settings.HideLeftPanel) { foreach (var timage in _imageService.GetTopOptimizedImages()) { nodes.Add(CreateTreeNode(timage.Id + string.Empty, id, queryStrings, timage.Name, PackageConstants.TreeIcon, false, FormDataCollectionExtensions.GetValue <string>(queryStrings, PackageConstants.AppAlias) + PackageConstants.CustomTreeUrl + timage.Id)); } } return(nodes); }
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { var text = Services.TextService; var settingsNodes = new List <dynamic>(); settingsNodes.Add(new { Id = "PairSettings", TitleKey = "pairing", Icon = "icon-link", RouteAction = "pairing" }); settingsNodes.Add(new { Id = "AppSettings", TitleKey = "application", Icon = "icon-hearts", RouteAction = "application" }); var nodes = new TreeNodeCollection(); if (id == Constants.System.Root.ToInvariantString()) { foreach (var node in settingsNodes) { var routePath = string.Format("{0}/{1}/{2}/all", FormDataCollectionExtensions.GetValue <string>(queryStrings, "application"), TreeAlias, node.RouteAction); var treeTitle = text.Localize(string.Format("latch_settingsTree/{0}", node.TitleKey), CultureInfo.CurrentCulture); nodes.Add(CreateTreeNode(node.Id, id, queryStrings, treeTitle, node.Icon, false, routePath)); } } return(nodes); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == "-1") { var nodes = new TreeNodeCollection(); nodes.Add(CreateTreeNode("people", id, queryStrings, "People", "icon-people", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/overviewPeople/all")); return(nodes); } //this tree doesn't suport rendering more than 2 levels throw new NotSupportedException(); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == global::Umbraco.Core.Constants.System.Root.ToInvariantString()) { var tree = new TreeNodeCollection(); tree.Add(CreateTreeNode("calendarTree", id, queryStrings, "Calendar", "icon-calendar-alt", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/overviewCalendar/all")); tree.Add(CreateTreeNode("locationTree", id, queryStrings, "Locations", "icon-globe-alt", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/overviewLocation/all")); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { tree.Add(CreateTreeNode("security", id, queryStrings, "Security", "icon-combination-lock", true)); } return(tree); } if (id == "calendarTree") { var tree = new TreeNodeCollection(); List <ECalendar> calendar = new List <ECalendar>(); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { calendar = CalendarService.GetAllCalendar().ToList(); } else { calendar = CalendarService.GetCalendarForUser(Security.GetUserId()).ToList(); } foreach (var cal in calendar) { tree.Add(CreateTreeNode("c-" + cal.Id.ToString(), id, queryStrings, cal.Calendarname, "icon-calendar", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editCalendar/" + cal.Id)); } return(tree); } if (id == "locationTree") { var tree = new TreeNodeCollection(); List <EventLocation> locations = new List <EventLocation>(); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { locations = LocationService.GetAllLocations().ToList(); } else { locations = LocationService.GetLocationsForUser(Security.GetUserId()).ToList(); } foreach (var loc in locations) { tree.Add(CreateTreeNode("l-" + loc.Id.ToString(), id, queryStrings, loc.LocationName, "icon-map-loaction", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editLocation/" + loc.Id.ToString())); } return(tree); } if (id == "security") { var us = Services.UserService; var tree = new TreeNodeCollection(); var total = 0; var users = us.GetAll(0, 1000, out total); foreach (var user in users.Where(x => x.AllowedSections.Contains("eventCalendar"))) { //Only the superadmin should change the settings for superadmin if ((Security.CurrentUser.Id != 0 && user.Id != 0) || Security.CurrentUser.Id == 0) { tree.Add(CreateTreeNode("u-" + user.Id.ToString(), id, queryStrings, user.Name, "", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editUser/" + user.Id.ToString())); } } return(tree); } if (id.Contains("c-")) { List <Event> events = EventService.GetAllEvents().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList();//ctrl.GetAll().Where(x => x.calendarId.ToString() == id.Replace("c-","")).ToList(); var tree = new TreeNodeCollection(); foreach (var e in events) { tree.Add(CreateTreeNode("e-" + e.Id.ToString(), id, queryStrings, e.title, "icon-music", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editEvent/" + e.Id)); } List <RecurringEvent> revents = RecurringEventService.GetAllEvents().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList();//ctrl2.GetAll().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList(); foreach (var e in revents) { tree.Add(CreateTreeNode("re-" + e.Id.ToString(), id, queryStrings, e.title, "icon-axis-rotation", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editREvent/" + e.Id)); } return(tree); } //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }