using System; using System.Collections.Generic; using System.Text; using ScrewTurn.Wiki.AclEngine; namespace ScrewTurn.Wiki.PluginFramework { /// /// The interface that must be implemented in order to create a custom Settings and Log Storage Provider for ScrewTurn Wiki. /// /// A class that implements this interface should have some kind of data caching. /// The Provider should not use the method during the execution of /// the method, nor access the wiki log. public interface ISettingsStorageProviderV30 : IProviderV30 { /// /// Retrieves the value of a Setting. /// /// The name of the Setting. /// The value of the Setting, or null. /// If is null. /// If is empty. string GetSetting(string name); /// /// Stores the value of a Setting. /// /// The name of the Setting. /// The value of the Setting. Value cannot contain CR and LF characters, which will be removed. /// True if the Setting is stored, false otherwise. /// This method stores the Value immediately. /// If is null. /// If is empty. bool SetSetting(string name, string value); /// /// Gets the all the setting values. /// /// All the settings. IDictionary GetAllSettings(); /// /// Starts a Bulk update of the Settings so that a bulk of settings can be set before storing them. /// void BeginBulkUpdate(); /// /// Ends a Bulk update of the Settings and stores the settings. /// void EndBulkUpdate(); /// /// Records a message to the System Log. /// /// The Log Message. /// The Type of the Entry. /// The User. /// This method should not write messages to the Log using the method IHost.LogEntry. /// This method should also never throw exceptions (except for parameter validation). /// If or are null. /// If or are empty. void LogEntry(string message, EntryType entryType, string user); /// /// Gets all the Log Entries, sorted by date/time (oldest to newest). /// /// The Log Entries. LogEntry[] GetLogEntries(); /// /// Clear the Log. /// void ClearLog(); /// /// Gets the current size of the Log, in KB. /// int LogSize { get; } /// /// Gets a meta-data item's content. /// /// The item. /// The tag that specifies the context (usually the namespace). /// The content. string GetMetaDataItem(MetaDataItem item, string tag); /// /// Sets a meta-data items' content. /// /// The item. /// The tag that specifies the context (usually the namespace). /// The content. /// true if the content is set, false otherwise. bool SetMetaDataItem(MetaDataItem item, string tag, string content); /// /// Gets the recent changes of the Wiki. /// /// The recent Changes, oldest to newest. RecentChange[] GetRecentChanges(); /// /// Adds a new change. /// /// The page name. /// The page title. /// The message subject (or null). /// The date/time. /// The user. /// The change. /// The description (optional). /// true if the change is saved, false otherwise. /// If , or are null. /// If , or are empty. bool AddRecentChange(string page, string title, string messageSubject, DateTime dateTime, string user, Change change, string descr); /// /// Lists the stored plugin assemblies. /// /// string[] ListPluginAssemblies(); /// /// Stores a plugin's assembly, overwriting existing ones if present. /// /// The file name of the assembly, such as "Assembly.dll". /// The assembly content. /// true if the assembly is stored, false otherwise. /// If or are null. /// If or are empty. bool StorePluginAssembly(string filename, byte[] assembly); /// /// Retrieves a plugin's assembly. /// /// The file name of the assembly. /// The assembly content, or null. /// If is null. /// If is empty. byte[] RetrievePluginAssembly(string filename); /// /// Removes a plugin's assembly. /// /// The file name of the assembly to remove, such as "Assembly.dll". /// true if the assembly is removed, false otherwise. /// If is null. /// If is empty. bool DeletePluginAssembly(string filename); /// /// Sets the status of a plugin. /// /// The Type name of the plugin. /// The plugin status. /// true if the status is stored, false otherwise. /// If is null. /// If is empty. bool SetPluginStatus(string typeName, bool enabled); /// /// Gets the status of a plugin. /// /// The Type name of the plugin. /// The status (false for disabled, true for enabled), or true if no status is found. /// If is null. /// If is empty. bool GetPluginStatus(string typeName); /// /// Sets the configuration of a plugin. /// /// The Type name of the plugin. /// The configuration. /// true if the configuration is stored, false otherwise. /// If is null. /// If is empty. bool SetPluginConfiguration(string typeName, string config); /// /// Gets the configuration of a plugin. /// /// The Type name of the plugin. /// The plugin configuration, or String.Empty. /// If is null. /// If is empty. string GetPluginConfiguration(string typeName); /// /// Gets the ACL Manager instance. /// IAclManager AclManager { get; } /// /// Stores the outgoing links of a page, overwriting existing data. /// /// The full name of the page. /// The full names of the pages that page links to. /// true if the outgoing links are stored, false otherwise. /// If or are null. /// If or are empty. bool StoreOutgoingLinks(string page, string[] outgoingLinks); /// /// Gets the outgoing links of a page. /// /// The full name of the page. /// The outgoing links. /// If is null. /// If is empty. string[] GetOutgoingLinks(string page); /// /// Gets all the outgoing links stored. /// /// The outgoing links, in a dictionary in the form page->outgoing_links. IDictionary GetAllOutgoingLinks(); /// /// Deletes the outgoing links of a page and all the target links that include the page. /// /// The full name of the page. /// true if the links are deleted, false otherwise. /// If is null. /// If is empty. bool DeleteOutgoingLinks(string page); /// /// Updates all outgoing links data for a page rename. /// /// The old page name. /// The new page name. /// true if the data is updated, false otherwise. /// If or are null. /// If or are empty. bool UpdateOutgoingLinksForRename(string oldName, string newName); } /// /// Lists legal meta-data items (global items have a integer value greater than or equal to 100. /// public enum MetaDataItem { // Numbers < 100 -> global items // Numbers >= 100 -> namespace-specific items /// /// The account activation message which is sent to the newly registered users. /// AccountActivationMessage = 0, /// /// The password reset message which is sent to the users who reset their password. /// PasswordResetProcedureMessage = 7, /// /// The notice that appears and replaces the text in the Login page. /// LoginNotice = 2, /// /// The notice that appears and replaces the text in the Access Denied page. /// AccessDeniedNotice = 8, /// /// The message that is sent when a page is modified. /// PageChangeMessage = 3, /// /// The message that is sent when a new message is posted on a discussion. /// DiscussionChangeMessage = 4, /// /// The message sent when a page draft requires approval. /// ApproveDraftMessage = 5, /// /// The notice that appears and replates the text in the Register page. /// RegisterNotice = 6, /// /// The notice that appears in the editing page. /// EditNotice = 100, /// /// The wiki footer. /// Footer = 101, /// /// The wiki header. /// Header = 102, /// /// The custom content of the HTML Head tag. /// HtmlHead = 103, /// /// The pages footer. /// PageFooter = 104, /// /// The pages header. /// PageHeader = 105, /// /// The content of the sidebar. /// Sidebar = 106 } /// /// Represents a Log Entry. /// public class LogEntry { private EntryType type; private DateTime dateTime; private string message; private string user; /// /// Initializes a new instance of the LogEntry class. /// /// The type of the Entry /// The DateTime. /// The Message. /// The User. public LogEntry(EntryType type, DateTime dateTime, string message, string user) { this.type = type; this.dateTime = dateTime; this.message = message; this.user = user; } /// /// Gets the EntryType. /// public EntryType EntryType { get { return type; } } /// /// Gets the DateTime. /// public DateTime DateTime { get { return dateTime; } } /// /// Gets the Message. /// public string Message { get { return message; } } /// /// Gets the User. /// public string User { get { return user; } } } /// /// Enumerates the Types of Log Entries. /// public enum EntryType { /// /// Represents a simple Message. /// General, /// /// Represents a Warning. /// Warning, /// /// Represents an Error. /// Error } /// /// Lists legal logging level values. /// public enum LoggingLevel { /// /// All messages are logged. /// AllMessages = 3, /// /// Warnings and errors are logged. /// WarningsAndErrors = 2, /// /// Errors only are logged. /// ErrorsOnly = 1, /// /// Logging is completely disabled. /// DisableLog = 0 } }