<?php
/*
File: xajaxResponse.inc.php
Contains the response class.
Title: xajax response class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxResponse.inc.php 361 2007-05-24 12:48:14Z calltoconstruct $
@copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Class: xajaxResponse
Collect commands to be sent back to the browser in response to a xajax
request. Commands are encoded and packaged in a format that is acceptable
to the response handler from the javascript library running on the client
side.
Common commands include:
- <xajaxResponse->assign>: Assign a value to an elements property.
- <xajaxResponse->append>: Append a value on to an elements property.
- <xajaxResponse->script>: Execute a portion of javascript code.
- <xajaxResponse->call>: Execute an existing javascript function.
- <xajaxResponse->alert>: Display an alert dialog to the user.
Elements are identified by the value of the HTML id attribute. If you do
not see your updates occuring on the browser side, ensure that you are
using the correct id in your response.
*/
class xajaxResponse
{
/**#@+
* @access protected
*/
/*
Array: aCommands
Stores the commands that will be sent to the browser in the response.
*/
var $aCommands;
/*
String: sCharacterEncoding
The name of the encoding method you wish to use when dealing with
special characters. See <xajax->setEncoding> for more information.
*/
var $sCharacterEncoding;
/*
Boolean: bOutputEntities
Convert special characters to the HTML equivellent. See also
<xajax->bOutputEntities> and <xajax->setFlag>.
*/
var $bOutputEntities;
/*
Mixed: returnValue
A string, array or integer value to be returned to the caller when
using 'synchronous' mode requests. See <xajax->setMode> for details.
*/
var $returnValue;
/*
Object: objPluginManager
A reference to the global plugin manager.
*/
var $objPluginManager;
/**#@-*/
/*
Constructor: xajaxResponse
Create and initialize a xajaxResponse object.
*/
function xajaxResponse()
{
//SkipDebug
if (0 < func_num_args()) {
$objLanguageManager =& xajaxLanguageManager::getInstance();
trigger_error(
$objLanguageManager->getText('XJXRSP:EDERR:01')
, E_USER_ERROR
);
}
//EndSkipDebug
$this->aCommands = array();
$objResponseManager =& xajaxResponseManager::getInstance();
$this->sCharacterEncoding = $objResponseManager->getCharacterEncoding();
$this->bOutputEntities = $objResponseManager->getOutputEntities();
$this->objPluginManager =& xajaxPluginManager::getInstance();
}
/*
Function: setCharacterEncoding
Overrides the default character encoding (or the one specified in the
constructor) to the specified character encoding.
sCharacterEncoding - (string): The encoding method to use for this response.
See also, <xajaxResponse->xajaxResponse>()
Returns:
object - The xajaxResponse object.
*/
function setCharacterEncoding($sCharacterEncoding)
{
$this->sCharacterEncoding = $sCharacterEncoding;
return $this;
}
/*
Function: setOutputEntities
Convert special characters to their HTML equivellent automatically
(only works if the mb_string extension is available).
bOption - (boolean): Convert special characters
Returns:
object - The xajaxResponse object.
*/
function setOutputEntities($bOutputEntities)
{
$this->bOutputEntities = (boolean)$bOutputEntities;
return $this;
}
/*
Function: plugin
Provides access to registered response plugins. If you are using PHP
4 or 5, pass the plugin name as the first argument, the plugin method
name as the second argument and subsequent arguments (if any) to be
passed along to the plugin.
Optionally, if you use PHP 5, you can pass just the plugin name as the
first argument and the plugin object will be returned. You can then
access the methods of the plugin directly.
sName - (string): Name of the plugin.
sFunction - (string, optional): The name of the method to call.
arg1...argn - (mixed, optional): Additional arguments to pass on to
the plugin function.
Returns:
object - The plugin specified by sName.
*/
function &plugin()
{
$aArgs = func_get_args();
$nArgs = func_num_args();
//SkipDebug
if (false == (0 < $nArgs)) {
$objLanguageManager =& xajaxLanguageManager::getInstance();
trigger_error(
$objLanguageManager->getText('XJXRSP:MPERR:01')
, E_USER_ERROR
);
}
//EndSkipDebug
$sName = array_shift($aArgs);
$objPlugin =& $this->objPluginManager->getPlugin($sName);
if (false === $objPlugin)
{
$bReturn = false;
return $bReturn;
}
$objPlugin->setResponse($this);
if (0 < count($aArgs))
{
$sMethod = array_shift($aArgs);
$aFunction = array(&$objPlugin, $sMethod);
call_user_func_array($aFunction, $aArgs);
}
return $objPlugin;
}
/*
Function: __get
Magic function for PHP 5. Used to permit plugins to be called as if they
where native members of the xajaxResponse instance.
sPluginName - (string): The name of the plugin.
Returns:
object - The plugin specified by sPluginName.
*/
function &__get($sPluginName)
{
$objPlugin =& $this->plugin($sPluginName);
return $objPlugin;
}
/*
Function: confirmCommands
Response command that prompts user with [ok] [cancel] style
message box. If the user clicks cancel, the specified
number of response commands following this one, will be
skipped.
iCmdNumber - (integer): The number of commands to skip upon cancel.
sMessage - (string): The message to display to the user.
Returns:
object - The xajaxResponse object.
*/
function confirmCommands($iCmdNumber, $sMessage)
{
return $this->addCommand(
array(
'n'=>'cc',
't'=>$iCmdNumber
),
$sMessage
);
}
/*
Function: assign
Response command indicating that the specified value should be
assigned to the given element's attribute.
sTarget - (string): The id of the html element on the browser.
sAttribute - (string): The property to be assigned.
sData - (string): The value to be assigned to the property.
Returns:
object - The <xajaxResponse> object.
Example:
$objResponse->assign("contentDiv", "innerHTML", "Some Text");
*/
function assign($sTarget,$sAttribute,$sData)
{
return $this->addCommand(
array(
'n'=>'as',
't'=>$sTarget,
'p'=>$sAttribute
),
$sData
);
}
/*
Function: append
Response command that indicates the specified data should be appended
to the given element's property.
sTarget - (string): The id of the element to be updated.
sAttribute - (string): The name of the property to be appended to.
sData - (string): The data to be appended to the property.
Returns:
object - The <xajaxResponse> object.
*/
function append($sTarget,$sAttribute,$sData)
{
return $this->addCommand(
array(
'n'=>'ap',
't'=>$sTarget,
'p'=>$sAttribute
),
$sData
);
}
/*
Function: prepend
Response command to prepend the specified value onto the given
element's property.
sTarget - (string): The id of the element to be updated.
sAttribute - (string): The property to be updated.
sData - (string): The value to be prepended.
Returns:
object - The <xajaxResponse> object.
*/
function prepend($sTarget,$sAttribute,$sData)
{
return $this->addCommand(
array(
没有合适的资源?快使用搜索试试~ 我知道了~
dasai.tar.gz_xajax
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 180 浏览量
2022-09-21
05:26:40
上传
评论
收藏 1.26MB GZ 举报
温馨提示
共80个文件
php:34个
jpg:24个
js:12个
自己的第一个作品,呵呵,技术比较简单,php+xajax,比较傻瓜。
资源推荐
资源详情
资源评论
收起资源包目录
dasai.tar.gz (80个子文件)
dasai
css
style.css~ 6KB
style.css 6KB
xajax_core
xajaxCall.inc.php 8KB
xajaxCompress.inc.php 4KB
xajaxLanguageManager.inc.php 7KB
plugin_layer
xajaxScriptPlugin.inc.php 7KB
xajaxEventPlugin.inc.php 5KB
xajaxDefaultIncludePlugin.inc.php 9KB
support
xajaxEvent.inc.php 4KB
xajaxUserFunction.inc.php 6KB
xajaxCallableObject.inc.php 6KB
xajaxCallableObjectPlugin.inc.php 5KB
xajaxFunctionPlugin.inc.php 6KB
xajaxResponse.inc.php 40KB
legacy.inc.php 5KB
xajaxRequest.inc.php 9KB
xajaxResponseManager.inc.php 6KB
xajax.inc.php 37KB
xajax_lang_de.inc.php 5KB
xajaxArgumentManager.inc.php 9KB
xajaxControl.inc.php 17KB
xajaxPlugin.inc.php 5KB
xajaxPluginManager.inc.php 8KB
xajax_js
xajax_legacy_uncompressed.js 2KB
xajax_legacy.js 623B
xajax_verbose_uncompressed.js 4KB
xajax_core.js 35KB
xajax_debug.js 15KB
xajax_debug_uncompressed.js 25KB
xajax_lang_de_uncompressed.js 3KB
xajax_core_uncompressed.js 81KB
xajax_verbose.js 2KB
xajax_lang_de.js 3KB
index.php 1KB
images
photos
p6.jpg 39KB
p5.jpg 79KB
p12.jpg 96KB
p9.jpg 51KB
p3.jpg 47KB
p8.jpg 58KB
p10.jpg 117KB
p2.jpg 72KB
p1.jpg 67KB
p16.jpg 21KB
p4.jpg 81KB
p15.jpg 67KB
p7.jpg 70KB
p13.jpg 269KB
p14.jpg 44KB
p11.jpg 41KB
kubrickbgwide.jpg 18KB
about.gif 3KB
kubrickbg-rtl.jpg 2KB
kubrickfooter.jpg 25KB
kubrickbg-ltr.jpg 18KB
kubrickbgcolor.jpg 556B
backgrnd.jpg 10KB
kubrickheader.jpg 37KB
cal.gif 1KB
main.gif 2KB
Thumbs.db 15KB
art2.jpg 26KB
art.gif 11KB
index_inc.php 510B
index_server.php 20KB
js
article.js~ 2KB
article.js 2KB
.settings
org.eclipse.core.resources.prefs 88B
.project 394B
xajax_plugins
response
tableUpdater.js 20KB
googleMap.inc.php 5KB
tableUpdater.inc.php 7KB
request
xajax_controls
validate_HTML401TRANSITIONAL.inc.php 13KB
group.inc.php 13KB
content.inc.php 6KB
document.inc.php 8KB
form.inc.php 8KB
structure.inc.php 1014B
misc.inc.php 3KB
validate_XHTML10TRANSITIONAL.inc.php 15KB
共 80 条
- 1
资源评论
钱亚锋
- 粉丝: 86
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功