Call this function to set options that will effect the processing of
xajax requests. Configuration settings can be specific to the xajax
core, request processor plugins and response plugins.
Parameters:
Options include:
javascript URI - (string): The path to the folder that contains the
xajax javascript files.
errorHandler - (boolean): true to enable the xajax error handler, see
bErrorHandler>
exitAllowed - (boolean): true to allow xajax to exit after processing
a request. See bExitAllowed> for more information.
public configure ( $sName, $mValue ) |
public function __construct($sRequestURI = null, $sLanguage = null, $aConfig = array()) { if (is_null(self::$oXajax)) { self::$oXajax = new xajax($sRequestURI, $sLanguage); self::$oXajax->configure('javascript URI', '/lib/xajax/'); self::$oXajax->configure('statusMessages', true); self::$oXajax->configure('exitAllowed', false); //self::$oXajax->configure( 'debug', true ); foreach ($aConfig as $sName => $mValue) { self::$oXajax->configure($sName, $mValue); } } }
<?php $xajax = new xajax(); $xajax->configure('javascript URI', W2P_BASE_URL . '/lib/xajax/'); function calcFinish($start_date, $start_hour, $start_minute, $duration_type, $task_duration) { global $AppUI; $df = $AppUI->getPref('SHDATEFORMAT'); $year = substr($start_date, 0, 4); $month = substr($start_date, 4, 2); $day = substr($start_date, 6, 2); $date = new w2p_Utilities_Date($year . '-' . $month . '-' . $day); $date->setTime($start_hour, $start_minute); $finish = $date->calcFinish($task_duration, $duration_type); $response = new xajaxResponse(); $response->assign('end_date', 'value', $finish->format($df)); $response->assign('task_end_date', 'value', $finish->format(FMT_TIMESTAMP_DATE)); $response->assign('end_hour', 'value', $finish->getHour()); $minute = '0' == $finish->getMinute() ? '00' : $finish->getMinute(); $response->assign('end_minute', 'value', $minute); if ($finish->getHour() > 11) { $response->assign('end_hour_ampm', 'value', 'pm'); } else { $response->assign('end_hour_ampm', 'value', 'am'); } return $response; } function calcDuration($start_date, $start_hour, $start_minute, $end_date, $end_hour, $end_minute, $duration_type, $duration_output_field = 'task_duration') { $year = substr($start_date, 0, 4); $month = substr($start_date, 4, 2);
<? define("XAJAX_DEFAULT_CHAR_ENCODING","windows-1251"); require_once($_SERVER['DOCUMENT_ROOT'] . "/xajax/xajax_core/xajax.inc.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/config.php"); $xajax = new xajax("/xajax/employers.server.php"); //$xajax->debugOn(); //$xajax->waitCursorOff(); // Для Fp нужен... $xajax->configure('decodeUTF8Input',true); $xajax->configure('scriptLoadTimeout', XAJAX_LOAD_TIMEOUT); $xajax->register(XAJAX_FUNCTION, "ChangeCity"); $xajax->register(XAJAX_FUNCTION, "AddFav"); ?>
<?php require_once '../../lib/xajax_core/xajax.inc.php'; require_once "mod.php"; $xajax = new xajax(); $xajax->configure("debug", false); session_start(); $n_url = "../solicitud_detalles/solicitud_detalles.php"; ///////////////configuraciones mensajes validaciones//////////////// $n_nro_solicitud = '<div class="alert alert-danger alert-dismissable"> <i class="fa fa-ban"></i> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <b>Error!</b> Debe indicar numero de solicitud </div>'; $n_fecha = '<div class="alert alert-danger alert-dismissable"> <i class="fa fa-ban"></i> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <b>Error!</b> Debe indicar fecha </div>'; $n_user_id = '<div class="alert alert-danger alert-dismissable"> <i class="fa fa-ban"></i> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <b>Error!</b> Debe indicar usuario </div>'; /////////////encabezado resultado busqueda grid///////////////// $ng_nro_solicitud = 'nro_solicitud'; $ng_fecha = 'fecha'; $ng_user_id = 'user_id'; /////////////encabezado resultado busqueda grid///////////////// class ctrl {
nied@unicamp.br ------------------------------------------------------------------------------ --> */ /*========================================================== ARQUIVO : cursos/aplic/forum/forum.php ========================================================== */ $bibliotecas = "../bibliotecas/"; include $bibliotecas . "geral.inc"; include "forum.inc"; include "avaliacoes_forum.inc"; require_once "../xajax_0.5/xajax_core/xajax.inc.php"; //Estancia o objeto XAJAX $objAjax = new xajax(); $objAjax->configure("characterEncoding", 'ISO-8859-1'); $objAjax->setFlag("decodeUTF8Input", true); $objAjax->configure('javascript URI', "../xajax_0.5"); $objAjax->configure('errorHandler', true); //Registre os nomes das funções em PHP que você quer chamar através do xajax $objAjax->register(XAJAX_FUNCTION, "MudarConfiguracaoDinamic"); $objAjax->register(XAJAX_FUNCTION, "EditarTituloDinamic"); $objAjax->register(XAJAX_FUNCTION, "DecodificaString"); // Registra fun��es para uso de menu_principal.php $objAjax->register(XAJAX_FUNCTION, "DeslogaUsuarioCursoDinamic"); // Manda o xajax executar os pedidos acima. $objAjax->processRequest(); $cod_ferramenta = 9; $cod_ferramenta_ajuda = $cod_ferramenta; if (isset($status) && $status == 'D') { $cod_pagina_ajuda = 2;
$pagelist_id = (int) $_REQUEST["page"]; } $submit = false; if (isset($_POST["submitbutton"])) { $submit = true; } $apply = false; if (isset($_POST["apply"])) { $apply = true; } $ajax = false; if (isset($_POST['ajax']) && $_POST['ajax']) { $ajax = true; } $xajax = new xajax(); $xajax->configure('requestURI', $config['admin_url'] . '/editcontent.php?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY] . '&content_id=' . $content_id); $xajax->register(XAJAX_FUNCTION, 'ajaxpreview'); $headtext = $xajax->getJavascript('../lib/xajax') . "\n"; if (isset($_POST["cancel"])) { redirect("listcontent.php" . $urlext); } if ($apply) { $CMS_EXCLUDE_FROM_RECENT = 1; } #Get a list of content types and pick a default if necessary $gCms = cmsms(); $contentops = $gCms->GetContentOperations(); $existingtypes = $contentops->ListContentTypes(false, true); #Get current userid and make sure they have permission to add something $userid = get_userid(); $access = check_ownership($userid, $content_id) || check_permission($userid, 'Modify Any Page') || check_permission($userid, 'Manage All Content');
require_once 'common/xajax/xajax_core/xajax.inc.php'; $xajax = new xajax(); event::register('page_assembleheader', 'edk_xajax::insertHTML'); // if mods depend on xajax they can register to xajax_initialised // it gets called after all mods have been initialized //event::register('smarty_displayindex', 'edk_xajax::lateProcess'); //event::register('page_assembleheader', 'edk_xajax::lateProcess'); event::register('mods_initialised', 'edk_xajax::lateProcess'); //event::register('page_initialisation', 'edk_xajax::lateProcess'); $uri = html_entity_decode(edkURI::build(edkURI::parseURI())); if (strpos($uri, "?") === false) { $uri .= "?xajax=1"; } else { $uri .= "&xajax=1"; } $xajax->configure('requestURI', $uri); /** * @package EDK */ class edk_xajax { public static function xajax() { global $xajax_enable; $xajax_enable = true; } // on page assembly check whether or not xajax is needed public static function insertHTML($obj) { global $xajax_enable; if (!isset($xajax_enable)) {
$xajax->register(XAJAX_FUNCTION, "azulon"); $xajax->register(XAJAX_FUNCTION, "azuloff"); $xajax->register(XAJAX_FUNCTION, "verdeon"); $xajax->register(XAJAX_FUNCTION, "verdeoff"); $xajax->register(XAJAX_FUNCTION, "rojoon"); $xajax->register(XAJAX_FUNCTION, "rojooff"); $xajax->register(XAJAX_FUNCTION, "amarilloon"); $xajax->register(XAJAX_FUNCTION, "amarillooff"); $xajax->register(XAJAX_FUNCTION, "controlazul"); $xajax->register(XAJAX_FUNCTION, "controlverde"); $xajax->register(XAJAX_FUNCTION, "controlrojo"); $xajax->register(XAJAX_FUNCTION, "controlamarillo"); /** * Indicamos la ruta del componenete Javascript de Xajax. */ $xajax->configure('javascript URI', './controlador/include/xajax/'); /** * El método processRequest procesa las peticiones que llegan a la página. Debe * ser llamado antes del código HTML. */ $xajax->processRequest(); /** * EL método printJavascript() permite la inclusión de las funciones javascript * en el codigo. */ $xajax->printJavascript(); /** * Añadimos la pagina head.php con el contenido del head. */ require_once './vista/head.php'; /**
} /******************************************/ /* Load :: Header Content */ $tpl->display("header.tpl"); include 'php/js_root_dir.php'; /******************************************/ /* XAJAX :: Register Object AND Functions */ $xajax = new xajax(ROOT_DIR . "index.server.php"); //$xajax->registerFunction("page"); $xajax->register(XAJAX_FUNCTION, "move"); $xajax->register(XAJAX_FUNCTION, "page"); $xajax->register(XAJAX_FUNCTION, "delete"); $xajax->register(XAJAX_FUNCTION, "edit_comment"); //$xajax->configure('debug', true); //$xajax->setFlag('debug',true); $xajax->configure('javascript URI', ROOT_DIR . 'xajax/'); // $tpl->assign("xajax_javascript",$xajax->getJavascript(ROOT_DIR.'xajax/')); $xajax->printJavascript(); /******************************************/ /* Load :: Left Frame Content */ $tpl->display("div_top.tpl"); // Styling correction /* Twitter message */ if ($block["twitter"]["status"] == 1) { $tpl->display("twitter.tpl"); } /************/ /* Settings :: Design AND Language */ if ($block["settings"]["status"] == 1) { include "modules/blocks/settings.php"; }
*/ /* @package xajax @version $Id: errorHandlingTest.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Standard xajax startup - include <xajax.inc.php> - instantiate the <xajax> object */ require_once "../xajax_core/xajax.inc.php"; $xajax = new xajax(); $xajax->configure('javascript URI', '../'); /* - enable deubgging if desired */ $xajax->configure('debug', true); /* Section: Enable Error Handler - set <xajax->bErrorHandler> using <xajax->setFlag> or <xajax->setFlags> - set the log file using <xajax->setLogFile> */ $xajax->configure('errorHandler', true); $xajax->configure('logFile', 'xajax_error_log.log'); /* Section: Define error ridden function
<?php require_once "../xajax_core/xajax.inc.php"; $xajax = new xajax(); if ($xajax->canProcessRequest()) { echo ' '; } $xajax->configure('debug', true); $xajax->configure('responseType', 'XML'); $xajax->register(XAJAX_FUNCTION, 'showOutput'); $xajax->processRequest(); $xajax->configure('javascript URI', '../'); function showOutput() { $objResponse = new xajaxResponse(); $objResponse->alert("Hello"); return $objResponse; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>PHP Whitespace Test | xajax Tests</title> <?php $xajax->printJavascript("../"); ?> </head> <body>
<?php if (isset($_POST['PHPSESSID'])) { session_id($_POST['PHPSESSID']); } session_start(); ini_set("display_errors", 1); error_reporting(E_ALL ^ E_NOTICE); if (!isset($_SESSION['foo'])) { $_SESSION['foo'] = 0; } $core = '../../xajax_core'; require_once $core . '/xajax.inc.php'; $xajax = new xajax(); require_once '../../xajax_plugins/response/swfupload/swfupload.inc.php'; $xajax->configure("javascript URI", "../../"); $xajax->configure("responseType", "XML"); $xajax->register(XAJAX_FUNCTION, "uploader", array("mode" => "'SWFupload'", "SWFform" => "'upload_form'")); $xajax->register(XAJAX_FUNCTION, "transform"); $xajax->register(XAJAX_FUNCTION, "transfield"); $xajax->register(XAJAX_FUNCTION, "destroyfield"); $xajax->register(XAJAX_FUNCTION, "sync_test", array('mode' => "'synchronous'")); $xajax->register(XAJAX_FUNCTION, "destroyform"); $_SESSION['foo']++; $xajax->processRequest(); // This is dev code, you don't need these lines for using the SWFupload plugin. $xajax->autoCompressJavaScript(null, true); $xajax->autoCompressJavaScript('../../xajax_plugins/response/swfupload/swfupload.xajax.js', true); $xajax->autoCompressJavaScript('../../xajax_plugins/response/swfupload/swfupload.js', true); function transfield() {
<?php require_once $AppUI->getLibraryClass('xajax/xajax_core/xajax.inc'); $xajax = new xajax(); $xajax->configure('javascript URI', w2PgetConfig('base_url') . '/lib/xajax/'); function calcFinish($start_date, $start_hour, $start_minute, $duration_type, $task_duration) { global $AppUI; $df = $AppUI->getPref('SHDATEFORMAT'); $year = substr($start_date, 0, 4); $month = substr($start_date, 4, 2); $day = substr($start_date, 6, 2); $date = new w2p_Utilities_Date($year . '-' . $month . '-' . $day); $date->setTime($start_hour, $start_minute); $finish = $date->calcFinish($task_duration, $duration_type); $response = new xajaxResponse(); $response->assign('end_date', 'value', $finish->format($df)); $response->assign('task_end_date', 'value', $finish->format(FMT_TIMESTAMP_DATE)); $response->assign('end_hour', 'value', $finish->getHour()); $response->assign('end_minute', 'value', $finish->getMinute()); if ($finish->getHour() > 11) { $response->assign('end_hour_ampm', 'value', 'pm'); } else { $response->assign('end_hour_ampm', 'value', 'am'); } return $response; } function calcDuration($start_date, $start_hour, $start_minute, $end_date, $end_hour, $end_minute, $duration_type) { $year = substr($start_date, 0, 4); $month = substr($start_date, 4, 2);
if (@$_GET['refresh'] == "yes") { session_destroy(); header("location: charEncodingTest.php"); exit; } if (isset($_SESSION['useEncoding'])) { $useEncoding = $_SESSION['useEncoding']; } if (isset($_SESSION['htmlEntities'])) { $htmlEntities = $_SESSION['htmlEntities']; } if (isset($_SESSION['decodeUTF8'])) { $decodeUTF8 = $_SESSION['decodeUTF8']; } $xajax = new xajax(); $xajax->configure('javascript URI', '../'); $xajax->configure('characterEncoding', $useEncoding); if ($htmlEntities) { $xajax->configure("outputEntities", true); } if ($decodeUTF8) { $xajax->configure("decodeUTF8Input", true); } $xajax->configure('debug', true); $xajax->register(XAJAX_FUNCTION, 'setOptions'); $xajax->register(XAJAX_FUNCTION, 'testForm'); $xajax->processRequest(); $xajax->configure('javascript URI', '../'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
//function get_search_query_matrix($HTTP_VARS) if (is_site_enabled()) { if (is_opendb_valid_session() || is_site_public_access()) { if (is_user_granted_permission(PERM_VIEW_LISTINGS)) { $v_item_types = get_list_item_types($HTTP_VARS['s_item_type_group'], $HTTP_VARS['s_item_type']); if (!is_array($HTTP_VARS['s_item_type']) && strlen($HTTP_VARS['s_item_type']) > 0 && is_not_empty_array($v_item_types)) { if (!is_item_type_in_item_type_r($v_item_types, $HTTP_VARS['s_item_type'])) { unset($HTTP_VARS['s_item_type']); } } $show_interest_column = FALSE; if (is_user_granted_permission(PERM_USER_INTEREST)) { $show_interest_column = TRUE; //@TODO This should be moved to HTML_listing class. $xajax = new xajax(); $xajax->configure('responseType', 'XML'); $xajax->configure('javascript URI', 'lib/xajax/'); $xajax->configure('debug', false); $xajax->configure('statusMessages', true); $xajax->configure('waitCursor', true); $xajax->register(XAJAX_FUNCTION, "ajax_update_interest_level"); $xajax->register(XAJAX_FUNCTION, "ajax_remove_all_interest_level"); $xajax->processRequest(); } if (strlen($HTTP_VARS['owner_id']) > 0) { $show_owner_column = FALSE; } else { $show_owner_column = TRUE; } // Work out whether Item action checkboxes should be displayed. $show_checkbox_column = FALSE;
/** * @package tikiwiki */ // (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id: x_maps.php 44444 2013-01-05 21:24:24Z changi67 $ require_once 'tiki-setup.php'; //setting up xajax include_once 'lib/map/map_query.php'; require_once 'lib/ajax/xajax/xajax_core/xajaxAIO.inc.php'; $xajax = new xajax('x_maps.php'); $xajax->setFlag('debug', true); $xajax->configure('statusMessages', true); if ($prefs['feature_maps'] != 'y' || $prefs['ajax_xajax'] != 'y') { $objResponse = new xajaxResponse(); $objResponse->alert(tra('Feature disabled')); return $objResponse; } if ($tiki_p_map_view != 'y') { $objResponse = new xajaxResponse(); $objResponse->alert(tra('You do not have permissions to view the maps')); return $objResponse; } /** * @param $mapfile * @param $corx * @param $cory * @param $minx
{ global $_DOC_DIR; $result = ''; // xajax response $JSResponse = new xajaxResponse(); // read template information @(include DOC_DIR . '/templates/' . $template . '/info.php'); // call plugin @(include DOC_DIR . '/templates/' . $engine['name'] . '/' . $engine['plugin'] . '.php'); $JSResponse->assign('plugin', 'innerHTML', $result); return $JSResponse; } /* Using AJAX for template plugins */ require LIB_DIR . '/xajax/xajax_core/xajax.inc.php'; $xajax = new xajax(); $xajax->configure('errorHandler', true); $xajax->configure('javascript URI', 'img'); $xajax->register(XAJAX_FUNCTION, 'plugin'); $xajax->processRequest(); $SMARTY->assign('xajax', $xajax->getJavascript()); /* end AJAX plugin stuff */ $layout['pagetitle'] = trans('Documents Generator'); if (isset($_POST['document'])) { $document = $_POST['document']; $oldfromdate = $document['fromdate']; $oldtodate = $document['todate']; if (!$document['type']) { $error['type'] = trans('Document type is required!'); } if (!$document['title']) { $error['title'] = trans('Document title is required!');
<?php require_once "../xajax_core/xajax.inc.php"; $xajax = new xajax(); $xajax->configure('debug', true); $xajax->registerFunction("myExternalFunction", dirname(__FILE__) . "/myExternalFunction.php"); $xajax->registerFunction(array("myFunction", "myExternalClass", "myMethod"), dirname(__FILE__) . "/myExternalFunction.php"); $xajax->processRequest(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>registerExternalFunction Test | xajax Tests</title> <?php $xajax->printJavascript("../"); ?> </head> <body> <h2><a href = "index.php">xajax Tests</a></h2> <h1>registerExternalFunction Test</h1> <form id = "testForm1" onsubmit = "return false;"> <p> <input type = "submit" value = "Call External Function" onclick = "xajax_myExternalFunction(); return false;" /> </p>
<?php define("XAJAX_DEFAULT_CHAR_ENCODING", "windows-1251"); require_once $_SERVER['DOCUMENT_ROOT'] . "/xajax/xajax_core/xajax.inc.php"; global $xajax; if (!$xajax) { $xajax = new xajax("/xajax/hh.server.php?rnd=" . mt_rand()); $xajax->setFlag('decodeUTF8Input', true); //$xajax->setFlag('debug',true); $xajax->configure('scriptLoadTimeout', XAJAX_LOAD_TIMEOUT); $xajax->register(XAJAX_FUNCTION, 'addHHSpecProf'); $xajax->register(XAJAX_FUNCTION, 'delProf'); $xajax->register(XAJAX_FUNCTION, 'delHHSpec'); }
require_once "../xajax_core/xajax.inc.php"; function returnStatus($number) { if ($number == 500) { header("HTTP/1.1 500 Internal Server Error"); echo "Testing a server error..."; } if ($number == 404) { header("HTTP/1.1 404 Not Found"); echo "Testing an unknown URL..."; } exit; } $xajax = new xajax(); $xajax->configure("debug", true); $xajax->register(XAJAX_FUNCTION, "returnStatus"); $xajax->processRequest(); $xajax->configure('javascript URI', '../'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>HTTP Status Test | xajax Tests</title> <?php $xajax->printJavascript("../"); ?> </head>
function onInvalidRequest() { $objArgumentManager = xajaxArgumentManager::getInstance(); $aArgs = $objArgumentManager->process(); $objResponse = new xajaxResponse(); $objResponse->alert("This is from the invalid request handler"); return test2ndFunction($aArgs[0], $objResponse); } function testForm($formData) { $objResponse = new xajaxResponse(); $objResponse->alert("This is from the regular function"); return test2ndFunction($formData, $objResponse); } $xajax = new xajax(); $xajax->configure('javascript URI', '../'); $xajax->configure("errorHandler", true); $xajax->register(XAJAX_PROCESSING_EVENT, XAJAX_PROCESSING_EVENT_INVALID, "onInvalidRequest"); if (isset($_GET['registerFunction'])) { if (1 == $_GET['registerFunction']) { $xajax->register(XAJAX_FUNCTION, "testForm"); } } $xajax->processRequest(); $xajax->configure('javascript URI', '../'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head>
<?php //==================================================== // FileName: boxlist.php // Summary: 音乐盒列表 // Author: millken(迷路林肯) // LastModifed:2007-10-21 // copyright (c)2007 millken@gmail.com //==================================================== include './common.inc.php'; include ROOT_PATH . 'include/xajax/xajax_core/xajax.inc.php'; $xajax = new xajax(); $xajax->configure("debug", true); //debug mode $xajax->configure("waitCursor", false); //禁止漏斗提示 $xajax->register(XAJAX_FUNCTION, "play"); //$xajax->register(XAJAX_FUNCTION,"listdata"); //$xajax->register(XAJAX_FUNCTION,"reguser"); $xajax->processRequest(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML Transitional//EN"><META http-equiv="Content-Type" content="text/html; charset=utf-8"> <HTML> <HEAD> <link rel="stylesheet" href="templates/default/images/box/box.css" type="text/css"> <script src="js/mootools.js" type="text/javascript"></script> <script src="js/boxlist.js" type="text/javascript"></script> <?php $xajax->printJavascript('js/'); ?> </HEAD>
{ $objResponse = new xajaxCustomResponse('text/xml'); $objResponse->setCharacterEncoding('UTF-8'); $objResponse->append('<?xml version="1.0" encoding="utf-8" ?' . '><root><data>text</data></root>'); return $objResponse; } function testTextResponse() { $objResponse = new xajaxCustomResponse('text/plain'); $objResponse->append('text data'); return $objResponse; // return text data directly to the custom response handler function return 'text data'; } $xajax = new xajax(); $xajax->configure('debug', true); $xajax->configure('useUncompressedScripts', true); $xajax->configure('javascript URI', '../'); // Tell xajax to permit registered functions to return data other than xajaxResponse objects $xajax->configure('allowAllResponseTypes', true); $callXajaxResponse =& $xajax->register(XAJAX_FUNCTION, 'testXajaxResponse'); $callXmlResponse =& $xajax->register(XAJAX_FUNCTION, 'testXmlResponse', array('responseProcessor' => 'xmlResponse')); $callTextResponse =& $xajax->register(XAJAX_FUNCTION, 'testTextResponse', array('mode' => '"synchronous"', 'responseProcessor' => 'textResponse')); $xajax->processRequest(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Non-xajaxResponse XML and Text Responses Test | xajax Tests</title>
authUser(); } else { if (validUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { $valid = true; } } if ($valid == false) { authUser(); } /** * Llamado de xajax */ require './include/xajax_0.5_standard/xajax_core/xajax.inc.php'; $xajax = new xajax(); //$xajax->configure('debug', true); $xajax->configure('javascript URI', './include/xajax_0.5_standard/'); $xajax->registerFunction('insertActuacion'); $xajax->registerFunction('EditFieldActuacion'); $xajax->registerFunction('editActuacion'); $xajax->registerFunction('returnValueActuacion'); $xajax->registerFunction('deleteActuacion'); $xajax->registerFunction('confirmDeleteActuacion'); $xajax->processRequest(); /** * Fin xajax */ $dirtemplate = "./template/solutions/"; /** * llamado de Script */ ?>
<?php /** * ajax :: inits xajax & registers the functions * * @package ajax * @copyright Copyright 2007 rainer@langheiter.comn // http://edv.langheiter.com * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: ajax.common.php 72 2008-11-25 03:44:18Z yellow1912 $ */ // pi_1.php, pi_1.common.php, pi_1.server.php // demonstrate a very basic xajax implementation // using xajax version 0.5 // http://xajaxproject.org require_once DIR_FS_CATALOG . "ajax/xajax5/xajax_core/xajax.inc.php"; #require_once ("ajax/xajax.inc.php"); $xajax = new xajax(); //$xajax->configure('debug', true); $xajax->configure("javascript URI", '../ajax/xajax5'); if (isset($ajax_func)) { foreach ($ajax_func as $key => $value) { if (true == $value) { $xajax->registerFunction($key); } } } $xajax->processRequest();
<?php /* File: callScriptTest.php Test script that uses the <xajaxResponse->call> command to execute a function call on the browser. */ require_once "../../xajax_core/xajax.inc.php"; $xajax = new xajax(); $xajax->configure('requestURI', basename(__FILE__)); require_once "./options.inc.php"; function callScript() { $response = new xajaxResponse(); $value2 = "this is a string"; $response->call("myJSFunction", "arg1", 9432.120000000001, array("myKey" => "some value", "key2" => $value2)); return $response; } function callOtherScript() { $response = new xajaxResponse(); $response->call("myOtherJSFunction"); return $response; } $requestCallScript =& $xajax->register(XAJAX_FUNCTION, "callScript"); $requestCallOtherScript =& $xajax->register(XAJAX_FUNCTION, "callOtherScript"); $xajax->processRequest(); $sRoot = dirname(dirname(dirname(__FILE__))); $sCore = '/xajax_core'; include_once $sRoot . $sCore . '/xajaxControl.inc.php';
@license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Standard xajax startup - include <xajax.inc.php> - instantiate main <xajax> object */ require '../xajax_core/xajax.inc.php'; $xajax = new xajax(); /* - enable deubgging if desired - set the javascript uri (location of xajax js files) */ //$xajax->configure('debug', true); $xajax->configure('javascript URI', '../'); /* Function: helloWorld Modify the innerHTML of div1. */ function helloWorld($isCaps) { if ($isCaps) { $text = 'HELLO WORLD!'; } else { $text = 'Hello World!'; } $objResponse = new xajaxResponse(); $objResponse->assign('div1', 'innerHTML', $text); return $objResponse;
} else { $objResponse->alert('Error adding user (Username may already exist)!'); } } else { $objResponse->alert('Username cannot contain an @ symbol and E-mail Address must be valid.'); } } else { $objResponse->alert($project7->notLoggedIn(true)); } return $objResponse; } $xajax->register(XAJAX_FUNCTION, "deleteUser"); function deleteUser($user_id, $table_row) { $objResponse = new xajaxResponse(); $project7 = new editsee_App(); if ($project7->loggedIn() && $project7->isAdmin()) { $delete_user = $project7->db->_query("delete from `" . $project7->db->get_table_prefix() . "user` where user_id='" . $user_id . "'"); if ($delete_user->_affected_rows() == 1) { $objResponse->script('var table=document.getElementById("user_list"); table.deleteRow("' . $table_row . '");'); } else { $objResponse->alert('Unable to delete user!'); } } else { $objResponse->alert($project7->notLoggedIn(true)); } return $objResponse; } $xajax->processRequest(); $xajax->configure('javascript URI', str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . 'includes/xajax/');
<?php /* File: theFrame.php Test script that runs in an iframe and communicates with the parent frame. */ require '../../xajax_core/xajax.inc.php'; $xajax = new xajax(); $xajax->configure('requestURI', basename(__FILE__)); $xajax->configure('javascript URI', '../../'); class clsFunctions { function clsFunctions() { } function confirm($seconds) { sleep($seconds); $objResponse = new xajaxResponse(); $objResponse->append('outputDIV', 'innerHTML', '<br />confirmation from theFrame.php call'); return $objResponse; } } $xajax->register(XAJAX_CALLABLE_OBJECT, new clsFunctions()); $xajax->processRequest(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>xajax Test iFrame</title>
<?php $xajaxCore = "../../xajax_core"; $xajaxInclude = "/xajax.inc.php"; if (isset($_GET['AIO'])) { if (0 != $_GET['AIO']) { $xajaxInclude = "/xajaxAIO.inc.php"; } } require $xajaxCore . $xajaxInclude; $xajax = new xajax(); $xajax->configure('javascript URI', '../../'); if (isset($_GET['debugging'])) { if (0 != $_GET['debugging']) { $xajax->configure("debug", true); } } if (isset($_GET['verbose'])) { if (0 != $_GET['verbose']) { $xajax->configure("verboseDebug", true); } } if (isset($_GET['status'])) { if (0 != $_GET['status']) { $xajax->configure("statusMessages", true); } } if (isset($_GET['synchronous'])) { if (0 != $_GET['synchronous']) { $xajax->configure("defaultMode", "synchronous"); }