Inheritance diagram for AjaxHelper:

Public Member Functions | |
| __getHtmlOptions ($options, $extra=array()) | |
| __optionsForAjax ($options) | |
| _buildCallbacks ($options) | |
| _buildObserver ($klass, $name, $options=null) | |
| _buildOptions ($options, $acceptable) | |
| _optionsToString ($options, $stringOpts=array()) | |
| afterRender () | |
| autoComplete ($field, $url="", $options=array()) | |
| div ($id, $options=array()) | |
| divEnd ($id) | |
| drag ($id, $options=array()) | |
| drop ($id, $options=array()) | |
| dropRemote ($id, $options=array(), $ajaxOptions=array()) | |
| editor ($id, $url, $options=array()) | |
| form ($params=null, $type= 'post', $options=array()) | |
| isAjax () | |
| link ($title, $href=null, $options=array(), $confirm=null, $escapeTitle=true) | |
| observeField ($field, $options=array()) | |
| observeForm ($form, $options=array()) | |
| remoteFunction ($options) | |
| remoteTimer ($options=null) | |
| slider ($id, $trackId, $options=array()) | |
| sortable ($id, $options=array()) | |
| submit ($title= 'Submit', $options=array()) | |
Public Attributes | |
| $__ajaxBuffer = array() | |
| $ajaxOptions | |
| $autoCompleteOptions | |
| $callbacks | |
| $dragOptions | |
| $dropOptions | |
| $editorOptions | |
| $helpers = array('Html', 'Javascript', 'Form') | |
| $Html = null | |
| $Javascript = null | |
| $sliderOptions | |
| $sortOptions | |
Definition at line 35 of file ajax.php.
| AjaxHelper::__getHtmlOptions | ( | $ | options, | |
| $ | extra = array() | |||
| ) |
Private Method to return a string of html options option data as a JavaScript options hash.
| array | $options Options in the shape of keys and values | |
| array | $extra Array of legal keys in this options context |
Definition at line 817 of file ajax.php.
Referenced by autoComplete(), form(), link(), and submit().
| AjaxHelper::__optionsForAjax | ( | $ | options | ) |
Private helper function for Javascript.
| array | $options Set of options private |
Definition at line 741 of file ajax.php.
References _buildCallbacks(), _buildOptions(), _optionsToString(), camelize(), and form().
Referenced by editor(), and remoteFunction().
| AjaxHelper::_buildCallbacks | ( | $ | options | ) |
Return Javascript text for callbacks.
| array | $options Option array where a callback is specified |
Definition at line 882 of file ajax.php.
References $callbacks.
Referenced by __optionsForAjax(), and sortable().
| AjaxHelper::_buildObserver | ( | $ | klass, | |
| $ | name, | |||
| $ | options = null | |||
| ) |
Return JavaScript text for an observer...
| string | $klass Name of JavaScript class | |
| string | $name | |
| array | $options Ajax options |
Definition at line 864 of file ajax.php.
References remoteFunction(), and Helper::value().
Referenced by observeField(), and observeForm().
| AjaxHelper::_buildOptions | ( | $ | options, | |
| $ | acceptable | |||
| ) |
Returns a string of JavaScript with the given option data as a JavaScript options hash.
| array | $options Options in the shape of keys and values | |
| array | $acceptable Array of legal keys in this options context |
Definition at line 832 of file ajax.php.
References $out.
Referenced by __optionsForAjax(), autoComplete(), drag(), drop(), dropRemote(), editor(), slider(), and sortable().
| AjaxHelper::_optionsToString | ( | $ | options, | |
| $ | stringOpts = array() | |||
| ) |
Returns a string of JavaScript with a string representation of given options array.
| array | $options Ajax options array | |
| array | $stringOpts Options as strings in an array private |
Definition at line 927 of file ajax.php.
Referenced by __optionsForAjax(), autoComplete(), drag(), drop(), dropRemote(), editor(), slider(), and sortable().
| AjaxHelper::afterRender | ( | ) |
Executed after a view has rendered, used to include bufferred code blocks.
public
Reimplemented from Helper.
Definition at line 952 of file ajax.php.
References Helper::$data, $out, Object::_stop(), and env().
| AjaxHelper::autoComplete | ( | $ | field, | |
| $ | url = "", |
|||
| $ | options = array() | |||
| ) |
Create a text field with Autocomplete.
Creates an autocomplete field with the given ID and options.
options['with'] defaults to "Form.Element.serialize('$field')", but can be any valid javascript expression defining the additional fields.
| string | $field DOM ID of field to observe | |
| string | $url URL for the autocomplete action | |
| array | $options Ajax options |
Definition at line 450 of file ajax.php.
References $url, __getHtmlOptions(), _buildOptions(), _optionsToString(), and camelize().
| AjaxHelper::div | ( | $ | id, | |
| $ | options = array() | |||
| ) |
Creates an Ajax-updateable DIV element
| string | $id options for javascript |
Definition at line 503 of file ajax.php.
References $id, Helper::_parseAttributes(), env(), and Helper::output().
| AjaxHelper::divEnd | ( | $ | id | ) |
Closes an Ajax-updateable DIV element
| string | $id The DOM ID of the element |
Definition at line 523 of file ajax.php.
References $id, env(), and Helper::output().
| AjaxHelper::drag | ( | $ | id, | |
| $ | options = array() | |||
| ) |
Creates a draggable element. For a reference on the options for this function, check out http://github.com/madrobby/scriptaculous/wikis/draggable
| unknown_type | $id | |
| array | $options |
Definition at line 551 of file ajax.php.
References _buildOptions(), and _optionsToString().
| AjaxHelper::drop | ( | $ | id, | |
| $ | options = array() | |||
| ) |
For a reference on the options for this function, check out http://github.com/madrobby/scriptaculous/wikis/droppables
| unknown_type | $id | |
| array | $options |
Definition at line 570 of file ajax.php.
References _buildOptions(), and _optionsToString().
| AjaxHelper::dropRemote | ( | $ | id, | |
| $ | options = array(), |
|||
| $ | ajaxOptions = array() | |||
| ) |
Make an element with the given $id droppable, and trigger an Ajax call when a draggable is dropped on it.
For a reference on the options for this function, check out http://wiki.script.aculo.us/scriptaculous/show/Droppables.add
| string | $id | |
| array | $options | |
| array | $ajaxOptions |
Definition at line 594 of file ajax.php.
References $ajaxOptions, _buildOptions(), _optionsToString(), and remoteFunction().
| AjaxHelper::editor | ( | $ | id, | |
| $ | url, | |||
| $ | options = array() | |||
| ) |
Makes an Ajax In Place editor control.
| string | $id DOM ID of input element | |
| string | $url Postback URL of saved data | |
| array | $options Array of options to control the editor, including ajaxOptions (see link). http://github.com/madrobby/scriptaculous/wikis/ajax-inplaceeditor |
Definition at line 656 of file ajax.php.
References $url, __optionsForAjax(), _buildOptions(), _optionsToString(), form(), Helper::url(), and Helper::value().
| AjaxHelper::form | ( | $ | params = null, |
|
| $ | type = 'post', |
|||
| $ | options = array() | |||
| ) |
Returns form tag that will submit using Ajax.
Returns a form tag that will submit using XMLHttpRequest in the background instead of the regular reloading POST arrangement. Even though it's using Javascript to serialize the form elements, the form submission will work just like a regular submission as viewed by the receiving side (all elements available in params). The options for defining callbacks is the same as AjaxHelper::link().
| mixed | $params Either a string identifying the form target, or an array of method parameters, including:
| |
| array | $type How form data is posted: 'get' or 'post' | |
| array | $options Callback/HTML options |
Definition at line 317 of file ajax.php.
References Helper::$params, __getHtmlOptions(), Helper::model(), remoteFunction(), submit(), and Helper::url().
Referenced by __optionsForAjax(), and editor().
| AjaxHelper::isAjax | ( | ) |
| AjaxHelper::link | ( | $ | title, | |
| $ | href = null, |
|||
| $ | options = array(), |
|||
| $ | confirm = null, |
|||
| $ | escapeTitle = true | |||
| ) |
Returns link to remote action
Returns a link to a remote action defined by options[url] (using the url() format) that's called in the background using XMLHttpRequest. The result of that request can then be inserted into a DOM object whose id can be specified with options[update].
Examples: link("Delete this post", array("update" => "posts", "url" => "delete/{$postid->id}")); link(imageTag("refresh"), array("update" => "emails", "url" => "list_emails" ));
By default, these remote requests are processed asynchronous during which various callbacks can be triggered (for progress indicators and the likes).
Example: link (word, array("url" => "undo", "n" => word_counter), array("complete" => "undoRequestCompleted(request)"));
The callbacks that may be specified are:
If you for some reason or another need synchronous processing (that'll block the browser while the request is happening), you can specify options[type] = synchronous.
You can customize further browser side call logic by passing in Javascript code snippets via some optional parameters. In their order of use these are:
| string | $title Title of link | |
| string | $href Href string "/products/view/12" | |
| array | $options Options for JavaScript function | |
| string | $confirm Confirmation message. Calls up a JavaScript confirm() message. | |
| boolean | $escapeTitle Escaping the title string to HTML entities |
Definition at line 203 of file ajax.php.
References __getHtmlOptions(), remoteFunction(), and Helper::url().
| AjaxHelper::observeField | ( | $ | field, | |
| $ | options = array() | |||
| ) |
Observe field and call ajax on change.
Observes the field with the DOM ID specified by field and makes an Ajax when its contents have changed.
Required +options+ are:
Additionally, you may specify any of the options documented in
| string | $field DOM ID of field to observe | |
| array | $options ajax options |
Definition at line 401 of file ajax.php.
References _buildObserver().
| AjaxHelper::observeForm | ( | $ | form, | |
| $ | options = array() | |||
| ) |
Observe entire form and call ajax on change.
Like
| string | $form DOM ID of form to observe | |
| array | $options ajax options |
Definition at line 425 of file ajax.php.
References _buildObserver().
| AjaxHelper::remoteFunction | ( | $ | options | ) |
Creates JavaScript function for remote AJAX call
This function creates the javascript needed to make a remote call it is primarily used as a helper for AjaxHelper::link.
| array | $options options for javascript |
Definition at line 243 of file ajax.php.
References __optionsForAjax(), and Helper::url().
Referenced by _buildObserver(), dropRemote(), form(), link(), remoteTimer(), sortable(), and submit().
| AjaxHelper::remoteTimer | ( | $ | options = null |
) |
Periodically call remote url via AJAX.
Periodically calls the specified url (options[url]) every options[frequency] seconds (default is 10). Usually used to update a specified div (options[update]) with the results of the remote call. The options for specifying the target with url and defining callbacks is the same as AjaxHelper::link().
| array | $options Callback options |
Definition at line 292 of file ajax.php.
References remoteFunction().
| AjaxHelper::slider | ( | $ | id, | |
| $ | trackId, | |||
| $ | options = array() | |||
| ) |
Makes a slider control.
| string | $id DOM ID of slider handle | |
| string | $trackId DOM ID of slider track | |
| array | $options Array of options to control the slider http://github.com/madrobby/scriptaculous/wikis/slider |
Definition at line 619 of file ajax.php.
References $callbacks, $id, _buildOptions(), and _optionsToString().
| AjaxHelper::sortable | ( | $ | id, | |
| $ | options = array() | |||
| ) |
Makes a list or group of floated objects sortable.
| string | $id DOM ID of parent | |
| array | $options Array of options to control sort. http://github.com/madrobby/scriptaculous/wikis/sortable |
Definition at line 698 of file ajax.php.
References _buildCallbacks(), _buildOptions(), _optionsToString(), remoteFunction(), and Helper::url().
| AjaxHelper::submit | ( | $ | title = 'Submit', |
|
| $ | options = array() | |||
| ) |
Returns a button input tag that will submit using Ajax
Returns a button input tag that will submit form using XMLHttpRequest in the background instead of regular reloading POST arrangement. options argument is the same as in AjaxHelper::form().
| string | $title Input button title | |
| array | $options Callback options |
Definition at line 355 of file ajax.php.
References __getHtmlOptions(), remoteFunction(), and Helper::value().
Referenced by form().
| AjaxHelper::$ajaxOptions |
Initial value:
array(
'after', 'asynchronous', 'before', 'confirm', 'condition', 'contentType', 'encoding',
'evalScripts', 'failure', 'fallback', 'form', 'indicator', 'insertion', 'interactive',
'loaded', 'loading', 'method', 'onCreate', 'onComplete', 'onException', 'onFailure',
'onInteractive', 'onLoaded', 'onLoading', 'onSuccess', 'onUninitialized', 'parameters',
'position', 'postBody', 'requestHeaders', 'success', 'type', 'update', 'with'
)
Definition at line 70 of file ajax.php.
Referenced by dropRemote().
| AjaxHelper::$autoCompleteOptions |
| AjaxHelper::$callbacks |
Initial value:
array(
'complete', 'create', 'exception', 'failure', 'interactive', 'loading',
'loaded', 'success', 'uninitialized'
)
Definition at line 61 of file ajax.php.
Referenced by _buildCallbacks(), and slider().
| AjaxHelper::$dragOptions |
| AjaxHelper::$dropOptions |
| AjaxHelper::$editorOptions |
Initial value:
array(
'okText', 'cancelText', 'savingText', 'formId', 'externalControl', 'rows', 'cols', 'size',
'highlightcolor', 'highlightendcolor', 'savingClassName', 'formClassName', 'loadTextURL',
'loadingText', 'callback', 'ajaxOptions', 'clickToEditText', 'collection', 'okControl',
'cancelControl', 'submitOnBlur'
)
| AjaxHelper::$helpers = array('Html', 'Javascript', 'Form') |
| AjaxHelper::$sliderOptions |
| AjaxHelper::$sortOptions |
1.4.7