[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/xajax/ -> xajaxResponse.inc.php (sommaire)

xajaxResponse.inc.php :: xajax XML response class xajax version 0.2.4 copyright (c) 2005 by Jared White & J. Max Wilson http://www.xajaxproject.org

Copyright: Copyright (c) 2005-2006 by Jared White & J. Max Wilson
License: http://www.gnu.org/copyleft/lesser.html#SEC3 LGPL License
Version: $Id$
Poids: 580 lignes (19 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

xajaxResponse:: (29 méthodes):
  xajaxResponse()
  setCharEncoding()
  outputEntitiesOn()
  outputEntitiesOff()
  addConfirmCommands()
  addAssign()
  addAppend()
  addPrepend()
  addReplace()
  addClear()
  addAlert()
  addRedirect()
  addScript()
  addScriptCall()
  addRemove()
  addCreate()
  addInsert()
  addInsertAfter()
  addCreateInput()
  addInsertInput()
  addInsertInputAfter()
  addEvent()
  addHandler()
  addRemoveHandler()
  addIncludeScript()
  getXML()
  loadXML()
  _cmdXML()
  _buildObjXml()


Classe: xajaxResponse  - X-Ref

The xajaxResponse class is used to create responses to be sent back to your
Web page.  A response contains one or more command messages for updating
your page.
Currently xajax supports 21 kinds of command messages, including some common
ones such as:
<ul>
<li>Assign - sets the specified attribute of an element in your page</li>
<li>Append - appends data to the end of the specified attribute of an
element in your page</li>
<li>Prepend - prepends data to the beginning of the specified attribute of
an element in your page</li>
<li>Replace - searches for and replaces data in the specified attribute of
an element in your page</li>
<li>Script - runs the supplied JavaScript code</li>
<li>Alert - shows an alert box with the supplied message text</li>
</ul>

<i>Note:</i> elements are identified by their HTML id, so if you don't see
your browser HTML display changing from the request, make sure you're using
the right id names in your response.

xajaxResponse($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)   X-Ref
The constructor's main job is to set the character encoding for the
response.

<i>Note:</i> to change the character encoding for all of the
responses, set the XAJAX_DEFAULT_ENCODING constant before you
instantiate xajax.

param: string  contains the character encoding string to use
param: boolean lets you set if you want special characters in the output

setCharEncoding($sEncoding)   X-Ref
Sets the character encoding for the response based on $sEncoding, which
is a string containing the character encoding to use. You don't need to
use this method normally, since the character encoding for the response
gets set automatically based on the XAJAX_DEFAULT_CHAR_ENCODING
constant.

param: string

outputEntitiesOn()   X-Ref
Tells the response object to convert special characters to HTML entities
automatically (only works if the mb_string extension is available).


outputEntitiesOff()   X-Ref
Tells the response object to output special characters intact. (default
behavior)


addConfirmCommands($iCmdNumber, $sMessage)   X-Ref
Adds a confirm commands command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addConfirmCommands(1, "Do you want to preview the new data?");</kbd>

param: integer the number of commands to skip if the user presses
param: string  the message to show in the browser's confirm dialog

addAssign($sTarget,$sAttribute,$sData)   X-Ref
Adds an assign command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addAssign("contentDiv", "innerHTML", "Some Text");</kbd>

param: string contains the id of an HTML element
param: string the part of the element you wish to modify ("innerHTML",
param: string the data you want to set the attribute to

addAppend($sTarget,$sAttribute,$sData)   X-Ref
Adds an append command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addAppend("contentDiv", "innerHTML", "Some New Text");</kbd>

param: string contains the id of an HTML element
param: string the part of the element you wish to modify ("innerHTML",
param: string the data you want to append to the end of the attribute

addPrepend($sTarget,$sAttribute,$sData)   X-Ref
Adds an prepend command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addPrepend("contentDiv", "innerHTML", "Some Starting Text");</kbd>

param: string contains the id of an HTML element
param: string the part of the element you wish to modify ("innerHTML",
param: string the data you want to prepend to the beginning of the

addReplace($sTarget,$sAttribute,$sSearch,$sData)   X-Ref
Adds a replace command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addReplace("contentDiv", "innerHTML", "text", "<b>text</b>");</kbd>

param: string contains the id of an HTML element
param: string the part of the element you wish to modify ("innerHTML",
param: string the string to search for
param: string the string to replace the search string when found in the

addClear($sTarget,$sAttribute)   X-Ref
Adds a clear command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addClear("contentDiv", "innerHTML");</kbd>

param: string contains the id of an HTML element
param: string the part of the element you wish to clear ("innerHTML",

addAlert($sMsg)   X-Ref
Adds an alert command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addAlert("This is important information");</kbd>

param: string the text to be displayed in the Javascript alert box

addRedirect($sURL)   X-Ref
Uses the addScript() method to add a Javascript redirect to another URL.

<i>Usage:</i> <kbd>$objResponse->addRedirect("http://www.xajaxproject.org");</kbd>

param: string the URL to redirect the client browser to

addScript($sJS)   X-Ref
Adds a Javascript command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addScript("var x = prompt('get some text');");</kbd>

param: string contains Javascript code to be executed

addScriptCall()   X-Ref
Adds a Javascript function call command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);</kbd>

param: string $sFunc the name of a Javascript function
param: mixed $args,... optional arguments to pass to the Javascript function

addRemove($sTarget)   X-Ref
Adds a remove element command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addRemove("Div2");</kbd>

param: string contains the id of an HTML element to be removed

addCreate($sParent, $sTag, $sId, $sType="")   X-Ref
Adds a create element command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addCreate("parentDiv", "h3", "myid");</kbd>

param: string contains the id of an HTML element to to which the new
param: string the tag to be added
param: string the id to be assigned to the new element
param: string deprecated, use the addCreateInput() method instead

addInsert($sBefore, $sTag, $sId)   X-Ref
Adds a insert element command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addInsert("childDiv", "h3", "myid");</kbd>

param: string contains the id of the child before which the new element
param: string the tag to be added
param: string the id to be assigned to the new element

addInsertAfter($sAfter, $sTag, $sId)   X-Ref
Adds a insert element command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addInsertAfter("childDiv", "h3", "myid");</kbd>

param: string contains the id of the child after which the new element
param: string the tag to be added
param: string the id to be assigned to the new element

addCreateInput($sParent, $sType, $sName, $sId)   X-Ref
Adds a create input command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addCreateInput("form1", "text", "username", "input1");</kbd>

param: string contains the id of an HTML element to which the new input
param: string the type of input to be created (text, radio, checkbox,
param: string the name to be assigned to the new input and the variable
param: string the id to be assigned to the new input

addInsertInput($sBefore, $sType, $sName, $sId)   X-Ref
Adds an insert input command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addInsertInput("input5", "text", "username", "input1");</kbd>

param: string contains the id of the child before which the new element
param: string the type of input to be created (text, radio, checkbox,
param: string the name to be assigned to the new input and the variable
param: string the id to be assigned to the new input

addInsertInputAfter($sAfter, $sType, $sName, $sId)   X-Ref
Adds an insert input command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addInsertInputAfter("input7", "text", "email", "input2");</kbd>

param: string contains the id of the child after which the new element
param: string the type of input to be created (text, radio, checkbox,
param: string the name to be assigned to the new input and the variable
param: string the id to be assigned to the new input

addEvent($sTarget,$sEvent,$sScript)   X-Ref
Adds an event command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addEvent("contentDiv", "onclick", "alert(\'Hello World\');");</kbd>

param: string contains the id of an HTML element
param: string the event you wish to set ("onclick", "onmouseover", etc.)
param: string the Javascript string you want the event to invoke

addHandler($sTarget,$sEvent,$sHandler)   X-Ref
Adds a handler command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addHandler("contentDiv", "onclick", "content_click");</kbd>

param: string contains the id of an HTML element
param: string the event you wish to set ("onclick", "onmouseover", etc.)
param: string the name of a Javascript function that will handle the

addRemoveHandler($sTarget,$sEvent,$sHandler)   X-Ref
Adds a remove handler command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addRemoveHandler("contentDiv", "onclick", "content_click");</kbd>

param: string contains the id of an HTML element
param: string the event you wish to remove ("onclick", "onmouseover",
param: string the name of a Javascript handler function that you want to

addIncludeScript($sFileName)   X-Ref
Adds an include script command message to the XML response.

<i>Usage:</i> <kbd>$objResponse->addIncludeScript("functions.js");</kbd>

param: string URL of the Javascript file to include

getXML()   X-Ref
Returns the XML to be returned from your function to the xajax processor
on your page. Since xajax 0.2, you can also return an xajaxResponse
object from your function directly, and xajax will automatically request
the XML using this method call.

<i>Usage:</i> <kbd>return $objResponse->getXML();</kbd>

return: string response XML data

loadXML($mXML)   X-Ref
Adds the commands of the provided response XML output to this response
object

<i>Usage:</i>
<code>$r1 = $objResponse1->getXML();
$objResponse2->loadXML($r1);
return $objResponse2->getXML();</code>

param: string the response XML (returned from a getXML() method) to add

_cmdXML($aAttributes, $sData)   X-Ref
Generates XML from command data

param: array associative array of attributes
param: string data
return: string XML command

_buildObjXml($var)   X-Ref
Recursively serializes a data structure in XML so it can be sent to
the client. It could be thought of as the opposite of
{@link xajax::_parseObjXml()}.

param: mixed data structure to serialize to XML
return: string serialized XML



Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7