public static bool IsTimeline(string id) { if (IsGuid(id)) { Guid parsedId = Guid.Parse(id); return(_storage.Timelines.Any(candidate => candidate.Id == parsedId)); } else { string parsedTitle = FriendlyUrl.FriendlyUrlDecode(id); return(_storage.Timelines.Any(candidate => candidate.Title == parsedTitle)); } }
public static string RootTimelineId(Uri collection) { string root = "00000000-0000-0000-0000-000000000000"; if (collection != null) { if (IsGuid(collection.Segments[collection.Segments.Length - 1])) { if (IsTimeline(collection.Segments[collection.Segments.Length - 1])) { Timeline timeline = _storage.GetRootTimeline(_storage.GetCollectionFromGuid(Guid.Parse(collection.Segments[collection.Segments.Length - 1]))); Guid rootGuid = timeline.Id; if (Guid.Parse(root) != rootGuid) { root = rootGuid.ToString(); } } if (IsExhibit(collection.Segments[collection.Segments.Length - 1])) { Timeline exhibit = _storage.GetRootTimeline(_storage.GetCollectionFromExhibitGuid(Guid.Parse(collection.Segments[collection.Segments.Length - 1]))); Guid rootGuid = exhibit.Id; if (Guid.Parse(root) != rootGuid) { root = rootGuid.ToString(); } } if (IsContentItem(collection.Segments[collection.Segments.Length - 1])) { Timeline contentItem = _storage.GetRootTimeline(_storage.GetCollectionFromContentItemGuid(Guid.Parse(collection.Segments[collection.Segments.Length - 1]))); Guid rootGuid = contentItem.Id; if (Guid.Parse(root) != rootGuid) { root = rootGuid.ToString(); } } } else { string title = FriendlyUrl.FriendlyUrlDecode(UrlCollection(collection).Substring(0, UrlCollection(collection).Length - 1)); Timeline timeline = _storage.GetRootTimeline(_storage.GetCollectionGuid(title)); if (timeline != null) { root = timeline.Id.ToString(); } } } return(root); }
/// <summary> /// Validates if a supercollection is present. /// </summary> /// <param name="superCollection"></param> /// <returns>Boolean value</returns> public static bool IsSuperCollectionPresent(string superCollection) { string _superCollection = FriendlyUrl.FriendlyUrlDecode(superCollection); if (_storage.SuperCollections.Any(candidate => candidate.Title.ToLower() == _superCollection)) { return(true); } else { HttpContext.Current.Response.Redirect("/"); return(false); } }
public static string GetTitle(Uri url) { StringBuilder title = new StringBuilder(); string urlGuid = UrlGuid(url); if (url != null && url.Segments.Length > 1 && IsGuid(url.Segments[url.Segments.Length - 1])) { if (IsTimeline(urlGuid)) { title.Append(Timelines(urlGuid).Title + " - "); } else if (IsExhibit(urlGuid)) { title.Append(Exhibits(urlGuid).Title + " - "); } else if (IsContentItem(urlGuid)) { title.Append(ContentItems(urlGuid).Title + " - "); } } title.Append("ChronoZoom"); if (!string.IsNullOrEmpty(UrlSuperCollection(url))) { if (UrlSuperCollection(url) != ConfigurationManager.AppSettings["DefaultSuperCollection"]) { title.Append(FriendlyUrl.FriendlyUrlDecode(" (" + UrlSuperCollection(url)) + ")"); } } else if (!string.IsNullOrEmpty(UrlCollection(url))) { title.Append(FriendlyUrl.FriendlyUrlDecode(" (" + UrlCollection(url)) + ")"); } return(title.ToString()); }