C# Class Sage.UrlGenerator

Implements a class that handles all link generation.
ファイルを表示 Open project: igorfrance/sage

Private Properties

Property Type Description
FormatAndRewriteUrl string
FormatPattern string
GetLinkFunction string
GetProjectLinkFunction string
GetSelfFunction string
ProcessHrefAttribute System.Xml.XmlNode
ProcessSageBaseHrefElement System.Xml.XmlNode
ProcessSageLinkElement System.Xml.XmlNode
ProcessSageUrlElement System.Xml.XmlNode

Public Methods

Method Description
GetUrl ( XmlElement linkElement ) : string

Resolves a link href based on the attributes of the specified linkElement.

The attributes on the element that will be taken into account:

Attribute Description id The id of the URL of the link to resolve:

<sage:link id="CustomerSuport" />

values To add formatting values to the resulting URL, such as the ID of the current customer, use the values attribute:

<sage:link id="CustomerSuport" values="id=${CustomerID}"/>

encode To URL-encode the resulting URL, use the encode attribute and set it's value to "1", "true", or "yes".
GetUrl ( string linkName, NameValueCollection query = null, string hashString = null, bool qualify = false ) : string

Generates the specified link, using the name/value pairs from the specified query to format it.

GetUrl ( string linkName, string query, string hashString = null, bool qualify = false ) : string

Generates the specified link, using the name/value pairs from the specified query to format it.

PrefixUrl ( string url ) : string

Returns the specified url with the current ServerPrefix (if any) pre-pended to it.

UrlGenerator ( SageContext context ) : System

Initializes a new instance of the UrlGenerator class, using the specified context.

Private Methods

Method Description
FormatAndRewriteUrl ( string linkName, NameValueCollection parameters, string hashString = null, bool qualify = false ) : string

Formats and rewrites the link pattern with the specified linkName.

FormatPattern ( string pattern, NameValueCollection parameters ) : string
GetLinkFunction ( SageContext context ) : string
GetProjectLinkFunction ( SageContext context ) : string
GetSelfFunction ( SageContext context ) : string
ProcessHrefAttribute ( SageContext context, XmlNode node ) : XmlNode
ProcessSageBaseHrefElement ( SageContext context, XmlNode node ) : XmlNode
ProcessSageLinkElement ( SageContext context, XmlNode node ) : XmlNode
ProcessSageUrlElement ( SageContext context, XmlNode node ) : XmlNode

Method Details

GetUrl() public method

Resolves a link href based on the attributes of the specified linkElement.

The attributes on the element that will be taken into account:

Attribute Description id The id of the URL of the link to resolve:

<sage:link id="CustomerSuport" />

values To add formatting values to the resulting URL, such as the ID of the current customer, use the values attribute:

<sage:link id="CustomerSuport" values="id=${CustomerID}"/>

encode To URL-encode the resulting URL, use the encode attribute and set it's value to "1", "true", or "yes".
public GetUrl ( XmlElement linkElement ) : string
linkElement System.Xml.XmlElement The element that contains attributes that define the link to resolve.
return string

GetUrl() public method

Generates the specified link, using the name/value pairs from the specified query to format it.
public GetUrl ( string linkName, NameValueCollection query = null, string hashString = null, bool qualify = false ) : string
linkName string The name of the link to get.
query System.Collections.Specialized.NameValueCollection The query to use for formatting the link.
hashString string The browser hash string to append to the end of the URL.
qualify bool If set to true the resulting URL will be prefixed with .
return string

GetUrl() public method

Generates the specified link, using the name/value pairs from the specified query to format it.
public GetUrl ( string linkName, string query, string hashString = null, bool qualify = false ) : string
linkName string The name of the link to generate.
query string The query to use for formatting the link.
hashString string The browser hash string to append to the end of the URL.
qualify bool If set to true the resulting URL will be prefixed with .
return string

PrefixUrl() public method

Returns the specified url with the current ServerPrefix (if any) pre-pended to it.
/// is null. ///
public PrefixUrl ( string url ) : string
url string The URL to process.
return string

UrlGenerator() public method

Initializes a new instance of the UrlGenerator class, using the specified context.
public UrlGenerator ( SageContext context ) : System
context SageContext The current .
return System