C# Class ScrewTurn.Wiki.Host

Implements the IHost interface.
Inheritance: IHostV30
显示文件 Open project: mono/ScrewTurnWiki

Public Methods

Method Description
AddToolbarItem ( ToolbarItem item, string text, string value ) : void

Adds an item in the Editing Toolbar.

AlignDateTimeWithPreferences ( System.DateTime dt ) : System.DateTime

Aligns a Date and Time object to the User's Time Zone preferences.

The method takes care of daylight saving settings.

ChangeCurrentUserLanguage ( string language ) : void

Changes the language of the current user.

CheckActionForDirectory ( StDirectoryInfo directory, string action, UserInfo user ) : bool

Checks whether an action is allowed for a directory.

CheckActionForGlobals ( string action, UserInfo user ) : bool

Checks whether an action is allowed for a global resource.

CheckActionForNamespace ( NamespaceInfo nspace, string action, UserInfo user ) : bool

Checks whether an action is allowed for a namespace.

CheckActionForPage ( System.PageInfo page, string action, UserInfo user ) : bool

Checks whether an action is allowed for a page.

ClearCache ( CacheData data ) : void

Clears the cache.

FindNamespace ( string name ) : NamespaceInfo

Finds a namespace by name.

FindPage ( string fullName ) : System.PageInfo

Gets a Wiki Page.

FindUser ( string username ) : UserInfo

Finds a user by username, properly handling Users Storage Providers.

FindUserGroup ( string name ) : UserGroup

Finds a user group by name.

Format ( string raw ) : string

Formats a block of WikiMarkup, using the built-in formatter only.

GetBackupContent ( System.PageInfo page, int revision ) : PageContent

Gets the Content of a Page Backup.

GetBackups ( System.PageInfo page ) : int[]

Gets the Backup/Revision numbers of a Page.

GetCacheProviders ( bool enabled ) : ICacheProviderV30[]

Gets the cache providers, either enabled or disabled.

GetCategories ( NamespaceInfo nspace ) : CategoryInfo[]

Gets the List of Categories in a namespace.

GetCategoriesPerPage ( System.PageInfo page ) : CategoryInfo[]

Gets the Categories of a Page.

GetCurrentUser ( ) : UserInfo

Gets the authenticated user in the current session, if any.

If the built-it admin user is authenticated, the returned user has admin as Username.

GetDefaultProvider ( Type providerType ) : string

Gets the default provider of the specified type.

GetFilesStorageProviders ( bool enabled ) : IFilesStorageProviderV30[]

Gets the files storage providers, either enabled or disabled.

GetFormattedContent ( System.PageInfo page ) : string

Gets the formatted content of a Wiki Page.

GetFormatterProviders ( bool enabled ) : IFormatterProviderV30[]

Gets the formatter providers, either enabled or disabled.

GetNamespaces ( ) : NamespaceInfo[]

Gets the list of the namespaces.

GetNavigationPaths ( NamespaceInfo nspace ) : NavigationPath[]

Gets the list of Navigation Paths in a namespace.

GetPageContent ( System.PageInfo page ) : PageContent

Gets the Content of a Page.

GetPages ( NamespaceInfo nspace ) : System.PageInfo[]

Gets the list of the Wiki Pages in a namespace.

GetPagesStorageProviders ( bool enabled ) : IPagesStorageProviderV30[]

Gets the pages storage providers, either enabled or disabled.

GetProviderConfiguration ( string providerTypeName ) : string

Gets the configuration of a provider.

GetSettingValue ( SettingName name ) : string

Gets the values of the Wiki Settings.

GetSettingsStorageProvider ( ) : ISettingsStorageProviderV30

Gets the current settings storage provider.

GetSnippets ( ) : System.Snippet[]

Gets the list of Snippets.

GetTheme ( NamespaceInfo nspace ) : string

Gets the theme in use for a namespace.

GetUserGroups ( ) : UserGroup[]

Gets the list of the user groups.

GetUsers ( ) : UserInfo[]

Gets the list of the Users.

GetUsersStorageProviders ( bool enabled ) : IUsersStorageProviderV30[]

Gets the users storage providers, either enabled or disabled.

Host ( ) : System

Initializes a new instance of the PluginHost class.

ListDirectories ( StDirectoryInfo directory ) : ScrewTurn.Wiki.PluginFramework.StDirectoryInfo[]

Lists directories in a directory.

ListFiles ( StDirectoryInfo directory ) : StFileInfo[]

Lists files in a directory.

ListPageAttachments ( System.PageInfo page ) : StFileInfo[]

Lists page attachments.

LogEntry ( string message, LogEntryType entryType, string user, object caller ) : void

Logs a new message.

OnAttachmentActivity ( string provider, string attachment, string page, string oldAttachmentName, FileActivity activity ) : void

Fires the FileActivity event.

OnDirectoryActivity ( string provider, string directory, string oldDirectoryName, FileActivity activity ) : void

Fires the FileActivity event.

OnFileActivity ( string provider, string file, string oldFileName, FileActivity activity ) : void

Fires the FileActivity event.

OnNamespaceActivity ( NamespaceInfo nspace, string nspaceOldName, NamespaceActivity activity ) : void

Fires the NamespaceActivity event.

OnPageActivity ( System.PageInfo page, string pageOldName, string author, PageActivity activity ) : void

Fires the PageActivity event.

OnUserAccountActivity ( UserInfo user, UserAccountActivity activity ) : void

Fires the UserAccountActivity event.

OnUserGroupActivity ( UserGroup group, UserGroupActivity activity ) : void

Fires the UserGroupActivity event.

PerformSearch ( string query, bool fullText, bool filesAndAttachments, SearchOptions options ) : SearchResultCollection

Performs a search.

PrepareContentForIndexing ( System.PageInfo page, string content ) : string

Prepares content for indexing in the search engine, performing bare-bones formatting and removing all WikiMarkup and XML-like characters.

PrepareTitleForIndexing ( System.PageInfo page, string title ) : string

Prepares a title for indexing in the search engine, removing all WikiMarkup and XML-like characters.

SendEmail ( string recipient, string sender, string subject, string body, bool html ) : bool

Sends an Email.

SetProviderConfiguration ( IProviderV30 provider, string configuration ) : bool

Sets the configuration of a provider.

UpgradePageStatusToAcl ( System.PageInfo page, char oldStatus ) : bool

Upgrades the old Page Status to use the new ACL facilities.

UpgradeSecurityFlagsToGroupsAcl ( UserGroup administrators, UserGroup users ) : bool

Upgrades the old security flags to use the new ACL facilities and user groups support.

Method Details

AddToolbarItem() public method

Adds an item in the Editing Toolbar.
If text or value are null. If text or value are empty, or if they contain single or double quotes, /// or if value does not contain a pipe when item is SpecialTagWrap.
public AddToolbarItem ( ToolbarItem item, string text, string value ) : void
item ToolbarItem The item to add.
text string The text of the item.
value string The value of the item.
return void

AlignDateTimeWithPreferences() public method

Aligns a Date and Time object to the User's Time Zone preferences.
The method takes care of daylight saving settings.
public AlignDateTimeWithPreferences ( System.DateTime dt ) : System.DateTime
dt System.DateTime The Date/Time to align.
return System.DateTime

ChangeCurrentUserLanguage() public method

Changes the language of the current user.
public ChangeCurrentUserLanguage ( string language ) : void
language string The language code.
return void

CheckActionForDirectory() public method

Checks whether an action is allowed for a directory.
If directory, action or user are null. If action is empty.
public CheckActionForDirectory ( StDirectoryInfo directory, string action, UserInfo user ) : bool
directory ScrewTurn.Wiki.PluginFramework.StDirectoryInfo The directory.
action string The action (see ).
user UserInfo The user.
return bool

CheckActionForGlobals() public method

Checks whether an action is allowed for a global resource.
If action or user are null. If action is empty.
public CheckActionForGlobals ( string action, UserInfo user ) : bool
action string The action (see class)
user UserInfo The user.
return bool

CheckActionForNamespace() public method

Checks whether an action is allowed for a namespace.
If action or user are null. If action is empty.
public CheckActionForNamespace ( NamespaceInfo nspace, string action, UserInfo user ) : bool
nspace NamespaceInfo The namespace (null for the root).
action string The action (see class)
user UserInfo The user.
return bool

CheckActionForPage() public method

Checks whether an action is allowed for a page.
If page, action or user are null. If action is empty.
public CheckActionForPage ( System.PageInfo page, string action, UserInfo user ) : bool
page System.PageInfo The page.
action string The action (see class)
user UserInfo The user.
return bool

ClearCache() public method

Clears the cache.
public ClearCache ( CacheData data ) : void
data CacheData The part of the cache to clear.
return void

FindNamespace() public method

Finds a namespace by name.
public FindNamespace ( string name ) : NamespaceInfo
name string The name.
return NamespaceInfo

FindPage() public method

Gets a Wiki Page.
If fullName is null. If fullName is empty.
public FindPage ( string fullName ) : System.PageInfo
fullName string The full Name of the Page.
return System.PageInfo

FindUser() public method

Finds a user by username, properly handling Users Storage Providers.
If username is null. If username is empty.
public FindUser ( string username ) : UserInfo
username string The username.
return UserInfo

FindUserGroup() public method

Finds a user group by name.
If name is null. If name is empty.
public FindUserGroup ( string name ) : UserGroup
name string The name.
return UserGroup

Format() public method

Formats a block of WikiMarkup, using the built-in formatter only.
If raw is null.
public Format ( string raw ) : string
raw string The block of WikiMarkup.
return string

GetBackupContent() public method

Gets the Content of a Page Backup.
If page is null. If revision is less than zero.
public GetBackupContent ( System.PageInfo page, int revision ) : PageContent
page System.PageInfo The Page.
revision int The revision.
return ScrewTurn.Wiki.PluginFramework.PageContent

GetBackups() public method

Gets the Backup/Revision numbers of a Page.
If page is null.
public GetBackups ( System.PageInfo page ) : int[]
page System.PageInfo The Page.
return int[]

GetCacheProviders() public method

Gets the cache providers, either enabled or disabled.
public GetCacheProviders ( bool enabled ) : ICacheProviderV30[]
enabled bool true to get enabled providers, false to get disabled providers.
return ICacheProviderV30[]

GetCategories() public method

Gets the List of Categories in a namespace.
public GetCategories ( NamespaceInfo nspace ) : CategoryInfo[]
nspace NamespaceInfo The namespace (null for the root).
return CategoryInfo[]

GetCategoriesPerPage() public method

Gets the Categories of a Page.
If page is null.
public GetCategoriesPerPage ( System.PageInfo page ) : CategoryInfo[]
page System.PageInfo The Page.
return CategoryInfo[]

GetCurrentUser() public method

Gets the authenticated user in the current session, if any.
If the built-it admin user is authenticated, the returned user has admin as Username.
public GetCurrentUser ( ) : UserInfo
return UserInfo

GetDefaultProvider() public method

Gets the default provider of the specified type.
public GetDefaultProvider ( Type providerType ) : string
providerType System.Type The type of the provider ( /// , /// , /// , /// ).
return string

GetFilesStorageProviders() public method

Gets the files storage providers, either enabled or disabled.
public GetFilesStorageProviders ( bool enabled ) : IFilesStorageProviderV30[]
enabled bool true to get enabled providers, false to get disabled providers.
return IFilesStorageProviderV30[]

GetFormattedContent() public method

Gets the formatted content of a Wiki Page.
If page is null.
public GetFormattedContent ( System.PageInfo page ) : string
page System.PageInfo The Page.
return string

GetFormatterProviders() public method

Gets the formatter providers, either enabled or disabled.
public GetFormatterProviders ( bool enabled ) : IFormatterProviderV30[]
enabled bool true to get enabled providers, false to get disabled providers.
return IFormatterProviderV30[]

GetNamespaces() public method

Gets the list of the namespaces.
public GetNamespaces ( ) : NamespaceInfo[]
return NamespaceInfo[]

GetNavigationPaths() public method

Gets the list of Navigation Paths in a namespace.
public GetNavigationPaths ( NamespaceInfo nspace ) : NavigationPath[]
nspace NamespaceInfo The namespace (null for the root).
return NavigationPath[]

GetPageContent() public method

Gets the Content of a Page.
If page is null.
public GetPageContent ( System.PageInfo page ) : PageContent
page System.PageInfo The Page.
return ScrewTurn.Wiki.PluginFramework.PageContent

GetPages() public method

Gets the list of the Wiki Pages in a namespace.
public GetPages ( NamespaceInfo nspace ) : System.PageInfo[]
nspace NamespaceInfo The namespace (null for the root).
return System.PageInfo[]

GetPagesStorageProviders() public method

Gets the pages storage providers, either enabled or disabled.
public GetPagesStorageProviders ( bool enabled ) : IPagesStorageProviderV30[]
enabled bool true to get enabled providers, false to get disabled providers.
return IPagesStorageProviderV30[]

GetProviderConfiguration() public method

Gets the configuration of a provider.
If providerTypeName is null. If providerTypeName is empty.
public GetProviderConfiguration ( string providerTypeName ) : string
providerTypeName string The type name of the provider, such as 'Vendor.Namespace.Provider'.
return string

GetSettingValue() public method

Gets the values of the Wiki Settings.
public GetSettingValue ( SettingName name ) : string
name SettingName The Setting's Name.
return string

GetSettingsStorageProvider() public method

Gets the current settings storage provider.
public GetSettingsStorageProvider ( ) : ISettingsStorageProviderV30
return ISettingsStorageProviderV30

GetSnippets() public method

Gets the list of Snippets.
public GetSnippets ( ) : System.Snippet[]
return System.Snippet[]

GetTheme() public method

Gets the theme in use for a namespace.
public GetTheme ( NamespaceInfo nspace ) : string
nspace NamespaceInfo The namespace (null for the root).
return string

GetUserGroups() public method

Gets the list of the user groups.
public GetUserGroups ( ) : UserGroup[]
return UserGroup[]

GetUsers() public method

Gets the list of the Users.
public GetUsers ( ) : UserInfo[]
return UserInfo[]

GetUsersStorageProviders() public method

Gets the users storage providers, either enabled or disabled.
public GetUsersStorageProviders ( bool enabled ) : IUsersStorageProviderV30[]
enabled bool true to get enabled providers, false to get disabled providers.
return IUsersStorageProviderV30[]

Host() public method

Initializes a new instance of the PluginHost class.
public Host ( ) : System
return System

ListDirectories() public method

Lists directories in a directory.
public ListDirectories ( StDirectoryInfo directory ) : ScrewTurn.Wiki.PluginFramework.StDirectoryInfo[]
directory ScrewTurn.Wiki.PluginFramework.StDirectoryInfo The directory (null for the root, first invocation).
return ScrewTurn.Wiki.PluginFramework.StDirectoryInfo[]

ListFiles() public method

Lists files in a directory.
public ListFiles ( StDirectoryInfo directory ) : StFileInfo[]
directory ScrewTurn.Wiki.PluginFramework.StDirectoryInfo The directory (null for the root, first invocation).
return StFileInfo[]

ListPageAttachments() public method

Lists page attachments.
If page is null.
public ListPageAttachments ( System.PageInfo page ) : StFileInfo[]
page System.PageInfo The page.
return StFileInfo[]

LogEntry() public method

Logs a new message.
If message or caller are null. If message is empty.
public LogEntry ( string message, LogEntryType entryType, string user, object caller ) : void
message string The Message.
entryType LogEntryType The Entry Type.
user string The user, or null. If null, the system will log "PluginName+System".
caller object The Component that calls the method. The caller cannot be null.
return void

OnAttachmentActivity() public method

Fires the FileActivity event.
public OnAttachmentActivity ( string provider, string attachment, string page, string oldAttachmentName, FileActivity activity ) : void
provider string The provider that handles the attachment.
attachment string The old name of the renamed attachment, if any.
page string The page that owns the attachment.
oldAttachmentName string The old name of the renamed attachment, if any.
activity FileActivity The activity.
return void

OnDirectoryActivity() public method

Fires the FileActivity event.
public OnDirectoryActivity ( string provider, string directory, string oldDirectoryName, FileActivity activity ) : void
provider string The provider that handles the directory.
directory string The directory that changed.
oldDirectoryName string The old name of the renamed directory, if any.
activity FileActivity The activity.
return void

OnFileActivity() public method

Fires the FileActivity event.
public OnFileActivity ( string provider, string file, string oldFileName, FileActivity activity ) : void
provider string The provider that handles the file.
file string The name of the file that changed.
oldFileName string The old name of the renamed file, if any.
activity FileActivity The activity.
return void

OnNamespaceActivity() public method

Fires the NamespaceActivity event.
public OnNamespaceActivity ( NamespaceInfo nspace, string nspaceOldName, NamespaceActivity activity ) : void
nspace NamespaceInfo The namespace the activity refers to.
nspaceOldName string The old name of the renamed namespace, or null.
activity NamespaceActivity The activity.
return void

OnPageActivity() public method

Fires the PageActivity event.
public OnPageActivity ( System.PageInfo page, string pageOldName, string author, PageActivity activity ) : void
page System.PageInfo The page the activity refers to.
pageOldName string The old name of the renamed page, or null.
author string The author of the activity.
activity PageActivity The activity.
return void

OnUserAccountActivity() public method

Fires the UserAccountActivity event.
public OnUserAccountActivity ( UserInfo user, UserAccountActivity activity ) : void
user UserInfo The user the activity refers to.
activity UserAccountActivity The activity.
return void

OnUserGroupActivity() public method

Fires the UserGroupActivity event.
public OnUserGroupActivity ( UserGroup group, UserGroupActivity activity ) : void
group UserGroup The group the activity refers to.
activity UserGroupActivity The activity.
return void

PerformSearch() public method

Performs a search.
If query is null. If query is empty.
public PerformSearch ( string query, bool fullText, bool filesAndAttachments, SearchOptions options ) : SearchResultCollection
query string The search query.
fullText bool A value indicating whether to perform a full-text search.
filesAndAttachments bool A value indicating whether to search the names of files and attachments.
options SearchOptions The search options.
return SearchResultCollection

PrepareContentForIndexing() public method

Prepares content for indexing in the search engine, performing bare-bones formatting and removing all WikiMarkup and XML-like characters.
If content is null.
public PrepareContentForIndexing ( System.PageInfo page, string content ) : string
page System.PageInfo The page being indexed, if any, null otherwise.
content string The string to prepare.
return string

PrepareTitleForIndexing() public method

Prepares a title for indexing in the search engine, removing all WikiMarkup and XML-like characters.
If title is null.
public PrepareTitleForIndexing ( System.PageInfo page, string title ) : string
page System.PageInfo The page being indexed, if any, null otherwise.
title string The title to prepare.
return string

SendEmail() public method

Sends an Email.
If recipient, sender, subject or body are null. If recipient, sender, subject or body are empty.
public SendEmail ( string recipient, string sender, string subject, string body, bool html ) : bool
recipient string The Recipient Email address.
sender string The Sender's Email address.
subject string The Subject.
body string The Body.
html bool True if the message is HTML.
return bool

SetProviderConfiguration() public method

Sets the configuration of a provider.
If provider is null.
public SetProviderConfiguration ( IProviderV30 provider, string configuration ) : bool
provider IProviderV30 The provider of which to set the configuration.
configuration string The configuration to set.
return bool

UpgradePageStatusToAcl() public method

Upgrades the old Page Status to use the new ACL facilities.
If page is null. If oldStatus is invalid.
public UpgradePageStatusToAcl ( System.PageInfo page, char oldStatus ) : bool
page System.PageInfo The page of which to upgrade the status.
oldStatus char The old status ('L' = Locked, 'P' = Public).
return bool

UpgradeSecurityFlagsToGroupsAcl() public method

Upgrades the old security flags to use the new ACL facilities and user groups support.
If administrators or users are null.
public UpgradeSecurityFlagsToGroupsAcl ( UserGroup administrators, UserGroup users ) : bool
administrators UserGroup The administrators group.
users UserGroup The users group.
return bool