C# Class Rock.Web.UI.RockPage

RockPage is the base abstract class that all page templates in Rock should inherit from
Inheritance: System.Web.UI.Page
Afficher le fichier Open project: SparkDevNetwork/Rock Class Usage Examples

Protected Properties

Свойство Type Description
UserName string

Private Properties

Свойство Type Description
AddBlockMove void
AddGoogleAnalytics void
AddPopupControls void
AddTriggerPanel void
AddZoneElements void
GetCookieContext void
HtmlLinkExists bool
HtmlMetaExists bool
OnBlockUpdated void
SaveContextItem void
SetPage void

Méthodes publiques

Méthode Description
AddCSSLink ( Page page, string href, bool fingerprint = true ) : void

Adds a new CSS link that will be added to the page header prior to the page being rendered

AddCSSLink ( Page page, string href, string mediaType, bool fingerprint = true ) : void

Adds the CSS link to the page

AddCSSLink ( string href, bool fingerprint = true ) : void

Adds a new CSS link that will be added to the page header prior to the page being rendered

AddCSSLink ( string href, string mediaType, bool fingerprint = true ) : void

Adds the CSS link to the page

AddConfigurationUpdateTrigger ( UpdatePanel updatePanel ) : void

Adds an update trigger for when the block instance properties are updated.

AddHistory ( string key, string state, string title = "" ) : void

Adds a history point to the ScriptManager. Note: ScriptManager's EnableHistory property must be set to True

AddHtmlLink ( System.Web.UI.HtmlControls.HtmlLink htmlLink ) : void

Adds a new Html link that will be added to the page header prior to the page being rendered.

AddHtmlLink ( Page page, System.Web.UI.HtmlControls.HtmlLink htmlLink, string contentPlaceHolderId = "" ) : void

Adds a new Html link that will be added to the page header prior to the page being rendered

AddMetaTag ( System.Web.UI.HtmlControls.HtmlMeta htmlMeta ) : void

Adds a meta tag to the page header prior to the page being rendered

AddMetaTag ( Page page, System.Web.UI.HtmlControls.HtmlMeta htmlMeta ) : void

Adds a meta tag to the page

AddScriptLink ( Page page, string path, bool fingerprint = true ) : void

Adds a new script tag to the page header prior to the page being rendered

AddScriptLink ( string path, bool fingerprint = true ) : void

Adds a new script tag to the page header prior to the page being rendered.

AddScriptToHead ( Page page, string script, bool AddScriptTags ) : void

Adds the script to head.

DeleteUserPreference ( string key ) : void

Deletes a user preference value for the specified key

GetAttributeValue ( string key ) : string

Returns the current page's first value for the selected attribute If the attribute doesn't exist, null is returned

GetAttributeValues ( string key ) : List

Returns the current page's values for the selected attribute. If the attribute doesn't exist an empty list is returned.

GetClientIpAddress ( ) : string

Gets the client's ip address.

GetContextCookieName ( bool pageSpecific ) : string

Gets the name of the context cookie.

GetContextEntityTypes ( ) : List

Gets the context entity types.

GetCurrentContext ( Rock.Web.Cache.EntityTypeCache entity ) : Rock.Data.IEntity

Gets the current context object for a given entity type.

GetSharedItem ( string key ) : object

Retrieves an item from the current HTTPRequest items collection. This is useful to retrieve an object that was saved by a previous block on the same page.

GetUserPreference ( string key ) : string

Returns a user preference for the current user and given key.

GetUserPreferences ( string keyPrefix ) : string>.Dictionary

Returns the preference values for the current user that start with a given key.

HideSecondaryBlocks ( Rock.Web.UI.RockBlock caller, bool hidden ) : void

Hides any secondary blocks.

LoadGoogleMapsApi ( ) : void

Adds the google maps javascript API to the page

LogException ( Exception ex ) : void

Logs the exception.

PageParameter ( Rock.Web.UI.PageReference pageReference, string name ) : string

Checks the page reference's parms and querystring for a parameter matching the specified name, and if found returns the string

PageParameter ( string name, bool searchFormParams = false ) : string

Checks the page's RouteData values and then the query string for a parameter matching the specified name, and if found returns the string value

PageParameters ( ) : object>.Dictionary

Gets the page route and query string parameters

ResolveRockUrl ( string url ) : string

Returns a resolved Rock URL. Similar to System.Web.UI.Control's ResolveUrl method except that you can prefix a url with '~~' to indicate a virtual path to Rock's current theme root folder.

ResolveRockUrl ( string url, bool fingerprint ) : string

Resolves the rock URL.

ResolveRockUrlIncludeRoot ( string url ) : string

Resolves the rock URL and includes root.

SaveSharedItem ( string key, object item ) : void

Used to save an item to the current HTTPRequests items collection. This is useful if multiple blocks on the same page will need access to the same object. The first block can read the object and save it using this method for the other blocks to reference

SaveUserPreferences ( string keyPrefix ) : void

Saves the user preferences.

SessionUserPreferences ( ) : string>.Dictionary

Returns the current user's preferences, if they have previously been loaded into the session, they will be retrieved from there, otherwise they will be retrieved from the database, added to session and then returned

SetContextCookie ( IEntity entity, bool pageSpecific = false, bool refreshPage = true ) : void

Sets the context cookie.

SetUserPreference ( string key, string value, bool saveValue = true ) : void

Sets a user preference value for the specified key. If the key already exists, the value will be updated, if it is a new key it will be added. Value is then optionally saved to database.

UpdateBlocks ( string blockTypePath ) : void

Updates the blocks.

Méthodes protégées

Méthode Description
FindRockControls ( System.Web.UI.ControlCollection controls ) : void

Recurses the page's System.Web.UI.ControlCollection looking for any Rock.Web.UI.Controls.Zone controls

FindZone ( string zoneName ) : Control

Find the Rock.Web.UI.Controls.Zone for the specified zone name. Looks in the Zones property to see if it has been defined. If an existing zone Rock.Web.UI.Controls.Zone cannot be found, the HtmlForm control is returned

InitializeCulture ( ) : void

Initializes the page's culture to use the culture specified by the browser ("auto")

OnInit ( EventArgs e ) : void

Loads all of the configured blocks for the current page into the control tree

OnLoad ( EventArgs e ) : void

Raises the E:System.Web.UI.Control.Load event.

OnSaveStateComplete ( EventArgs e ) : void

Raises the E:System.Web.UI.Page.SaveStateComplete event after the page state has been saved to the persistence medium.

scriptManager_Navigate ( object sender, System.Web.UI.HistoryEventArgs e ) : void

Handles the Navigate event of the scriptManager control.

trigger_Click ( object sender, EventArgs e ) : void

Handles the Click event of the trigger control.

Private Methods

Méthode Description
AddBlockMove ( ) : void

Adds a control to move the block to another zone on the page.

AddGoogleAnalytics ( string code ) : void

Adds the google analytics script

AddPopupControls ( ) : void

Adds the popup controls.

AddTriggerPanel ( ) : void

Adds the config elements.

AddZoneElements ( bool canConfigPage ) : void

Adds the config elements.

GetCookieContext ( string cookieName ) : void
HtmlLinkExists ( Control parentControl, System.Web.UI.HtmlControls.HtmlLink newLink ) : bool

Returns a System.Boolean flag indicating if a specified parent control contains the specified HtmlLink.

HtmlMetaExists ( Page page, System.Web.UI.HtmlControls.HtmlMeta newMeta ) : bool

Returns a flag indicating if a meta tag exists on the page.

OnBlockUpdated ( int blockId ) : void

Called when a block's properties are updated.

SaveContextItem ( string key, object item ) : void
SetPage ( PageCache pageCache ) : void

Sets the page.

Method Details

AddCSSLink() public static méthode

Adds a new CSS link that will be added to the page header prior to the page being rendered
public static AddCSSLink ( Page page, string href, bool fingerprint = true ) : void
page System.Web.UI.Page The .
href string A representing the path to css file. Should be relative to layout template. Will be resolved at runtime
fingerprint bool if set to true [fingerprint].
Résultat void

AddCSSLink() public static méthode

Adds the CSS link to the page
public static AddCSSLink ( Page page, string href, string mediaType, bool fingerprint = true ) : void
page System.Web.UI.Page The .
href string A representing the path to css file. Should be relative to layout template. Will be resolved at runtime
mediaType string A representing the type of the media to use for the css link.
fingerprint bool if set to true [fingerprint].
Résultat void

AddCSSLink() public méthode

Adds a new CSS link that will be added to the page header prior to the page being rendered
public AddCSSLink ( string href, bool fingerprint = true ) : void
href string A representing the path to css file. Should be relative to layout template. Will be resolved at runtime.
fingerprint bool if set to true [fingerprint].
Résultat void

AddCSSLink() public méthode

Adds the CSS link to the page
public AddCSSLink ( string href, string mediaType, bool fingerprint = true ) : void
href string A representing the path to css file. Should be relative to layout template. Will be resolved at runtime
mediaType string A representing the type of the media to use for the css link.
fingerprint bool if set to true [fingerprint].
Résultat void

AddConfigurationUpdateTrigger() public méthode

Adds an update trigger for when the block instance properties are updated.
public AddConfigurationUpdateTrigger ( UpdatePanel updatePanel ) : void
updatePanel System.Web.UI.UpdatePanel The to add the to.
Résultat void

AddHistory() public méthode

Adds a history point to the ScriptManager. Note: ScriptManager's EnableHistory property must be set to True
public AddHistory ( string key, string state, string title = "" ) : void
key string A representing the key to use for the history point.
state string A representing any state information to store for the history point.
title string A representing the title to be used by the browser, will use an empty string by default.
Résultat void

AddHtmlLink() public méthode

Adds a new Html link that will be added to the page header prior to the page being rendered.
public AddHtmlLink ( System.Web.UI.HtmlControls.HtmlLink htmlLink ) : void
htmlLink System.Web.UI.HtmlControls.HtmlLink The .
Résultat void

AddHtmlLink() public static méthode

Adds a new Html link that will be added to the page header prior to the page being rendered
public static AddHtmlLink ( Page page, System.Web.UI.HtmlControls.HtmlLink htmlLink, string contentPlaceHolderId = "" ) : void
page System.Web.UI.Page The .
htmlLink System.Web.UI.HtmlControls.HtmlLink The to add to the page.
contentPlaceHolderId string A representing the Id of the content placeholder to add the link to.
Résultat void

AddMetaTag() public méthode

Adds a meta tag to the page header prior to the page being rendered
public AddMetaTag ( System.Web.UI.HtmlControls.HtmlMeta htmlMeta ) : void
htmlMeta System.Web.UI.HtmlControls.HtmlMeta The tag.
Résultat void

AddMetaTag() public static méthode

Adds a meta tag to the page
public static AddMetaTag ( Page page, System.Web.UI.HtmlControls.HtmlMeta htmlMeta ) : void
page System.Web.UI.Page The .
htmlMeta System.Web.UI.HtmlControls.HtmlMeta A representing the HTML meta tag.
Résultat void

AddScriptLink() public static méthode

Adds a new script tag to the page header prior to the page being rendered
public static AddScriptLink ( Page page, string path, bool fingerprint = true ) : void
page System.Web.UI.Page The .
path string A representing the path to script file. Should be relative to layout template. Will be resolved at runtime.
fingerprint bool if set to true [fingerprint].
Résultat void

AddScriptLink() public méthode

Adds a new script tag to the page header prior to the page being rendered.
public AddScriptLink ( string path, bool fingerprint = true ) : void
path string A representing the path to the script link.
fingerprint bool if set to true [fingerprint].
Résultat void

AddScriptToHead() public static méthode

Adds the script to head.
public static AddScriptToHead ( Page page, string script, bool AddScriptTags ) : void
page System.Web.UI.Page The page.
script string The script.
AddScriptTags bool if set to true [add script tags].
Résultat void

DeleteUserPreference() public méthode

Deletes a user preference value for the specified key
public DeleteUserPreference ( string key ) : void
key string A representing the name of the key.
Résultat void

FindRockControls() protected méthode

Recurses the page's System.Web.UI.ControlCollection looking for any Rock.Web.UI.Controls.Zone controls
protected FindRockControls ( System.Web.UI.ControlCollection controls ) : void
controls System.Web.UI.ControlCollection A containing the page's controls.
Résultat void

FindZone() protected méthode

Find the Rock.Web.UI.Controls.Zone for the specified zone name. Looks in the Zones property to see if it has been defined. If an existing zone Rock.Web.UI.Controls.Zone cannot be found, the HtmlForm control is returned
protected FindZone ( string zoneName ) : Control
zoneName string A representing the name of the zone.
Résultat System.Web.UI.Control

GetAttributeValue() public méthode

Returns the current page's first value for the selected attribute If the attribute doesn't exist, null is returned
public GetAttributeValue ( string key ) : string
key string A representing the argument key.
Résultat string

GetAttributeValues() public méthode

Returns the current page's values for the selected attribute. If the attribute doesn't exist an empty list is returned.
public GetAttributeValues ( string key ) : List
key string A representing the key of the selected attribute ///
Résultat List

GetClientIpAddress() public static méthode

Gets the client's ip address.
public static GetClientIpAddress ( ) : string
Résultat string

GetContextCookieName() public méthode

Gets the name of the context cookie.
public GetContextCookieName ( bool pageSpecific ) : string
pageSpecific bool if set to true [page specific].
Résultat string

GetContextEntityTypes() public méthode

Gets the context entity types.
public GetContextEntityTypes ( ) : List
Résultat List

GetCurrentContext() public méthode

Gets the current context object for a given entity type.
public GetCurrentContext ( Rock.Web.Cache.EntityTypeCache entity ) : Rock.Data.IEntity
entity Rock.Web.Cache.EntityTypeCache The containing a reference to the entity.
Résultat Rock.Data.IEntity

GetSharedItem() public méthode

Retrieves an item from the current HTTPRequest items collection. This is useful to retrieve an object that was saved by a previous block on the same page.
public GetSharedItem ( string key ) : object
key string A representing the object's key value.
Résultat object

GetUserPreference() public méthode

Returns a user preference for the current user and given key.
public GetUserPreference ( string key ) : string
key string A representing the key to the user preference.
Résultat string

GetUserPreferences() public méthode

Returns the preference values for the current user that start with a given key.
public GetUserPreferences ( string keyPrefix ) : string>.Dictionary
keyPrefix string A representing the key prefix. Preference values, for the current user, with a key that begins with this value will be included.
Résultat string>.Dictionary

HideSecondaryBlocks() public méthode

Hides any secondary blocks.
public HideSecondaryBlocks ( Rock.Web.UI.RockBlock caller, bool hidden ) : void
caller Rock.Web.UI.RockBlock The that is the caller
hidden bool A value that signifies if secondary blocks should be hidden.
Résultat void

InitializeCulture() protected méthode

Initializes the page's culture to use the culture specified by the browser ("auto")
protected InitializeCulture ( ) : void
Résultat void

LoadGoogleMapsApi() public méthode

Adds the google maps javascript API to the page
public LoadGoogleMapsApi ( ) : void
Résultat void

LogException() public méthode

Logs the exception.
public LogException ( Exception ex ) : void
ex System.Exception The to log.
Résultat void

OnInit() protected méthode

Loads all of the configured blocks for the current page into the control tree
protected OnInit ( EventArgs e ) : void
e System.EventArgs
Résultat void

OnLoad() protected méthode

Raises the E:System.Web.UI.Control.Load event.
protected OnLoad ( EventArgs e ) : void
e System.EventArgs The object that contains the event data.
Résultat void

OnSaveStateComplete() protected méthode

Raises the E:System.Web.UI.Page.SaveStateComplete event after the page state has been saved to the persistence medium.
protected OnSaveStateComplete ( EventArgs e ) : void
e System.EventArgs A object containing the event data.
Résultat void

PageParameter() public méthode

Checks the page reference's parms and querystring for a parameter matching the specified name, and if found returns the string
public PageParameter ( Rock.Web.UI.PageReference pageReference, string name ) : string
pageReference Rock.Web.UI.PageReference The .
name string A containing the name of the parameter.
Résultat string

PageParameter() public méthode

Checks the page's RouteData values and then the query string for a parameter matching the specified name, and if found returns the string value
public PageParameter ( string name, bool searchFormParams = false ) : string
name string A representing the name of the page parameter.
searchFormParams bool if set to true [search form parameters].
Résultat string

PageParameters() public méthode

Gets the page route and query string parameters
public PageParameters ( ) : object>.Dictionary
Résultat object>.Dictionary

ResolveRockUrl() public méthode

Returns a resolved Rock URL. Similar to System.Web.UI.Control's ResolveUrl method except that you can prefix a url with '~~' to indicate a virtual path to Rock's current theme root folder.
public ResolveRockUrl ( string url ) : string
url string A representing the URL to resolve.
Résultat string

ResolveRockUrl() public méthode

Resolves the rock URL.
public ResolveRockUrl ( string url, bool fingerprint ) : string
url string The URL.
fingerprint bool if set to true [fingerprint].
Résultat string

ResolveRockUrlIncludeRoot() public méthode

Resolves the rock URL and includes root.
public ResolveRockUrlIncludeRoot ( string url ) : string
url string The URL.
Résultat string

SaveSharedItem() public méthode

Used to save an item to the current HTTPRequests items collection. This is useful if multiple blocks on the same page will need access to the same object. The first block can read the object and save it using this method for the other blocks to reference
public SaveSharedItem ( string key, object item ) : void
key string A representing the item's key
item object The to save.
Résultat void

SaveUserPreferences() public méthode

Saves the user preferences.
public SaveUserPreferences ( string keyPrefix ) : void
keyPrefix string The key prefix.
Résultat void

SessionUserPreferences() public méthode

Returns the current user's preferences, if they have previously been loaded into the session, they will be retrieved from there, otherwise they will be retrieved from the database, added to session and then returned
public SessionUserPreferences ( ) : string>.Dictionary
Résultat string>.Dictionary

SetContextCookie() public méthode

Sets the context cookie.
public SetContextCookie ( IEntity entity, bool pageSpecific = false, bool refreshPage = true ) : void
entity IEntity The entity.
pageSpecific bool if set to true [page specific].
refreshPage bool if set to true [refresh page].
Résultat void

SetUserPreference() public méthode

Sets a user preference value for the specified key. If the key already exists, the value will be updated, if it is a new key it will be added. Value is then optionally saved to database.
public SetUserPreference ( string key, string value, bool saveValue = true ) : void
key string A representing the name of the key.
value string A representing the preference value.
saveValue bool if set to true [save value].
Résultat void

UpdateBlocks() public méthode

Updates the blocks.
public UpdateBlocks ( string blockTypePath ) : void
blockTypePath string The block type path.
Résultat void

scriptManager_Navigate() protected méthode

Handles the Navigate event of the scriptManager control.
protected scriptManager_Navigate ( object sender, System.Web.UI.HistoryEventArgs e ) : void
sender object The source of the event.
e System.Web.UI.HistoryEventArgs The instance containing the event data.
Résultat void

trigger_Click() protected méthode

Handles the Click event of the trigger control.
protected trigger_Click ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event data.
Résultat void

Property Details

UserName protected_oe property

The full name of the currently logged in user
protected string UserName
Résultat string