## Class TCallbackClientScript

Description

TCallbackClientScript class.

The TCallbackClientScript class provides corresponding methods that can be executed on the client-side (i.e. the browser client that is viewing the page) during a callback response.

The avaiable methods includes setting/clicking input elements, changing Css styles, hiding/showing elements, and adding visual effects to elements on the page. The client-side methods can be access through the CallbackClient property available in TPage.

For example, to hide "$myTextBox" element during callback response, do

     $this->getPage()->getCallbackClient()->hide($myTextBox);

- since: 3.1
- version: $Id: TCallbackClientScript.php 2773 2010-02-17 13:55:18Z Christophe.Boulain $
- author: Wei Zhuo <weizhuo[at]gamil[dot]com>

Located in /Web/UI/ActiveControls/TCallbackClientScript.php (line 35)

    TComponent
       |
       --TApplicationComponent
          |
          --TCallbackClientScript

Method Summary
TCallbackClientScript __construct ()
void addCssClass (TControl $element, string $cssClass)
void addPostDataLoader (mixed $name)
void appear (TControl $element, [array $options = null])
void appendContent (TControl $element, string $content)
void blindDown (TControl $element, [array $options = null])
void blindUp (TControl $element, [array $options = null])
void callClientFunction (string $function, [array $params = null])
void check (TControl $checkbox, [boolean $checked = true])
void click (TControl $control)
void dropOut (TControl $element, [array $options = null])
void evaluateScript (THtmlWriter $writer)
void fade (TControl $element, [array $options = null])
void focus (TControl $element)
void fold (TControl $element, [array $options = null])
array getClientFunctionsToExecute ()
void grow (TControl $element, [array $options = null])
void hide (TControl $element)
void highlight (TControl $element, [array $options = null])
void insertContentAfter (TControl $element, string $content)
void insertContentBefore (TControl $element, string $content)
void prependContent (TControl $element, string $content)
void puff (TControl $element, [array $options = null])
void pulsate (TControl $element, [array $options = null])
void raiseClientEvent (TControl $control, string $eventName)
void remove (TControl $element)
void removeCssClass (TControl $element, string $cssClass)
void replace (TControl $element, string $content, [string $method = "Element.replace"], [string $boundary = null])
void replaceContent (TControl $element, string $content)
void scrollTo (TControl $element)
void select (TControl $control, [string $method = 'Value'], [string|int $value = null], [string $type = null])
void setAttribute (TControl $control, string $name, string $value)
void setListItems (TControl $control, TCollection $items)
void setOpacity (TControl $element, float $value)
void setStyle (TControl $element, array $styles)
void setValue (TControl $input, string $text)
void shake (TControl $element, [array $options = null])
void show (TControl $element)
void shrink (TControl $element, [array $options = null])
void slideDown (TControl $element, [array $options = null])
void slideUp (TControl $element, [array $options = null])
void squish (TControl $element, [array $options = null])
void switchOff (TControl $element, [array $options = null])
void toggle (TControl $element, [string $effect = null], [array $options = array()])
void update (TControl $element, TControl $content)
void visualEffect (string $type, TControl $element, [array $options = null])
Methods
Constructor __construct (line 45)

Constructor.

- access: public

TCallbackClientScript __construct ()
addCssClass (line 271)

Add a Css class name to the element.

- access: public

void addCssClass (TControl $element, string $cssClass)

- TControl $element: control element or element id
- string $cssClass: CssClass name to add.

addPostDataLoader (line 248)

- access: public

void addPostDataLoader (mixed $name)
appear (line 483)

Visual Effect: Gradually make the element appear.

- access: public

void appear (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

appendContent (line 339)

Append a HTML fragement to the element.

- access: public

void appendContent (TControl $element, string $content)

- TControl $element: control element or element id
- string $content: HTML fragement or the control to be rendered

blindDown (line 495)

Visual Effect: Blind down.

- access: public

void blindDown (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

blindUp (line 507)

Visual Effect: Blind up.

- access: public

void blindUp (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

callClientFunction (line 64)

Executes a client-side statement.

- access: public

void callClientFunction (string $function, [array $params = null])

- string $function: javascript function name
- array $params: list of arguments for the function

check (line 143)

Client script to check or uncheck a checkbox or radio button.

- access: public

void check (TControl $checkbox, [boolean $checked = true])

- TControl $checkbox: control element or element id
- boolean $checked: check or uncheck the checkbox or radio button.

click (line 133)

Client script to click on an element. This client-side function is unpredictable.

- access: public

void click (TControl $control)

- TControl $control: control element or element id

dropOut (line 520)

Visual Effect: Drop out.

- access: public

void dropOut (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

evaluateScript (line 430)

Evaluate a block of javascript enclosed in a boundary.

- access: public

void evaluateScript (THtmlWriter $writer)

- THtmlWriter $writer: writer for the content.

fade (line 532)

Visual Effect: Gradually fade the element.

- access: public

void fade (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

focus (line 316)

Focus on a particular element.

- access: public

void focus (TControl $element)

- TControl $element: control element or element id.

fold (line 544)

Visual Effect: Fold.

- access: public

void fold (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

getClientFunctionsToExecute (line 54)

- return: list of client function to be executed during callback response.
- access: public

array getClientFunctionsToExecute ()
grow (line 556)

Visual Effect: Gradually make an element grow to a predetermined size.

- access: public

void grow (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

hide (line 217)

Hides an element by changing its CSS display style to "none".

- access: public

void hide (TControl $element)

- TControl $element: control element or element id

highlight (line 664)

Visual Effect: High light the element for about 2 seconds.

- access: public

void highlight (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

insertContentAfter (line 363)

Insert a HTML fragement after the element.

- access: public

void insertContentAfter (TControl $element, string $content)

- TControl $element: control element or element id
- string $content: HTML fragement or the control to be rendered

insertContentBefore (line 375)

Insert a HTML fragement in before the element.

- access: public

void insertContentBefore (TControl $element, string $content)

- TControl $element: control element or element id
- string $content: HTML fragement or the control to be rendered

prependContent (line 351)

Prepend a HTML fragement to the element.

- access: public

void prependContent (TControl $element, string $content)

- TControl $element: control element or element id
- string $content: HTML fragement or the control to be rendered

puff (line 568)

Visual Effect: Gradually grow and fade the element.

- access: public

void puff (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

pulsate (line 580)

Visual Effect: Pulsate.

- access: public

void pulsate (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

raiseClientEvent (line 153)

Raise the client side event (given by $eventName) on a particular element.

- access: public

void raiseClientEvent (TControl $control, string $eventName)

- TControl $control: control element or element id
- string $eventName: Event name, e.g. "click"

remove (line 241)

Removes an element from the HTML page.

- access: public

void remove (TControl $element)

- TControl $element: control element or element id

removeCssClass (line 283)

Remove a Css class name from the element.

- access: public

void removeCssClass (TControl $element, string $cssClass)

- TControl $element: control element or element id
- string $cssClass: CssClass name to remove.

replace (line 397)

Replace the content of an element with new content. The new content can be a string or a TControl component. If the <tt>content</tt> parameter is a TControl component, its rendered method will be called and its contents will be used for replacement.

- access: protected
- see: insertAfter
- see: insertBefore
- see: insertBelow
- see: insertAbout

void replace (TControl $element, string $content, [string $method = "Element.replace"], [string $boundary = null])

- TControl $element: control element or HTML element id.
- string $content: HTML fragement or the control to be rendered
- string $method: replacement method, default is to replace the outter html content.
- string $boundary: provide a custom boundary.

replaceContent (line 419)

Replace the content of an element with new content contained in writer.

- access: public

void replaceContent (TControl $element, string $content)

- TControl $element: control element or HTML element id.
- string $content: HTML fragement or the control to be rendered

scrollTo (line 305)

Scroll the top of the browser viewing area to the location of the element.

- access: public

void scrollTo (TControl $element)

- TControl $element: control element or element id

select (line 103)

Client script to select/clear/check a drop down list, check box list, or radio button list.

The second parameter determines the selection method. Valid methods are

- Value, select or check by value
- Values, select or check by a list of values
- Index, select or check by index (zero based index)
- Indices, select or check by a list of index (zero based index)
- Clear, clears or selections or checks in the list
- All, select all
- Invert, invert the selection.

- access: public

void select (TControl $control, [string $method = 'Value'], [string|int $value = null], [string $type = null])

- TControl $control: list control
- string $method: selection method
- string|int $value: the value or index to select/check.
- string $type: selection control type, either 'check' or 'select'

setAttribute (line 165)

Sets the attribute of a particular control.

- access: public

void setAttribute (TControl $control, string $name, string $value)

- TControl $control: control element or element id
- string $name: attribute name
- string $value: attribute value

setListItems (line 177)

Sets the options of a select input element.

- access: public

void setListItems (TControl $control, TCollection $items)

- TControl $control: control element or element id
- TCollection $items: a list of new options

setOpacity (line 676)

Set the opacity on a html element or control.

- access: public

void setOpacity (TControl $element, float $value)

- TControl $element: control element or element id
- float $value: opacity value between 1 and 0

setStyle (line 327)

Sets the style of element. The style must be a key-value array where the key is the style property and the value is the style value.

- access: public

void setStyle (TControl $element, array $styles)

- TControl $element: control element or element id
- array $styles: list of key-value pairs as style property and style value.

setValue (line 82)

Client script to set the value of a particular input element.

- access: public

void setValue (TControl $input, string $text)

- TControl $input: control element to set the new value
- string $text: new value

shake (line 592)

Visual Effect: Shake the element.

- access: public

void shake (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

show (line 206)

Shows an element by changing its CSS display style as empty.

- access: public

void show (TControl $element)

- TControl $element: control element or element id

shrink (line 604)

Visual Effect: Shrink the element.

- access: public

void shrink (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

slideDown (line 616)

Visual Effect: Slide down.

- access: public

void slideDown (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

slideUp (line 628)

Visual Effect: Side up.

- access: public

void slideUp (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

squish (line 640)

Visual Effect: Squish the element.

- access: public

void squish (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

switchOff (line 652)

Visual Effect: Switch Off effect.

- access: public

void switchOff (TControl $element, [array $options = null])

- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

toggle (line 230)

Toggles the visibility of the element.

- access: public

void toggle (TControl $element, [string $effect = null], [array $options = array()])

- TControl $element: control element or element id
- string $effect: visual effect, such as, 'appear' or 'slide' or 'blind'.
- array $options: additional options.

update (line 259)

Update the element's innerHTML with new content.

- access: public

void update (TControl $element, TControl $content)

- TControl $element: control element or element id
- TControl $content: new HTML content, if content is of a TControl, the controls render method is called.

visualEffect (line 471)

Add a visual effect the element.

- access: public

void visualEffect (string $type, TControl $element, [array $options = null])

- string $type: visual effect function name.
- TControl $element: control element or element id
- array $options: visual effect key-value pair options.

#### 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()

Documentation generated on Mon, 22 Feb 2010 12:16:57 +0000 by phpDocumentor 1.3.0RC4