C# Class Roadkill.Core.Services.PageService

Provides a set of tasks for wiki page management.
Inheritance: IPageService
Mostra file Open project: LocalGovDigital/pipeline Class Usage Examples

Public Methods

Method Description
AddPage ( PageViewModel model ) : PageViewModel

Adds the page to the database.

AllPages ( bool loadPageContent = false ) : IEnumerable

Retrieves a list of all pages in the system.

AllPagesCreatedBy ( string userName ) : IEnumerable

Gets alls the pages created by a user.

AllTags ( ) : IEnumerable

Retrieves a list of all tags in the system.

ClearPageTables ( ) : void

Clears all pages and page content from the database.

DeletePage ( int pageId ) : void

Deletes a page from the database.

ExportToXml ( ) : string

Exports all pages in the database, including content, to an XML format.

FindByTag ( string tag ) : IEnumerable

Finds all pages with the given tag.

FindByTitle ( string title ) : PageViewModel

Finds a page by its title

FindHomePage ( ) : PageViewModel

Finds the first page with the tag 'homepage'. Any pages that are locked by an administrator take precedence.

GetActivity ( ) : IEnumerable

Finds all relationships related to the page.

GetBootStrapNavMenu ( IUserContext userContext ) : string

Retrieves the (usually left) menu containing the new page, settings etc. options

GetById ( int id, bool loadContent = false ) : PageViewModel

Retrieves the page by its id.

GetCurrentContent ( int pageId ) : PageContent

Retrieves the current text content for a page.

GetMarkupConverter ( ) : Roadkill.Core.Converters.MarkupConverter

Retrieves the MarkupConverter used by this IPageService.

GetMenu ( IUserContext userContext ) : string

Retrieves the (usually left) menu containing the new page, settings etc. options

GetRelByPage ( int pageid ) : IEnumerable

Finds all relationships related to the page.

PageService ( Roadkill.Core.Configuration.ApplicationSettings settings, IRepository repository, SearchService searchService, PageHistoryService historyService, IUserContext context, ListCache listCache, Roadkill.Core.Cache.PageViewModelCache pageViewModelCache, Roadkill.Core.Cache.SiteCache sitecache, IPluginFactory pluginFactory ) : System
RenameTag ( string oldTagName, string newTagName ) : void

Renames a tag by changing all pages that reference the tag to use the new tag name.

UpdateLinksToPage ( string oldTitle, string newTitle ) : void

Updates all links in pages to another page, when that page's title is changed.

UpdatePage ( PageViewModel model ) : void

Updates the provided page.

Private Methods

Method Description
AppendIpForDemoSite ( string username ) : string

Adds an IP address after the username for any demo site vandalism.

GetCollapsableMenuHtml ( ) : string

Adds the Adidas bar to the nav bar so it can be collapsed on mobile devices

Method Details

AddPage() public method

Adds the page to the database.
An databaseerror occurred while saving. An error occurred adding the page to the search index.
public AddPage ( PageViewModel model ) : PageViewModel
model Roadkill.Core.Mvc.ViewModels.PageViewModel The summary details for the page.
return Roadkill.Core.Mvc.ViewModels.PageViewModel

AllPages() public method

Retrieves a list of all pages in the system.
An databaseerror occurred while retrieving the list.
public AllPages ( bool loadPageContent = false ) : IEnumerable
loadPageContent bool
return IEnumerable

AllPagesCreatedBy() public method

Gets alls the pages created by a user.
An databaseerror occurred while retrieving the list.
public AllPagesCreatedBy ( string userName ) : IEnumerable
userName string Name of the user.
return IEnumerable

AllTags() public method

Retrieves a list of all tags in the system.
An databaseerror occurred while getting the tags.
public AllTags ( ) : IEnumerable
return IEnumerable

ClearPageTables() public method

Clears all pages and page content from the database.
An datastore error occurred while clearing the page data.
public ClearPageTables ( ) : void
return void

DeletePage() public method

Deletes a page from the database.
An databaseerror occurred while deleting the page.
public DeletePage ( int pageId ) : void
pageId int The id of the page to remove.
return void

ExportToXml() public method

Exports all pages in the database, including content, to an XML format.
An databaseerror occurred while getting the list. An XML serialiation occurred exporting the page content.
public ExportToXml ( ) : string
return string

FindByTag() public method

Finds all pages with the given tag.
An database error occurred while getting the list.
public FindByTag ( string tag ) : IEnumerable
tag string The tag to search for.
return IEnumerable

FindByTitle() public method

Finds a page by its title
An databaseerror occurred while getting the page.
public FindByTitle ( string title ) : PageViewModel
title string The page title
return Roadkill.Core.Mvc.ViewModels.PageViewModel

FindHomePage() public method

Finds the first page with the tag 'homepage'. Any pages that are locked by an administrator take precedence.
public FindHomePage ( ) : PageViewModel
return Roadkill.Core.Mvc.ViewModels.PageViewModel

GetActivity() public method

Finds all relationships related to the page.
An database error occurred while getting the list.
public GetActivity ( ) : IEnumerable
return IEnumerable

GetBootStrapNavMenu() public method

Retrieves the (usually left) menu containing the new page, settings etc. options
public GetBootStrapNavMenu ( IUserContext userContext ) : string
userContext IUserContext
return string

GetById() public method

Retrieves the page by its id.
An databaseerror occurred while getting the page.
public GetById ( int id, bool loadContent = false ) : PageViewModel
id int The id of the page
loadContent bool
return Roadkill.Core.Mvc.ViewModels.PageViewModel

GetCurrentContent() public method

Retrieves the current text content for a page.
public GetCurrentContent ( int pageId ) : PageContent
pageId int The id of the page.
return Roadkill.Core.Database.PageContent

GetMarkupConverter() public method

Retrieves the MarkupConverter used by this IPageService.
public GetMarkupConverter ( ) : Roadkill.Core.Converters.MarkupConverter
return Roadkill.Core.Converters.MarkupConverter

GetMenu() public method

Retrieves the (usually left) menu containing the new page, settings etc. options
public GetMenu ( IUserContext userContext ) : string
userContext IUserContext
return string

GetRelByPage() public method

Finds all relationships related to the page.
An database error occurred while getting the list.
public GetRelByPage ( int pageid ) : IEnumerable
pageid int
return IEnumerable

PageService() public method

public PageService ( Roadkill.Core.Configuration.ApplicationSettings settings, IRepository repository, SearchService searchService, PageHistoryService historyService, IUserContext context, ListCache listCache, Roadkill.Core.Cache.PageViewModelCache pageViewModelCache, Roadkill.Core.Cache.SiteCache sitecache, IPluginFactory pluginFactory ) : System
settings Roadkill.Core.Configuration.ApplicationSettings
repository IRepository
searchService SearchService
historyService PageHistoryService
context IUserContext
listCache ListCache
pageViewModelCache Roadkill.Core.Cache.PageViewModelCache
sitecache Roadkill.Core.Cache.SiteCache
pluginFactory IPluginFactory
return System

RenameTag() public method

Renames a tag by changing all pages that reference the tag to use the new tag name.
An databaseerror occurred while saving one of the pages. An error occurred updating the search index.
public RenameTag ( string oldTagName, string newTagName ) : void
oldTagName string
newTagName string
return void

UpdateLinksToPage() public method

Updates all links in pages to another page, when that page's title is changed.
public UpdateLinksToPage ( string oldTitle, string newTitle ) : void
oldTitle string The previous page title.
newTitle string The new page title.
return void

UpdatePage() public method

Updates the provided page.
An databaseerror occurred while updating. An error occurred adding the page to the search index.
public UpdatePage ( PageViewModel model ) : void
model Roadkill.Core.Mvc.ViewModels.PageViewModel The summary.
return void