public ParseSelectionFromRequest ( ) : ContentItem | ||
Résultat | ContentItem |
public virtual ContextData GetInterfaceContextData(HttpContextBase context, SelectionUtility selection) { var item = selection.ParseSelectionFromRequest(); Url selectedUrl = context.Request["selectedUrl"]; if (item == null && selectedUrl != null) item = selection.ParseUrl(selectedUrl); var data = new ContextData(); if (item != null) { var adapter = engine.GetContentAdapter<NodeAdapter>(item); data.CurrentItem = adapter.GetTreeNode(item); data.ExtendedInfo = CreateExtendedContextData(item, resolveVersions: true); var l = adapter.GetLanguage(item); if (l != null) data.Language = new ContextLanguage { IconClass = "sprite " + (l.LanguageCode.Split('-').LastOrDefault() ?? string.Empty).ToLower(), LanguageCode = l.LanguageCode, LanguageTitle = l.LanguageTitle }; data.Flags = adapter.GetNodeFlags(item).ToList(); } else data.Flags = new List<string>(); var mangementUrl = "{ManagementUrl}".ResolveUrlTokens(); if (!selectedUrl.IsEmpty()) { data.ReturnUrl = HttpUtility.UrlDecode(selectedUrl["returnUrl"]); var isOrganizing = selectedUrl["edit"] == "drag"; if (selectedUrl.Path.StartsWith(mangementUrl, StringComparison.InvariantCultureIgnoreCase)) { data.Flags.Add("Management"); data.Flags.Add(selectedUrl.Path.Substring(mangementUrl.Length).ToUrl().PathWithoutExtension.Replace("/", "")); if (isOrganizing) data.Flags.Add("Organize"); } else if (isOrganizing) { data.Flags.Add("Management"); data.Flags.Add("Organize"); } } if (new[] { "MyselfRoot", "ContentEditRecursive", "ContentTemplatesDefault", "ContentWizardDefault", "UsersUsers" }.Intersect(data.Flags).Any() == false) data.Flags.Add("ContentPages"); data.Actions = CreateActions(context); var collaborationContext = CollaborationContext.Create(engine.Resolve<IProfileRepository>(), item, context); data.Messages = engine.Resolve<N2.Edit.Collaboration.ManagementMessageCollector>().GetMessages(collaborationContext).ToList(); data.Flags.AddRange(engine.Resolve<N2.Edit.Collaboration.ManagementFlagCollector>().GetFlags(collaborationContext)); if (ContextBuilt != null) ContextBuilt(this, new ContextBuiltEventArgs { Data = data }); return data; }
public object GetMessages(HttpContextBase context, SelectionUtility selection) { var messageContext = new Edit.Collaboration.CollaborationContext { SelectedItem = selection.ParseSelectionFromRequest(), User = context.User } .ParseLastDismissed(context.Request["lastDismissed"]); return new { Messages = engine.Resolve<N2.Edit.Collaboration.ManagementMessageCollector>().GetMessages(messageContext).ToList() }; }