using System; using System.Collections.Generic; using System.Text; using System.Web; namespace ScrewTurn.Wiki.PluginFramework { /// /// Contains information about the Context of the page formatting. /// public class ContextInformation { private bool forIndexing; private bool forWysiwyg; private FormattingContext context; private PageInfo page; private string language; private HttpContext httpContext; private string username; private string[] groups; /// /// Initializes a new instance of the FormatContext class. /// /// A value indicating whether the formatting is being done for content indexing. /// A value indicating whether the formatting is being done for display in the WYSIWYG editor. /// The formatting context. /// The Page Information, if any, null otherwise. /// The current Thread's language (for example "en-US"). /// The current HTTP Context object. /// The current User's Username (or null). /// The groups the user is member of (or null). public ContextInformation(bool forIndexing, bool forWysiwyg, FormattingContext context, PageInfo page, string language, HttpContext httpContext, string username, string[] groups) { this.forIndexing = forIndexing; this.forWysiwyg = forWysiwyg; this.context = context; this.page = page; this.language = language; this.httpContext = httpContext; this.username = username; this.groups = groups; } /// /// Gets a value indicating whether the formatting is being done for content indexing. /// public bool ForIndexing { get { return forIndexing; } } /// /// Gets a value indicating whether the formatting is being done for display in the WYSIWYG editor. /// public bool ForWysiwyg { get { return forWysiwyg; } } /// /// Gets the formatting context. /// public FormattingContext Context { get { return context; } } /// /// Gets the Page Information. /// public PageInfo Page { get { return page; } } /// /// Gets the current Thread's Language (for example en-US). /// public string Language { get { return language; } } /// /// Gets the current HTTP Context object. /// public HttpContext HttpContext { get { return httpContext; } } /// /// Gets the Username of the current User (or null). /// /// If the Username is not available, the return value is null. public string Username { get { return username; } } /// /// Gets the groups the user is member of (or null). /// public string[] Groups { get { return groups; } } } /// /// Lists formatting contexts. /// public enum FormattingContext { /// /// The overall header. /// Header, /// /// The overall footer. /// Footer, /// /// The sidebar. /// Sidebar, /// /// The page header. /// PageHeader, /// /// The page footer. /// PageFooter, /// /// The page content. /// PageContent, /// /// Transcluded page content. /// TranscludedPageContent, /// /// The body of a message. /// MessageBody, /// /// Any other context. /// Other, /// /// No know context. /// Unknown } }