## Class TClientScriptManager

Description

TClientScriptManager class.

TClientScriptManager manages javascript and CSS stylesheets for a page.

- since: 3.0
- version: $Id: TClientScriptManager.php 2283 2007-10-01 00:33:28Z xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/TClientScriptManager.php (line 23)

    TComponent
       |
       --TApplicationComponent
          |
          --TClientScriptManager

Class Constant Summary
SCRIPT_LOADER = 'Web/Javascripts/clientscripts.php'
SCRIPT_PATH = 'Web/Javascripts/source'
Method Summary
TClientScriptManager __construct (TPage $owner)
string getCallbackReference (ICallbackEventHandler $callbackHandler, [array $options = null])
array getDefaultButtonOptions (string $panelID, string $buttonID)
array getPackagePathUrl (string $base)
string getPradoScriptAssetUrl ()
boolean getRequiresHead ()
boolean hasBeginScripts ()
boolean hasEndScripts ()
boolean isBeginScriptRegistered (string $key)
boolean isEndScriptRegistered (string $key)
boolean isHeadScriptFileRegistered (string $key)
boolean isHeadScriptRegistered (string $key)
boolean isHiddenFieldRegistered (string $key)
boolean isScriptFileRegistered (string $key)
boolean isStyleSheetFileRegistered (string $key)
boolean isStyleSheetRegistered (string $key)
void registerBeginScript (string $key, string $script)
void registerCallbackControl (string $class, array $options)
void registerDefaultButton (TControl|string $panel, TControl|string $button)
void registerEndScript (string $key, string $script)
void registerFocusControl (string $target)
void registerHeadScript (string $key, string $script)
void registerHeadScriptFile (string $key, string $url)
void registerHiddenField (string $name, string|array $value)
string registerJavascriptPackages (string $base, array $packages, [boolean $debug = null], [boolean $gzip = true])
void registerPostBackControl (string $class, array $options)
void registerPradoScript (string $name)
void registerScriptFile (string $key, string $url)
void registerStyleSheet (string $key, string $css, [mixed $media = ''])
void registerStyleSheetFile (string $key, string $url, [string $media = ''])
void renderBeginScripts (THtmlWriter $writer)
void renderEndScripts (THtmlWriter $writer)
void renderHeadScriptFiles (THtmlWriter $writer)
void renderHeadScripts (THtmlWriter $writer)
void renderHiddenFields (THtmlWriter $writer)
void renderPradoScripts (THtmlWriter $writer)
void renderScriptFiles (THtmlWriter $writer)
void renderStyleSheetFiles (THtmlWriter $writer)
void renderStyleSheets (THtmlWriter $writer)
void verifyJavascriptPackages (mixed $base, mixed $path, mixed $scripts)
Methods
Constructor __construct (line 84)

Constructor.

- access: public

TClientScriptManager __construct (TPage $owner)

- TPage $owner: page that owns this client script manager

getCallbackReference (line 226)

Returns javascript statement that create a new callback request object.

- return: javascript statement that creates a new callback request.
- access: public

string getCallbackReference (ICallbackEventHandler $callbackHandler, [array $options = null])

- ICallbackEventHandler $callbackHandler: callback response handler
- array $options: additional callback options

getDefaultButtonOptions (line 310)

- return: default button options.
- access: protected

array getDefaultButtonOptions (string $panelID, string $buttonID)

- string $panelID: the unique ID of the container control
- string $buttonID: the unique ID of the button control

getPackagePathUrl (line 205)

- return: tuple($path,$url).
- access: protected

array getPackagePathUrl (string $base)

- string $base: javascript package path.

getPradoScriptAssetUrl (line 135)

- return: Prado javascript library base asset url.
- access: public

string getPradoScriptAssetUrl ()
getRequiresHead (line 93)

- return: whether THead is required in order to render CSS and js within head
- access: public
- since: 3.1.1

boolean getRequiresHead ()
hasBeginScripts (line 518)

- return: true if any begin scripts are registered.
- access: public

boolean hasBeginScripts ()
hasEndScripts (line 510)

- return: true if any end scripts are registered.
- access: public

boolean hasEndScripts ()
isBeginScriptRegistered (line 493)

- return: whether there is a beginning javascript block registered with the specified key
- access: public

boolean isBeginScriptRegistered (string $key)

- string $key: a unique key

isEndScriptRegistered (line 502)

- return: whether there is an ending javascript block registered with the specified key
- access: public

boolean isEndScriptRegistered (string $key)

- string $key: a unique key

isHeadScriptFileRegistered (line 466)

- return: whether there is a head javascript file registered with the specified key
- access: public

boolean isHeadScriptFileRegistered (string $key)

- string $key: a unique key

isHeadScriptRegistered (line 475)

- return: whether there is a head javascript block registered with the specified key
- access: public

boolean isHeadScriptRegistered (string $key)

- string $key: a unique key

isHiddenFieldRegistered (line 527)

- return: whether there is a hidden field registered with the specified key
- access: public

boolean isHiddenFieldRegistered (string $key)

- string $key: a unique key

isScriptFileRegistered (line 484)

- return: whether there is a javascript file registered with the specified key
- access: public

boolean isScriptFileRegistered (string $key)

- string $key: a unique key

isStyleSheetFileRegistered (line 448)

- return: whether there is a CSS file registered with the specified key
- access: public

boolean isStyleSheetFileRegistered (string $key)

- string $key: a unique key

isStyleSheetRegistered (line 457)

- return: whether there is a CSS block registered with the specified key
- access: public

boolean isStyleSheetRegistered (string $key)

- string $key: a unique key

registerBeginScript (line 409)

Registers a javascript script block at the beginning of the form

- access: public

void registerBeginScript (string $key, string $script)

- string $key: a unique key identifying the script block
- string $script: javascript block

registerCallbackControl (line 243)

Registers callback javascript for a control.

- access: public

void registerCallbackControl (string $class, array $options)

- string $class: javascript class responsible for the control being registered for callback
- array $options: callback options

registerDefaultButton (line 283)

Register a default button to panel. When the $panel is in focus and the 'enter' key is pressed, the $button will be clicked.

- access: public

void registerDefaultButton (TControl|string $panel, TControl|string $button)

- TControl|string $panel: panel (or its unique ID) to register the default button action
- TControl|string $button: button (or its unique ID) to trigger a postback

registerEndScript (line 422)

Registers a javascript script block at the end of the form

- access: public

void registerEndScript (string $key, string $script)

- string $key: a unique key identifying the script block
- string $script: javascript block

registerFocusControl (line 323)

Registers the control to receive default focus.

- access: public

void registerFocusControl (string $target)

- string $target: the client ID of the control to receive default focus

registerHeadScript (line 383)

Registers a javascript block in the page head.

- access: public

void registerHeadScript (string $key, string $script)

- string $key: a unique key identifying the script block
- string $script: javascript block

registerHeadScriptFile (line 370)

Registers a javascript file in the page head

- access: public

void registerHeadScriptFile (string $key, string $url)

- string $key: a unique key identifying the file
- string $url: URL to the javascript file

registerHiddenField (line 436)

Registers a hidden field to be rendered in the form.

- access: public

void registerHiddenField (string $name, string|array $value)

- string $name: a unique key identifying the hidden field
- string|array $value: hidden field value, if the value is an array, every element in the array will be rendered as a hidden field value.

registerJavascriptPackages (line 166)

Publishes a javascript library path and register packages to be loaded.

See TClientScriptLoader for component that enables users to register custom javascript libraries.

- return: javascript src url
- access: public
- since: 3.1

string registerJavascriptPackages (string $base, array $packages, [boolean $debug = null], [boolean $gzip = true])

- string $base: javascript library base path
- array $packages: list of packages or javascript files (without .js extension) to be loaded.
- boolean $debug: true to enable keep comments in javascript files loaded, null to use application configuration.
- boolean $gzip: true to gzip the javascript code if browsers and php supports it.

registerPostBackControl (line 260)

Registers postback javascript for a control. A null class parameter will prevent the javascript code registration.

- access: public

void registerPostBackControl (string $class, array $options)

- string $class: javascript class responsible for the control being registered for postback
- array $options: postback options

registerPradoScript (line 104)

Registers Prado javascript by library name. See "Web/Javascripts/source/packages.php" for library names.

- access: public

void registerPradoScript (string $name)

- string $name: script library name.

registerScriptFile (line 396)

Registers a javascript file to be rendered within the form

- access: public

void registerScriptFile (string $key, string $url)

- string $key: a unique key identifying the file
- string $url: URL to the javascript file to be rendered

registerStyleSheet (line 357)

Registers a CSS block to be rendered in the page head

- access: public

void registerStyleSheet (string $key, string $css, [mixed $media = ''])

- string $key: a unique key identifying the CSS block
- string $css: CSS block

registerStyleSheetFile (line 341)

Registers a CSS file to be rendered in the page head

- access: public

void registerStyleSheetFile (string $key, string $url, [string $media = ''])

- string $key: a unique key identifying the file
- string $url: URL to the CSS file
- string $media: media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types.

renderBeginScripts (line 586)

- access: public

void renderBeginScripts (THtmlWriter $writer)

- THtmlWriter $writer: writer for the rendering purpose

renderEndScripts (line 594)

- access: public

void renderEndScripts (THtmlWriter $writer)

- THtmlWriter $writer: writer for the rendering purpose

renderHeadScriptFiles (line 560)

- access: public

void renderHeadScriptFiles (THtmlWriter $writer)

- THtmlWriter $writer: writer for the rendering purpose

renderHeadScripts (line 568)

- access: public

void renderHeadScripts (THtmlWriter $writer)

- THtmlWriter $writer: writer for the rendering purpose

renderHiddenFields (line 602)

- access: public

void renderHiddenFields (THtmlWriter $writer)

- THtmlWriter $writer: writer for the rendering purpose

renderPradoScripts (line 146)

Renders the HTML tags for PRADO js files

- access: protected

void renderPradoScripts (THtmlWriter $writer)

- THtmlWriter $writer: writer

renderScriptFiles (line 576)

- access: public

void renderScriptFiles (THtmlWriter $writer)

- THtmlWriter $writer: writer for the rendering purpose

renderStyleSheetFiles (line 535)

- access: public

void renderStyleSheetFiles (THtmlWriter $writer)

- THtmlWriter $writer: writer for the rendering purpose

renderStyleSheets (line 551)

- access: public

void renderStyleSheets (THtmlWriter $writer)

- THtmlWriter $writer: writer for the rendering purpose

verifyJavascriptPackages (line 187)

- access: protected
- throws: TConfigurationException when javascript packages mismatch.

void verifyJavascriptPackages (mixed $base, mixed $path, mixed $scripts)

#### Inherited Methods

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants
SCRIPT_LOADER = 'Web/Javascripts/clientscripts.php' (line 32)

the PHP script for loading Prado javascript files

SCRIPT_PATH = 'Web/Javascripts/source' (line 28)

directory containing Prado javascript files

Documentation generated on Mon, 21 Apr 2008 11:33:34 -0400 by phpDocumentor 1.3.0RC4