using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using ScrewTurn.Wiki.SearchEngine;
namespace ScrewTurn.Wiki.PluginFramework {
///
/// It is the interface that the ScrewTurn Wiki's Host object implements.
///
public interface IHostV30 {
///
/// Gets the values of the Wiki Settings.
///
/// The Setting's Name.
/// The Setting's value.
string GetSettingValue(SettingName name);
///
/// Gets the list of the Users.
///
/// The users.
UserInfo[] GetUsers();
///
/// Finds a user by username.
///
/// The username.
/// The , or null if no users are found.
/// If is null.
/// If is empty.
UserInfo FindUser(string username);
///
/// Gets the authenticated user in the current session, if any.
///
/// The authenticated user, or null if no user is authenticated.
/// If the built-it admin user is authenticated, the returned user
/// has admin as Username.
UserInfo GetCurrentUser();
///
/// Gets the list of the user groups.
///
/// The groups.
UserGroup[] GetUserGroups();
///
/// Finds a user group by name.
///
/// The name.
/// The , or null if no groups are found.
/// If is null.
/// If is empty.
UserGroup FindUserGroup(string name);
///
/// Checks whether an action is allowed for a global resource.
///
/// The action (see class)
/// The user.
/// true if the action is allowed, false otherwise.
/// If or are null.
/// If is empty.
bool CheckActionForGlobals(string action, UserInfo user);
///
/// Checks whether an action is allowed for a namespace.
///
/// The namespace (null for the root).
/// The action (see class)
/// The user.
/// true if the action is allowed, false otherwise.
/// If or are null.
/// If is empty.
bool CheckActionForNamespace(NamespaceInfo nspace, string action, UserInfo user);
///
/// Checks whether an action is allowed for a page.
///
/// The page.
/// The action (see class)
/// The user.
/// true if the action is allowed, false otherwise.
/// If , or are null.
/// If is empty.
bool CheckActionForPage(PageInfo page, string action, UserInfo user);
///
/// Checks whether an action is allowed for a directory.
///
/// The directory.
/// The action (see ).
/// The user.
/// true if the action is allowed, false otherwise.
/// If , or are null.
/// If is empty.
bool CheckActionForDirectory(StDirectoryInfo directory, string action, UserInfo user);
///
/// Gets the theme in use for a namespace.
///
/// The namespace (null for the root).
/// The theme.
string GetTheme(NamespaceInfo nspace);
///
/// Gets the list of the namespaces.
///
/// The namespaces.
NamespaceInfo[] GetNamespaces();
///
/// Finds a namespace by name.
///
/// The name.
/// The , or null if no namespaces are found.
NamespaceInfo FindNamespace(string name);
///
/// Gets the list of the Pages in a namespace.
///
/// The namespace (null for the root).
/// The pages.
PageInfo[] GetPages(NamespaceInfo nspace);
///
/// Gets the list of the Categories in a namespace.
///
/// The namespace (null for the root).
/// The categories.
CategoryInfo[] GetCategories(NamespaceInfo nspace);
///
/// Gets the list of Snippets.
///
/// The snippets.
Snippet[] GetSnippets();
///
/// Gets the list of Navigation Paths in a namespace.
///
/// The namespace (null for the root).
/// The navigation paths.
NavigationPath[] GetNavigationPaths(NamespaceInfo nspace);
///
/// Gets the Categories of a Page.
///
/// The Page.
/// The Categories.
/// If is null.
CategoryInfo[] GetCategoriesPerPage(PageInfo page);
///
/// Gets the WikiPage with the specified full Name.
///
/// The full Name of the Page.
/// The Wiki Page, or null if no pages are found.
/// If is null.
/// If is empty.
PageInfo FindPage(string fullName);
///
/// Gets the Content of a Page.
///
/// The Page.
/// The Page Content.
/// If is null.
PageContent GetPageContent(PageInfo page);
///
/// Gets the Backup/Revision numbers of a Page.
///
/// The Page.
/// The Backup/Revision numbers.
/// If is null.
int[] GetBackups(PageInfo page);
///
/// Gets the Content of a Page Backup.
///
/// The Page.
/// The revision.
/// The Backup Content.
/// If is null.
/// If is less than zero.
PageContent GetBackupContent(PageInfo page, int revision);
///
/// Gets the formatted content of a Page, retrieving it from the cache (if available).
///
/// The Page.
/// The formatted content of the Page.
/// If is null.
string GetFormattedContent(PageInfo page);
///
/// Formats a block of WikiMarkup, using the built-in formatter only.
///
/// The block of WikiMarkup.
/// The formatted content.
/// If is null.
string Format(string raw);
///
/// Prepares content for indexing in the search engine, performing bare-bones formatting and removing all WikiMarkup and XML-like characters.
///
/// The page being indexed, if any, null otherwise.
/// The string to prepare.
/// The sanitized string.
/// If is null.
string PrepareContentForIndexing(PageInfo page, string content);
///
/// Prepares a title for indexing in the search engine, removing all WikiMarkup and XML-like characters.
///
/// The page being indexed, if any, null otherwise.
/// The title to prepare.
/// The sanitized string.
/// If is null.
string PrepareTitleForIndexing(PageInfo page, string title);
///
/// Performs a search.
///
/// The search query.
/// A value indicating whether to perform a full-text search.
/// A value indicating whether to search the names of files and attachments.
/// The search options.
/// The search results.
/// If is null.
/// If is empty.
SearchResultCollection PerformSearch(string query, bool fullText, bool filesAndAttachments, SearchOptions options);
///
/// Lists directories in a directory.
///
/// The directory (null for the root, first invocation).
/// The directories.
StDirectoryInfo[] ListDirectories(StDirectoryInfo directory);
///
/// Lists files in a directory.
///
/// The directory (null for the root, first invocation).
/// The files.
StFileInfo[] ListFiles(StDirectoryInfo directory);
///
/// Lists page attachments.
///
/// The page.
/// The attachments.
/// If is null.
StFileInfo[] ListPageAttachments(PageInfo page);
///
/// Sends an Email.
///
/// The Recipient Email address.
/// The Sender's Email address.
/// The Subject.
/// The Body.
/// True if the message is HTML.
/// True if the message has been sent successfully.
/// If , , or are null.
/// If , , or are empty.
bool SendEmail(string recipient, string sender, string subject, string body, bool html);
///
/// Logs a new message.
///
/// The Message.
/// The Entry Type.
/// The user, or null. If null, the system will log "PluginName+System".
/// The Component that calls the method. The caller cannot be null.
/// If or are null.
/// If is empty.
void LogEntry(string message, LogEntryType entryType, string user, object caller);
///
/// Aligns a Date and Time object to the User's Time Zone preferences.
///
/// The Date/Time to align.
/// The aligned Date/Time.
/// The method takes care of daylight saving settings.
DateTime AlignDateTimeWithPreferences(DateTime dt);
///
/// Clears the cache.
///
/// The part of the cache to clear.
void ClearCache(CacheData data);
///
/// Adds an item in the Editing Toolbar.
///
/// The item to add.
/// The text of the item showed in the toolbar.
/// The value of the item, placed in the content: if item is ToolbarItem.SpecialTagWrap, separate start and end tag with a pipe.
/// If or are null.
/// If or are empty, or if they contain single or double quotes,
/// or if does not contain a pipe when is SpecialTagWrap.
void AddToolbarItem(ToolbarItem item, string text, string value);
///
/// Gets the default provider of the specified type.
///
/// The type of the provider (
/// ,
/// ,
/// ,
/// ,
/// ).
/// The Full type name of the default provider of the specified type or null.
string GetDefaultProvider(Type providerType);
///
/// Gets the pages storage providers, either enabled or disabled.
///
/// true to get enabled providers, false to get disabled providers.
/// The providers.
IPagesStorageProviderV30[] GetPagesStorageProviders(bool enabled);
///
/// Gets the users storage providers, either enabled or disabled.
///
/// true to get enabled providers, false to get disabled providers.
/// The providers.
IUsersStorageProviderV30[] GetUsersStorageProviders(bool enabled);
///
/// Gets the files storage providers, either enabled or disabled.
///
/// true to get enabled providers, false to get disabled providers.
/// The providers.
IFilesStorageProviderV30[] GetFilesStorageProviders(bool enabled);
///
/// Gets the cache providers, either enabled or disabled.
///
/// true to get enabled providers, false to get disabled providers.
/// The providers.
ICacheProviderV30[] GetCacheProviders(bool enabled);
///
/// Gets the formatter providers, either enabled or disabled.
///
/// true to get enabled providers, false to get disabled providers.
/// The providers.
IFormatterProviderV30[] GetFormatterProviders(bool enabled);
///
/// Gets the current settings storage provider.
///
/// The settings storage provider.
ISettingsStorageProviderV30 GetSettingsStorageProvider();
///
/// Gets the configuration of a provider.
///
/// The type name of the provider, such as 'Vendor.Namespace.Provider'.
/// The configuration (can be empty or null).
/// If is null.
/// If is empty.
string GetProviderConfiguration(string providerTypeName);
///
/// Sets the configuration of a provider.
///
/// The provider of which to set the configuration.
/// The configuration to set.
/// true if the configuration is set, false otherwise.
/// If is null.
bool SetProviderConfiguration(IProviderV30 provider, string configuration);
///
/// Upgrades the old Page Status to use the new ACL facilities.
///
/// The page of which to upgrade the status.
/// The old status ('L' = Locked, 'P' = Public).
/// true if the operation succeeded, false otherwise.
/// If is null.
/// If is invalid.
bool UpgradePageStatusToAcl(PageInfo page, char oldStatus);
///
/// Upgrades the old security flags to use the new ACL facilities and user groups support.
///
/// The administrators group.
/// The users group.
/// true if the operation succeeded, false otherwise.
/// If or are null.
bool UpgradeSecurityFlagsToGroupsAcl(UserGroup administrators, UserGroup users);
///
/// Event fired whenever an activity is performed on a User Account.
///
event EventHandler UserAccountActivity;
///
/// Event fired whenever an activity is performed on a user group.
///
event EventHandler UserGroupActivity;
///
/// Event fired whenever an activity is performed on a namespace.
///
event EventHandler NamespaceActivity;
///
/// Even fired whenever an activity is performed on a Page.
///
event EventHandler PageActivity;
///
/// Event fired whenever an activity is performed on a file, directory or attachment.
///
event EventHandler FileActivity;
}
///
/// Enumerates the Types of Log Entries.
///
public enum LogEntryType {
///
/// Represents a simple Message.
///
General,
///
/// Represents a Warning.
///
Warning,
///
/// Represents an Error.
///
Error
}
///
/// Enumerates the Setting values' names.
///
public enum SettingName {
///
/// The Title of the Wiki.
///
WikiTitle,
///
/// The Main URL of the Wiki.
///
MainUrl,
///
/// The default page of the root namespace.
///
RootNamespaceDefaultPage,
///
/// The Contact Email.
///
ContactEmail,
///
/// The Sender Email.
///
SenderEmail,
///
/// The Date/Time format.
///
DateTimeFormat,
///
/// The default Language (for example en-US).
///
DefaultLanguage,
///
/// The default Time Zone (a string representing the shift in minutes respect to the Greenwich time, for example -120).
///
DefaultTimeZone,
///
/// The Themes directory.
///
ThemesDirectory,
///
/// The Public directory.
///
PublicDirectory,
///
/// A value (true/false) indicating whether users can create new accounts.
///
UsersCanRegister,
///
/// The regex used to validate usernames.
///
UsernameRegex,
///
/// The regex used to validate passwords.
///
PasswordRegex,
///
/// The regex used to validate email addresses.
///
EmailRegex,
///
/// The regex used to validate the main Wiki URL.
///
MainUrlRegex,
///
/// A value (true/false) indicating whether to activate page editing with a double click.
///
EnableDoubleClickEditing,
///
/// A value (true/false) indicating whether to process single line breaks in WikiMarkup.
///
ProcessSingleLineBreaks,
///
/// The account activation mode.
///
AccountActivationMode,
///
/// The file types allowed for upload.
///
AllowedFileTypes,
///
/// A value (true/false) indicating whether to disable the automatic version check.
///
DisableAutomaticVersionCheck,
///
/// A value (true/false) indicating whether to disable the breadcrumbs trail.
///
DisableBreadcrumbsTrail,
///
/// A value (true/false) indicating whether to disable the page cache.
///
DisableCache,
///
/// A value (true/false) indicating whether to disable the captcha control in public functionalities.
///
DisableCaptchaControl,
///
/// A value (true/false) indicating whether to disable concurrent page editing.
///
DisableConcurrentEditing,
///
/// A value (true/false) indicating whether to enable HTTP compression.
///
EnableHttpCompression,
///
/// A value (true/false) indicating whether to enable View State compression.
///
EnableViewStateCompression,
///
/// The logging level.
///
LoggingLevel,
///
/// The max size for uploaded files (bytes).
///
MaxFileSize,
///
/// The extension used for pages.
///
PageExtension,
///
/// A value (true/false) indicating whether to SCRIPT tags are allowed in WikiMarkup.
///
ScriptTagsAllowed,
///
/// The version of the Wiki Engine.
///
WikiVersion,
///
/// The max size, in KB, of the log.
///
MaxLogSize,
///
/// The max number of recent changes to log.
///
MaxRecentChanges,
///
/// The size of the cache (# of pages).
///
CacheSize,
///
/// The # of pages to remove fromm the cache when it is full.
///
CacheCutSize,
///
/// The timeout, in seconds, after which a page editing session is considered to be dead.
///
EditingSessionTimeout,
///
/// The default administrators group.
///
AdministratorsGroup,
///
/// The default users group.
///
UsersGroup,
///
/// The default anonymous users group.
///
AnonymousGroup,
///
/// The page change moderation mode.
///
ChangeModerationMode,
///
/// The default pages provider.
///
DefaultPagesStorageProvider,
///
/// The default users provider.
///
DefaultUsersStorageProvider,
///
/// The default files provider.
///
DefaultFilesStorageProvider,
///
/// The default cache provider.
///
DefaultCacheProvider
}
///
/// Enumerates the parts of the cache that can be cleared.
///
public enum CacheData {
///
/// All the pages data.
///
Pages,
///
/// All the meta-files (Header, Footer, Sidebar, etc.).
///
MetaFiles
}
///
/// Enumerates the toolbar items that can be added.
///
public enum ToolbarItem {
///
/// A Special Tag that is inserted in the text.
///
SpecialTag,
///
/// A special tag that wraps the selected text.
///
SpecialTagWrap
}
}