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(); }
public IEnumerable <RecurringEvent> GetAll() { return(RecurringEventService.GetAllEvents()); }