C# Class Piranha.Web.UIHelper

The UI helper provides methods for genering url's and html for the web applications.
Mostra file Open project: PiranhaCMS/Piranha

Private Properties

Property Type Description
ChildActive bool
CreateLinkTag string
CreateMetaTag string
GenerateUrl string
GetStartLevel List
RenderBreadcrumb void
RenderLI void
RenderUL void
Url string

Public Methods

Method Description
APIKey ( System.Guid apiKey ) : IHtmlString

Gets an encrypted API-key valid for 30 minutes.

APIKey ( string apiKey = "" ) : IHtmlString

Gets an ecrypted API-key valid for 30 minutes. If no API-key is provided the key for the currently logged in user is used.

AbsoluteUrl ( string url ) : IHtmlString

Generates an absolute url from the virtual path or site url.

Breadcrumb ( int StartLevel = 1, string RootNode = "" ) : IHtmlString

Renders the current breadcrumb.

Content ( System.Guid id, int width, int height ) : IHtmlString

Gets the URL to the content with the given id.

Content ( string id, int width, int height ) : IHtmlString

Gets the URL to the content with the given id.

Head ( ) : IHtmlString

Generates the tags appropriate for the html head.

Menu ( int StartLevel = 1, int StopLevel = Int32.MaxValue, int Levels, string RootNode = "", string CssClass = "menu", bool RenderParent = false ) : IHtmlString

Return the site structure as an ul/li list with the current page selected.

Permalink ( System.Guid permalinkid, string prefix = "" ) : IHtmlString

Generates the url to the given permalink.

Permalink ( string permalink = "", string prefix = "" ) : IHtmlString

Generates the url to the given permalink.

SetCurrent ( Page page ) : void

Sets the current page to the given value. This can be useful when using the UI helper in passive mode and the routing never sets the current page.

SetCurrent ( Post post ) : void

Sets the current post to the given value. This can be useful when using the UI helper in passive mode and the routing never sets the current post.

SiteUrl ( string virtualpath ) : IHtmlString

Generates a full site url from the virtual path.

Thumbnail ( System.Guid id, int size ) : IHtmlString

Generates an image tag for the specified thumbnail.

Thumbnail ( string id, int size ) : IHtmlString

Generates an image tag for the specified thumbnail.

UIHelper ( ) : System

Default constructor. Creates a new UI helper.

Upload ( System.Guid id, int width, int height ) : IHtmlString

Gets the url to the uploaded content with the given id.

Upload ( string id, int width, int height ) : IHtmlString

Gets the url to the uploaded content with the given id.

Private Methods

Method Description
ChildActive ( Sitemap page, System.Guid id ) : bool

Checks if the given sitemap is active or has an active child

CreateLinkTag ( string rel, string type, string href, string title = "" ) : string

Generates the appropriate html string for a link tag. Properly escapes attribute values.

CreateMetaTag ( string name, string content ) : string

Generates the appropriate html string for a meta tag. Properly escapes attribute values.

GenerateUrl ( ISitemap page ) : string

Generate the correct URL for the given sitemap node

GetStartLevel ( List sm, System.Guid id, int start, bool includedParent = false ) : List

Gets the current start level for the sitemap.

RenderBreadcrumb ( Page curr, List sm, StringBuilder str ) : void

Renders the breadcrumb from the given sitemap.

RenderLI ( Page curr, Sitemap page, StringBuilder str, int stoplevel ) : void

Renders an LI element for the given sitemap node.

RenderUL ( Page curr, List sm, StringBuilder str, int stoplevel, string cssclass = "" ) : void

Renders an UL list for the given sitemap elements

Url ( string virtualpath ) : string

Method Details

APIKey() public method

Gets an encrypted API-key valid for 30 minutes.
public APIKey ( System.Guid apiKey ) : IHtmlString
apiKey System.Guid The API-key
return IHtmlString

APIKey() public method

Gets an ecrypted API-key valid for 30 minutes. If no API-key is provided the key for the currently logged in user is used.
public APIKey ( string apiKey = "" ) : IHtmlString
apiKey string
return IHtmlString

AbsoluteUrl() public method

Generates an absolute url from the virtual path or site url.
public AbsoluteUrl ( string url ) : IHtmlString
url string The url
return IHtmlString

Breadcrumb() public method

Renders the current breadcrumb.
public Breadcrumb ( int StartLevel = 1, string RootNode = "" ) : IHtmlString
StartLevel int Optional start level
RootNode string Optional root node
return IHtmlString

Content() public method

Gets the URL to the content with the given id.
public Content ( System.Guid id, int width, int height ) : IHtmlString
id System.Guid The content id
width int Optional width
height int Optional height
return IHtmlString

Content() public method

Gets the URL to the content with the given id.
public Content ( string id, int width, int height ) : IHtmlString
id string The content id
width int Optional width
height int Optional height
return IHtmlString

Head() public method

Generates the tags appropriate for the html head.
public Head ( ) : IHtmlString
return IHtmlString

Menu() public method

Return the site structure as an ul/li list with the current page selected.
public Menu ( int StartLevel = 1, int StopLevel = Int32.MaxValue, int Levels, string RootNode = "", string CssClass = "menu", bool RenderParent = false ) : IHtmlString
StartLevel int The start level of the menu
StopLevel int The stop level of the menu
Levels int The number of levels. Use this if you don't know the start level
RootNode string
CssClass string
RenderParent bool
return IHtmlString

Permalink() public method

Generates the url to the given permalink.
public Permalink ( System.Guid permalinkid, string prefix = "" ) : IHtmlString
permalinkid System.Guid The id of the permalink
prefix string Optional culture prefix
return IHtmlString

Permalink() public method

Generates the url to the given permalink.
public Permalink ( string permalink = "", string prefix = "" ) : IHtmlString
permalink string The permalink
prefix string Optional culture prefix
return IHtmlString

SetCurrent() public method

Sets the current page to the given value. This can be useful when using the UI helper in passive mode and the routing never sets the current page.
public SetCurrent ( Page page ) : void
page Page The page
return void

SetCurrent() public method

Sets the current post to the given value. This can be useful when using the UI helper in passive mode and the routing never sets the current post.
public SetCurrent ( Post post ) : void
post Post
return void

SiteUrl() public method

Generates a full site url from the virtual path.
public SiteUrl ( string virtualpath ) : IHtmlString
virtualpath string The virtual path.
return IHtmlString

Thumbnail() public method

Generates an image tag for the specified thumbnail.
public Thumbnail ( System.Guid id, int size ) : IHtmlString
id System.Guid The content, page or post id.
size int Optional size
return IHtmlString

Thumbnail() public method

Generates an image tag for the specified thumbnail.
public Thumbnail ( string id, int size ) : IHtmlString
id string The content id
size int Optional size
return IHtmlString

UIHelper() public method

Default constructor. Creates a new UI helper.
public UIHelper ( ) : System
return System

Upload() public method

Gets the url to the uploaded content with the given id.
public Upload ( System.Guid id, int width, int height ) : IHtmlString
id System.Guid The upload id
width int Optional width
height int Optional height
return IHtmlString

Upload() public method

Gets the url to the uploaded content with the given id.
public Upload ( string id, int width, int height ) : IHtmlString
id string The upload id
width int Optional width
height int Optional height
return IHtmlString