php-xajax-0.5/0000755000175000017500000000000011345167007011702 5ustar dgildgilphp-xajax-0.5/xajax_plugins/0000755000175000017500000000000011345167002014551 5ustar dgildgilphp-xajax-0.5/xajax_plugins/response/0000755000175000017500000000000011137074674016422 5ustar dgildgilphp-xajax-0.5/xajax_plugins/response/tableUpdater.inc.php0000644000175000017500000001640111137037724022314 0ustar dgildgil for a detailed description, copyright and license information. */ if (false == class_exists('xajaxPlugin') || false == class_exists('xajaxPluginManager')) { $sBaseFolder = dirname(dirname(dirname(__FILE__))); $sXajaxCore = $sBaseFolder . '/xajax_core'; if (false == class_exists('xajaxPlugin')) require $sXajaxCore . '/xajaxPlugin.inc.php'; if (false == class_exists('xajaxPluginManager')) require $sXajaxCore . '/xajaxPluginManager.inc.php'; } /* Class: clsTableUpdater */ class clsTableUpdater extends xajaxResponsePlugin { /* String: sDefer Used to store the state of the scriptDeferral configuration setting. When script deferral is desired, this member contains 'defer' which will request that the browser defer loading of the javascript until the rest of the page has been loaded. */ var $sDefer; /* String: sJavascriptURI Used to store the base URI for where the javascript files are located. This enables the plugin to generate a script reference to it's javascript file if the javascript code is NOT inlined. */ var $sJavascriptURI; /* Boolean: bInlineScript Used to store the value of the inlineScript configuration option. When true, the plugin will return it's javascript code as part of the javascript header for the page, else, it will generate a script tag referencing the file by using the sJavascriptURI>. */ var $bInlineScript; /* Function: clsTableUpdater Constructs and initializes an instance of the table updater class. */ function clsTableUpdater() { $this->sDefer = ''; $this->sJavascriptURI = ''; $this->bInlineScript = true; } /* Function: configure Receives configuration settings set by or user script calls to configure>. sName - (string): The name of the configuration option being set. mValue - (mixed): The value being associated with the configuration option. */ function configure($sName, $mValue) { if ('scriptDeferral' == $sName) { if (true === $mValue || false === $mValue) { if ($mValue) $this->sDefer = 'defer '; else $this->sDefer = ''; } } else if ('javascript URI' == $sName) { $this->sJavascriptURI = $mValue; } else if ('inlineScript' == $sName) { if (true === $mValue || false === $mValue) $this->bInlineScript = $mValue; } } /* Function: generateClientScript Called by the during the script generation phase. This will either inline the script or insert a script tag which references the file based on the value of the bInlineScript> configuration option. */ function generateClientScript() { if ($this->bInlineScript) { echo "\n\n"; } else { echo "\n\n"; echo "\n\n"; } function getName() { return get_class($this); } function setGoogleSiteKey($sKey) { $this->sGoogleSiteKey = $sKey; } function create($sMap, $sParentId) { $command = array('n'=>'gm:cr', 't'=>$sParentId); $this->addCommand($command, $sMap); } function zoom($sMap, $nZoom) { $command = array('n'=>'gm:zm', 't'=>$sMap); $this->addCommand($command, $nZoom); } function setMarker($sMap, $nLat, $nLon, $sText) { $this->addCommand( array('n'=>'gm:sm', 't'=>$sMap), array($nLat, $nLon, $sText) ); } function moveTo($sMap, $nLat, $nLon) { // 39.928005, // -82.70784, // 15); $command = array('n'=>'et_ar', 't'=>$parent); if (null != $position) $command['p'] = $position; $this->addCommand($command, $row); } } $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new clsGoogleMap()); php-xajax-0.5/xajax_plugins/response/tableUpdater.js0000644000175000017500000005200411000570314021352 0ustar dgildgil// if xajax has not yet been initialized, wait a second and try again // once xajax has been initialized, then install the table command // handlers. installTableUpdater = function() { var xjxReady = false; try { if (xajax) xjxReady = true; } catch (e) { } if (false == xjxReady) { setTimeout('installTableUpdater();', 1000); return; } try { if ('undefined' == typeof xajax.ext.tables) xajax.ext.tables = {}; } catch (e) { xajax.ext = {}; xajax.ext.tables = {}; } // internal helper functions xajax.ext.tables.internal = {}; xajax.ext.tables.internal.createTable = function(table) { if ('string' != typeof (table)) throw { name: 'TableError', message: 'Invalid table name specified.' } var newTable = document.createElement('table'); newTable.id = table; // save the column configuration xajax.ext.tables.appendHeader(table + '_header', newTable); xajax.ext.tables.appendBody(table + '_body', newTable); xajax.ext.tables.appendFooter(table + '_footer', newTable); return newTable; } xajax.ext.tables.internal.createRow = function(objects, id) { var row = document.createElement('tr'); if (null != id) row.id = id; return row; } xajax.ext.tables.internal.createCell = function(objects, id) { var cell = document.createElement('td'); if (null != id) cell.id = id; cell.innerHTML = '...'; return cell; } xajax.ext.tables.internal.getColumnNumber = function(objects, cell) { var position; var columns = objects.header.getElementsByTagName('td'); for (var column = 0; column < columns.length; ++column) if (columns[column].id == cell) return column; throw { name: 'TableError', message: 'Column not found. (getColumnNumber)' } return undefined; } xajax.ext.tables.internal.objectify = function(params, required) { if ('undefined' == typeof params.source) return false; var source = params.source; if ('string' == typeof (source)) source = xajax.$(source); if ('TBODY' == source.nodeName) { params.table = source.parentNode; } else if ('TABLE' == source.nodeName) { params.table = source; } else if ('TR' == source.nodeName) { params.row = source; params.body = source.parentNode; params.table = source.parentNode.parentNode; } else if ('TD' == source.nodeName) { params.cell = source; params.row = source.parentNode; params.columns = params.row.getElementsByTagName('TD'); for (var column = 0; 'undefined' == typeof params.column && column < params.columns.length; ++column) if (params.cell.id == params.columns[column].id) params.column = column; params.table = source.parentNode.parentNode.parentNode; } else if ('THEAD' == source.nodeName) { params.table = source.parentNode; } else if ('TFOOT' == source.nodeName) { params.table = source.parentNode; } else params.source = source; var bodies = params.table.getElementsByTagName('TBODY'); if (0 < bodies.length) params.body = bodies[0]; var headers = params.table.getElementsByTagName('THEAD'); if (0 < headers.length) params.header = headers[0]; var feet = params.table.getElementsByTagName('TFOOT'); if (0 < feet.length) params.footer = feet[0]; if ('undefined' != typeof params.body) params.rows = params.body.getElementsByTagName('TR'); if ('undefined' != typeof params.row) params.cells = params.row.getElementsByTagName('TD'); if ('undefined' != typeof params.header) params.columns = params.header.getElementsByTagName('TD'); if ('undefined' == typeof required) return true; for (var index = 0; index < required.length; ++index) { var require = required[index]; var is_defined = false; eval('is_defined = (undefined != params.' + require + ');'); if (false == is_defined) throw { name: 'TableError', message: 'Unable to locate required object [' + require + '].' }; } return true; } // table xajax.ext.tables.append = function(table, parent) { if ('string' == typeof (parent)) parent = xajax.$(parent); parent.appendChild(xajax.ext.tables.internal.createTable(table)); } xajax.ext.tables.insert = function(table, parent, before) { if ('string' == typeof (parent)) parent = xajax.$(parent); if ('string' == typeof (before)) before = xajax.$(before); parent.insertBefore(xajax.ext.tables.internal.createTable(table), before); } xajax.ext.tables.remove = function(table) { var objects = { source: table }; xajax.ext.tables.internal.objectify(objects, ['table']); objects.table.parentNode.removeChild(objects.table); } xajax.ext.tables.appendHeader = function(id, table) { var objects = { source: table }; xajax.ext.tables.internal.objectify(objects, ['table']); if ('undefined' == typeof objects.header) { var thead = document.createElement('thead'); if (null != id) thead.id = id; objects.header = thead; thead.appendChild(xajax.ext.tables.internal.createRow(objects, null)); if ('undefined' == typeof objects.table.firstChild) table.appendChild(thead); else table.insertBefore(thead, table.firstChild); } } xajax.ext.tables.appendBody = function(id, table) { var objects = { source: table }; xajax.ext.tables.internal.objectify(objects, ['table']); if ('undefined' == typeof objects.body) { var tbody = document.createElement('tbody'); if (null != id) tbody.id = id; objects.body = tbody; } if ('undefined' != typeof objects.rows) { for (var rn = 0; rn < objects.rows.length; ++rn) { var row = objects.rows[rn]; objects.table.removeChild(row); objects.body.appendChild(row); } } if ('undefined' != typeof objects.footer) objects.table.insertBefore(objects.body, objects.footer); else objects.table.appendChild(objects.body); } xajax.ext.tables.appendFooter = function(id, table) { var objects = { source: table } xajax.ext.tables.internal.objectify(objects, ['table']); if ('undefined' == typeof objects.footer) { var tfoot = document.createElement('tfoot'); if (null != id) tfoot.id = id; objects.footer = tfoot; tfoot.appendChild(xajax.ext.tables.internal.createRow(objects, null)); objects.table.appendChild(tfoot); } } // rows xajax.ext.tables.rows = {} xajax.ext.tables.rows.internal = {} xajax.ext.tables.rows.internal.calculateRow = function(objects, position) { if ('undefined' == typeof position) throw { name: 'TableError', message: 'Missing row number / id.' } if ('undefined' == typeof objects.row) if ('undefined' != typeof objects.rows) if ('undefined' != typeof objects.rows[position]) objects.row = objects.rows[position]; if ('undefined' == typeof objects.row) objects.row = xajax.$(position); if ('undefined' == typeof objects.row) throw { name: 'TableError', message: 'Invalid row number / row id specified.' } } xajax.ext.tables.rows.append = function(id, table) { var objects = { source: table } xajax.ext.tables.internal.objectify(objects, ['table', 'body']); var row = xajax.ext.tables.internal.createRow(objects, id); if ('undefined' != typeof objects.columns) { for (var column = 0; column < objects.columns.length; ++column) { var cell = xajax.ext.tables.internal.createCell(objects, null); cell.innerHTML = '...'; row.appendChild(cell); } } objects.body.appendChild(row); } xajax.ext.tables.rows.insert = function(id, source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'body']); if ('undefined' == typeof objects.row) xajax.ext.tables.rows.internal.calculateRow(objects, position); var row = xajax.ext.tables.internal.createRow(objects, id); if ('undefined' != typeof objects.columns) { for (var column = 0; column < objects.columns.length; ++column) { var cell = xajax.ext.tables.internal.createCell(objects, null); cell.innerHTML = '...'; row.appendChild(cell); } } objects.body.insertBefore(row, objects.row); } xajax.ext.tables.rows.replace = function(id, source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'body']); if ('undefined' == typeof objects.row) xajax.ext.tables.rows.internal.calculateRow(objects, position); var row = xajax.ext.tables.internal.createRow(objects, id); if ('undefined' != typeof objects.columns) { for (var column = 0; column < objects.columns.length; ++column) { var cell = xajax.ext.tables.internal.createCell(objects, null); cell.innerHTML = '...'; row.appendChild(cell); } } objects.body.insertBefore(row, objects.row); objects.body.removeChild(objects.row); } xajax.ext.tables.rows.remove = function(source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'body']); if ('undefined' == typeof objects.row) xajax.ext.tables.rows.internal.calculateRow(objects, position); objects.body.removeChild(objects.row); } xajax.ext.tables.rows.assignProperty = function(value, source, position, property) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'body', 'header']); if ('undefined' == typeof objects.row) xajax.ext.tables.rows.internal.calculateRow(objects, position); if ('undefined' != typeof property) eval('objects.row.' + property + ' = value;'); } xajax.ext.tables.rows.assign = function(values, source, position, start_column) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'body', 'header']); if ('undefined' == typeof objects.row) xajax.ext.tables.rows.internal.calculateRow(objects, position); if ('undefined' == typeof start_column) start_column = 0; for (var column = 0; column < values.length; ++column) xajax.ext.tables.cells.assign(values[column], objects.row, start_column + column); } // columns xajax.ext.tables.columns = {} xajax.ext.tables.columns.internal = {} xajax.ext.tables.columns.internal.calculateColumn = function(objects, position) { if ('undefined' == typeof position) throw { name: 'TableError', message: 'Missing column number / id.' } if ('undefined' == typeof objects.column) if ('undefined' != typeof objects.columns) if ('undefined' != typeof objects.columns[position]) objects.column = position; if ('undefined' == typeof objects.column) for (var column = 0; 'undefined' == typeof objects.column && column < objects.columns.length; ++column) if (objects.columns[column].id == position) objects.column = column; if ('undefined' == typeof objects.column) throw { name: 'TableError', message: 'Invalid column number / row id specified.' } } xajax.ext.tables.columns.append = function(column_definition, table) { var objects = { source: table } xajax.ext.tables.internal.objectify(objects, ['table', 'header', 'body']); var cell = xajax.ext.tables.internal.createCell(objects, column_definition.id); if ('undefined' != typeof column_definition.name) cell.innerHTML = column_definition.name; objects.header.firstChild.appendChild(cell); if ('undefined' != typeof objects.rows) for (var i = 0; i < objects.rows.length; ++i) xajax.ext.tables.cells.append({id: null}, objects.rows[i]); } xajax.ext.tables.columns.insert = function(column_definition, source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'header']); if ('undefined' == typeof objects.column) xajax.ext.tables.columns.internal.calculateColumn(objects, position); var column = xajax.ext.tables.internal.createCell(objects, column_definition.id); if ('undefined' != typeof column_definition.name) column.innerHTML = column_definition.name; objects.header.firstChild.insertBefore(column, objects.columns[objects.column]); if ('undefined' != typeof objects.rows) for (var i = 0; i < objects.rows.length; ++i) xajax.ext.tables.cells.insert({id: null}, objects.rows[i], objects.column); } xajax.ext.tables.columns.replace = function(column_definition, source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'header', 'columns']); if ('undefined' == typeof objects.column) xajax.ext.tables.columns.internal.calculateColumn(objects, position); var before = objects.columns[objects.column]; var column = xajax.ext.tables.internal.createCell(objects, column_definition.id); if ('undefined' != typeof column_definition.name) column.innerHTML = column_definition.name; objects.header.firstChild.insertBefore(column, before); objects.header.firstChild.removeChild(before); if ('undefined' != typeof objects.rows) for (var i = 0; i < objects.rows.length; ++i) xajax.ext.tables.cells.replace({id: null}, objects.rows[i], objects.column); } xajax.ext.tables.columns.remove = function(source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'header']); if ('undefined' == typeof objects.column) xajax.ext.tables.columns.internal.calculateColumn(objects, position); objects.header.firstChild.removeChild(objects.columns[objects.column]); if ('undefined' != typeof objects.rows) for (var i = 0; i < objects.rows.length; ++i) xajax.ext.tables.cells.remove(objects.rows[i], objects.column); } xajax.ext.tables.columns.assign = function(values, source, position, start_row) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'cell']); if ('undefined' == typeof objects.column) xajax.ext.tables.columns.internal.calculateColumn(objects, position); for (var row = 0; row < values.length; ++row) xajax.ext.tables.cells.assign(values[row], objects.rows[start_row + row], objects.column); } xajax.ext.tables.columns.assignProperty = function(value, source, position, property) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'cell']); if ('undefined' == typeof objects.column) xajax.ext.tables.columns.internal.calculateColumn(objects, position); for (var row = 0; row < objects.rows.length; ++row) xajax.ext.tables.cells.assignProperty(value, objects.rows[row], objects.column, property); } // cells xajax.ext.tables.cells = {} xajax.ext.tables.cells.internal = {} xajax.ext.tables.cells.internal.calculateCell = function(objects, position) { if ('undefined' == typeof position) throw { name: 'TableError', message: 'Missing cell number / id.' } if ('undefined' == typeof objects.cell) if ('undefined' != typeof objects.cells) if ('undefined' != typeof objects.cells[position]) objects.cell = objects.cells[position]; if ('undefined' == typeof objects.cell) if ('undefined' != typeof objects.columns) for (var column = 0; 'undefined' == typeof objects.cell && column < objects.columns.length; ++column) if (objects.columns[column].id == position) objects.cell = objects.cells[column]; if ('undefined' == typeof objects.cell) throw { name: 'TableError', message: 'Invalid cell number / id specified.' } } xajax.ext.tables.cells.append = function(cell_definition, source) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'row']); var cell = xajax.ext.tables.internal.createCell(objects, cell_definition.id); if ('undefined' != typeof cell_definition.name) cell.innerHTML = cell_definition.name; objects.row.appendChild(cell); } xajax.ext.tables.cells.insert = function(cell_definition, source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'row']); if ('undefined' == typeof objects.cell) xajax.ext.tables.cells.internal.calculateCell(objects, position); var cell = xajax.ext.tables.internal.createCell(objects, cell_definition.id); if ('undefined' != typeof cell_definition.name) cell.innerHTML = cell_definition.name; objects.row.insertBefore(cell, objects.cell); } xajax.ext.tables.cells.replace = function(cell_definition, source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'row']); if ('undefined' == typeof objects.cell) xajax.ext.tables.cells.internal.calculateCell(objects, position); var cell = xajax.ext.tables.internal.createCell(objects, cell_definition.id); if ('undefined' != typeof cell_definition.name) cell.innerHTML = cell_definition.name; objects.row.insertBefore(cell, objects.cell); objects.row.removeChild(objects.cell); } xajax.ext.tables.cells.remove = function(source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'row']); if ('undefined' == typeof objects.cell) xajax.ext.tables.cells.internal.calculateCell(objects, position); objects.row.removeChild(objects.cell); } xajax.ext.tables.cells.assign = function(value, source, position) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'row']); if ('undefined' == typeof objects.cell) xajax.ext.tables.cells.internal.calculateCell(objects, position); objects.cell.innerHTML = value; } xajax.ext.tables.cells.assignProperty = function(value, source, position, property) { var objects = { source: source } xajax.ext.tables.internal.objectify(objects, ['table', 'row']); if ('undefined' == typeof objects.cell) xajax.ext.tables.cells.internal.calculateCell(objects, position); eval('objects.cell.' + property + ' = value;'); } // command handlers // tables xajax.command.handler.register('et_at', function(args) { args.fullName = 'ext.tables.append'; xajax.ext.tables.append(args.data, args.id); return true; }); xajax.command.handler.register('et_it', function(args) { args.fullName = 'ext.tables.insert'; xajax.ext.tables.insert(args.data, args.id, args.pos); return true; }); xajax.command.handler.register('et_dt', function(args) { args.fullName = 'ext.tables.remove'; xajax.ext.tables.remove(args.data); return true; }); // rows xajax.command.handler.register('et_ar', function(args) { args.fullName = 'ext.tables.rows.append'; xajax.ext.tables.rows.append(args.data, args.id); return true; }); xajax.command.handler.register('et_ir', function(args) { args.fullName = 'ext.tables.rows.insert'; xajax.ext.tables.rows.insert(args.data, args.id, args.pos); return true; }); xajax.command.handler.register('et_rr', function(args) { args.fullName = 'ext.tables.rows.replace'; xajax.ext.tables.rows.replace(args.data, args.id, args.pos); return true; }); xajax.command.handler.register('et_dr', function(args) { args.fullName = 'ext.tables.rows.remove'; xajax.ext.tables.rows.remove(args.id, args.pos); return true; }); xajax.command.handler.register('et_asr', function(args) { args.fullName = 'ext.tables.rows.assign'; xajax.ext.tables.rows.assign(args.data, args.id, args.pos); return true; }); xajax.command.handler.register('et_asrp', function(args) { args.fullName = 'ext.tables.rows.assignProperty'; xajax.ext.tables.rows.assignProperty(args.data, args.id, args.pos, args.prop); }); // columns xajax.command.handler.register('et_acol', function(args) { args.fullName = 'ext.tables.columns.append'; xajax.ext.tables.columns.append(args.data, args.id); return true; }); xajax.command.handler.register('et_icol', function(args) { args.fullName = 'ext.tables.columns.insert'; xajax.ext.tables.columns.insert(args.data, args.id, args.pos); return true; }); xajax.command.handler.register('et_rcol', function(args) { args.fullName = 'ext.tables.columns.replace'; xajax.ext.tables.columns.replace(args.data, args.id, args.pos); return true; }); xajax.command.handler.register('et_dcol', function(args) { args.fullName = 'ext.tables.columns.remove'; xajax.ext.tables.columns.remove(args.id, args.pos); return true; }); xajax.command.handler.register('et_ascol', function(args) { args.fullName = 'ext.tables.columns.assign'; xajax.ext.tables.columns.assign(args.data, args.id, args.pos, args.type); return true; }); xajax.command.handler.register('et_ascolp', function(args) { args.fullName = 'ext.tables.columns.assignProperty'; xajax.ext.tables.columns.assignProperty(args.data, args.id, args.pos, args.prop); return true; }); // cells xajax.command.handler.register('et_ac', function(args) { args.fullName = 'ext.tables.cells.append'; xajax.ext.tables.cells.append(args.data, args.id); return true; }); xajax.command.handler.register('et_ic', function(args) { args.fullName = 'ext.tables.cells.insert'; xajax.ext.tables.cells.insert(args.data, args.id, args.pos); return true; }); xajax.command.handler.register('et_rc', function(args) { args.fullName = 'ext.tables.cells.replace'; xajax.ext.tables.cells.replace(args.data, args.id, args.pos); }); xajax.command.handler.register('et_dc', function(args) { args.fullName = 'ext.tables.cells.remove'; xajax.ext.tables.cells.remove(args.id, args.pos); return true; }); xajax.command.handler.register('et_asc', function(args) { args.fullName = 'ext.tables.cells.assign'; xajax.ext.tables.cells.assign(args.data, args.id, args.pos); return true; }); xajax.command.handler.register('et_ascp', function(args) { args.fullName = 'ext.tables.cells.assignProperty'; xajax.ext.tables.cells.assignProperty(args.data, args.id, args.pos, args.prop); return true; }); } installTableUpdater(); php-xajax-0.5/xajax_plugins/request/0000755000175000017500000000000011137074674016254 5ustar dgildgilphp-xajax-0.5/xajax_js/0000755000175000017500000000000011345167002013504 5ustar dgildgilphp-xajax-0.5/xajax_js/xajax_debug.js0000644000175000017500000003553411045155136016337 0ustar dgildgil try{if('undefined'==typeof xajax) throw{name:'SequenceError',message:'Error: xajax core was not detected, debug module disabled.'} if('undefined'==typeof xajax.debug) xajax.debug={} xajax.debug.workId='xajaxWork'+new Date().getTime();xajax.debug.windowSource='about:blank';xajax.debug.windowID='xajax_debug_'+xajax.debug.workId;if('undefined'==typeof xajax.debug.windowStyle) xajax.debug.windowStyle= 'width=800,'+ 'height=600,'+ 'scrollbars=yes,'+ 'resizable=yes,'+ 'status=yes';if('undefined'==typeof xajax.debug.windowTemplate) xajax.debug.windowTemplate= ''+ ''+ 'xajax debug output'+ ''+ ''+ '

xajax debug output

'+ '
'+ '';xajax.debug.text=[];xajax.debug.text[100]='WARNING: ';xajax.debug.text[101]='ERROR: ';xajax.debug.text[102]='XAJAX DEBUG MESSAGE:\n';xajax.debug.text[103]='...\n[LONG RESPONSE]\n...';xajax.debug.text[104]='SENDING REQUEST';xajax.debug.text[105]='SENT [';xajax.debug.text[106]=' bytes]';xajax.debug.text[107]='CALLING: ';xajax.debug.text[108]='URI: ';xajax.debug.text[109]='INITIALIZING REQUEST';xajax.debug.text[110]='PROCESSING PARAMETERS [';xajax.debug.text[111]=']';xajax.debug.text[112]='NO PARAMETERS TO PROCESS';xajax.debug.text[113]='PREPARING REQUEST';xajax.debug.text[114]='STARTING XAJAX CALL (deprecated: use xajax.request instead)';xajax.debug.text[115]='STARTING XAJAX REQUEST';xajax.debug.text[116]='No response processor is available to process the response from the server.\n';xajax.debug.text[117]='.\nCheck for error messages from the server.';xajax.debug.text[118]='RECEIVED [status: ';xajax.debug.text[119]=', size: ';xajax.debug.text[120]=' bytes, time: ';xajax.debug.text[121]='ms]:\n';xajax.debug.text[122]='The server returned the following HTTP status: ';xajax.debug.text[123]='\nRECEIVED:\n';xajax.debug.text[124]='The server returned a redirect to:
';xajax.debug.text[125]='DONE [';xajax.debug.text[126]='ms]';xajax.debug.text[127]='INITIALIZING REQUEST OBJECT';xajax.debug.exceptions=[];xajax.debug.exceptions[10001]='Invalid response XML: The response contains an unknown tag: {data}.';xajax.debug.exceptions[10002]='GetRequestObject: XMLHttpRequest is not available, xajax is disabled.';xajax.debug.exceptions[10003]='Queue overflow: Cannot push object onto queue because it is full.';xajax.debug.exceptions[10004]='Invalid response XML: The response contains an unexpected tag or text: {data}.';xajax.debug.exceptions[10005]='Invalid request URI: Invalid or missing URI; autodetection failed; please specify a one explicitly.';xajax.debug.exceptions[10006]='Invalid response command: Malformed response command received.';xajax.debug.exceptions[10007]='Invalid response command: Command [{data}] is not a known command.';xajax.debug.exceptions[10008]='Element with ID [{data}] not found in the document.';xajax.debug.exceptions[10009]='Invalid request: Missing function name parameter.';xajax.debug.exceptions[10010]='Invalid request: Missing function object parameter.';xajax.debug.getExceptionText=function(e){if('undefined'!=typeof e.code){if('undefined'!=typeof xajax.debug.exceptions[e.code]){var msg=xajax.debug.exceptions[e.code];if('undefined'!=typeof e.data){msg.replace('{data}',e.data);} return msg;} }else if('undefined'!=typeof e.name){var msg=e.name;if('undefined'!=typeof e.message){msg+=': ';msg+=e.message;} return msg;} return 'An unknown error has occurred.';} xajax.debug.writeMessage=function(text,prefix,cls){try{var xd=xajax.debug;if('undefined'==typeof xd.window||true==xd.window.closed){xd.window=window.open(xd.windowSource,xd.windowID,xd.windowStyle);if("about:blank"==xd.windowSource) xd.window.document.write(xd.windowTemplate);} var xdw=xd.window;var xdwd=xdw.document;if('undefined'==typeof prefix) prefix='';if('undefined'==typeof cls) cls='debugText';text=xajax.debug.prepareDebugText(text);var debugTag=xdwd.getElementById('debugTag');var debugEntry=xdwd.createElement('div');var debugDate=xdwd.createElement('span');var debugText=xdwd.createElement('pre');debugDate.innerHTML=new Date().toString();debugText.innerHTML=prefix+text;debugEntry.appendChild(debugDate);debugEntry.appendChild(debugText);debugTag.insertBefore(debugEntry,debugTag.firstChild);try{debugEntry.className='debugEntry';debugDate.className='debugDate';debugText.className=cls;}catch(e){} }catch(e){if(text.length > 1000)text=text.substr(0,1000)+xajax.debug.text[102];alert(xajax.debug.text[102]+text);} } xajax.debug.prepareDebugText=function(text){try{text=text.replace(/&/g,'&') .replace(//g,'>') .replace(/\n/g,'
');return text;}catch(e){xajax.debug.stringReplace=function(haystack,needle,newNeedle){var segments=haystack.split(needle);haystack='';for(var i=0;i < segments.length;++i){if(0!=i) haystack+=newNeedle;haystack+=segments[i];} return haystack;} xajax.debug.prepareDebugText=function(text){text=xajax.debug.stringReplace(text,'&','&');text=xajax.debug.stringReplace(text,'<','<');text=xajax.debug.stringReplace(text,'>','>');text=xajax.debug.stringReplace(text,'\n','
');return text;} xajax.debug.prepareDebugText(text);} } xajax.debug.executeCommand=xajax.executeCommand;xajax.executeCommand=function(args){try{if('undefined'==typeof args.cmd) throw{code:10006};if(false==xajax.command.handler.isRegistered(args)) throw{code:10007,data:args.cmd};return xajax.debug.executeCommand(args);}catch(e){var msg='ExecuteCommand (';if('undefined'!=typeof args.sequence){msg+='#';msg+=args.sequence;msg+=', ';} if('undefined'!=typeof args.cmdFullName){msg+='"';msg+=args.cmdFullName;msg+='"';} msg+='):\n';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');} return true;} xajax.debug.parseAttributes=xajax.parseAttributes;xajax.parseAttributes=function(child,obj){try{xajax.debug.parseAttributes(child,obj);}catch(e){var msg='ParseAttributes:\n';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');} } xajax.debug.commandHandler=xajax.command.handler.unregister('dbg');xajax.command.handler.register('dbg',function(args){args.cmdFullName='debug message';xajax.debug.writeMessage(args.data,xajax.debug.text[100],'warningText');return xajax.debug.commandHandler(args);});xajax.debug.$=xajax.tools.$;xajax.tools.$=function(sId){try{var returnValue=xajax.debug.$(sId);if('object'!=typeof returnValue) throw{code:10008};} catch(e){var msg='$:';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[100],'warningText');} return returnValue;} xajax.debug._objectToXML=xajax.tools._objectToXML;xajax.tools._objectToXML=function(obj,guard){try{if(0==guard.size){var msg='OBJECT TO XML: maxDepth = ';msg+=guard.maxDepth;msg+=', maxSize = ';msg+=guard.maxSize;xajax.debug.writeMessage(msg);} var r=xajax.debug._objectToXML(obj,guard);if(0==guard.depth){var msg='OBJECT TO XML: size = ';msg+=guard.size;xajax.debug.writeMessage(msg);} return r;}catch(e){var msg='ObjectToXML: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');} return '';} xajax.debug._internalSend=xajax._internalSend;xajax._internalSend=function(oRequest){try{xajax.debug.writeMessage(xajax.debug.text[104]);xajax.debug.writeMessage( xajax.debug.text[105]+ oRequest.requestData.length+ xajax.debug.text[106] );oRequest.beginDate=new Date();xajax.debug._internalSend(oRequest);}catch(e){var msg='InternalSend: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } xajax.debug.submitRequest=xajax.submitRequest;xajax.submitRequest=function(oRequest){var msg=oRequest.method;msg+=': ';text=decodeURIComponent(oRequest.requestData);text=text.replace(new RegExp('&xjx','g'),'\n&xjx');text=text.replace(new RegExp('','g'),'\n');text=text.replace(new RegExp('','g'),'\n');text=text.replace(new RegExp('','g'),'\n\n');msg+=text;xajax.debug.writeMessage(msg);msg=xajax.debug.text[107];var separator='\n';for(var mbr in oRequest.functionName){msg+=separator;msg+=mbr;msg+=': ';msg+=oRequest.functionName[mbr];separator='\n';} msg+=separator;msg+=xajax.debug.text[108];msg+=separator;msg+=oRequest.URI;xajax.debug.writeMessage(msg);try{return xajax.debug.submitRequest(oRequest);}catch(e){xajax.debug.writeMessage(e.message);if(0 < oRequest.retry) throw e;} } xajax.debug.initializeRequest=xajax.initializeRequest;xajax.initializeRequest=function(oRequest){try{var msg=xajax.debug.text[109];xajax.debug.writeMessage(msg);return xajax.debug.initializeRequest(oRequest);}catch(e){var msg='InitializeRequest: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } xajax.debug.processParameters=xajax.processParameters;xajax.processParameters=function(oRequest){try{if('undefined'!=typeof oRequest.parameters){var msg=xajax.debug.text[110];msg+=oRequest.parameters.length;msg+=xajax.debug.text[111];xajax.debug.writeMessage(msg);}else{var msg=xajax.debug.text[112];xajax.debug.writeMessage(msg);} return xajax.debug.processParameters(oRequest);}catch(e){var msg='ProcessParameters: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } xajax.debug.prepareRequest=xajax.prepareRequest;xajax.prepareRequest=function(oRequest){try{var msg=xajax.debug.text[113];xajax.debug.writeMessage(msg);return xajax.debug.prepareRequest(oRequest);}catch(e){var msg='PrepareRequest: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } xajax.debug.call=xajax.call;xajax.call=function(){try{xajax.debug.writeMessage(xajax.debug.text[114]);var numArgs=arguments.length;if(0==numArgs) throw{code:10009};var functionName=arguments[0];var oOptions={} if(1 < numArgs) oOptions=arguments[1];oOptions.debugging=true;return xajax.debug.call(functionName,oOptions);}catch(e){var msg='Call: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } xajax.debug.request=xajax.request;xajax.request=function(){try{xajax.debug.writeMessage(xajax.debug.text[115]);var numArgs=arguments.length;if(0==numArgs) throw{code:10010};var oFunction=arguments[0];var oOptions={} if(1 < numArgs) oOptions=arguments[1];oOptions.debugging=true;return xajax.debug.request(oFunction,oOptions);}catch(e){var msg='Request: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } xajax.debug.getResponseProcessor=xajax.getResponseProcessor;xajax.getResponseProcessor=function(oRequest){try{var fProc=xajax.debug.getResponseProcessor(oRequest);if('undefined'==typeof fProc){var msg=xajax.debug.text[116];try{var contentType=oRequest.request.getResponseHeader('content-type');msg+="Content-Type: ";msg+=contentType;if('text/html'==contentType){msg+=xajax.debug.text[117];} }catch(e){} xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');} return fProc;}catch(e){var msg='GetResponseProcessor: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } xajax.debug.responseReceived=xajax.responseReceived;xajax.responseReceived=function(oRequest){var xx=xajax;var xt=xx.tools;var xd=xx.debug;var oRet;try{var status=oRequest.request.status;if(xt.arrayContainsValue(xx.responseSuccessCodes,status)){var packet=oRequest.request.responseText;packet=packet.replace(new RegExp('','g'),'\n');packet=packet.replace(new RegExp('','g'),'\n');packet=packet.replace(new RegExp('','g'),'\n');packet=packet.replace(new RegExp('','g'),'\n\n');packet=packet.replace(new RegExp('','g'),'\n');oRequest.midDate=new Date();var msg=xajax.debug.text[118];msg+=oRequest.request.status;msg+=xajax.debug.text[119];msg+=packet.length;msg+=xajax.debug.text[120];msg+=(oRequest.midDate-oRequest.beginDate);msg+=xajax.debug.text[121];msg+=packet;xd.writeMessage(msg);}else if(xt.arrayContainsValue(xx.responseErrorsForAlert,status)){var msg=xajax.debug.text[122];msg+=status;msg+=xajax.debug.text[123];msg+=oRequest.request.responseText;xd.writeMessage(msg,xajax.debug.text[101],'errorText');}else if(xt.arrayContainsValue(xx.responseRedirectCodes,status)){var msg=xajax.debug.text[124];msg+=oRequest.request.getResponseHeader('location');xd.writeMessage(msg);} oRet=xd.responseReceived(oRequest);}catch(e){var msg='ResponseReceived: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xd.writeMessage(msg,xajax.debug.text[101],'errorText');} return oRet;} xajax.debug.completeResponse=xajax.completeResponse;xajax.completeResponse=function(oRequest){try{var returnValue=xajax.debug.completeResponse(oRequest);oRequest.endDate=new Date();var msg=xajax.debug.text[125];msg+=(oRequest.endDate-oRequest.beginDate);msg+=xajax.debug.text[126];xajax.debug.writeMessage(msg);return returnValue;}catch(e){var msg='CompleteResponse: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } xajax.debug.getRequestObject=xajax.tools.getRequestObject;xajax.tools.getRequestObject=function(){try{xajax.debug.writeMessage(xajax.debug.text[127]);return xajax.debug.getRequestObject();}catch(e){var msg='GetRequestObject: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');throw e;} } if(xajax.dom.assign){xajax.debug.assign=xajax.dom.assign;xajax.dom.assign=function(element,property,data){try{return xajax.debug.assign(element,property,data);}catch(e){var msg='xajax.dom.assign: ';msg+=xajax.debug.getExceptionText(e);msg+='\n';msg+='Eval: element.';msg+=property;msg+=' = data;\n';xajax.debug.writeMessage(msg,xajax.debug.text[101],'errorText');} return true;} } if(xajax.tools){if(xajax.tools.queue){if(xajax.tools.queue.retry){if('undefined'==typeof xajax.debug.tools) xajax.debug.tools={};if('undefined'==typeof xajax.debug.tools.queue) xajax.debug.tools.queue={};xajax.debug.tools.queue.retry=xajax.tools.queue.retry;xajax.tools.queue.retry=function(obj,count){if(xajax.debug.tools.queue.retry(obj,count)) return true;if(obj.cmd&&'s'==obj.cmd) return false;xajax.debug.writeMessage('Retry count exceeded.');return false;} } } } xajax.debug.isLoaded=true;xjx={} xjx.$=xajax.tools.$;xjx.getFormValues=xajax.tools.getFormValues;xjx.call=xajax.call;xjx.request=xajax.request;xajax.$=xajax.tools.$;xajax.getFormValues=xajax.tools.getFormValues;}catch(e){alert(e.name+': '+e.message);} php-xajax-0.5/xajax_js/xajax_lang_bg.js0000644000175000017500000000733511046052100016624 0ustar dgildgil if('undefined'!=typeof xajax.debug){xajax.debug.text=[];xajax.debug.text[100]='ПРЕДУПРЕЖДЕНИЕ: ';xajax.debug.text[101]='ГРЕШКА: ';xajax.debug.text[102]='XAJAX ДЕБЪГ СЪОБЩЕНИЕ:\n';xajax.debug.text[103]='...\n[ДЪЛЪГ ОТГОВОР]\n...';xajax.debug.text[104]='ИЗПРАЩАНЕ НА ЗАЯВКИ';xajax.debug.text[105]='ИЗПРАТЕНИ [';xajax.debug.text[106]=' байта]';xajax.debug.text[107]='ИЗВИКВАНЕ: ';xajax.debug.text[108]='Адрес: ';xajax.debug.text[109]='ИНИЦИАЛИЗИРАНЕ НА ЗАЯВКАТА';xajax.debug.text[110]='ОБРАБОТВАНЕ НА ПАРАМЕТРИТЕ [';xajax.debug.text[111]=']';xajax.debug.text[112]='НЯМА ПАРАМЕТРИ ЗА ОБРАБОТВАНЕ';xajax.debug.text[113]='ПОДГОТВЯВАНЕ НА ЗАЯВКАТА';xajax.debug.text[114]='СТАРТИРАНЕ НА XAJAX ПОВИКВАНЕТО (остаряло: вместо това използвай xajax.request)';xajax.debug.text[115]='СТАРТИРАНЕ НА XAJAX ЗАЯВКАТА';xajax.debug.text[116]='Няма регистрирани функции, които да обработят заявката ви на сървъра!\n';xajax.debug.text[117]='.\nПровери за съобщения за грешки на сървъра.';xajax.debug.text[118]='ПОЛУЧЕНИ [статус: ';xajax.debug.text[119]=', размер: ';xajax.debug.text[120]=' байта, време: ';xajax.debug.text[121]='мсек]:\n';xajax.debug.text[122]='Сървъра върна следния HTTP статус: ';xajax.debug.text[123]='\nПОЛУЧЕНИ:\n';xajax.debug.text[124]='Сървъра върна пренасочване към:
';xajax.debug.text[125]='ГОТОВО [';xajax.debug.text[126]='мсек]';xajax.debug.text[127]='ИНИЦИАЛИЗИРАНЕ НА ОБЕКТА НА ЗАЯВКАТА';xajax.debug.exceptions=[];xajax.debug.exceptions[10001]='Невалиден XML отговор: Отговора съдържа непознат таг: {data}.';xajax.debug.exceptions[10002]='GetRequestObject: Няма XMLHttpRequest, xajax е изключен.';xajax.debug.exceptions[10003]='Препълване на опашката: Обекта не може да бъде сложен на опашката, защото тя е пълна.';xajax.debug.exceptions[10004]='Невалиден XML отговор: Отговора съдържа неочакван таг или текст: {data}.';xajax.debug.exceptions[10005]='Невалиден адрес: Невалиден или липсващ адрес; автоматичното откриване неуспешнп; please specify a one explicitly.';xajax.debug.exceptions[10006]='Невалидна команда в отговора: Получена беше невалидна команда като отговор.';xajax.debug.exceptions[10007]='Невалидна команда в отговора: Командата [{data}] е непозната.';xajax.debug.exceptions[10008]='Елемент с ID [{data}] не беше намерен в документа.';xajax.debug.exceptions[10009]='Невалидна заявка: Параметъра с името на функцията липсва.';xajax.debug.exceptions[10010]='Невалидна заявка: Липсва обекта на функцията.';} if('undefined'!=typeof xajax.config){if('undefined'!=typeof xajax.config.status){xajax.config.status.update=function(){return{onRequest:function(){window.status='Изпращане на заявка...';}, onWaiting:function(){window.status='Изчакване на отговор...';}, onProcessing:function(){window.status='Изпълнение...';}, onComplete:function(){window.status='Готово.';} } } } } php-xajax-0.5/xajax_js/xajax_legacy.js0000644000175000017500000000126211045155136016504 0ustar dgildgil try{if('undefined'==typeof xajax) throw{name:'SequenceError',message:'Error: xajax core was not detected, legacy module disabled.'} if('undefined'==typeof xajax.legacy) xajax.legacy={} xajax.legacy.call=xajax.call;xajax.call=function(sFunction,objParameters){var oOpt={} oOpt.parameters=objParameters;if(undefined!=xajax.loadingFunction){if(undefined==oOpt.callback) oOpt.callback={} oOpt.callback.onResponseDelay=xajax.loadingFunction;} if(undefined!=xajax.doneLoadingFunction){if(undefined==oOpt.callback) oOpt.callback={} oOpt.callback.onComplete=xajax.doneLoadingFunction;} return xajax.legacy.call(sFunction,oOpt);} xajax.legacy.isLoaded=true;}catch(e){alert(e.name+': '+e.message);} php-xajax-0.5/xajax_js/xajax_lang_nl_uncompressed.js0000644000175000017500000000646211100036744021443 0ustar dgildgil/** * translation for: xajax v.x.x * @version: 1.0.0 * @author: jeffrey * @copyright xajax project * @license GNU/GPL * @package xajax x.x.x * @since v.x.x.x * save as UTF-8 */ if ('undefined' != typeof xajax.debug) { /* Array: text */ xajax.debug.text = []; xajax.debug.text[100] = 'FOUTMELDING: '; xajax.debug.text[101] = 'FOUT: '; xajax.debug.text[102] = 'XAJAX FOUTMELDINGS BERICHT:\n'; xajax.debug.text[103] = '...\n[LANG ANTWOORD]\n...'; xajax.debug.text[104] = 'VERZENDING AANVRAAG'; xajax.debug.text[105] = 'VERZONDEN ['; xajax.debug.text[106] = ' bytes]'; xajax.debug.text[107] = 'AANROEPING: '; xajax.debug.text[108] = 'URI: '; xajax.debug.text[109] = 'INITIALISATIE AANVRAAG'; xajax.debug.text[110] = 'VERWERKING PARAMETERS ['; xajax.debug.text[111] = ']'; xajax.debug.text[112] = 'GEEN PARAMETERS OM TE VERWERKEN'; xajax.debug.text[113] = 'VOORBEREIDING AANVRAAG'; xajax.debug.text[114] = 'BEGIN XAJAX AANVRAAG (verouderd: gebruik xajax.request)'; xajax.debug.text[115] = 'BEGIN XAJAX AANVRAAG'; xajax.debug.text[116] = 'Er is geen verwerkingsbestand gespecificeerd om de aanvraag te verwerken.\n'; xajax.debug.text[117] = '.\nBekijk foutmeldingen van de server.'; xajax.debug.text[118] = 'ONTVANGEN [status: '; xajax.debug.text[119] = ', omvang: '; xajax.debug.text[120] = ' bytes, Zeit: '; xajax.debug.text[121] = 'ms]:\n'; xajax.debug.text[122] = 'De server retourneert de volgende HTTP-status: '; xajax.debug.text[123] = '\nONTVANGEN:\n'; xajax.debug.text[124] = 'De server retourneert een doorverwijzing naar:
'; xajax.debug.text[125] = 'KLAAR ['; xajax.debug.text[126] = 'ms]'; xajax.debug.text[127] = 'INITIALISATIE OBJECT AANVRAAG'; /* Array: exceptions */ xajax.debug.exceptions = []; xajax.debug.exceptions[10001] = 'Ongeldig XML-antwoord: het antwoord bevat een onbekende tag: {data}.'; xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest is niet beschikbaar, XajaX is uitgeschakeld.'; xajax.debug.exceptions[10003] = 'Wachtrij limiet overschreden: kan het object niet in de wachtrij plaatsen, omdat die vol is.'; xajax.debug.exceptions[10004] = 'Ongeldig XML-antwoord: het antwoord bevat een onverwachte tag of tekst: {data}.'; xajax.debug.exceptions[10005] = 'Ongeldige Request-URI: Ongeldige of ontbrekende URI; automatische detectie faalt; specificeer een URI expliciet.'; xajax.debug.exceptions[10006] = 'Ongeldig antwoord bevel: misvormd antwoord bevel ontvangen.'; xajax.debug.exceptions[10007] = 'Ongeldig antwoord bevel: Bevel [{data}] is niet bekend.'; xajax.debug.exceptions[10008] = 'Element met het ID [{data}] kon niet in het document worden gevonden.'; xajax.debug.exceptions[10009] = 'Ongeldige aanvraag: Missende functie parameter - naam.'; xajax.debug.exceptions[10010] = 'Ongeldige aanvraag: Missende functie parameter - object.'; } if ('undefined' != typeof xajax.config) { if ('undefined' != typeof xajax.config.status) { /* Object: update */ xajax.config.status.update = function() { return { onRequest: function() { window.status = "Verzenden aanvraag..."; }, onWaiting: function() { window.status = "Wachten op antwoord..."; }, onProcessing: function() { window.status = "Verwerking..."; }, onComplete: function() { window.status = "Afgesloten."; } } } } } php-xajax-0.5/xajax_js/xajax_lang_fr_uncompressed.js0000644000175000017500000000627511137037724021454 0ustar dgildgil xajax.debug.text = []; xajax.debug.text[100] = 'ATTENTION : '; xajax.debug.text[101] = 'ERREUR : '; xajax.debug.text[102] = 'MESSAGE DE DEBUG XAJAX :\n'; xajax.debug.text[103] = '...\n[R�PONSE LONGUE]\n...'; xajax.debug.text[104] = 'ENVOI DE LA REQU�TE'; xajax.debug.text[105] = 'ENVOY� ['; xajax.debug.text[106] = ' octets]'; xajax.debug.text[107] = 'APPEL : '; xajax.debug.text[108] = 'URI : '; xajax.debug.text[109] = 'INITIALISATION DE LA REQU�TE'; xajax.debug.text[110] = 'TRAITEMENT DES PARAM�TRES ['; xajax.debug.text[111] = ']'; xajax.debug.text[112] = 'AUCUN PARAM�TRE � TRAITER'; xajax.debug.text[113] = 'PR�PARATION DE LA REQU�TE'; xajax.debug.text[114] = 'D�BUT DE L\'APPEL XAJAX (d�pr�ci�: utilisez plut�t xajax.request)'; xajax.debug.text[115] = 'D�BUT DE LA REQU�TE'; xajax.debug.text[116] = 'Aucun traitement disponible pour traiter la r�ponse du serveur.\n'; xajax.debug.text[117] = '.\nV�rifie s\'il existe des messages d\'erreur du serveur.'; xajax.debug.text[118] = 'RE�US [statut : '; xajax.debug.text[119] = ', taille: '; xajax.debug.text[120] = ' octets, temps: '; xajax.debug.text[121] = 'ms] :\n'; xajax.debug.text[122] = 'Le serveur a retourn� la statut HTTP suivant : '; xajax.debug.text[123] = '\nRE�US :\n'; xajax.debug.text[124] = 'Le serveur a indiqu� une redirection vers :
'; xajax.debug.text[125] = 'FAIT ['; xajax.debug.text[126] = 'ms]'; xajax.debug.text[127] = 'INITIALISATION DE L\'OBJET REQU�TE'; xajax.debug.exceptions = []; xajax.debug.exceptions[10001] = 'R�ponse XML non valide : La r�ponse contient une balise inconnue : {data}.'; xajax.debug.exceptions[10002] = 'GetRequestObject : XMLHttpRequest n\'est pas disponible, xajax est d�sactiv�.'; xajax.debug.exceptions[10003] = 'File pleine : Ne peut ajouter un objet � la file car elle est pleine.'; xajax.debug.exceptions[10004] = 'R�ponse XML non valide : La r�ponse contient une balise ou un texte inattendu : {data}.'; xajax.debug.exceptions[10005] = 'URI de la requ�te non valide : URI non valide ou manquante; auto-d�tection �chou�e; veuillez en sp�cifier une explicitement.'; xajax.debug.exceptions[10006] = 'R�ponse de commande invalide : Commande de r�ponse re�ue mal form�e.'; xajax.debug.exceptions[10007] = 'R�ponse de commande invalide : Commande [{data}] est inconnue.'; xajax.debug.exceptions[10008] = 'L\'�l�ment d\'ID [{data}] est introuvable dans le document.'; xajax.debug.exceptions[10009] = 'Requ�te invalide : Aucun nom de fonction indiqu� en param�tre.'; xajax.debug.exceptions[10010] = 'Requ�te invalide : Aucun objet indiqu� en param�tre pour la fonction.'; if ('undefined' != typeof xajax.config) { if ('undefined' != typeof xajax.config.status) { /* Object: mise � jour */ xajax.config.status.update = function() { return { onRequest: function() { window.status = 'Envoi de la requ�te...'; }, onWaiting: function() { window.status = 'Attente de la r�ponse...'; }, onProcessing: function() { window.status = 'En cours de traitement...'; }, onComplete: function() { window.status = 'Fait.'; } } } } }php-xajax-0.5/xajax_js/xajax_legacy_uncompressed.js0000644000175000017500000000352211137037724021300 0ustar dgildgil/* File: xajax_legacy.js Provides support for legacy scripts that have not been updated to the latest syntax. Title: xajax legacy support module Please see for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajax_legacy_uncompressed.php 327 2007-02-28 16:55:26Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ try { /* Class: xajax.legacy */ if ('undefined' == typeof xajax) throw { name: 'SequenceError', message: 'Error: xajax core was not detected, legacy module disabled.' } if ('undefined' == typeof xajax.legacy) xajax.legacy = {} /* Function: xajax.legacy.call Convert call parameters from the 0.2.x syntax to the new *improved* call format. Parameters: sFunction - (string): Registered PHP Functionname to be called objParametes - (object): Paramter object for the request. This is a wrapper function around the standard function. */ xajax.legacy.call = xajax.call; xajax.call = function(sFunction, objParameters) { var oOpt = {} oOpt.parameters = objParameters; if (undefined != xajax.loadingFunction) { if (undefined == oOpt.callback) oOpt.callback = {} oOpt.callback.onResponseDelay = xajax.loadingFunction; } if (undefined != xajax.doneLoadingFunction) { if (undefined == oOpt.callback) oOpt.callback = {} oOpt.callback.onComplete = xajax.doneLoadingFunction; } return xajax.legacy.call(sFunction, oOpt); } /* Boolean: isLoaded true - Indicates that the module is loaded. */ xajax.legacy.isLoaded = true; } catch (e) { alert(e.name + ': ' + e.message); } php-xajax-0.5/xajax_js/xajax_lang_tr_uncompressed.js0000644000175000017500000000636311137037724021470 0ustar dgildgil/** * translation for: xajax v.x.x * @version: 1.0.0 * @author: mic * @copyright xajax project * @license GNU/GPL * @package xajax x.x.x * @since v.x.x.x * save as UTF-8 */ if ('undefined' != typeof xajax.debug) { xajax.debug.text = []; xajax.debug.text[100] = 'IKAZ: '; xajax.debug.text[101] = 'HATA: '; xajax.debug.text[102] = 'XAJAX DEBUG (HATA AYIKLAMASI) MESAJI:\n'; xajax.debug.text[103] = '...\n[UZUN YANIT]\n...'; xajax.debug.text[104] = 'ISTEK GÖNDERILIYOR'; xajax.debug.text[105] = 'GÖNDERILDI ['; xajax.debug.text[106] = ' byte]'; xajax.debug.text[107] = 'ÇAGIRILIYOR: '; xajax.debug.text[108] = 'URI: '; xajax.debug.text[109] = 'ISTEK BASLATILIYOR'; xajax.debug.text[110] = 'PARAMETRELER ISLENIYOR ['; xajax.debug.text[111] = ']'; xajax.debug.text[112] = 'ISLENECEK PARAMETRE YOK'; xajax.debug.text[113] = 'ISTEK HAZIRLANIYOR'; xajax.debug.text[114] = 'XAJAX ÇAGRISI BASLATILIYOR (kullanimi tavsiye edilmiyor: yerine xajax.request kullanin)'; xajax.debug.text[115] = 'XAJAX ISTEGI BASLATILIYOR'; xajax.debug.text[116] = 'Sunucudan gelen cevabi isleyecek cevap islemcisi yok.\n'; xajax.debug.text[117] = '.\nSunucudan gelen hata mesajlarini kontrol edin.'; xajax.debug.text[118] = 'ALINDI [durum: '; xajax.debug.text[119] = ', boyut: '; xajax.debug.text[120] = ' byte, süre: '; xajax.debug.text[121] = 'ms]:\n'; xajax.debug.text[122] = 'Sunucu asagidaki HTTP durumunu gönderdi: '; xajax.debug.text[123] = '\nALINDI:\n'; xajax.debug.text[124] = 'Sunucu su adrese yönlendirme istegi gönderdi :
'; xajax.debug.text[125] = 'TAMAMLANDI ['; xajax.debug.text[126] = 'ms]'; xajax.debug.text[127] = 'ISTEK NESNESI BASLATILIYOR'; /* Array: exceptions */ xajax.debug.exceptions = []; xajax.debug.exceptions[10001] = 'Geçersiz XML cevabi: Cevap bilinmeyen bir etiket tasiyor: {data}.'; xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest hazir degil, xajax nesnesi etkisizlestirildi.'; xajax.debug.exceptions[10003] = 'Islem kuyrugu fazla yüklendi: Kuyruk dolu oldugu için nesne kuyruga eklenemiyor.'; xajax.debug.exceptions[10004] = 'Geçersiz XML cevabi: Cevap bilinmeyen bir etiket veya metin tasiyor: {data}.'; xajax.debug.exceptions[10005] = 'Geçersiz istek URI: Geçersiz veya kayip URI; otomatik tespit yapilamadi; lütfen açikça bir tane belirleyiniz.'; xajax.debug.exceptions[10006] = 'Geçersiz cevap komutu: Bozulmus cevap komutu alindi.'; xajax.debug.exceptions[10007] = 'Geçersiz cevap komutu: [{data}] komutu bilinmiyor.'; xajax.debug.exceptions[10008] = '[{data}] ID li element dosya içinde bulunamadi.'; xajax.debug.exceptions[10009] = 'Geçersiz istek: Fonksiyon isim parametresi eksik.'; xajax.debug.exceptions[10010] = 'Geçersiz istek: Fonksiyon nesne parametresi eksik.'; } if ('undefined' != typeof xajax.config) { if ('undefined' != typeof xajax.config.status) { /* Object: update */ xajax.config.status.update = function() { return { onRequest: function() { window.status = 'İstek Gönderiliyor...'; }, onWaiting: function() { window.status = 'Cevap Bekleniyor...'; }, onProcessing: function() { window.status = 'İşlem Devam Ediyor...'; }, onComplete: function() { window.status = 'Tamamlandı.'; } } } } } php-xajax-0.5/xajax_js/xajax_lang_de_uncompressed.js0000644000175000017500000000653511100036744021423 0ustar dgildgil/** * translation for: xajax v.x.x * @version: 1.0.0 * @author: mic * @copyright xajax project * @license GNU/GPL * @package xajax x.x.x * @since v.x.x.x * save as UTF-8 */ if ('undefined' != typeof xajax.debug) { /* Array: text */ xajax.debug.text = []; xajax.debug.text[100] = 'WARNUNG: '; xajax.debug.text[101] = 'FEHLER: '; xajax.debug.text[102] = 'XAJAX FEHLERSUCHE NACHRICHT:\n'; xajax.debug.text[103] = '...\n[UMGFANGREICHE ANTWORT]\n...'; xajax.debug.text[104] = 'SENDE ANFRAGE'; xajax.debug.text[105] = 'GESENDET ['; xajax.debug.text[106] = ' bytes]'; xajax.debug.text[107] = 'STARTE AUFRUF: '; xajax.debug.text[108] = 'URI: '; xajax.debug.text[109] = 'BEGINNE ANFRAGE'; xajax.debug.text[110] = 'PARAMETER IN BEARBEITUNG ['; xajax.debug.text[111] = ']'; xajax.debug.text[112] = 'KEINE PARAMETER ZU VERARBEITEN'; xajax.debug.text[113] = 'BEREITE REQUEST VOR'; xajax.debug.text[114] = 'BEGINNE XAJAX CALL (veraltet: verwendet stattdessen xajax.request)'; xajax.debug.text[115] = 'BEGINNE XAJAX ANFRAGE'; xajax.debug.text[116] = 'Die vom Server erhaltenen Daten konnten nicht verarbeitet werden.\n'; xajax.debug.text[117] = '.\nPrüfe auf Fehlermeldungen des Servers.'; xajax.debug.text[118] = 'ERHALTEN [status: '; xajax.debug.text[119] = ', Größe: '; xajax.debug.text[120] = ' bytes, Zeit: '; xajax.debug.text[121] = 'ms]:\n'; xajax.debug.text[122] = 'Der Server hat folgenden HTTP-Status zurück gesendet: '; xajax.debug.text[123] = '\nERHALTEN:\n'; xajax.debug.text[124] = 'Der Server lieferte einen Redirect nach:
'; xajax.debug.text[125] = 'ABGESCHLOSSEN ['; xajax.debug.text[126] = 'ms]'; xajax.debug.text[127] = 'INITIALISIERE REQUEST OBJEKT'; /* Array: exceptions */ xajax.debug.exceptions = []; xajax.debug.exceptions[10001] = 'Ungültige XML-Antwort: die Antwort enthält ein ungültiges Tag: {data}.'; xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest ist nicht verfügbar, XajaX ist nicht verfügbar.'; xajax.debug.exceptions[10003] = 'Warteschleife-Überlauf: kann Objekt nicht an Warteschleife übergeben da diese voll ist.'; xajax.debug.exceptions[10004] = 'Ungültige XML-Antwort: die Antwort enthält einen unerwarteten Tag oder Text: {data}.'; xajax.debug.exceptions[10005] = 'Ungültige Request-URI: Ungültige oder Fehlende URI; Autoerkennung fehlgeschlagen; bitte nur eine einzige URI angeben.'; xajax.debug.exceptions[10006] = 'Ungültiges Antwort-Befehl: Unvollständiges Objekt zurück erhalten.'; xajax.debug.exceptions[10007] = 'Ungültiges Antwort-Befehl: Befehl [{data}] ist nicht bekannt.'; xajax.debug.exceptions[10008] = 'Es konnte kein Element mit der ID [{data}] konnte im Dokument gefunden werden.'; xajax.debug.exceptions[10009] = 'Ungültige Anfrage: Fehlender Funktionsparameter - name.'; xajax.debug.exceptions[10010] = 'Ungültige Anfrage: Fehlender Funktionsparameter - object.'; } if ('undefined' != typeof xajax.config) { if ('undefined' != typeof xajax.config.status) { /* Object: update */ xajax.config.status.update = function() { return { onRequest: function() { window.status = 'Sende Anfrage...'; }, onWaiting: function() { window.status = 'Warten auf Antwort...'; }, onProcessing: function() { window.status = 'Verarbeitung...'; }, onComplete: function() { window.status = 'Fertig.'; } } } } } php-xajax-0.5/xajax_js/xajax_lang_nl.js0000644000175000017500000000540211100036744016645 0ustar dgildgilif('undefined'!=typeof xajax.debug){xajax.debug.text=[];xajax.debug.text[100]='FOUTMELDING: ';xajax.debug.text[101]='FOUT: ';xajax.debug.text[102]='XAJAX FOUTMELDINGS BERICHT:\n';xajax.debug.text[103]='...\n[LANG ANTWOORD]\n...';xajax.debug.text[104]='VERZENDING AANVRAAG';xajax.debug.text[105]='VERZONDEN [';xajax.debug.text[106]=' bytes]';xajax.debug.text[107]='AANROEPING: ';xajax.debug.text[108]='URI: ';xajax.debug.text[109]='INITIALISATIE AANVRAAG';xajax.debug.text[110]='VERWERKING PARAMETERS [';xajax.debug.text[111]=']';xajax.debug.text[112]='GEEN PARAMETERS OM TE VERWERKEN';xajax.debug.text[113]='VOORBEREIDING AANVRAAG';xajax.debug.text[114]='BEGIN XAJAX AANVRAAG (verouderd: gebruik xajax.request)';xajax.debug.text[115]='BEGIN XAJAX AANVRAAG';xajax.debug.text[116]='Er is geen verwerkingsbestand gespecificeerd om de aanvraag te verwerken.\n';xajax.debug.text[117]='.\nBekijk foutmeldingen van de server.';xajax.debug.text[118]='ONTVANGEN [status: ';xajax.debug.text[119]=', omvang: ';xajax.debug.text[120]=' bytes, Zeit: ';xajax.debug.text[121]='ms]:\n';xajax.debug.text[122]='De server retourneert de volgende HTTP-status: ';xajax.debug.text[123]='\nONTVANGEN:\n';xajax.debug.text[124]='De server retourneert een doorverwijzing naar:
';xajax.debug.text[125]='KLAAR [';xajax.debug.text[126]='ms]';xajax.debug.text[127]='INITIALISATIE OBJECT AANVRAAG';xajax.debug.exceptions=[];xajax.debug.exceptions[10001]='Ongeldig XML-antwoord: het antwoord bevat een onbekende tag: {data}.';xajax.debug.exceptions[10002]='GetRequestObject: XMLHttpRequest is niet beschikbaar, XajaX is uitgeschakeld.';xajax.debug.exceptions[10003]='Wachtrij limiet overschreden: kan het object niet in de wachtrij plaatsen, omdat die vol is.';xajax.debug.exceptions[10004]='Ongeldig XML-antwoord: het antwoord bevat een onverwachte tag of tekst: {data}.';xajax.debug.exceptions[10005]='Ongeldige Request-URI: Ongeldige of ontbrekende URI; automatische detectie faalt; specificeer een URI expliciet.';xajax.debug.exceptions[10006]='Ongeldig antwoord bevel: misvormd antwoord bevel ontvangen.';xajax.debug.exceptions[10007]='Ongeldig antwoord bevel: Bevel [{data}] is niet bekend.';xajax.debug.exceptions[10008]='Element met het ID [{data}] kon niet in het document worden gevonden.';xajax.debug.exceptions[10009]='Ongeldige aanvraag: Missende functie parameter - naam.';xajax.debug.exceptions[10010]='Ongeldige aanvraag: Missende functie parameter - object.';} if('undefined'!=typeof xajax.config){if('undefined'!=typeof xajax.config.status){xajax.config.status.update=function(){return{onRequest:function(){window.status="Verzenden aanvraag...";}, onWaiting:function(){window.status="Wachten op antwoord...";}, onProcessing:function(){window.status="Verwerking...";}, onComplete:function(){window.status="Afgesloten.";} } } } } php-xajax-0.5/xajax_js/xajax_lang_fr.js0000644000175000017500000000542611045155650016657 0ustar dgildgilxajax.debug.text=[];xajax.debug.text[100]='ATTENTION : ';xajax.debug.text[101]='ERREUR : ';xajax.debug.text[102]='MESSAGE DE DEBUG XAJAX :\n';xajax.debug.text[103]='...\n[RPONSE LONGUE]\n...';xajax.debug.text[104]='ENVOI DE LA REQUTE';xajax.debug.text[105]='ENVOY [';xajax.debug.text[106]=' octets]';xajax.debug.text[107]='APPEL : ';xajax.debug.text[108]='URI : ';xajax.debug.text[109]='INITIALISATION DE LA REQUTE';xajax.debug.text[110]='TRAITEMENT DES PARAMTRES [';xajax.debug.text[111]=']';xajax.debug.text[112]='AUCUN PARAMTRE TRAITER';xajax.debug.text[113]='PRPARATION DE LA REQUTE';xajax.debug.text[114]='DBUT DE L\'APPEL XAJAX (dprci: utilisez plutt xajax.request)';xajax.debug.text[115]='DBUT DE LA REQUTE';xajax.debug.text[116]='Aucun traitement disponible pour traiter la rponse du serveur.\n';xajax.debug.text[117]='.\nVrifie s\'il existe des messages d\'erreur du serveur.';xajax.debug.text[118]='REUS [statut : ';xajax.debug.text[119]=', taille: ';xajax.debug.text[120]=' octets, temps: ';xajax.debug.text[121]='ms] :\n';xajax.debug.text[122]='Le serveur a retourn la statut HTTP suivant : ';xajax.debug.text[123]='\nREUS :\n';xajax.debug.text[124]='Le serveur a indiqu une redirection vers :
';xajax.debug.text[125]='FAIT [';xajax.debug.text[126]='ms]';xajax.debug.text[127]='INITIALISATION DE L\'OBJET REQUTE';xajax.debug.exceptions=[];xajax.debug.exceptions[10001]='Rponse XML non valide : La rponse contient une balise inconnue : {data}.';xajax.debug.exceptions[10002]='GetRequestObject : XMLHttpRequest n\'est pas disponible, xajax est dsactiv.';xajax.debug.exceptions[10003]='File pleine : Ne peut ajouter un objet la file car elle est pleine.';xajax.debug.exceptions[10004]='Rponse XML non valide : La rponse contient une balise ou un texte inattendu : {data}.';xajax.debug.exceptions[10005]='URI de la requte non valide : URI non valide ou manquante; auto-dtection choue; veuillez en spcifier une explicitement.';xajax.debug.exceptions[10006]='Rponse de commande invalide : Commande de rponse reue mal forme.';xajax.debug.exceptions[10007]='Rponse de commande invalide : Commande [{data}] est inconnue.';xajax.debug.exceptions[10008]='L\'lment d\'ID [{data}] est introuvable dans le document.';xajax.debug.exceptions[10009]='Requte invalide : Aucun nom de fonction indiqu en paramtre.';xajax.debug.exceptions[10010]='Requte invalide : Aucun objet indiqu en paramtre pour la fonction.';if('undefined'!=typeof xajax.config){if('undefined'!=typeof xajax.config.status){xajax.config.status.update=function(){return{onRequest:function(){window.status='Envoi de la requte...';}, onWaiting:function(){window.status='Attente de la rponse...';}, onProcessing:function(){window.status='En cours de traitement...';}, onComplete:function(){window.status='Fait.';} } } } } php-xajax-0.5/xajax_js/xajax_debug_uncompressed.js0000644000175000017500000006256311137037724021134 0ustar dgildgil/* File: xajax_debug.js This optional file contains the debugging module for use with xajax. If you include this module after the standard module, you will receive debugging messages, including errors, that occur during the processing of your xajax requests. Title: xajax debugging module Please see for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajax_debug_uncompressed.js 327 2007-02-28 16:55:26Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ try { /* Class: xajax.debug This object contains the variables and functions used to display process state messages and to trap error conditions and report them to the user via a secondary browser window or alert messages as necessary. */ if ('undefined' == typeof xajax) throw { name: 'SequenceError', message: 'Error: xajax core was not detected, debug module disabled.' } if ('undefined' == typeof xajax.debug) xajax.debug = {} /* String: xajax.debug.workId Stores a 'unique' identifier for this session so that an existing debugging window can be detected, else one will be created. */ xajax.debug.workId = 'xajaxWork'+ new Date().getTime(); /* String: xajax.debug.windowSource The default URL that is given to the debugging window upon creation. */ xajax.debug.windowSource = 'about:blank'; /* String: xajax.debug.windowID A 'unique' name used to identify the debugging window that is attached to this xajax session. */ xajax.debug.windowID = 'xajax_debug_'+xajax.debug.workId; /* String: windowStyle The parameters that will be used to create the debugging window. */ if ('undefined' == typeof xajax.debug.windowStyle) xajax.debug.windowStyle = 'width=800,' + 'height=600,' + 'scrollbars=yes,' + 'resizable=yes,' + 'status=yes'; /* String: windowTemplate The HTML template and CSS style information used to populate the debugging window upon creation. */ if ('undefined' == typeof xajax.debug.windowTemplate) xajax.debug.windowTemplate = '' + '' + 'xajax debug output' + '' + '' + '

xajax debug output

' + '
' + ''; /* Object: window A reference to the debugging window, once constructed, where messages will be displayed throughout the request process. This is constructed internally as needed. */ /* Array: xajax.debug.text */ xajax.debug.text = []; xajax.debug.text[100] = 'WARNING: '; xajax.debug.text[101] = 'ERROR: '; xajax.debug.text[102] = 'XAJAX DEBUG MESSAGE:\n'; xajax.debug.text[103] = '...\n[LONG RESPONSE]\n...'; xajax.debug.text[104] = 'SENDING REQUEST'; xajax.debug.text[105] = 'SENT ['; xajax.debug.text[106] = ' bytes]'; xajax.debug.text[107] = 'CALLING: '; xajax.debug.text[108] = 'URI: '; xajax.debug.text[109] = 'INITIALIZING REQUEST'; xajax.debug.text[110] = 'PROCESSING PARAMETERS ['; xajax.debug.text[111] = ']'; xajax.debug.text[112] = 'NO PARAMETERS TO PROCESS'; xajax.debug.text[113] = 'PREPARING REQUEST'; xajax.debug.text[114] = 'STARTING XAJAX CALL (deprecated: use xajax.request instead)'; xajax.debug.text[115] = 'STARTING XAJAX REQUEST'; xajax.debug.text[116] = 'No response processor is available to process the response from the server.\n'; xajax.debug.text[117] = '.\nCheck for error messages from the server.'; xajax.debug.text[118] = 'RECEIVED [status: '; xajax.debug.text[119] = ', size: '; xajax.debug.text[120] = ' bytes, time: '; xajax.debug.text[121] = 'ms]:\n'; xajax.debug.text[122] = 'The server returned the following HTTP status: '; xajax.debug.text[123] = '\nRECEIVED:\n'; xajax.debug.text[124] = 'The server returned a redirect to:
'; xajax.debug.text[125] = 'DONE ['; xajax.debug.text[126] = 'ms]'; xajax.debug.text[127] = 'INITIALIZING REQUEST OBJECT'; /* Array: xajax.debug.exceptions */ xajax.debug.exceptions = []; xajax.debug.exceptions[10001] = 'Invalid response XML: The response contains an unknown tag: {data}.'; xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest is not available, xajax is disabled.'; xajax.debug.exceptions[10003] = 'Queue overflow: Cannot push object onto queue because it is full.'; xajax.debug.exceptions[10004] = 'Invalid response XML: The response contains an unexpected tag or text: {data}.'; xajax.debug.exceptions[10005] = 'Invalid request URI: Invalid or missing URI; autodetection failed; please specify a one explicitly.'; xajax.debug.exceptions[10006] = 'Invalid response command: Malformed response command received.'; xajax.debug.exceptions[10007] = 'Invalid response command: Command [{data}] is not a known command.'; xajax.debug.exceptions[10008] = 'Element with ID [{data}] not found in the document.'; xajax.debug.exceptions[10009] = 'Invalid request: Missing function name parameter.'; xajax.debug.exceptions[10010] = 'Invalid request: Missing function object parameter.'; /* Function: xajax.debug.getExceptionText Parameters: e - (object): Exception */ xajax.debug.getExceptionText = function(e) { if ('undefined' != typeof e.code) { if ('undefined' != typeof xajax.debug.exceptions[e.code]) { var msg = xajax.debug.exceptions[e.code]; if ('undefined' != typeof e.data) { msg.replace('{data}', e.data); } return msg; } } else if ('undefined' != typeof e.name) { var msg = e.name; if ('undefined' != typeof e.message) { msg += ': '; msg += e.message; } return msg; } return 'An unknown error has occurred.'; } /* Function: xajax.debug.writeMessage Output a debug message to the debug window if available or send to an alert box. If the debug window has not been created, attempt to create it. Parameters: text - (string): The text to output. prefix - (string): The prefix to use; this is prepended onto the message; it should indicate the type of message (warning, error) cls - (stirng): The className that will be applied to the message; invoking a style from the CSS provided in . Should be one of the following: - warningText - errorText */ xajax.debug.writeMessage = function(text, prefix, cls) { try { var xd = xajax.debug; if ('undefined' == typeof xd.window || true == xd.window.closed) { xd.window = window.open(xd.windowSource, xd.windowID, xd.windowStyle); if ("about:blank" == xd.windowSource) xd.window.document.write(xd.windowTemplate); } var xdw = xd.window; var xdwd = xdw.document; if ('undefined' == typeof prefix) prefix = ''; if ('undefined' == typeof cls) cls = 'debugText'; text = xajax.debug.prepareDebugText(text); var debugTag = xdwd.getElementById('debugTag'); var debugEntry = xdwd.createElement('div'); var debugDate = xdwd.createElement('span'); var debugText = xdwd.createElement('pre'); debugDate.innerHTML = new Date().toString(); debugText.innerHTML = prefix + text; debugEntry.appendChild(debugDate); debugEntry.appendChild(debugText); debugTag.insertBefore(debugEntry, debugTag.firstChild); // don't allow 'style' issues to hinder the debug output try { debugEntry.className = 'debugEntry'; debugDate.className = 'debugDate'; debugText.className = cls; } catch (e) { } } catch (e) { if (text.length > 1000) text = text.substr(0,1000) + xajax.debug.text[102]; alert(xajax.debug.text[102] + text); } } /* Function: xajax.debug.prepareDebugText Convert special characters to their HTML equivellents so they will show up in the . Parameters: text - (string): Debug text */ xajax.debug.prepareDebugText = function(text) { try { text = text.replace(/&/g, '&') .replace(//g, '>') .replace(/\n/g, '
'); return text; } catch (e) { xajax.debug.stringReplace = function(haystack, needle, newNeedle) { var segments = haystack.split(needle); haystack = ''; for (var i = 0; i < segments.length; ++i) { if (0 != i) haystack += newNeedle; haystack += segments[i]; } return haystack; } xajax.debug.prepareDebugText = function(text) { text = xajax.debug.stringReplace(text, '&', '&'); text = xajax.debug.stringReplace(text, '<', '<'); text = xajax.debug.stringReplace(text, '>', '>'); text = xajax.debug.stringReplace(text, '\n', '
'); return text; } xajax.debug.prepareDebugText(text); } } /* Function: xajax.debug.executeCommand Catch any exceptions that are thrown by a response command handler and display a message in the debugger. This is a wrapper function which surrounds the standard function. */ xajax.debug.executeCommand = xajax.executeCommand; xajax.executeCommand = function(args) { try { if ('undefined' == typeof args.cmd) throw { code: 10006 }; if (false == xajax.command.handler.isRegistered(args)) throw { code: 10007, data: args.cmd }; return xajax.debug.executeCommand(args); } catch(e) { var msg = 'ExecuteCommand ('; if ('undefined' != typeof args.sequence) { msg += '#'; msg += args.sequence; msg += ', '; } if ('undefined' != typeof args.cmdFullName) { msg += '"'; msg += args.cmdFullName; msg += '"'; } msg += '):\n'; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); } return true; } /* Function: xajax.parseAttributes Catch any exception thrown during the parsing of response command attributes and display an appropriate debug message. This is a wrapper around the standard function. Parameters: child - (object): Childnode obj - (object): Object */ xajax.debug.parseAttributes = xajax.parseAttributes; xajax.parseAttributes = function(child, obj) { try { xajax.debug.parseAttributes(child, obj); } catch(e) { var msg = 'ParseAttributes:\n'; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); } } xajax.debug.commandHandler = xajax.command.handler.unregister('dbg'); xajax.command.handler.register('dbg', function(args) { args.cmdFullName = 'debug message'; xajax.debug.writeMessage(args.data, xajax.debug.text[100], 'warningText'); return xajax.debug.commandHandler(args); }); /* Function: xajax.tools.$ Catch any exceptions thrown while attempting to locate an HTML element by it's unique name. This is a wrapper around the standard function. Parameters: sId - (string): Element ID or name */ xajax.debug.$ = xajax.tools.$; xajax.tools.$ = function(sId) { try { var returnValue = xajax.debug.$(sId); if ('object' != typeof returnValue) throw { code: 10008 }; } catch (e) { var msg = '$:'; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[100], 'warningText'); } return returnValue; } /* Function: xajax.tools._objectToXML Generate a message indicating that a javascript object is being converted to xml. Indicate the max depth and size. Then display the size of the object upon completion. Catch any exceptions thrown during the conversion process. This is a wrapper around the standard function. Parameters: obj - (object): guard - (object): */ xajax.debug._objectToXML = xajax.tools._objectToXML; xajax.tools._objectToXML = function(obj, guard) { try { if (0 == guard.size) { var msg = 'OBJECT TO XML: maxDepth = '; msg += guard.maxDepth; msg += ', maxSize = '; msg += guard.maxSize; xajax.debug.writeMessage(msg); } var r = xajax.debug._objectToXML(obj, guard); if (0 == guard.depth) { var msg = 'OBJECT TO XML: size = '; msg += guard.size; xajax.debug.writeMessage(msg); } return r; } catch(e) { var msg = 'ObjectToXML: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); } return ''; } /* Function: xajax._internalSend Generate a message indicating that the xajax request is about the be sent to the server. This is a wrapper around the standard function. */ xajax.debug._internalSend = xajax._internalSend; xajax._internalSend = function(oRequest) { try { xajax.debug.writeMessage(xajax.debug.text[104]); xajax.debug.writeMessage( xajax.debug.text[105] + oRequest.requestData.length + xajax.debug.text[106] ); oRequest.beginDate = new Date(); xajax.debug._internalSend(oRequest); } catch (e) { var msg = 'InternalSend: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.submitRequest Generate a message indicating that a request is ready to be submitted; providing the URL and the function being invoked. Catch any exceptions thrown and display a message. This is a wrapper around the standard function. */ xajax.debug.submitRequest = xajax.submitRequest; xajax.submitRequest = function(oRequest) { var msg = oRequest.method; msg += ': '; text = decodeURIComponent(oRequest.requestData); text = text.replace(new RegExp('&xjx', 'g'), '\n&xjx'); text = text.replace(new RegExp('', 'g'), '\n'); text = text.replace(new RegExp('', 'g'), '\n'); text = text.replace(new RegExp('', 'g'), '\n\n'); msg += text; xajax.debug.writeMessage(msg); msg = xajax.debug.text[107]; var separator = '\n'; for (var mbr in oRequest.functionName) { msg += separator; msg += mbr; msg += ': '; msg += oRequest.functionName[mbr]; separator = '\n'; } msg += separator; msg += xajax.debug.text[108]; msg += separator; msg += oRequest.URI; xajax.debug.writeMessage(msg); try { return xajax.debug.submitRequest(oRequest); } catch (e) { xajax.debug.writeMessage(e.message); if (0 < oRequest.retry) throw e; } } /* Function: xajax.initializeRequest Generate a message indicating that the request object is being initialized. This is a wrapper around the standard function. */ xajax.debug.initializeRequest = xajax.initializeRequest; xajax.initializeRequest = function(oRequest) { try { var msg = xajax.debug.text[109]; xajax.debug.writeMessage(msg); return xajax.debug.initializeRequest(oRequest); } catch (e) { var msg = 'InitializeRequest: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.processParameters Generate a message indicating that the request object is being populated with the parameters provided. This is a wrapper around the standard function. */ xajax.debug.processParameters = xajax.processParameters; xajax.processParameters = function(oRequest) { try { if ('undefined' != typeof oRequest.parameters) { var msg = xajax.debug.text[110]; msg += oRequest.parameters.length; msg += xajax.debug.text[111]; xajax.debug.writeMessage(msg); } else { var msg = xajax.debug.text[112]; xajax.debug.writeMessage(msg); } return xajax.debug.processParameters(oRequest); } catch (e) { var msg = 'ProcessParameters: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.prepareRequest Generate a message indicating that the request is being prepared. This may occur more than once for a request if it errors and a retry is attempted. This is a wrapper around the standard */ xajax.debug.prepareRequest = xajax.prepareRequest; xajax.prepareRequest = function(oRequest) { try { var msg = xajax.debug.text[113]; xajax.debug.writeMessage(msg); return xajax.debug.prepareRequest(oRequest); } catch (e) { var msg = 'PrepareRequest: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.call Validates that a function name was provided, generates a message indicating that a xajax call is starting and sets a flag in the request object indicating that debugging is enabled for this call. This is a wrapper around the standard function. */ xajax.debug.call = xajax.call; xajax.call = function() { try { xajax.debug.writeMessage(xajax.debug.text[114]); var numArgs = arguments.length; if (0 == numArgs) throw { code: 10009 }; var functionName = arguments[0]; var oOptions = {} if (1 < numArgs) oOptions = arguments[1]; oOptions.debugging = true; return xajax.debug.call(functionName, oOptions); } catch (e) { var msg = 'Call: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.request Validates that a function name was provided, generates a message indicating that a xajax request is starting and sets a flag in the request object indicating that debugging is enabled for this request. This is a wrapper around the standard function. */ xajax.debug.request = xajax.request; xajax.request = function() { try { xajax.debug.writeMessage(xajax.debug.text[115]); var numArgs = arguments.length; if (0 == numArgs) throw { code: 10010 }; var oFunction = arguments[0]; var oOptions = {} if (1 < numArgs) oOptions = arguments[1]; oOptions.debugging = true; return xajax.debug.request(oFunction, oOptions); } catch (e) { var msg = 'Request: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.getResponseProcessor Generate an error message when no reponse processor is available to process the type of response returned from the server. This is a wrapper around the standard function. */ xajax.debug.getResponseProcessor = xajax.getResponseProcessor; xajax.getResponseProcessor = function(oRequest) { try { var fProc = xajax.debug.getResponseProcessor(oRequest); if ('undefined' == typeof fProc) { var msg = xajax.debug.text[116]; try { var contentType = oRequest.request.getResponseHeader('content-type'); msg += "Content-Type: "; msg += contentType; if ('text/html' == contentType) { msg += xajax.debug.text[117]; } } catch (e) { } xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); } return fProc; } catch (e) { var msg = 'GetResponseProcessor: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.responseReceived Generate a message indicating that a response has been received from the server; provide some statistical data regarding the response and the response time. Catch any exceptions that are thrown during the processing of the response and generate a message. This is a wrapper around the standard function. */ xajax.debug.responseReceived = xajax.responseReceived; xajax.responseReceived = function(oRequest) { var xx = xajax; var xt = xx.tools; var xd = xx.debug; var oRet; try { var status = oRequest.request.status; if (xt.arrayContainsValue(xx.responseSuccessCodes, status)) { var packet = oRequest.request.responseText; packet = packet.replace(new RegExp('', 'g'), '\n'); packet = packet.replace(new RegExp('', 'g'), '\n'); packet = packet.replace(new RegExp('', 'g'), '\n'); packet = packet.replace(new RegExp('', 'g'), '\n\n'); packet = packet.replace(new RegExp('', 'g'), '\n'); oRequest.midDate = new Date(); var msg = xajax.debug.text[118]; msg += oRequest.request.status; msg += xajax.debug.text[119]; msg += packet.length; msg += xajax.debug.text[120]; msg += (oRequest.midDate - oRequest.beginDate); msg += xajax.debug.text[121]; msg += packet; xd.writeMessage(msg); } else if (xt.arrayContainsValue(xx.responseErrorsForAlert, status)) { var msg = xajax.debug.text[122]; msg += status; msg += xajax.debug.text[123]; msg += oRequest.request.responseText; xd.writeMessage(msg, xajax.debug.text[101], 'errorText'); } else if (xt.arrayContainsValue(xx.responseRedirectCodes, status)) { var msg = xajax.debug.text[124]; msg += oRequest.request.getResponseHeader('location'); xd.writeMessage(msg); } oRet = xd.responseReceived(oRequest); } catch (e) { var msg = 'ResponseReceived: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xd.writeMessage(msg, xajax.debug.text[101], 'errorText'); } return oRet; } /* Function: xajax.completeResponse Generate a message indicating that the request has completed and provide some statistics regarding the request and response. This is a wrapper around the standard function. */ xajax.debug.completeResponse = xajax.completeResponse; xajax.completeResponse = function(oRequest) { try { var returnValue = xajax.debug.completeResponse(oRequest); oRequest.endDate = new Date(); var msg = xajax.debug.text[125]; msg += (oRequest.endDate - oRequest.beginDate); msg += xajax.debug.text[126]; xajax.debug.writeMessage(msg); return returnValue; } catch (e) { var msg = 'CompleteResponse: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.tools.getRequestObject Generate a message indicating that the request object is being initialized. Catch any exceptions that are thrown during the process or initializing a new request object. This is a wrapper around the standard function. */ xajax.debug.getRequestObject = xajax.tools.getRequestObject; xajax.tools.getRequestObject = function() { try { xajax.debug.writeMessage(xajax.debug.text[127]); return xajax.debug.getRequestObject(); } catch (e) { var msg = 'GetRequestObject: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); throw e; } } /* Function: xajax.dom.assign Catch any exceptions thrown during the assignment and display an error message. This is a wrapper around the standard function. */ if (xajax.dom.assign) { xajax.debug.assign = xajax.dom.assign; xajax.dom.assign = function(element, property, data) { try { return xajax.debug.assign(element, property, data); } catch (e) { var msg = 'xajax.dom.assign: '; msg += xajax.debug.getExceptionText(e); msg += '\n'; msg += 'Eval: element.'; msg += property; msg += ' = data;\n'; xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText'); } return true; } } /* Function: xajax.tools.queue.retry */ if (xajax.tools) { if (xajax.tools.queue) { if (xajax.tools.queue.retry) { if ('undefined' == typeof xajax.debug.tools) xajax.debug.tools = {}; if ('undefined' == typeof xajax.debug.tools.queue) xajax.debug.tools.queue = {}; xajax.debug.tools.queue.retry = xajax.tools.queue.retry; xajax.tools.queue.retry = function(obj, count) { if (xajax.debug.tools.queue.retry(obj, count)) return true; // no 'exceeded' message for sleep command if (obj.cmd && 's' == obj.cmd) return false; xajax.debug.writeMessage('Retry count exceeded.'); return false; } } } } /* Boolean: xajax.debug.isLoaded true - indicates that the debugging module is loaded */ xajax.debug.isLoaded = true; /* Section: Redefine shortcuts. Must redefine these shortcuts so they point to the new debug (wrapper) versions: - - - Must redefine these shortcuts as well: - - */ xjx = {} xjx.$ = xajax.tools.$; xjx.getFormValues = xajax.tools.getFormValues; xjx.call = xajax.call; xjx.request = xajax.request; xajax.$ = xajax.tools.$; xajax.getFormValues = xajax.tools.getFormValues; } catch (e) { alert(e.name + ': ' + e.message); } php-xajax-0.5/xajax_js/xajax_lang_tr.js0000644000175000017500000000534211045155650016672 0ustar dgildgil if('undefined'!=typeof xajax.debug){xajax.debug.text=[];xajax.debug.text[100]='IKAZ: ';xajax.debug.text[101]='HATA: ';xajax.debug.text[102]='XAJAX DEBUG (HATA AYIKLAMASI) MESAJI:\n';xajax.debug.text[103]='...\n[UZUN YANIT]\n...';xajax.debug.text[104]='ISTEK GÖNDERILIYOR';xajax.debug.text[105]='GÖNDERILDI [';xajax.debug.text[106]=' byte]';xajax.debug.text[107]='ÇAGIRILIYOR: ';xajax.debug.text[108]='URI: ';xajax.debug.text[109]='ISTEK BASLATILIYOR';xajax.debug.text[110]='PARAMETRELER ISLENIYOR [';xajax.debug.text[111]=']';xajax.debug.text[112]='ISLENECEK PARAMETRE YOK';xajax.debug.text[113]='ISTEK HAZIRLANIYOR';xajax.debug.text[114]='XAJAX ÇAGRISI BASLATILIYOR (kullanimi tavsiye edilmiyor: yerine xajax.request kullanin)';xajax.debug.text[115]='XAJAX ISTEGI BASLATILIYOR';xajax.debug.text[116]='Sunucudan gelen cevabi isleyecek cevap islemcisi yok.\n';xajax.debug.text[117]='.\nSunucudan gelen hata mesajlarini kontrol edin.';xajax.debug.text[118]='ALINDI [durum: ';xajax.debug.text[119]=', boyut: ';xajax.debug.text[120]=' byte, süre: ';xajax.debug.text[121]='ms]:\n';xajax.debug.text[122]='Sunucu asagidaki HTTP durumunu gönderdi: ';xajax.debug.text[123]='\nALINDI:\n';xajax.debug.text[124]='Sunucu su adrese yönlendirme istegi gönderdi :
';xajax.debug.text[125]='TAMAMLANDI [';xajax.debug.text[126]='ms]';xajax.debug.text[127]='ISTEK NESNESI BASLATILIYOR';xajax.debug.exceptions=[];xajax.debug.exceptions[10001]='Geçersiz XML cevabi: Cevap bilinmeyen bir etiket tasiyor: {data}.';xajax.debug.exceptions[10002]='GetRequestObject: XMLHttpRequest hazir degil, xajax nesnesi etkisizlestirildi.';xajax.debug.exceptions[10003]='Islem kuyrugu fazla yüklendi: Kuyruk dolu oldugu için nesne kuyruga eklenemiyor.';xajax.debug.exceptions[10004]='Geçersiz XML cevabi: Cevap bilinmeyen bir etiket veya metin tasiyor: {data}.';xajax.debug.exceptions[10005]='Geçersiz istek URI: Geçersiz veya kayip URI; otomatik tespit yapilamadi; lütfen açikça bir tane belirleyiniz.';xajax.debug.exceptions[10006]='Geçersiz cevap komutu: Bozulmus cevap komutu alindi.';xajax.debug.exceptions[10007]='Geçersiz cevap komutu: [{data}] komutu bilinmiyor.';xajax.debug.exceptions[10008]='[{data}] ID li element dosya içinde bulunamadi.';xajax.debug.exceptions[10009]='Geçersiz istek: Fonksiyon isim parametresi eksik.';xajax.debug.exceptions[10010]='Geçersiz istek: Fonksiyon nesne parametresi eksik.';} if('undefined'!=typeof xajax.config){if('undefined'!=typeof xajax.config.status){xajax.config.status.update=function(){return{onRequest:function(){window.status='İstek Gönderiliyor...';}, onWaiting:function(){window.status='Cevap Bekleniyor...';}, onProcessing:function(){window.status='İşlem Devam Ediyor...';}, onComplete:function(){window.status='Tamamlandı.';} } } } } php-xajax-0.5/xajax_js/xajax_core_uncompressed.js0000644000175000017500000025601111137037724020767 0ustar dgildgil/* File: xajax_core.js This file contains the definition of the main xajax javascript core. This is the client side code which runs on the web browser or similar web enabled application. Include this in the HEAD of each page for which you wish to use xajax. Title: xajax core javascript library Please see for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajax_core_uncompressed.js 327 2007-02-28 16:55:26Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajax.config This class contains all the default configuration settings. These are application level settings; however, they can be overridden by including a xajax.config definition prior to including the file, or by specifying the appropriate configuration options on a per call basis. */ if ('undefined' == typeof xajax) xajax = {}; if ('undefined' == typeof xajax.config) xajax.config = {}; /* Function: xajax.config.setDefault This function will set a default configuration option if it is not already set. Parameters: option - (string): The name of the option that will be set. defaultValue - (unknown): The value to use if a value was not already set. */ xajax.config.setDefault = function(option, defaultValue) { if ('undefined' == typeof xajax.config[option]) xajax.config[option] = defaultValue; } /* Object: commonHeaders An array of header entries where the array key is the header option name and the associated value is the value that will set when the request object is initialized. These headers will be set for both POST and GET requests. */ xajax.config.setDefault('commonHeaders', { 'If-Modified-Since': 'Sat, 1 Jan 2000 00:00:00 GMT' }); /* Object: postHeaders An array of header entries where the array key is the header option name and the associated value is the value that will set when the request object is initialized. */ xajax.config.setDefault('postHeaders', {}); /* Object: getHeaders An array of header entries where the array key is the header option name and the associated value is the value that will set when the request object is initialized. */ xajax.config.setDefault('getHeaders', {}); /* Boolean: waitCursor true - xajax should display a wait cursor when making a request false - xajax should not show a wait cursor during a request */ xajax.config.setDefault('waitCursor', false); /* Boolean: statusMessages true - xajax should update the status bar during a request false - xajax should not display the status of the request */ xajax.config.setDefault('statusMessages', false); /* Object: baseDocument The base document that will be used throughout the code for locating elements by ID. */ xajax.config.setDefault('baseDocument', document); /* String: requestURI The URI that requests will be sent to. */ xajax.config.setDefault('requestURI', xajax.config.baseDocument.URL); /* String: defaultMode The request mode. 'asynchronous' - The request will immediately return, the response will be processed when (and if) it is received. 'synchronous' - The request will block, waiting for the response. This option allows the server to return a value directly to the caller. */ xajax.config.setDefault('defaultMode', 'asynchronous'); /* String: defaultHttpVersion The Hyper Text Transport Protocol version designated in the header of the request. */ xajax.config.setDefault('defaultHttpVersion', 'HTTP/1.1'); /* String: defaultContentType The content type designated in the header of the request. */ xajax.config.setDefault('defaultContentType', 'application/x-www-form-urlencoded'); /* Integer: defaultResponseDelayTime The delay time, in milliseconds, associated with the event. */ xajax.config.setDefault('defaultResponseDelayTime', 1000); /* Integer: defaultExpirationTime The amount of time to wait, in milliseconds, before a request is considered expired. This is used to trigger the to form a URL. */ xajax.config.setDefault('defaultMethod', 'POST'); // W3C: Method is case sensitive /* Integer: defaultRetry The number of times a request should be retried if it expires. */ xajax.config.setDefault('defaultRetry', 5); /* Object: defaultReturnValue The value returned by when in asynchronous mode, or when a syncrhonous call does not specify the return value. */ xajax.config.setDefault('defaultReturnValue', false); /* Integer: maxObjectDepth The maximum depth of recursion allowed when serializing objects to be sent to the server in a request. */ xajax.config.setDefault('maxObjectDepth', 20); /* Integer: maxObjectSize The maximum number of members allowed when serializing objects to be sent to the server in a request. */ xajax.config.setDefault('maxObjectSize', 2000); xajax.config.setDefault('responseQueueSize', 1000); /* Class: xajax.config.status Provides support for updating the browser's status bar during the request process. By splitting the status bar functionality into an object, the xajax developer has the opportunity to customize the status bar messages prior to sending xajax requests. */ xajax.config.status = { /* Function: update Constructs and returns a set of event handlers that will be called by the xajax framework to set the status bar messages. */ update: function() { return { onRequest: function() { window.status = 'Sending Request...'; }, onWaiting: function() { window.status = 'Waiting for Response...'; }, onProcessing: function() { window.status = 'Processing...'; }, onComplete: function() { window.status = 'Done.'; } } }, /* Function: dontUpdate Constructs and returns a set of event handlers that will be called by the xajax framework where status bar updates would normally occur. */ dontUpdate: function() { return { onRequest: function() {}, onWaiting: function() {}, onProcessing: function() {}, onComplete: function() {} } } } /* Class: xajax.config.cursor Provides the base functionality for updating the browser's cursor during requests. By splitting this functionalityh into an object of it's own, xajax developers can now customize the functionality prior to submitting requests. */ xajax.config.cursor = { /* Function: update Constructs and returns a set of event handlers that will be called by the xajax framework to effect the status of the cursor during requests. */ update: function() { return { onWaiting: function() { if (xajax.config.baseDocument.body) xajax.config.baseDocument.body.style.cursor = 'wait'; }, onComplete: function() { xajax.config.baseDocument.body.style.cursor = 'auto'; } } }, /* Function: dontUpdate Constructs and returns a set of event handlers that will be called by the xajax framework where cursor status changes would typically be made during the handling of requests. */ dontUpdate: function() { return { onWaiting: function() {}, onComplete: function() {} } } } /* Class: xajax.tools This contains utility functions which are used throughout the xajax core. */ xajax.tools = {} /* Function: xajax.tools.$ Shorthand for finding a uniquely named element within the document. Parameters: sId - (string): The unique name of the element (specified by the ID attribute), not to be confused with the name attribute on form elements. Returns: object - The element found or null. Note: This function uses the which allows to operate on the main window document as well as documents from contained iframes and child windows. See also: and */ xajax.tools.$ = function(sId) { if (!sId) return null; var oDoc = xajax.config.baseDocument; var obj = oDoc.getElementById(sId); if (obj) return obj; if (oDoc.all) return oDoc.all[sId]; return obj; } /* Function xajax.tools.arrayContainsValue Looks for a value within the specified array and, if found, returns true; otherwise it returns false. Parameters: array - (object): The array to be searched. valueToCheck - (object): The value to search for. Returns: true : The value is one of the values contained in the array. false : The value was not found in the specified array. */ xajax.tools.arrayContainsValue = function(array, valueToCheck) { var i = 0; var l = array.length; while (i < l) { if (array[i] == valueToCheck) return true; ++i; } return false; } /* Function: xajax.tools.doubleQuotes Replace all occurances of the single quote character with a double quote character. Parameters: haystack - The source string to be scanned. Returns: string - A new string with the modifications applied. */ xajax.tools.doubleQuotes = function(haystack) { return haystack.replace(new RegExp("'", 'g'), '"'); } /* Function: xajax.tools.singleQuotes Replace all occurances of the double quote character with a single quote character. haystack - The source string to be scanned. Returns: string - A new string with the modification applied. */ xajax.tools.singleQuotes = function(haystack) { return haystack.replace(new RegExp('"', 'g'), "'"); } /* Function: xajax.tools._escape Determine if the specified value contains special characters and create a CDATA section so the value can be safely transmitted. Parameters: data - (string or other): The source string value to be evaluated or an object of unknown type. Returns: string - The string value, escaped if necessary or the object provided if it is not a string. Note: When the specified object is NOT a string, the value is returned as is. */ xajax.tools._escape = function(data) { if ('undefined' == typeof data) return data; // 'object' is handled elsewhere, // 'string' handled below, // 'number' will be returned here // 'boolean' will be returned here if ('string' != typeof data) return data; var needCDATA = false; if (encodeURIComponent(data) != data) { needCDATA = true; var segments = data.split(''); var fragLen = fragments.length; segment = ''; for (var j = 0; j < fragLen; ++j) { if (0 != j) segment += ']]]]>'; segment += fragments[j]; } if (0 != i) data.push(''; return data; } /* Function: xajax.tools._objectToXML Convert a javascript object or array into XML suitable for transmission to the server. Parameters: obj - The object or array to convert. guard - An object used to track the level of recursion when encoding javascript objects. When an object contains a reference to it's parent and the parent contains a reference to the child, an infinite recursion will cause some browsers to crash. Returns: string - the xml representation of the object or array. See also: and */ xajax.tools._objectToXML = function(obj, guard) { var aXml = []; aXml.push(''); for (var key in obj) { ++guard.size; if (guard.maxSize < guard.size) return aXml.join(''); if ('undefined' != typeof obj[key]) { if ('constructor' == key) continue; if ('function' == typeof obj[key]) continue; aXml.push(''); var val = xajax.tools._escape(key); aXml.push(val); aXml.push(''); if ('object' == typeof obj[key]) { ++guard.depth; if (guard.maxDepth > guard.depth) { try { aXml.push(xajax.tools._objectToXML(obj[key], guard)); } catch (e) { // do nothing, if the debug module is installed // it will catch the exception and handle it } } --guard.depth; } else { var val = xajax.tools._escape(obj[key]); if ('undefined' == typeof val || null == val) { aXml.push('*'); } else { var sType = typeof val; if ('string' == sType) aXml.push('S'); else if ('boolean' == sType) aXml.push('B'); else if ('number' == sType) aXml.push('N'); aXml.push(val); } } aXml.push(''); } } aXml.push(''); return aXml.join(''); } /* Function: xajax.tools._enforceDataType Ensure that the javascript variable created is of the correct data type. Parameters: value (string) Returns: (unknown) - The value provided converted to the correct data type. */ xajax.tools._enforceDataType = function(value) { value = new String(value); var type = value.substr(0, 1); value = value.substr(1); if ('*' == type) value = null; else if ('N' == type) value = value - 0; else if ('B' == type) value = !!value; // else if ('S' == type) // value = new String(value); return value; } /* Function: xajax.tools._nodeToObject Deserialize a javascript object from an XML node. Parameters: node - A node, likely from the xml returned by the server. Returns: object - The object extracted from the xml node. */ xajax.tools._nodeToObject = function(node) { if (null == node) return ''; if ('undefined' != typeof node.nodeName) { if ('#cdata-section' == node.nodeName || '#text' == node.nodeName) { var data = ''; do if (node.data) data += node.data; while (node = node.nextSibling); return xajax.tools._enforceDataType(data); } else if ('xjxobj' == node.nodeName) { var key = null; var value = null; var data = new Array; var child = node.firstChild; while (child) { if ('e' == child.nodeName) { var grandChild = child.firstChild; while (grandChild) { if ('k' == grandChild.nodeName) // Don't support objects here, only number, string, etc... key = xajax.tools._enforceDataType(grandChild.firstChild.data); else ('v' == grandChild.nodeName) // Value might be object, string, number, boolean... even null or undefined value = xajax.tools._nodeToObject(grandChild.firstChild); grandChild = grandChild.nextSibling; } // Allow the value to be null or undefined (or a value) if (null != key) { // && null != value) { data[key] = value; key = value = null; } } child = child.nextSibling; } return data; } } throw { code: 10001, data: node.nodeName }; } /* Function: xajax.tools.getRequestObject Construct an XMLHttpRequest object dependent on the capabilities of the browser. Returns: object - Javascript XHR object. */ xajax.tools.getRequestObject = function() { if ('undefined' != typeof XMLHttpRequest) { xajax.tools.getRequestObject = function() { return new XMLHttpRequest(); } } else if ('undefined' != typeof ActiveXObject) { xajax.tools.getRequestObject = function() { try { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); } catch (e) { xajax.tools.getRequestObject = function() { try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch (e2) { xajax.tools.getRequestObject = function() { return new ActiveXObject('Microsoft.XMLHTTP'); } return xajax.tools.getRequestObject(); } } return xajax.tools.getRequestObject(); } } } else if (window.createRequest) { xajax.tools.getRequestObject = function() { return window.createRequest(); } } else { xajax.tools.getRequestObject = function() { throw { code: 10002 }; } } // this would seem to cause an infinite loop, however, the function should // be reassigned by now and therefore, it will not loop. return xajax.tools.getRequestObject(); } /* Function: xajax.tools.getBrowserHTML Insert the specified string of HTML into the document, then extract it. This gives the browser the ability to validate the code and to apply any transformations it deems appropriate. Parameters: sValue - (string): A block of html code or text to be inserted into the browser's document. Returns: The (potentially modified) html code or text. */ xajax.tools.getBrowserHTML = function(sValue) { var oDoc = xajax.config.baseDocument; if (!oDoc.body) return ''; var elWorkspace = xajax.$('xajax_temp_workspace'); if (!elWorkspace) { elWorkspace = oDoc.createElement('div'); elWorkspace.setAttribute('id', 'xajax_temp_workspace'); elWorkspace.style.display = 'none'; elWorkspace.style.visibility = 'hidden'; oDoc.body.appendChild(elWorkspace); } elWorkspace.innerHTML = sValue; var browserHTML = elWorkspace.innerHTML; elWorkspace.innerHTML = ''; return browserHTML; } /* Function: xajax.tools.willChange Tests to see if the specified data is the same as the current value of the element's attribute. Parameters: element - (string or object): The element or it's unique name (specified by the ID attribute) attribute - (string): The name of the attribute. newData - (string): The value to be compared with the current value of the specified element. Returns: true - The specified value differs from the current attribute value. false - The specified value is the same as the current value. */ xajax.tools.willChange = function(element, attribute, newData) { if ('string' == typeof element) element = xajax.$(element); if (element) { var oldData; eval('oldData=element.'+attribute); return (newData != oldData); } return false; } /* Function: xajax.tools.getFormValues Build an associative array of form elements and their values from the specified form. Parameters: element - (string): The unique name (id) of the form to be processed. disabled - (boolean, optional): Include form elements which are currently disabled. prefix - (string, optional): A prefix used for selecting form elements. Returns: An associative array of form element id and value. */ xajax.tools.getFormValues = function(parent) { var submitDisabledElements = false; if (arguments.length > 1 && arguments[1] == true) submitDisabledElements = true; var prefix = ''; if(arguments.length > 2) prefix = arguments[2]; if ('string' == typeof parent) parent = xajax.$(parent); var aFormValues = {}; // JW: Removing these tests so that form values can be retrieved from a specified // container element like a DIV, regardless of whether they exist in a form or not. // // if (parent.tagName) // if ('FORM' == parent.tagName.toUpperCase()) if (parent) if (parent.childNodes) xajax.tools._getFormValues(aFormValues, parent.childNodes, submitDisabledElements, prefix); return aFormValues; } /* Function: xajax.tools._getFormValues Used internally by to recursively get the value of form elements. This function will extract all form element values regardless of the depth of the element within the form. */ xajax.tools._getFormValues = function(aFormValues, children, submitDisabledElements, prefix) { var iLen = children.length; for (var i = 0; i < iLen; ++i) { var child = children[i]; if ('undefined' != typeof child.childNodes) xajax.tools._getFormValues(aFormValues, child.childNodes, submitDisabledElements, prefix); xajax.tools._getFormValue(aFormValues, child, submitDisabledElements, prefix); } } /* Function: xajax.tools._getFormValue Used internally by to extract a single form value. This will detect the type of element (radio, checkbox, multi-select) and add it's value(s) to the form values array. */ xajax.tools._getFormValue = function(aFormValues, child, submitDisabledElements, prefix) { if (!child.name) return; if ('PARAM' == child.tagName) return; if (child.disabled) if (true == child.disabled) if (false == submitDisabledElements) return; if (prefix != child.name.substring(0, prefix.length)) return; if (child.type) if (child.type == 'radio' || child.type == 'checkbox') if (false == child.checked) return; var name = child.name; var values = []; if ('select-multiple' == child.type) { var jLen = child.length; for (var j = 0; j < jLen; ++j) { var option = child.options[j]; if (true == option.selected) values.push(option.value); } } else { values = child.value; } var keyBegin = name.indexOf('['); if (0 <= keyBegin) { var n = name; var k = n.substr(0, n.indexOf('[')); var a = n.substr(n.indexOf('[')); if (typeof aFormValues[k] == 'undefined') aFormValues[k] = []; var p = aFormValues; // pointer reset while (a.length != 0) { var sa = a.substr(0, a.indexOf(']')+1); var lk = k; //save last key var lp = p; //save last pointer a = a.substr(a.indexOf(']')+1); p = p[k]; k = sa.substr(1, sa.length-2); if (k == '') { if ('select-multiple' == child.type) { k = lk; //restore last key p = lp; } else { k = p.length; } } if (typeof p[k] == 'undefined') p[k] = []; } p[k] = values; } else { aFormValues[name] = values; } } /* Function: xajax.tools.stripOnPrefix Detect, and if found, remove the prefix 'on' from the specified string. This is used while working with event handlers. Parameters: sEventName - (string): The string to be modified. Returns: string - The modified string. */ xajax.tools.stripOnPrefix = function(sEventName) { sEventName = sEventName.toLowerCase(); if (0 == sEventName.indexOf('on')) sEventName = sEventName.replace(/on/,''); return sEventName; } /* Function: xajax.tools.addOnPrefix Detect, and add if not found, the prefix 'on' from the specified string. This is used while working with event handlers. Parameters: sEventName - (string): The string to be modified. Returns: string - The modified string. */ xajax.tools.addOnPrefix = function(sEventName) { sEventName = sEventName.toLowerCase(); if (0 != sEventName.indexOf('on')) sEventName = 'on' + sEventName; return sEventName; } /* Class: xajax.tools.xml An object that contains utility function for processing xml response packets. */ xajax.tools.xml = {}; /* Function: xajax.tools.xml.parseAttributes Take the parameters passed in the command of the XML response and convert them to parameters of the args object. This will serve as the command object which will be stored in the response command queue. Parameters: child - (object): The xml child node which contains the attributes for the current response command. obj - (object): The current response command that will have the attributes applied. */ xajax.tools.xml.parseAttributes = function(child, obj) { var iLen = child.attributes.length; for (var i = 0; i < iLen; ++i) { var attr = child.attributes[i]; obj[attr.name] = attr.value; } } /* Function: xajax.tools.xml.parseChildren Parses the child nodes of the command of the response XML. Generally, the child nodes contain the data element of the command; this member may be an object, which will be deserialized by Parameters: child - (object): The xml node that contains the child (data) for the current response command object. obj - (object): The response command object. */ xajax.tools.xml.parseChildren = function(child, obj) { obj.data = ''; if (0 < child.childNodes.length) { if (1 < child.childNodes.length) { var grandChild = child.firstChild; do { if ('#cdata-section' == grandChild.nodeName || '#text' == grandChild.nodeName) { obj.data += grandChild.data; } } while (grandChild = grandChild.nextSibling); } else { var grandChild = child.firstChild; if ('xjxobj' == grandChild.nodeName) { obj.data = xajax.tools._nodeToObject(grandChild); return; } else if ('#cdata-section' == grandChild.nodeName || '#text' == grandChild.nodeName) { obj.data = grandChild.data; } } } else if ('undefined' != typeof child.data) { obj.data = child.data; } obj.data = xajax.tools._enforceDataType(obj.data); } /* Function: xajax.tools.xml.processFragment Parameters: xmlNode - (object): The first xml node in the xml fragment. seq - (number): A counter used to keep track of the sequence of this command in the response. oRet - (object): A variable that is used to return the request "return value" for use with synchronous requests. */ xajax.tools.xml.processFragment = function(xmlNode, seq, oRet, oRequest) { var xx = xajax; var xt = xx.tools; while (xmlNode) { if ('cmd' == xmlNode.nodeName) { var obj = {}; obj.fullName = '*unknown*'; obj.sequence = seq; obj.request = oRequest; obj.context = oRequest.context; xt.xml.parseAttributes(xmlNode, obj); xt.xml.parseChildren(xmlNode, obj); xt.queue.push(xx.response, obj); } else if ('xjxrv' == xmlNode.nodeName) { oRet = xt._nodeToObject(xmlNode.firstChild); } else if ('debugmsg' == xmlNode.nodeName) { // txt = xt._nodeToObject(xmlNode.firstChild); } else throw { code: 10004, data: xmlNode.nodeName } ++seq; xmlNode = xmlNode.nextSibling; } return oRet; } /* Class: xajax.tools.queue This contains the code and variables for building, populating and processing First In Last Out (FILO) buffers. */ xajax.tools.queue = {} /* Function: create Construct and return a new queue object. Parameters: size - (integer): The number of entries the queue will be able to hold. */ xajax.tools.queue.create = function(size) { return { start: 0, size: size, end: 0, commands: [], timeout: null } } /* Function: xajax.tools.queue.retry Maintains a retry counter for the given object. Parameters: obj - (object): The object to track the retry count for. count - (integer): The number of times the operation should be attempted before a failure is indicated. Returns: true - The object has not exhausted all the retries. false - The object has exhausted the retry count specified. */ xajax.tools.queue.retry = function(obj, count) { var retries = obj.retries; if (retries) { --retries; if (1 > retries) return false; } else retries = count; obj.retries = retries; return true; } /* Function: xajax.tools.queue.rewind Rewind the buffer head pointer, effectively reinserting the last retrieved object into the buffer. Parameters: theQ - (object): The queue to be rewound. */ xajax.tools.queue.rewind = function(theQ) { if (0 < theQ.start) --theQ.start; else theQ.start = theQ.size; } /* Function: xajax.tools.queue.setWakeup Set or reset a timeout that is used to restart processing of the queue. This allows the queue to asynchronously wait for an event to occur (giving the browser time to process pending events, like loading files) Parameters: theQ - (object): The queue to process upon timeout. when - (integer): The number of milliseconds to wait before starting/ restarting the processing of the queue. */ xajax.tools.queue.setWakeup = function(theQ, when) { if (null != theQ.timeout) { clearTimeout(theQ.timeout); theQ.timeout = null; } theQ.timout = setTimeout(function() { xajax.tools.queue.process(theQ); }, when); } /* Function: xajax.tools.queue.process While entries exist in the queue, pull and entry out and process it's command. When a command returns false, the processing is halted. Parameters: theQ - (object): The queue object to process. This should have been crated by calling . Returns: true - The queue was fully processed and is now empty. false - The queue processing was halted before the queue was fully processed. Note: - Use or call this function to cause the queue processing to continue. - This will clear the associated timeout, this function is not designed to be reentrant. - When an exception is caught, do nothing; if the debug module is installed, it will catch the exception and handle it. */ xajax.tools.queue.process = function(theQ) { if (null != theQ.timeout) { clearTimeout(theQ.timeout); theQ.timeout = null; } var obj = xajax.tools.queue.pop(theQ); while (null != obj) { try { if (false == xajax.executeCommand(obj)) return false; } catch (e) { } delete obj; obj = xajax.tools.queue.pop(theQ); } return true; } /* Function: xajax.tools.queue.push Push a new object into the tail of the buffer maintained by the specified queue object. Parameters: theQ - (object): The queue in which you would like the object stored. obj - (object): The object you would like stored in the queue. */ xajax.tools.queue.push = function(theQ, obj) { var next = theQ.end + 1; if (next > theQ.size) next = 0; if (next != theQ.start) { theQ.commands[theQ.end] = obj; theQ.end = next; } else throw { code: 10003 } } /* Function: xajax.tools.queue.pushFront Push a new object into the head of the buffer maintained by the specified queue object. This effectively pushes an object to the front of the queue... it will be processed first. Parameters: theQ - (object): The queue in which you would like the object stored. obj - (object): The object you would like stored in the queue. */ xajax.tools.queue.pushFront = function(theQ, obj) { xajax.tools.queue.rewind(theQ); theQ.commands[theQ.start] = obj; } /* Function: xajax.tools.queue.pop Attempt to pop an object off the head of the queue. Parameters: theQ - (object): The queue object you would like to modify. Returns: object - The object that was at the head of the queue or null if the queue was empty. */ xajax.tools.queue.pop = function(theQ) { var next = theQ.start; if (next == theQ.end) return null; next++; if (next > theQ.size) next = 0; var obj = theQ.commands[theQ.start]; delete theQ.commands[theQ.start]; theQ.start = next; return obj; } /* Class: xajax.responseProcessor */ xajax.responseProcessor = {}; /* Function: xajax.responseProcessor.xml Parse the response XML into a series of commands. The commands are constructed by calling and . Parameters: oRequest - (object): The request context object. */ xajax.responseProcessor.xml = function(oRequest) { var xx = xajax; var xt = xx.tools; var xcb = xx.callback; var gcb = xcb.global; var lcb = oRequest.callback; var oRet = oRequest.returnValue; if (xt.arrayContainsValue(xx.responseSuccessCodes, oRequest.request.status)) { xcb.execute([gcb, lcb], 'onSuccess', oRequest); var seq = 0; if (oRequest.request.responseXML) { var responseXML = oRequest.request.responseXML; if (responseXML.documentElement) { oRequest.status.onProcessing(); var child = responseXML.documentElement.firstChild; oRet = xt.xml.processFragment(child, seq, oRet, oRequest); } } var obj = {}; obj.fullName = 'Response Complete'; obj.sequence = seq; obj.request = oRequest; obj.context = oRequest.context; obj.cmd = 'rcmplt'; xt.queue.push(xx.response, obj); // do not re-start the queue if a timeout is set if (null == xx.response.timeout) xt.queue.process(xx.response); } else if (xt.arrayContainsValue(xx.responseRedirectCodes, oRequest.request.status)) { xcb.execute([gcb, lcb], 'onRedirect', oRequest); window.location = oRequest.request.getResponseHeader('location'); xx.completeResponse(oRequest); } else if (xt.arrayContainsValue(xx.responseErrorsForAlert, oRequest.request.status)) { xcb.execute([gcb, lcb], 'onFailure', oRequest); xx.completeResponse(oRequest); } return oRet; } /* Class: xajax.js Contains the functions for javascript file and function manipulation. */ xajax.js = {} /* Function: xajax.js.includeScriptOnce Add a reference to the specified script file if one does not already exist in the HEAD of the current document. This will effecitvely cause the script file to be loaded in the browser. Parameters: fileName - (string): The URI of the file. Returns: true - The reference exists or was added. */ xajax.js.includeScriptOnce = function(command) { command.fullName = 'includeScriptOnce'; var fileName = command.data; // Check for existing script tag for this file. var oDoc = xajax.config.baseDocument; var loadedScripts = oDoc.getElementsByTagName('script'); var iLen = loadedScripts.length; for (var i = 0; i < iLen; ++i) { var script = loadedScripts[i]; if (script.src) { if (0 <= script.src.indexOf(fileName)) return true; } } return xajax.js.includeScript(command); } /* Function: xajax.js.includeScript Adds a SCRIPT tag referencing the specified file. This effectively causes the script to be loaded in the browser. Parameters: command (object) - Xajax response object Returns: true - The reference was added. */ xajax.js.includeScript = function(command) { command.fullName = 'includeScript'; var oDoc = xajax.config.baseDocument; var objHead = oDoc.getElementsByTagName('head'); var objScript = oDoc.createElement('script'); objScript.src = command.data; if ('undefined' == typeof command.type) objScript.type = 'text/javascript'; else objScript.type = command.type; if ('undefined' != typeof command.type) objScript.setAttribute('id', command.elm_id); objHead[0].appendChild(objScript); return true; } /* Function: xajax.js.removeScript Locates a SCRIPT tag in the HEAD of the document which references the specified file and removes it. Parameters: command (object) - Xajax response object Returns: true - The script was not found or was removed. */ xajax.js.removeScript = function(command) { command.fullName = 'removeScript'; var fileName = command.data; var unload = command.unld; var oDoc = xajax.config.baseDocument; var loadedScripts = oDoc.getElementsByTagName('script'); var iLen = loadedScripts.length; for (var i = 0; i < iLen; ++i) { var script = loadedScripts[i]; if (script.src) { if (0 <= script.src.indexOf(fileName)) { if ('undefined' != typeof unload) { var args = {}; args.data = unload; args.context = window; xajax.js.execute(args); } var parent = script.parentNode; parent.removeChild(script); } } } return true; } /* Function: xajax.js.sleep Causes the processing of items in the queue to be delayed for the specified amount of time. This is an asynchronous operation, therefore, other operations will be given an opportunity to execute during this delay. Parameters: args - (object): The response command containing the following parameters. - args.prop: The number of 10ths of a second to sleep. Returns: true - The sleep operation completed. false - The sleep time has not yet expired, continue sleeping. */ xajax.js.sleep = function(command) { command.fullName = 'sleep'; // inject a delay in the queue processing // handle retry counter if (xajax.tools.queue.retry(command, command.prop)) { xajax.tools.queue.setWakeup(xajax.response, 100); return false; } // wake up, continue processing queue return true; } /* Function: xajax.js.confirmCommands Prompt the user with the specified text, if the user responds by clicking cancel, then skip the specified number of commands in the response command queue. If the user clicks Ok, the command processing resumes normal operation. Parameters: command (object) - xajax response object Returns: true - The operation completed successfully. */ xajax.js.confirmCommands = function(command) { command.fullName = 'confirmCommands'; var msg = command.data; var numberOfCommands = command.id; if (false == confirm(msg)) { while (0 < numberOfCommands) { xajax.tools.queue.pop(xajax.response); --numberOfCommands; } } return true; } /* Function: xajax.js.execute Execute the specified string of javascript code, using the current script context. Parameters: args - The response command object containing the following: - args.data: (string): The javascript to be evaluated. - args.context: (object): The javascript object that to be referenced as 'this' in the script. Returns: unknown - A value set by the script using 'returnValue = ' true - If the script does not set a returnValue. */ xajax.js.execute = function(args) { args.fullName = 'execute Javascript'; var returnValue = true; args.context.xajaxDelegateCall = function() { eval(args.data); } args.context.xajaxDelegateCall(); return returnValue; } /* Function: xajax.js.waitFor Test for the specified condition, using the current script context; if the result is false, sleep for 1/10th of a second and try again. Parameters: args - The response command object containing the following: - args.data: (string): The javascript to evaluate. - args.prop: (integer): The number of 1/10ths of a second to wait before giving up. - args.context: (object): The current script context object which is accessable in the javascript being evaulated via the 'this' keyword. Returns: false - The condition evaulates to false and the sleep time has not expired. true - The condition evaluates to true or the sleep time has expired. */ xajax.js.waitFor = function(args) { args.fullName = 'waitFor'; var bResult = false; var cmdToEval = 'bResult = ('; cmdToEval += args.data; cmdToEval += ');'; try { args.context.xajaxDelegateCall = function() { eval(cmdToEval); } args.context.xajaxDelegateCall(); } catch (e) { } if (false == bResult) { // inject a delay in the queue processing // handle retry counter if (xajax.tools.queue.retry(args, args.prop)) { xajax.tools.queue.setWakeup(xajax.response, 100); return false; } // give up, continue processing queue } return true; } /* Function: xajax.js.call Call a javascript function with a series of parameters using the current script context. Parameters: args - The response command object containing the following: - args.data: (array): The parameters to pass to the function. - args.func: (string): The name of the function to call. - args.context: (object): The current script context object which is accessable in the function name via the 'this' keyword. Returns: true - The call completed successfully. */ xajax.js.call = function(args) { args.fullName = 'call js function'; var parameters = args.data; var scr = new Array(); scr.push(args.func); scr.push('('); if ('undefined' != typeof parameters) { if ('object' == typeof parameters) { var iLen = parameters.length; if (0 < iLen) { scr.push('parameters[0]'); for (var i = 1; i < iLen; ++i) scr.push(', parameters[' + i + ']'); } } } scr.push(');'); args.context.xajaxDelegateCall = function() { eval(scr.join('')); } args.context.xajaxDelegateCall(); return true; } /* Function: xajax.js.setFunction Constructs the specified function using the specified javascript as the body of the function. Parameters: args - The response command object which contains the following: - args.func: (string): The name of the function to construct. - args.data: (string): The script that will be the function body. - args.context: (object): The current script context object which is accessable in the script name via the 'this' keyword. Returns: true - The function was constructed successfully. */ xajax.js.setFunction = function(args) { args.fullName = 'setFunction'; var code = new Array(); code.push(args.func); code.push(' = function('); if ('object' == typeof args.prop) { var separator = ''; for (var m in args.prop) { code.push(separator); code.push(args.prop[m]); separator = ','; } } else code.push(args.prop); code.push(') { '); code.push(args.data); code.push(' }'); args.context.xajaxDelegateCall = function() { eval(code.join('')); } args.context.xajaxDelegateCall(); return true; } /* Function: xajax.js.wrapFunction Construct a javascript function which will call the original function with the same name, potentially executing code before and after the call to the original function. Parameters: args - (object): The response command object which will contain the following: - args.func: (string): The name of the function to be wrapped. - args.prop: (string): List of parameters used when calling the function. - args.data: (array): The portions of code to be called before, after or even between calls to the original function. - args.context: (object): The current script context object which is accessable in the function name and body via the 'this' keyword. Returns: true - The wrapper function was constructed successfully. */ xajax.js.wrapFunction = function(args) { args.fullName = 'wrapFunction'; var code = new Array(); code.push(args.func); code.push(' = xajax.js.makeWrapper('); code.push(args.func); code.push(', args.prop, args.data, args.type, args.context);'); args.context.xajaxDelegateCall = function() { eval(code.join('')); } args.context.xajaxDelegateCall(); return true; } /* Function: xajax.js.makeWrapper Helper function used in the wrapping of an existing javascript function. Parameters: origFun - (string): The name of the original function. args - (string): The list of parameters used when calling the function. codeBlocks - (array): Array of strings of javascript code to be executed before, after and perhaps between calls to the original function. returnVariable - (string): The name of the variable used to retain the return value from the call to the original function. context - (object): The current script context object which is accessable in the function name and body via the 'this' keyword. Returns: object - The complete wrapper function. */ xajax.js.makeWrapper = function(origFun, args, codeBlocks, returnVariable, context) { var originalCall = ''; if (0 < returnVariable.length) { originalCall += returnVariable; originalCall += ' = '; } var originalCall = 'origFun('; originalCall += args; originalCall += '); '; var code = 'wrapper = function('; code += args; code += ') { '; if (0 < returnVariable.length) { code += ' var '; code += returnVariable; code += ' = null;'; } var separator = ''; var bLen = codeBlocks.length; for (var b = 0; b < bLen; ++b) { code += separator; code += codeBlocks[b]; separator = originalCall; } if (0 < returnVariable.length) { code += ' return '; code += returnVariable; code += ';'; } code += ' } '; var wrapper = null; context.xajaxDelegateCall = function() { eval(code); } context.xajaxDelegateCall(); return wrapper; } /* Class: xajax.dom */ xajax.dom = {} /* Function: xajax.dom.assign Assign an element's attribute to the specified value. Parameters: element - (object): The HTML element to effect. property - (string): The name of the attribute to set. data - (string): The new value to be applied. Returns: true - The operation completed successfully. */ xajax.dom.assign = function(element, property, data) { if ('string' == typeof element) element = xajax.$(element); switch (property) { case 'innerHTML': element.innerHTML = data; break; case 'outerHTML': if ('undefined' == typeof element.outerHTML) { var r = xajax.config.baseDocument.createRange(); r.setStartBefore(element); var df = r.createContextualFragment(data); element.parentNode.replaceChild(df, element); } else element.outerHTML = data; break; default: if (xajax.tools.willChange(element, property, data)) eval('element.' + property + ' = data;'); break; } return true; } /* Function: xajax.dom.append Append the specified value to an element's attribute. Parameters: element - (object): The HTML element to effect. property - (string): The name of the attribute to append to. data - (string): The new value to be appended. Returns: true - The operation completed successfully. */ xajax.dom.append = function(element, property, data) { if ('string' == typeof element) element = xajax.$(element); eval('element.' + property + ' += data;'); return true; } /* Function: xajax.dom.prepend Prepend the specified value to an element's attribute. Parameters: element - (object): The HTML element to effect. property - (string): The name of the attribute. data - (string): The new value to be prepended. Returns: true - The operation completed successfully. */ xajax.dom.prepend = function(element, property, data) { if ('string' == typeof element) element = xajax.$(element); eval('element.' + property + ' = data + element.' + property); return true; } /* Function: xajax.dom.replace Search and replace the specified text. Parameters: element - (string or object): The name of, or the element itself which is to be modified. sAttribute - (string): The name of the attribute to be set. aData - (array): The search text and replacement text. Returns: true - The operation completed successfully. */ xajax.dom.replace = function(element, sAttribute, aData) { var sSearch = aData['s']; var sReplace = aData['r']; if (sAttribute == 'innerHTML') sSearch = xajax.tools.getBrowserHTML(sSearch); if ('string' == typeof element) element = xajax.$(element); eval('var txt = element.' + sAttribute); var bFunction = false; if ('function' == typeof txt) { txt = txt.join(''); bFunction = true; } var start = txt.indexOf(sSearch); if (start > -1) { var newTxt = []; while (start > -1) { var end = start + sSearch.length; newTxt.push(txt.substr(0, start)); newTxt.push(sReplace); txt = txt.substr(end, txt.length - end); start = txt.indexOf(sSearch); } newTxt.push(txt); newTxt = newTxt.join(''); if (bFunction) { eval('element.' + sAttribute + '=newTxt;'); } else if (xajax.tools.willChange(element, sAttribute, newTxt)) { eval('element.' + sAttribute + '=newTxt;'); } } return true; } /* Function: xajax.dom.remove Delete an element. Parameters: element - (string or object): The name of, or the element itself which will be deleted. Returns: true - The operation completed successfully. */ xajax.dom.remove = function(element) { if ('string' == typeof element) element = xajax.$(element); if (element && element.parentNode && element.parentNode.removeChild) element.parentNode.removeChild(element); return true; } /* Function: xajax.dom.create Create a new element and append it to the specified parent element. Parameters: objParent - (string or object): The name of, or the element itself which will contain the new element. sTag - (string): The tag name for the new element. sId - (string): The value to be assigned to the id attribute of the new element. Returns: true - The operation completed successfully. */ xajax.dom.create = function(objParent, sTag, sId) { if ('string' == typeof objParent) objParent = xajax.$(objParent); var target = xajax.config.baseDocument.createElement(sTag); target.setAttribute('id', sId); if (objParent) objParent.appendChild(target); return true; } /* Function: xajax.dom.insert Insert a new element before the specified element. Parameters: objSibling - (string or object): The name of, or the element itself that will be used as the reference point for insertion. sTag - (string): The tag name for the new element. sId - (string): The value that will be assigned to the new element's id attribute. Returns: true - The operation completed successfully. */ xajax.dom.insert = function(objSibling, sTag, sId) { if ('string' == typeof objSibling) objSibling = xajax.$(objSibling); var target = xajax.config.baseDocument.createElement(sTag); target.setAttribute('id', sId); objSibling.parentNode.insertBefore(target, objSibling); return true; } /* Function: xajax.dom.insertAfter Insert a new element after the specified element. Parameters: objSibling - (string or object): The name of, or the element itself that will be used as the reference point for insertion. sTag - (string): The tag name for the new element. sId - (string): The value that will be assigned to the new element's id attribute. Returns: true - The operation completed successfully. */ xajax.dom.insertAfter = function(objSibling, sTag, sId) { if ('string' == typeof objSibling) objSibling = xajax.$(objSibling); var target = xajax.config.baseDocument.createElement(sTag); target.setAttribute('id', sId); objSibling.parentNode.insertBefore(target, objSibling.nextSibling); return true; } /* Function: xajax.dom.contextAssign Assign a value to a named member of the current script context object. Parameters: args - (object): The response command object which will contain the following: - args.prop: (string): The name of the member to assign. - args.data: (string or object): The value to assign to the member. - args.context: (object): The current script context object which is accessable via the 'this' keyword. Returns: true - The operation completed successfully. */ xajax.dom.contextAssign = function(args) { args.fullName = 'context assign'; var code = []; code.push('this.'); code.push(args.prop); code.push(' = data;'); code = code.join(''); args.context.xajaxDelegateCall = function(data) { eval(code); } args.context.xajaxDelegateCall(args.data); return true; } /* Function: xajax.dom.contextAppend Appends a value to a named member of the current script context object. Parameters: args - (object): The response command object which will contain the following: - args.prop: (string): The name of the member to append to. - args.data: (string or object): The value to append to the member. - args.context: (object): The current script context object which is accessable via the 'this' keyword. Returns: true - The operation completed successfully. */ xajax.dom.contextAppend = function(args) { args.fullName = 'context append'; var code = []; code.push('this.'); code.push(args.prop); code.push(' += data;'); code = code.join(''); args.context.xajaxDelegateCall = function(data) { eval(code); } args.context.xajaxDelegateCall(args.data); return true; } /* Function: xajax.dom.contextPrepend Prepend a value to a named member of the current script context object. Parameters: args - (object): The response command object which will contain the following: - args.prop: (string): The name of the member to prepend to. - args.data: (string or object): The value to prepend to the member. - args.context: (object): The current script context object which is accessable via the 'this' keyword. Returns: true - The operation completed successfully. */ xajax.dom.contextPrepend = function(args) { args.fullName = 'context prepend'; var code = []; code.push('this.'); code.push(args.prop); code.push(' = data + this.'); code.push(args.prop); code.push(';'); code = code.join(''); args.context.xajaxDelegateCall = function(data) { eval(code); } args.context.xajaxDelegateCall(args.data); return true; } /* Class: xajax.css */ xajax.css = {} /* Function: xajax.css.add Add a LINK reference to the specified .css file if it does not already exist in the HEAD of the current document. Parameters: filename - (string): The URI of the .css file to reference. media - (string): The media type of the css file (print/screen/handheld,..) Returns: true - The operation completed successfully. */ xajax.css.add = function(fileName, media) { var oDoc = xajax.config.baseDocument; var oHeads = oDoc.getElementsByTagName('head'); var oHead = oHeads[0]; var oLinks = oHead.getElementsByTagName('link'); var found = false; var iLen = oLinks.length; for (var i = 0; i < iLen && false == found; ++i) if (0 <= oLinks[i].href.indexOf(fileName) && oLinks[i].media == media) found = true; if (false == found) { var oCSS = oDoc.createElement('link'); oCSS.rel = 'stylesheet'; oCSS.type = 'text/css'; oCSS.href = fileName; oCSS.media = media; oHead.appendChild(oCSS); } return true; } /* Function: xajax.css.remove Locate and remove a LINK reference from the current document's HEAD. Parameters: filename - (string): The URI of the .css file. Returns: true - The operation completed successfully. */ xajax.css.remove = function(fileName, media) { var oDoc = xajax.config.baseDocument; var oHeads = oDoc.getElementsByTagName('head'); var oHead = oHeads[0]; var oLinks = oHead.getElementsByTagName('link'); var i = 0; while (i < oLinks.length) if (0 <= oLinks[i].href.indexOf(fileName) && oLinks[i].media == media) oHead.removeChild(oLinks[i]); else ++i; return true; } /* Function: xajax.css.waitForCSS Attempt to detect when all .css files have been loaded once they are referenced by a LINK tag in the HEAD of the current document. Parameters: args - (object): The response command object which will contain the following: - args.prop - (integer): The number of 1/10ths of a second to wait before giving up. Returns: true - The .css files appear to be loaded. false - The .css files do not appear to be loaded and the timeout has not expired. */ xajax.css.waitForCSS = function(args) { var oDocSS = xajax.config.baseDocument.styleSheets; var ssEnabled = []; var iLen = oDocSS.length; for (var i = 0; i < iLen; ++i) { ssEnabled[i] = 0; try { ssEnabled[i] = oDocSS[i].cssRules.length; } catch (e) { try { ssEnabled[i] = oDocSS[i].rules.length; } catch (e) { } } } var ssLoaded = true; var iLen = ssEnabled.length; for (var i = 0; i < iLen; ++i) if (0 == ssEnabled[i]) ssLoaded = false; if (false == ssLoaded) { // inject a delay in the queue processing // handle retry counter if (xajax.tools.queue.retry(args, args.prop)) { xajax.tools.queue.setWakeup(xajax.response, 10); return false; } // give up, continue processing queue } return true; } /* Class: xajax.forms */ xajax.forms = {} /* Function: xajax.forms.getInput Create and return a form input element with the specified parameters. Parameters: type - (string): The type of input element desired. name - (string): The value to be assigned to the name attribute. id - (string): The value to be assigned to the id attribute. Returns: object - The new input element. */ xajax.forms.getInput = function(type, name, id) { if ('undefined' == typeof window.addEventListener) { xajax.forms.getInput = function(type, name, id) { return xajax.config.baseDocument.createElement(''); } } else { xajax.forms.getInput = function(type, name, id) { var oDoc = xajax.config.baseDocument; var Obj = oDoc.createElement('input'); Obj.setAttribute('type', type); Obj.setAttribute('name', name); Obj.setAttribute('id', id); return Obj; } } return xajax.forms.getInput(type, name, id); } /* Function: xajax.forms.createInput Create a new input element under the specified parent. Parameters: objParent - (string or object): The name of, or the element itself that will be used as the reference for the insertion. sType - (string): The value to be assigned to the type attribute. sName - (string): The value to be assigned to the name attribute. sId - (string): The value to be assigned to the id attribute. Returns: true - The operation completed successfully. */ xajax.forms.createInput = function(command) { command.fullName = 'createInput'; var objParent = command.id; var sType = command.type; var sName = command.data; var sId = command.prop; if ('string' == typeof objParent) objParent = xajax.$(objParent); var target = xajax.forms.getInput(sType, sName, sId); if (objParent && target) { objParent.appendChild(target); } return true; } /* Function: xajax.forms.insertInput Insert a new input element before the specified element. Parameters: objSibling - (string or object): The name of, or the element itself that will be used as the reference for the insertion. sType - (string): The value to be assigned to the type attribute. sName - (string): The value to be assigned to the name attribute. sId - (string): The value to be assigned to the id attribute. Returns: true - The operation completed successfully. */ xajax.forms.insertInput = function(command) { command.fullName = 'insertInput'; var objSibling = command.id; var sType = command.type; var sName = command.data; var sId = command.prop; if ('string' == typeof objSibling) objSibling = xajax.$(objSibling); var target = xajax.forms.getInput(sType, sName, sId); if (target && objSibling && objSibling.parentNode) objSibling.parentNode.insertBefore(target, objSibling); return true; } /* Function: xajax.forms.insertInputAfter Insert a new input element after the specified element. Parameters: objSibling - (string or object): The name of, or the element itself that will be used as the reference for the insertion. sType - (string): The value to be assigned to the type attribute. sName - (string): The value to be assigned to the name attribute. sId - (string): The value to be assigned to the id attribute. Returns: true - The operation completed successfully. */ xajax.forms.insertInputAfter = function(command) { command.fullName = 'insertInputAfter'; var objSibling = command.id; var sType = command.type; var sName = command.data; var sId = command.prop; if ('string' == typeof objSibling) objSibling = xajax.$(objSibling); var target = xajax.forms.getInput(sType, sName, sId); if (target && objSibling && objSibling.parentNode) objSibling.parentNode.insertBefore(target, objSibling.nextSibling); return true; } /* Class: xajax.events */ xajax.events = {} /* Function: xajax.events.setEvent Set an event handler. Parameters: command - (object): Response command object. - id: Element ID - prop: Event - data: Code Returns: true - The operation completed successfully. */ xajax.events.setEvent = function(command) { command.fullName = 'addEvent'; var element = command.id; var sEvent = command.prop; var code = command.data; if ('string' == typeof element) element = xajax.$(element); sEvent = xajax.tools.addOnPrefix(sEvent); code = xajax.tools.doubleQuotes(code); eval('element.' + sEvent + ' = function() { ' + code + '; }'); return true; } /* Function: xajax.events.addHandler Add an event handler to the specified element. Parameters: element - (string or object): The name of, or the element itself which will have the event handler assigned. sEvent - (string): The name of the event. fun - (string): The function to be called. Returns: true - The operation completed successfully. */ xajax.events.addHandler = function(element, sEvent, fun) { if (window.addEventListener) { xajax.events.addHandler = function(command) { command.fullName = 'addHandler'; var element = command.id; var sEvent = command.prop; var fun = command.data; if ('string' == typeof element) element = xajax.$(element); sEvent = xajax.tools.stripOnPrefix(sEvent); eval('element.addEventListener("' + sEvent + '", ' + fun + ', false);'); return true; } } else { xajax.events.addHandler = function(command) { command.fullName = 'addHandler'; var element = command.id; var sEvent = command.prop; var fun = command.data; if ('string' == typeof element) element = xajax.$(element); sEvent = xajax.tools.addOnPrefix(sEvent); eval('element.attachEvent("' + sEvent + '", ' + fun + ', false);'); return true; } } return xajax.events.addHandler(element, sEvent, fun); } /* Function: xajax.events.removeHandler Remove an event handler from an element. Parameters: element - (string or object): The name of, or the element itself which will have the event handler removed. event - (string): The name of the event for which this handler is associated. fun - The function to be removed. Returns: true - The operation completed successfully. */ xajax.events.removeHandler = function(element, sEvent, fun) { if (window.removeEventListener) { xajax.events.removeHandler = function(command) { command.fullName = 'removeHandler'; var element = command.id; var sEvent = command.prop; var fun = command.data; if ('string' == typeof element) element = xajax.$(element); sEvent = xajax.tools.stripOnPrefix(sEvent); eval('element.removeEventListener("' + sEvent + '", ' + fun + ', false);'); return true; } } else { xajax.events.removeHandler = function(command) { command.fullName = 'removeHandler'; var element = command.id; var sEvent = command.prop; var fun = command.data; if ('string' == typeof element) element = xajax.$(element); sEvent = xajax.tools.addOnPrefix(sEvent); eval('element.detachEvent("' + sEvent + '", ' + fun + ', false);'); return true; } } return xajax.events.removeHandler(element, sEvent, fun); } /* Class: xajax.callback */ xajax.callback = {} /* Function: xajax.callback.create Create a blank callback object. Two optional arguments let you set the delay time for the onResponseDelay and onExpiration events. Returns: object - The callback object. */ xajax.callback.create = function() { var xx = xajax; var xc = xx.config; var xcb = xx.callback; var oCB = {} oCB.timers = {}; oCB.timers.onResponseDelay = xcb.setupTimer( (arguments.length > 0) ? arguments[0] : xc.defaultResponseDelayTime); oCB.timers.onExpiration = xcb.setupTimer( (arguments.length > 1) ? arguments[1] : xc.defaultExpirationTime); oCB.onRequest = null; oCB.onResponseDelay = null; oCB.onExpiration = null; oCB.beforeResponseProcessing = null; oCB.onFailure = null; oCB.onRedirect = null; oCB.onSuccess = null; oCB.onComplete = null; return oCB; } /* Function: xajax.callback.setupTimer Create a timer to fire an event in the future. This will be used fire the onRequestDelay and onExpiration events. Parameters: iDelay - (integer): The amount of time in milliseconds to delay. Returns: object - A callback timer object. */ xajax.callback.setupTimer = function(iDelay) { return { timer: null, delay: iDelay }; } /* Function: xajax.callback.clearTimer Clear a callback timer for the specified function. Parameters: oCallback - (object): The callback object (or objects) that contain the specified function timer to be cleared. sFunction - (string): The name of the function associated with the timer to be cleared. */ xajax.callback.clearTimer = function(oCallback, sFunction) { if ('undefined' != typeof oCallback.timers) { if ('undefined' != typeof oCallback.timers[sFunction]) { clearTimeout(oCallback.timers[sFunction].timer); } } else if ('object' == typeof oCallback) { var iLen = oCallback.length; for (var i = 0; i < iLen; ++i) xajax.callback.clearTimer(oCallback[i], sFunction); } } /* Function: xajax.callback.execute Execute a callback event. Parameters: oCallback - (object): The callback object (or objects) which contain the event handlers to be executed. sFunction - (string): The name of the event to be triggered. args - (object): The request object for this request. */ xajax.callback.execute = function(oCallback, sFunction, args) { if ('undefined' != typeof oCallback[sFunction]) { var func = oCallback[sFunction]; if ('function' == typeof func) { if ('undefined' != typeof oCallback.timers[sFunction]) { oCallback.timers[sFunction].timer = setTimeout(function() { func(args); }, oCallback.timers[sFunction].delay); } else { func(args); } } } else if ('object' == typeof oCallback) { var iLen = oCallback.length; for (var i = 0; i < iLen; ++i) xajax.callback.execute(oCallback[i], sFunction, args); } } /* Class: xajax.callback.global The global callback object which is active for every request. */ xajax.callback.global = xajax.callback.create(); /* Class: xajax */ /* Object: xajax.response The response queue that holds response commands, once received from the server, until they are processed. */ xajax.response = xajax.tools.queue.create(xajax.config.responseQueueSize); /* Object: responseSuccessCodes This array contains a list of codes which will be returned from the server upon successful completion of the server portion of the request. These values should match those specified in the HTTP standard. */ xajax.responseSuccessCodes = ['0', '200']; // 10.4.1 400 Bad Request // 10.4.2 401 Unauthorized // 10.4.3 402 Payment Required // 10.4.4 403 Forbidden // 10.4.5 404 Not Found // 10.4.6 405 Method Not Allowed // 10.4.7 406 Not Acceptable // 10.4.8 407 Proxy Authentication Required // 10.4.9 408 Request Timeout // 10.4.10 409 Conflict // 10.4.11 410 Gone // 10.4.12 411 Length Required // 10.4.13 412 Precondition Failed // 10.4.14 413 Request Entity Too Large // 10.4.15 414 Request-URI Too Long // 10.4.16 415 Unsupported Media Type // 10.4.17 416 Requested Range Not Satisfiable // 10.4.18 417 Expectation Failed // 10.5 Server Error 5xx // 10.5.1 500 Internal Server Error // 10.5.2 501 Not Implemented // 10.5.3 502 Bad Gateway // 10.5.4 503 Service Unavailable // 10.5.5 504 Gateway Timeout // 10.5.6 505 HTTP Version Not Supported /* Object: responseErrorsForAlert This array contains a list of status codes returned by the server to indicate that the request failed for some reason. */ xajax.responseErrorsForAlert = ['400','401','402','403','404','500','501','502','503']; // 10.3.1 300 Multiple Choices // 10.3.2 301 Moved Permanently // 10.3.3 302 Found // 10.3.4 303 See Other // 10.3.5 304 Not Modified // 10.3.6 305 Use Proxy // 10.3.7 306 (Unused) // 10.3.8 307 Temporary Redirect /* Object: responseRedirectCodes An array of status codes returned from the server to indicate a request for redirect to another URL. Typically, this is used by the server to send the browser to another URL. This does not typically indicate that the xajax request should be sent to another URL. */ xajax.responseRedirectCodes = ['301','302','307']; /* Class: xajax.command The object that manages commands and command handlers. */ if ('undefined' == typeof xajax.command) xajax.command = {}; /* Function: xajax.command.create Creates a new command (object) that will be populated with command parameters and eventually passed to the command handler. */ xajax.command.create = function(sequence, request, context) { var newCmd = {}; newCmd.cmd = '*'; newCmd.fullName = '* unknown command name *'; newCmd.sequence = sequence; newCmd.request = request; newCmd.context = context; return newCmd; } /* Class: xajax.command.handler The object that manages command handlers. */ if ('undefined' == typeof xajax.command.handler) xajax.command.handler = {}; /* Object: handlers An array that is used internally in the xajax.command.handler object to keep track of command handlers that have been registered. */ if ('undefined' == typeof xajax.command.handler.handlers) xajax.command.handler.handlers = []; /* Function: xajax.command.handler.register Registers a new command handler. */ xajax.command.handler.register = function(shortName, func) { xajax.command.handler.handlers[shortName] = func; } /* Function: xajax.command.handler.unregister Unregisters and returns a command handler. Parameters: shortName - (string): The name of the command handler. Returns: func - (function): The unregistered function. */ xajax.command.handler.unregister = function(shortName) { var func = xajax.command.handler.handlers[shortName]; delete xajax.command.handler.handlers[shortName]; return func; } /* Function: xajax.command.handler.isRegistered Parameters: command - (object): - cmd: The Name of the function. Returns: boolean - (true or false): depending on whether a command handler has been created for the specified command (object). */ xajax.command.handler.isRegistered = function(command) { var shortName = command.cmd; if (xajax.command.handler.handlers[shortName]) return true; return false; } /* Function: xajax.command.handler.call Calls the registered command handler for the specified command (you should always check isRegistered before calling this function) Parameters: command - (object): - cmd: The Name of the function. Returns: true - (boolean) : */ xajax.command.handler.call = function(command) { var shortName = command.cmd; return xajax.command.handler.handlers[shortName](command); } xajax.command.handler.register('rcmplt', function(args) { xajax.completeResponse(args.request); return true; }); xajax.command.handler.register('css', function(args) { args.fullName = 'includeCSS'; if ('undefined' == typeof args.media) args.media = 'screen'; return xajax.css.add(args.data, args.media); }); xajax.command.handler.register('rcss', function(args) { args.fullName = 'removeCSS'; if ('undefined' == typeof args.media) args.media = 'screen'; return xajax.css.remove(args.data, args.media); }); xajax.command.handler.register('wcss', function(args) { args.fullName = 'waitForCSS'; return xajax.css.waitForCSS(args); }); xajax.command.handler.register('as', function(args) { args.fullName = 'assign/clear'; try { return xajax.dom.assign(args.target, args.prop, args.data); } catch (e) { // do nothing, if the debug module is installed it will // catch and handle the exception } return true; }); xajax.command.handler.register('ap', function(args) { args.fullName = 'append'; return xajax.dom.append(args.target, args.prop, args.data); }); xajax.command.handler.register('pp', function(args) { args.fullName = 'prepend'; return xajax.dom.prepend(args.target, args.prop, args.data); }); xajax.command.handler.register('rp', function(args) { args.fullName = 'replace'; return xajax.dom.replace(args.id, args.prop, args.data); }); xajax.command.handler.register('rm', function(args) { args.fullName = 'remove'; return xajax.dom.remove(args.id); }); xajax.command.handler.register('ce', function(args) { args.fullName = 'create'; return xajax.dom.create(args.id, args.data, args.prop); }); xajax.command.handler.register('ie', function(args) { args.fullName = 'insert'; return xajax.dom.insert(args.id, args.data, args.prop); }); xajax.command.handler.register('ia', function(args) { args.fullName = 'insertAfter'; return xajax.dom.insertAfter(args.id, args.data, args.prop); }); xajax.command.handler.register('c:as', xajax.dom.contextAssign); xajax.command.handler.register('c:ap', xajax.dom.contextAppend); xajax.command.handler.register('c:pp', xajax.dom.contextPrepend); xajax.command.handler.register('s', xajax.js.sleep); xajax.command.handler.register('ino', xajax.js.includeScriptOnce); xajax.command.handler.register('in', xajax.js.includeScript); xajax.command.handler.register('rjs', xajax.js.removeScript); xajax.command.handler.register('wf', xajax.js.waitFor); xajax.command.handler.register('js', xajax.js.execute); xajax.command.handler.register('jc', xajax.js.call); xajax.command.handler.register('sf', xajax.js.setFunction); xajax.command.handler.register('wpf', xajax.js.wrapFunction); xajax.command.handler.register('al', function(args) { args.fullName = 'alert'; alert(args.data); return true; }); xajax.command.handler.register('cc', xajax.js.confirmCommands); xajax.command.handler.register('ci', xajax.forms.createInput); xajax.command.handler.register('ii', xajax.forms.insertInput); xajax.command.handler.register('iia', xajax.forms.insertInputAfter); xajax.command.handler.register('ev', xajax.events.setEvent); xajax.command.handler.register('ah', xajax.events.addHandler); xajax.command.handler.register('rh', xajax.events.removeHandler); xajax.command.handler.register('dbg', function(args) { args.fullName = 'debug message'; return true; }); /* Function: xajax.initializeRequest Initialize a request object, populating default settings, where call specific settings are not already provided. Parameters: oRequest - (object): An object that specifies call specific settings that will, in addition, be used to store all request related values. This includes temporary values used internally by xajax. */ xajax.initializeRequest = function(oRequest) { var xx = xajax; var xc = xx.config; oRequest.append = function(opt, def) { if ('undefined' != typeof this[opt]) { for (var itmName in def) if ('undefined' == typeof this[opt][itmName]) this[opt][itmName] = def[itmName]; } else this[opt] = def; } oRequest.append('commonHeaders', xc.commonHeaders); oRequest.append('postHeaders', xc.postHeaders); oRequest.append('getHeaders', xc.getHeaders); oRequest.set = function(option, defaultValue) { if ('undefined' == typeof this[option]) this[option] = defaultValue; } oRequest.set('statusMessages', xc.statusMessages); oRequest.set('waitCursor', xc.waitCursor); oRequest.set('mode', xc.defaultMode); oRequest.set('method', xc.defaultMethod); oRequest.set('URI', xc.requestURI); oRequest.set('httpVersion', xc.defaultHttpVersion); oRequest.set('contentType', xc.defaultContentType); oRequest.set('retry', xc.defaultRetry); oRequest.set('returnValue', xc.defaultReturnValue); oRequest.set('maxObjectDepth', xc.maxObjectDepth); oRequest.set('maxObjectSize', xc.maxObjectSize); oRequest.set('context', window); var xcb = xx.callback; var gcb = xcb.global; var lcb = xcb.create(); lcb.take = function(frm, opt) { if ('undefined' != typeof frm[opt]) { lcb[opt] = frm[opt]; lcb.hasEvents = true; } delete frm[opt]; } lcb.take(oRequest, 'onRequest'); lcb.take(oRequest, 'onResponseDelay'); lcb.take(oRequest, 'onExpiration'); lcb.take(oRequest, 'beforeResponseProcessing'); lcb.take(oRequest, 'onFailure'); lcb.take(oRequest, 'onRedirect'); lcb.take(oRequest, 'onSuccess'); lcb.take(oRequest, 'onComplete'); if ('undefined' != typeof oRequest.callback) { if (lcb.hasEvents) oRequest.callback = [oRequest.callback, lcb]; } else oRequest.callback = lcb; oRequest.status = (oRequest.statusMessages) ? xc.status.update() : xc.status.dontUpdate(); oRequest.cursor = (oRequest.waitCursor) ? xc.cursor.update() : xc.cursor.dontUpdate(); oRequest.method = oRequest.method.toUpperCase(); if ('GET' != oRequest.method) oRequest.method = 'POST'; // W3C: Method is case sensitive oRequest.requestRetry = oRequest.retry; oRequest.append('postHeaders', { 'content-type': oRequest.contentType }); delete oRequest['append']; delete oRequest['set']; delete oRequest['take']; if ('undefined' == typeof oRequest.URI) throw { code: 10005 } } /* Function: xajax.processParameters Processes request specific parameters and generates the temporary variables needed by xajax to initiate and process the request. Parameters: oRequest - A request object, created initially by a call to Note: This is called once per request; upon a request failure, this will not be called for additional retries. */ xajax.processParameters = function(oRequest) { var xx = xajax; var xt = xx.tools; var rd = []; var separator = ''; for (var sCommand in oRequest.functionName) { if ('constructor' != sCommand) { rd.push(separator); rd.push(sCommand); rd.push('='); rd.push(encodeURIComponent(oRequest.functionName[sCommand])); separator = '&'; } } var dNow = new Date(); rd.push('&xjxr='); rd.push(dNow.getTime()); delete dNow; if (oRequest.parameters) { var i = 0; var iLen = oRequest.parameters.length; while (i < iLen) { var oVal = oRequest.parameters[i]; if ('object' == typeof oVal && null != oVal) { try { var oGuard = {}; oGuard.depth = 0; oGuard.maxDepth = oRequest.maxObjectDepth; oGuard.size = 0; oGuard.maxSize = oRequest.maxObjectSize; oVal = xt._objectToXML(oVal, oGuard); } catch (e) { oVal = ''; // do nothing, if the debug module is installed // it will catch the exception and handle it } rd.push('&xjxargs[]='); oVal = encodeURIComponent(oVal); rd.push(oVal); ++i; } else { rd.push('&xjxargs[]='); oVal = xt._escape(oVal); if ('undefined' == typeof oVal || null == oVal) { rd.push('*'); } else { var sType = typeof oVal; if ('string' == sType) rd.push('S'); else if ('boolean' == sType) rd.push('B'); else if ('number' == sType) rd.push('N'); oVal = encodeURIComponent(oVal); rd.push(oVal); } ++i; } } } oRequest.requestURI = oRequest.URI; if ('GET' == oRequest.method) { oRequest.requestURI += oRequest.requestURI.indexOf('?')== -1 ? '?' : '&'; oRequest.requestURI += rd.join(''); rd = []; } oRequest.requestData = rd.join(''); } /* Function: xajax.prepareRequest Prepares the XMLHttpRequest object for this xajax request. Parameters: oRequest - (object): An object created by a call to which already contains the necessary parameters and temporary variables needed to initiate and process a xajax request. Note: This is called each time a request object is being prepared for a call to the server. If the request is retried, the request must be prepared again. */ xajax.prepareRequest = function(oRequest) { var xx = xajax; var xt = xx.tools; oRequest.request = xt.getRequestObject(); oRequest.setRequestHeaders = function(headers) { if ('object' == typeof headers) { for (var optionName in headers) this.request.setRequestHeader(optionName, headers[optionName]); } } oRequest.setCommonRequestHeaders = function() { this.setRequestHeaders(this.commonHeaders); } oRequest.setPostRequestHeaders = function() { this.setRequestHeaders(this.postHeaders); } oRequest.setGetRequestHeaders = function() { this.setRequestHeaders(this.getHeaders); } if ('asynchronous' == oRequest.mode) { // references inside this function should be expanded // IOW, don't use shorthand references like xx for xajax oRequest.request.onreadystatechange = function() { if (oRequest.request.readyState != 4) return; xajax.responseReceived(oRequest); } oRequest.finishRequest = function() { return this.returnValue; } } else { oRequest.finishRequest = function() { return xajax.responseReceived(oRequest); } } if ('undefined' != typeof oRequest.userName && 'undefined' != typeof oRequest.password) { oRequest.open = function() { this.request.open( this.method, this.requestURI, 'asynchronous' == this.mode, oRequest.userName, oRequest.password); } } else { oRequest.open = function() { this.request.open( this.method, this.requestURI, 'asynchronous' == this.mode); } } if ('POST' == oRequest.method) { // W3C: Method is case sensitive oRequest.applyRequestHeaders = function() { this.setCommonRequestHeaders(); try { this.setPostRequestHeaders(); } catch (e) { this.method = 'GET'; this.requestURI += this.requestURI.indexOf('?')== -1 ? '?' : '&'; this.requestURI += this.requestData; this.requestData = ''; if (0 == this.requestRetry) this.requestRetry = 1; throw e; } } } else { oRequest.applyRequestHeaders = function() { this.setCommonRequestHeaders(); this.setGetRequestHeaders(); } } } /* Function: xajax.request Initiates a request to the server. Parameters: functionName - (object): An object containing the name of the function to execute on the server. The standard request is: {xjxfun:'function_name'} oRequest - (object, optional): A request object which may contain call specific parameters. This object will be used by xajax to store all the request parameters as well as temporary variables needed during the processing of the request. */ xajax.request = function() { var numArgs = arguments.length; if (0 == numArgs) return false; var oRequest = {} if (1 < numArgs) oRequest = arguments[1]; oRequest.functionName = arguments[0]; var xx = xajax; xx.initializeRequest(oRequest); xx.processParameters(oRequest); while (0 < oRequest.requestRetry) { try { --oRequest.requestRetry; xx.prepareRequest(oRequest); return xx.submitRequest(oRequest); } catch (e) { xajax.callback.execute( [xajax.callback.global, oRequest.callback], 'onFailure', oRequest); if (0 == oRequest.requestRetry) throw e; } } } /* Function: xajax.call Initiates a call to the server. Parameters: sFunctionName - (string): The name of the function to execute on the server. oRequestOptions - (object, optional): A request object which may contain call specific parameters. This object will be used by xajax to store all the request parameters as well as temporary variables needed during the processing of the request. Returns: unknown - For asynchronous calls, the return value will always be the value set for */ xajax.call = function() { var numArgs = arguments.length; if (0 == numArgs) return false; var oRequest = {} if (1 < numArgs) oRequest = arguments[1]; oRequest.functionName = { xjxfun: arguments[0] }; var xx = xajax; xx.initializeRequest(oRequest); xx.processParameters(oRequest); while (0 < oRequest.requestRetry) { try { --oRequest.requestRetry; xx.prepareRequest(oRequest); return xx.submitRequest(oRequest); } catch (e) { xajax.callback.execute( [xajax.callback.global, oRequest.callback], 'onFailure', oRequest); if (0 == oRequest.requestRetry) throw e; } } } /* Function: xajax.submitRequest Create a request object and submit the request using the specified request type; all request parameters should be finalized by this point. Upon failure of a POST, this function will fall back to a GET request. Parameters: oRequest - (object): The request context object. */ xajax.submitRequest = function(oRequest) { oRequest.status.onRequest(); var xcb = xajax.callback; var gcb = xcb.global; var lcb = oRequest.callback; xcb.execute([gcb, lcb], 'onResponseDelay', oRequest); xcb.execute([gcb, lcb], 'onExpiration', oRequest); xcb.execute([gcb, lcb], 'onRequest', oRequest); oRequest.open(); oRequest.applyRequestHeaders(); oRequest.cursor.onWaiting(); oRequest.status.onWaiting(); xajax._internalSend(oRequest); // synchronous mode causes response to be processed immediately here return oRequest.finishRequest(); } /* Function: xajax._internalSend This function is used internally by xajax to initiate a request to the server. Parameters: oRequest - (object): The request context object. */ xajax._internalSend = function(oRequest) { // this may block if synchronous mode is selected oRequest.request.send(oRequest.requestData); } /* Function: xajax.abortRequest Abort the request. Parameters: oRequest - (object): The request context object. */ xajax.abortRequest = function(oRequest) { oRequest.aborted = true; oRequest.request.abort(); xajax.completeResponse(oRequest); } /* Function: xajax.responseReceived Process the response. Parameters: oRequest - (object): The request context object. */ xajax.responseReceived = function(oRequest) { var xx = xajax; var xcb = xx.callback; var gcb = xcb.global; var lcb = oRequest.callback; // sometimes the responseReceived gets called when the // request is aborted if (oRequest.aborted) return; xcb.clearTimer([gcb, lcb], 'onExpiration'); xcb.clearTimer([gcb, lcb], 'onResponseDelay'); xcb.execute([gcb, lcb], 'beforeResponseProcessing', oRequest); var fProc = xx.getResponseProcessor(oRequest); if ('undefined' == typeof fProc) { xcb.execute([gcb, lcb], 'onFailure', oRequest); xx.completeResponse(oRequest); return; } return fProc(oRequest); } /* Function: xajax.getResponseProcessor This function attempts to determine, based on the content type of the reponse, what processor should be used for handling the response data. The default xajax response will be text/xml which will invoke the xajax xml response processor. Other response processors may be added in the future. The user can specify their own response processor on a call by call basis. Parameters: oRequest - (object): The request context object. */ xajax.getResponseProcessor = function(oRequest) { var fProc; if ('undefined' == typeof oRequest.responseProcessor) { var cTyp = oRequest.request.getResponseHeader('content-type'); if (cTyp) { if (0 <= cTyp.indexOf('text/xml')) { fProc = xajax.responseProcessor.xml; // } else if (0 <= cTyp.indexOf('application/json')) { // fProc = xajax.responseProcessor.json; } } } else fProc = oRequest.responseProcessor; return fProc; } /* Function: xajax.executeCommand Perform a lookup on the command specified by the response command object passed in the first parameter. If the command exists, the function checks to see if the command references a DOM object by ID; if so, the object is located within the DOM and added to the command data. The command handler is then called. If the command handler returns true, it is assumed that the command completed successfully. If the command handler returns false, then the command is considered pending; xajax enters a wait state. It is up to the command handler to set an interval, timeout or event handler which will restart the xajax response processing. Parameters: obj - (object): The response command to be executed. Returns: true - The command completed successfully. false - The command signalled that it needs to pause processing. */ xajax.executeCommand = function(command) { if (xajax.command.handler.isRegistered(command)) { // it is important to grab the element here as the previous command // might have just created the element if (command.id) command.target = xajax.$(command.id); // process the command if (false == xajax.command.handler.call(command)) { xajax.tools.queue.pushFront(xajax.response, command); return false; } } return true; } /* Function: xajax.completeResponse Called by the response command queue processor when all commands have been processed. Parameters: oRequest - (object): The request context object. */ xajax.completeResponse = function(oRequest) { xajax.callback.execute( [xajax.callback.global, oRequest.callback], 'onComplete', oRequest); oRequest.cursor.onComplete(); oRequest.status.onComplete(); // clean up -- these items are restored when the request is initiated delete oRequest['functionName']; delete oRequest['requestURI']; delete oRequest['requestData']; delete oRequest['requestRetry']; delete oRequest['request']; delete oRequest['set']; delete oRequest['open']; delete oRequest['setRequestHeaders']; delete oRequest['setCommonRequestHeaders']; delete oRequest['setPostRequestHeaders']; delete oRequest['setGetRequestHeaders']; delete oRequest['applyRequestHeaders']; delete oRequest['finishRequest']; delete oRequest['status']; delete oRequest['cursor']; } /* Function: xajax.$ Shortcut to . */ xajax.$ = xajax.tools.$; /* Function: xajax.getFormValues Shortcut to . */ xajax.getFormValues = xajax.tools.getFormValues; /* Boolean: xajax.isLoaded true - xajax module is loaded. */ xajax.isLoaded = true; /* Class: xjx Contains shortcut's to frequently used functions. */ xjx = {} /* Function: xjx.$ Shortcut to . */ xjx.$ = xajax.tools.$; /* Function: xjx.getFormValues Shortcut to . */ xjx.getFormValues = xajax.tools.getFormValues; /* Function: xjx.call Shortcut to . */ xjx.call = xajax.call; xjx.request = xajax.request; php-xajax-0.5/xajax_js/xajax_lang_es.js0000644000175000017500000000533211045155650016653 0ustar dgildgil if('undefined'!=typeof xajax.debug){xajax.debug.text=[];xajax.debug.text[100]='ALERTA: ';xajax.debug.text[101]='ERROR: ';xajax.debug.text[102]='MENSAJE XAJAX DEBUG:\n';xajax.debug.text[103]='...\n[RESPUESTA LARGA]\n...';xajax.debug.text[104]='ENVIANDO PETICION';xajax.debug.text[105]='ENVIADO [';xajax.debug.text[106]=' bytes]';xajax.debug.text[107]='LLAMADA: ';xajax.debug.text[108]='URI: ';xajax.debug.text[109]='INICIALIZANDO PETICION';xajax.debug.text[110]='PROCESANDO PARAMETROS [';xajax.debug.text[111]=']';xajax.debug.text[112]='NO HAY PARAMETROS A PROCESAR';xajax.debug.text[113]='PREPARANDO PETICION';xajax.debug.text[114]='INICIANDO XAJAX CALL (En desuso: use xajax.request)';xajax.debug.text[115]='INICIANDO XAJAX REQUEST';xajax.debug.text[116]='Ningn procesador de respuesta esta disponible para tratar la respuesta del servidor.\n';xajax.debug.text[117]='.\nRevisa mensajes de error del servidor.';xajax.debug.text[118]='RECIBIDO [status: ';xajax.debug.text[119]=', size: ';xajax.debug.text[120]=' bytes, time: ';xajax.debug.text[121]='ms]:\n';xajax.debug.text[122]='El servidor retorno el siguiente estado HTTP: ';xajax.debug.text[123]='\nRECIBIDO:\n';xajax.debug.text[124]='El servidor retorno una redireccion a:
';xajax.debug.text[125]='HECHO [';xajax.debug.text[126]='ms]';xajax.debug.text[127]='INICIALIZANDO PETICION OBJETO';xajax.debug.exceptions=[];xajax.debug.exceptions[10001]='Invalid response XML: La respuesta contiene una etiqueta desconocida: {data}.';xajax.debug.exceptions[10002]='GetRequestObject: XMLHttpRequest no disponible, xajax esta deshabilitado.';xajax.debug.exceptions[10003]='Queue overflow: No se puede colocar objeto en cola porque esta llena.';xajax.debug.exceptions[10004]='Invalid response XML: La respuesta contiene una etiqueta o texto inesperado: {data}.';xajax.debug.exceptions[10005]='Invalid request URI: URI invalida o perdida; autodeteccion fallida; por favor especifica una explicitamente.';xajax.debug.exceptions[10006]='Invalid response command: Orden de respuesta mal formado recibido.';xajax.debug.exceptions[10007]='Invalid response command: Comando [{data}] no es un comando conocido.';xajax.debug.exceptions[10008]='Elemento con ID [{data}] no encontrado en el documento.';xajax.debug.exceptions[10009]='Invalid request: Nombre parametro de funcion perdido.';xajax.debug.exceptions[10010]='Invalid request: Objeto parametro de funcion perdido.';} if('undefined'!=typeof xajax.config){if('undefined'!=typeof xajax.config.status){xajax.config.status.update=function(){return{onRequest:function(){window.status='Enviando Peticion...';}, onWaiting:function(){window.status='Esperando Respuesta...';}, onProcessing:function(){window.status='Procesando...';}, onComplete:function(){window.status='Hecho.';} } } } } php-xajax-0.5/xajax_js/xajax_lang_bg_uncompressed.js0000644000175000017500000001046411137037724021430 0ustar dgildgil/** * translation for: xajax v.x.x * @version: 1.0.0 * @author: mic * @copyright xajax project * @license GNU/GPL * @package xajax x.x.x * @since v.x.x.x * save as UTF-8 */ if ('undefined' != typeof xajax.debug) { /* Array: text */ xajax.debug.text = []; xajax.debug.text[100] = 'ПРЕДУПРЕЖДЕНИЕ: '; xajax.debug.text[101] = 'ГРЕШКА: '; xajax.debug.text[102] = 'XAJAX ДЕБЪГ СЪОБЩЕНИЕ:\n'; xajax.debug.text[103] = '...\n[ДЪЛЪГ ОТГОВОР]\n...'; xajax.debug.text[104] = 'ИЗПРАЩАНЕ НА ЗАЯВКИ'; xajax.debug.text[105] = 'ИЗПРАТЕНИ ['; xajax.debug.text[106] = ' байта]'; xajax.debug.text[107] = 'ИЗВИКВАНЕ: '; xajax.debug.text[108] = 'Адрес: '; xajax.debug.text[109] = 'ИНИЦИАЛИЗИРАНЕ НА ЗАЯВКАТА'; xajax.debug.text[110] = 'ОБРАБОТВАНЕ НА ПАРАМЕТРИТЕ ['; xajax.debug.text[111] = ']'; xajax.debug.text[112] = 'НЯМА ПАРАМЕТРИ ЗА ОБРАБОТВАНЕ'; xajax.debug.text[113] = 'ПОДГОТВЯВАНЕ НА ЗАЯВКАТА'; xajax.debug.text[114] = 'СТАРТИРАНЕ НА XAJAX ПОВИКВАНЕТО (остаряло: вместо това използвай xajax.request)'; xajax.debug.text[115] = 'СТАРТИРАНЕ НА XAJAX ЗАЯВКАТА'; xajax.debug.text[116] = 'Няма регистрирани функции, които да обработят заявката ви на сървъра!\n'; xajax.debug.text[117] = '.\nПровери за съобщения за грешки на сървъра.'; xajax.debug.text[118] = 'ПОЛУЧЕНИ [статус: '; xajax.debug.text[119] = ', размер: '; xajax.debug.text[120] = ' байта, време: '; xajax.debug.text[121] = 'мсек]:\n'; xajax.debug.text[122] = 'Сървъра върна следния HTTP статус: '; xajax.debug.text[123] = '\nПОЛУЧЕНИ:\n'; xajax.debug.text[124] = 'Сървъра върна пренасочване към:
'; xajax.debug.text[125] = 'ГОТОВО ['; xajax.debug.text[126] = 'мсек]'; xajax.debug.text[127] = 'ИНИЦИАЛИЗИРАНЕ НА ОБЕКТА НА ЗАЯВКАТА'; xajax.debug.exceptions = []; xajax.debug.exceptions[10001] = 'Невалиден XML отговор: Отговора съдържа непознат таг: {data}.'; xajax.debug.exceptions[10002] = 'GetRequestObject: Няма XMLHttpRequest, xajax е изключен.'; xajax.debug.exceptions[10003] = 'Препълване на опашката: Обекта не може да бъде сложен на опашката, защото тя е пълна.'; xajax.debug.exceptions[10004] = 'Невалиден XML отговор: Отговора съдържа неочакван таг или текст: {data}.'; xajax.debug.exceptions[10005] = 'Невалиден адрес: Невалиден или липсващ адрес; автоматичното откриване неуспешнп; please specify a one explicitly.'; xajax.debug.exceptions[10006] = 'Невалидна команда в отговора: Получена беше невалидна команда като отговор.'; xajax.debug.exceptions[10007] = 'Невалидна команда в отговора: Командата [{data}] е непозната.'; xajax.debug.exceptions[10008] = 'Елемент с ID [{data}] не беше намерен в документа.'; xajax.debug.exceptions[10009] = 'Невалидна заявка: Параметъра с името на функцията липсва.'; xajax.debug.exceptions[10010] = 'Невалидна заявка: Липсва обекта на функцията.'; } if ('undefined' != typeof xajax.config) { if ('undefined' != typeof xajax.config.status) { /* Object: update */ xajax.config.status.update = function() { return { onRequest: function() { window.status = 'Изпращане на заявка...'; }, onWaiting: function() { window.status = 'Изчакване на отговор...'; }, onProcessing: function() { window.status = 'Изпълнение...'; }, onComplete: function() { window.status = 'Готово.'; } } } } }php-xajax-0.5/xajax_js/xajax_lang_es_uncompressed.js0000644000175000017500000000652511137037724021452 0ustar dgildgil/** * translation for: xajax v.x.x * @version: 1.0.0 * @author: mic * @copyright xajax project * @license GNU/GPL * @package xajax x.x.x * @since v.x.x.x * save as UTF-8 */ if ('undefined' != typeof xajax.debug) { /* Array: text */ xajax.debug.text = []; xajax.debug.text[100] = 'ALERTA: '; xajax.debug.text[101] = 'ERROR: '; xajax.debug.text[102] = 'MENSAJE XAJAX DEBUG:\n'; xajax.debug.text[103] = '...\n[RESPUESTA LARGA]\n...'; xajax.debug.text[104] = 'ENVIANDO PETICION'; xajax.debug.text[105] = 'ENVIADO ['; xajax.debug.text[106] = ' bytes]'; xajax.debug.text[107] = 'LLAMADA: '; xajax.debug.text[108] = 'URI: '; xajax.debug.text[109] = 'INICIALIZANDO PETICION'; xajax.debug.text[110] = 'PROCESANDO PARAMETROS ['; xajax.debug.text[111] = ']'; xajax.debug.text[112] = 'NO HAY PARAMETROS A PROCESAR'; xajax.debug.text[113] = 'PREPARANDO PETICION'; xajax.debug.text[114] = 'INICIANDO XAJAX CALL (En desuso: use xajax.request)'; xajax.debug.text[115] = 'INICIANDO XAJAX REQUEST'; xajax.debug.text[116] = 'Ning�n procesador de respuesta esta disponible para tratar la respuesta del servidor.\n'; xajax.debug.text[117] = '.\nRevisa mensajes de error del servidor.'; xajax.debug.text[118] = 'RECIBIDO [status: '; xajax.debug.text[119] = ', size: '; xajax.debug.text[120] = ' bytes, time: '; xajax.debug.text[121] = 'ms]:\n'; xajax.debug.text[122] = 'El servidor retorno el siguiente estado HTTP: '; xajax.debug.text[123] = '\nRECIBIDO:\n'; xajax.debug.text[124] = 'El servidor retorno una redireccion a:
'; xajax.debug.text[125] = 'HECHO ['; xajax.debug.text[126] = 'ms]'; xajax.debug.text[127] = 'INICIALIZANDO PETICION OBJETO'; xajax.debug.exceptions = []; xajax.debug.exceptions[10001] = 'Invalid response XML: La respuesta contiene una etiqueta desconocida: {data}.'; xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest no disponible, xajax esta deshabilitado.'; xajax.debug.exceptions[10003] = 'Queue overflow: No se puede colocar objeto en cola porque esta llena.'; xajax.debug.exceptions[10004] = 'Invalid response XML: La respuesta contiene una etiqueta o texto inesperado: {data}.'; xajax.debug.exceptions[10005] = 'Invalid request URI: URI invalida o perdida; autodeteccion fallida; por favor especifica una explicitamente.'; xajax.debug.exceptions[10006] = 'Invalid response command: Orden de respuesta mal formado recibido.'; xajax.debug.exceptions[10007] = 'Invalid response command: Comando [{data}] no es un comando conocido.'; xajax.debug.exceptions[10008] = 'Elemento con ID [{data}] no encontrado en el documento.'; xajax.debug.exceptions[10009] = 'Invalid request: Nombre parametro de funcion perdido.'; xajax.debug.exceptions[10010] = 'Invalid request: Objeto parametro de funcion perdido.'; } if ('undefined' != typeof xajax.config) { if ('undefined' != typeof xajax.config.status) { /* Object: update */ xajax.config.status.update = function() { return { onRequest: function() { window.status = 'Enviando Peticion...'; }, onWaiting: function() { window.status = 'Esperando Respuesta...'; }, onProcessing: function() { window.status = 'Procesando...'; }, onComplete: function() { window.status = 'Hecho.'; } } } } }php-xajax-0.5/xajax_js/xajax_core.js0000644000175000017500000011566111104363124016173 0ustar dgildgil if('undefined'==typeof xajax) xajax={};if('undefined'==typeof xajax.config) xajax.config={};xajax.config.setDefault=function(option,defaultValue){if('undefined'==typeof xajax.config[option]) xajax.config[option]=defaultValue;} xajax.config.setDefault('commonHeaders',{'If-Modified-Since':'Sat, 1 Jan 2000 00:00:00 GMT' });xajax.config.setDefault('postHeaders',{});xajax.config.setDefault('getHeaders',{});xajax.config.setDefault('waitCursor',false);xajax.config.setDefault('statusMessages',false);xajax.config.setDefault('baseDocument',document);xajax.config.setDefault('requestURI',xajax.config.baseDocument.URL);xajax.config.setDefault('defaultMode','asynchronous');xajax.config.setDefault('defaultHttpVersion','HTTP/1.1');xajax.config.setDefault('defaultContentType','application/x-www-form-urlencoded');xajax.config.setDefault('defaultResponseDelayTime',1000);xajax.config.setDefault('defaultExpirationTime',10000);xajax.config.setDefault('defaultMethod','POST');xajax.config.setDefault('defaultRetry',5);xajax.config.setDefault('defaultReturnValue',false);xajax.config.setDefault('maxObjectDepth',20);xajax.config.setDefault('maxObjectSize',2000);xajax.config.setDefault('responseQueueSize',1000);xajax.config.status={update:function(){return{onRequest:function(){window.status='Sending Request...';}, onWaiting:function(){window.status='Waiting for Response...';}, onProcessing:function(){window.status='Processing...';}, onComplete:function(){window.status='Done.';} } }, dontUpdate:function(){return{onRequest:function(){}, onWaiting:function(){}, onProcessing:function(){}, onComplete:function(){} } } } xajax.config.cursor={update:function(){return{onWaiting:function(){if(xajax.config.baseDocument.body) xajax.config.baseDocument.body.style.cursor='wait';}, onComplete:function(){xajax.config.baseDocument.body.style.cursor='auto';} } }, dontUpdate:function(){return{onWaiting:function(){}, onComplete:function(){} } } } xajax.tools={} xajax.tools.$=function(sId){if(!sId) return null;var oDoc=xajax.config.baseDocument;var obj=oDoc.getElementById(sId);if(obj) return obj;if(oDoc.all) return oDoc.all[sId];return obj;} xajax.tools.arrayContainsValue=function(array,valueToCheck){var i=0;var l=array.length;while(i < l){if(array[i]==valueToCheck) return true;++i;} return false;} xajax.tools.doubleQuotes=function(haystack){return haystack.replace(new RegExp("'",'g'),'"');} xajax.tools.singleQuotes=function(haystack){return haystack.replace(new RegExp('"','g'),"'");} xajax.tools._escape=function(data){if('undefined'==typeof data) return data;if('string'!=typeof data) return data;var needCDATA=false;if(encodeURIComponent(data)!=data){needCDATA=true;var segments=data.split('');var fragLen=fragments.length;segment='';for(var j=0;j < fragLen;++j){if(0!=j) segment+=']]]]>';segment+=fragments[j];} if(0!=i) data.push('';return data;} xajax.tools._objectToXML=function(obj,guard){var aXml=[];aXml.push('');for(var key in obj){++guard.size;if(guard.maxSize < guard.size) return aXml.join('');if('undefined'!=typeof obj[key]){if('constructor'==key) continue;if('function'==typeof obj[key]) continue;aXml.push('');var val=xajax.tools._escape(key);aXml.push(val);aXml.push('');if('object'==typeof obj[key]){++guard.depth;if(guard.maxDepth > guard.depth){try{aXml.push(xajax.tools._objectToXML(obj[key],guard));}catch(e){} } --guard.depth;}else{var val=xajax.tools._escape(obj[key]);if('undefined'==typeof val||null==val){aXml.push('*');}else{var sType=typeof val;if('string'==sType) aXml.push('S');else if('boolean'==sType) aXml.push('B');else if('number'==sType) aXml.push('N');aXml.push(val);} } aXml.push('');} } aXml.push('');return aXml.join('');} xajax.tools._enforceDataType=function(value){value=new String(value);var type=value.substr(0,1);value=value.substr(1);if('*'==type) value=null;else if('N'==type) value=value-0;else if('B'==type) value=!!value;return value;} xajax.tools._nodeToObject=function(node){if(null==node) return '';if('undefined'!=typeof node.nodeName){if('#cdata-section'==node.nodeName||'#text'==node.nodeName){var data='';do if(node.data)data+=node.data;while(node=node.nextSibling);return xajax.tools._enforceDataType(data);}else if('xjxobj'==node.nodeName){var key=null;var value=null;var data=new Array;var child=node.firstChild;while(child){if('e'==child.nodeName){var grandChild=child.firstChild;while(grandChild){if('k'==grandChild.nodeName) key=xajax.tools._enforceDataType(grandChild.firstChild.data);else('v'==grandChild.nodeName) value=xajax.tools._nodeToObject(grandChild.firstChild);grandChild=grandChild.nextSibling;} if(null!=key){data[key]=value;key=value=null;} } child=child.nextSibling;} return data;} } throw{code:10001,data:node.nodeName};} xajax.tools.getRequestObject=function(){if('undefined'!=typeof XMLHttpRequest){xajax.tools.getRequestObject=function(){return new XMLHttpRequest();} }else if('undefined'!=typeof ActiveXObject){xajax.tools.getRequestObject=function(){try{return new ActiveXObject('Msxml2.XMLHTTP.4.0');}catch(e){xajax.tools.getRequestObject=function(){try{return new ActiveXObject('Msxml2.XMLHTTP');}catch(e2){xajax.tools.getRequestObject=function(){return new ActiveXObject('Microsoft.XMLHTTP');} return xajax.tools.getRequestObject();} } return xajax.tools.getRequestObject();} } }else if(window.createRequest){xajax.tools.getRequestObject=function(){return window.createRequest();} }else{xajax.tools.getRequestObject=function(){throw{code:10002};} } return xajax.tools.getRequestObject();} xajax.tools.getBrowserHTML=function(sValue){var oDoc=xajax.config.baseDocument;if(!oDoc.body) return '';var elWorkspace=xajax.$('xajax_temp_workspace');if(!elWorkspace){elWorkspace=oDoc.createElement('div');elWorkspace.setAttribute('id','xajax_temp_workspace');elWorkspace.style.display='none';elWorkspace.style.visibility='hidden';oDoc.body.appendChild(elWorkspace);} elWorkspace.innerHTML=sValue;var browserHTML=elWorkspace.innerHTML;elWorkspace.innerHTML='';return browserHTML;} xajax.tools.willChange=function(element,attribute,newData){if('string'==typeof element) element=xajax.$(element);if(element){var oldData;eval('oldData=element.'+attribute);return(newData!=oldData);} return false;} xajax.tools.getFormValues=function(parent){var submitDisabledElements=false;if(arguments.length > 1&&arguments[1]==true) submitDisabledElements=true;var prefix='';if(arguments.length > 2) prefix=arguments[2];if('string'==typeof parent) parent=xajax.$(parent);var aFormValues={};if(parent) if(parent.childNodes) xajax.tools._getFormValues(aFormValues,parent.childNodes,submitDisabledElements,prefix);return aFormValues;} xajax.tools._getFormValues=function(aFormValues,children,submitDisabledElements,prefix){var iLen=children.length;for(var i=0;i < iLen;++i){var child=children[i];if('undefined'!=typeof child.childNodes) xajax.tools._getFormValues(aFormValues,child.childNodes,submitDisabledElements,prefix);xajax.tools._getFormValue(aFormValues,child,submitDisabledElements,prefix);} } xajax.tools._getFormValue=function(aFormValues,child,submitDisabledElements,prefix){if(!child.name) return;if('PARAM'==child.tagName)return;if(child.disabled) if(true==child.disabled) if(false==submitDisabledElements) return;if(prefix!=child.name.substring(0,prefix.length)) return;if(child.type) if(child.type=='radio'||child.type=='checkbox') if(false==child.checked) return;var name=child.name;var values=[];if('select-multiple'==child.type){var jLen=child.length;for(var j=0;j < jLen;++j){var option=child.options[j];if(true==option.selected) values.push(option.value);} }else{values=child.value;} var keyBegin=name.indexOf('[');if(0 <=keyBegin){var n=name;var k=n.substr(0,n.indexOf('['));var a=n.substr(n.indexOf('['));if(typeof aFormValues[k]=='undefined') aFormValues[k]=[];var p=aFormValues;while(a.length!=0){var sa=a.substr(0,a.indexOf(']')+1);var lk=k;var lp=p;a=a.substr(a.indexOf(']')+1);p=p[k];k=sa.substr(1,sa.length-2);if(k==''){if('select-multiple'==child.type){k=lk;p=lp;}else{k=p.length;} } if(typeof p[k]=='undefined') p[k]=[];} p[k]=values;}else{aFormValues[name]=values;} } xajax.tools.stripOnPrefix=function(sEventName){sEventName=sEventName.toLowerCase();if(0==sEventName.indexOf('on')) sEventName=sEventName.replace(/on/,'');return sEventName;} xajax.tools.addOnPrefix=function(sEventName){sEventName=sEventName.toLowerCase();if(0!=sEventName.indexOf('on')) sEventName='on'+sEventName;return sEventName;} xajax.tools.xml={};xajax.tools.xml.parseAttributes=function(child,obj){var iLen=child.attributes.length;for(var i=0;i < iLen;++i){var attr=child.attributes[i];obj[attr.name]=attr.value;} } xajax.tools.xml.parseChildren=function(child,obj){obj.data='';if(0 < child.childNodes.length){if(1 < child.childNodes.length){var grandChild=child.firstChild;do{if('#cdata-section'==grandChild.nodeName||'#text'==grandChild.nodeName){obj.data+=grandChild.data;} }while(grandChild=grandChild.nextSibling);}else{var grandChild=child.firstChild;if('xjxobj'==grandChild.nodeName){obj.data=xajax.tools._nodeToObject(grandChild);return;}else if('#cdata-section'==grandChild.nodeName||'#text'==grandChild.nodeName){obj.data=grandChild.data;} } }else if('undefined'!=typeof child.data){obj.data=child.data;} obj.data=xajax.tools._enforceDataType(obj.data);} xajax.tools.xml.processFragment=function(xmlNode,seq,oRet,oRequest){var xx=xajax;var xt=xx.tools;while(xmlNode){if('cmd'==xmlNode.nodeName){var obj={};obj.fullName='*unknown*';obj.sequence=seq;obj.request=oRequest;obj.context=oRequest.context;xt.xml.parseAttributes(xmlNode,obj);xt.xml.parseChildren(xmlNode,obj);xt.queue.push(xx.response,obj);}else if('xjxrv'==xmlNode.nodeName){oRet=xt._nodeToObject(xmlNode.firstChild);}else if('debugmsg'==xmlNode.nodeName){}else throw{code:10004,data:xmlNode.nodeName} ++seq;xmlNode=xmlNode.nextSibling;} return oRet;} xajax.tools.queue={} xajax.tools.queue.create=function(size){return{start:0, size:size, end:0, commands:[], timeout:null } } xajax.tools.queue.retry=function(obj,count){var retries=obj.retries;if(retries){--retries;if(1 > retries) return false;}else retries=count;obj.retries=retries;return true;} xajax.tools.queue.rewind=function(theQ){if(0 < theQ.start) --theQ.start;else theQ.start=theQ.size;} xajax.tools.queue.setWakeup=function(theQ,when){if(null!=theQ.timeout){clearTimeout(theQ.timeout);theQ.timeout=null;} theQ.timout=setTimeout(function(){xajax.tools.queue.process(theQ);},when);} xajax.tools.queue.process=function(theQ){if(null!=theQ.timeout){clearTimeout(theQ.timeout);theQ.timeout=null;} var obj=xajax.tools.queue.pop(theQ);while(null!=obj){try{if(false==xajax.executeCommand(obj)) return false;}catch(e){} delete obj;obj=xajax.tools.queue.pop(theQ);} return true;} xajax.tools.queue.push=function(theQ,obj){var next=theQ.end+1;if(next > theQ.size) next=0;if(next!=theQ.start){theQ.commands[theQ.end]=obj;theQ.end=next;}else throw{code:10003} } xajax.tools.queue.pushFront=function(theQ,obj){xajax.tools.queue.rewind(theQ);theQ.commands[theQ.start]=obj;} xajax.tools.queue.pop=function(theQ){var next=theQ.start;if(next==theQ.end) return null;next++;if(next > theQ.size) next=0;var obj=theQ.commands[theQ.start];delete theQ.commands[theQ.start];theQ.start=next;return obj;} xajax.responseProcessor={};xajax.responseProcessor.xml=function(oRequest){var xx=xajax;var xt=xx.tools;var xcb=xx.callback;var gcb=xcb.global;var lcb=oRequest.callback;var oRet=oRequest.returnValue;if(xt.arrayContainsValue(xx.responseSuccessCodes,oRequest.request.status)){xcb.execute([gcb,lcb],'onSuccess',oRequest);var seq=0;if(oRequest.request.responseXML){var responseXML=oRequest.request.responseXML;if(responseXML.documentElement){oRequest.status.onProcessing();var child=responseXML.documentElement.firstChild;oRet=xt.xml.processFragment(child,seq,oRet,oRequest);} } var obj={};obj.fullName='Response Complete';obj.sequence=seq;obj.request=oRequest;obj.context=oRequest.context;obj.cmd='rcmplt';xt.queue.push(xx.response,obj);if(null==xx.response.timeout) xt.queue.process(xx.response);}else if(xt.arrayContainsValue(xx.responseRedirectCodes,oRequest.request.status)){xcb.execute([gcb,lcb],'onRedirect',oRequest);window.location=oRequest.request.getResponseHeader('location');xx.completeResponse(oRequest);}else if(xt.arrayContainsValue(xx.responseErrorsForAlert,oRequest.request.status)){xcb.execute([gcb,lcb],'onFailure',oRequest);xx.completeResponse(oRequest);} return oRet;} xajax.js={} xajax.js.includeScriptOnce=function(command){command.fullName='includeScriptOnce';var fileName=command.data;var oDoc=xajax.config.baseDocument;var loadedScripts=oDoc.getElementsByTagName('script');var iLen=loadedScripts.length;for(var i=0;i < iLen;++i){var script=loadedScripts[i];if(script.src){if(0 <=script.src.indexOf(fileName)) return true;} } return xajax.js.includeScript(command);} xajax.js.includeScript=function(command){command.fullName='includeScript';var oDoc=xajax.config.baseDocument;var objHead=oDoc.getElementsByTagName('head');var objScript=oDoc.createElement('script');objScript.src=command.data;if('undefined'==typeof command.type)objScript.type='text/javascript';else objScript.type=command.type;if('undefined'!=typeof command.type)objScript.setAttribute('id',command.elm_id);objHead[0].appendChild(objScript);return true;} xajax.js.removeScript=function(command){command.fullName='removeScript';var fileName=command.data;var unload=command.unld;var oDoc=xajax.config.baseDocument;var loadedScripts=oDoc.getElementsByTagName('script');var iLen=loadedScripts.length;for(var i=0;i < iLen;++i){var script=loadedScripts[i];if(script.src){if(0 <=script.src.indexOf(fileName)){if('undefined'!=typeof unload){var args={};args.data=unload;args.context=window;xajax.js.execute(args);} var parent=script.parentNode;parent.removeChild(script);} } } return true;} xajax.js.sleep=function(command){command.fullName='sleep';if(xajax.tools.queue.retry(command,command.prop)){xajax.tools.queue.setWakeup(xajax.response,100);return false;} return true;} xajax.js.confirmCommands=function(command){command.fullName='confirmCommands';var msg=command.data;var numberOfCommands=command.id;if(false==confirm(msg)){while(0 < numberOfCommands){xajax.tools.queue.pop(xajax.response);--numberOfCommands;} } return true;} xajax.js.execute=function(args){args.fullName='execute Javascript';var returnValue=true;args.context.xajaxDelegateCall=function(){eval(args.data);} args.context.xajaxDelegateCall();return returnValue;} xajax.js.waitFor=function(args){args.fullName='waitFor';var bResult=false;var cmdToEval='bResult = (';cmdToEval+=args.data;cmdToEval+=');';try{args.context.xajaxDelegateCall=function(){eval(cmdToEval);} args.context.xajaxDelegateCall();}catch(e){} if(false==bResult){if(xajax.tools.queue.retry(args,args.prop)){xajax.tools.queue.setWakeup(xajax.response,100);return false;} } return true;} xajax.js.call=function(args){args.fullName='call js function';var parameters=args.data;var scr=new Array();scr.push(args.func);scr.push('(');if('undefined'!=typeof parameters){if('object'==typeof parameters){var iLen=parameters.length;if(0 < iLen){scr.push('parameters[0]');for(var i=1;i < iLen;++i) scr.push(', parameters['+i+']');} } } scr.push(');');args.context.xajaxDelegateCall=function(){eval(scr.join(''));} args.context.xajaxDelegateCall();return true;} xajax.js.setFunction=function(args){args.fullName='setFunction';var code=new Array();code.push(args.func);code.push(' = function(');if('object'==typeof args.prop){var separator='';for(var m in args.prop){code.push(separator);code.push(args.prop[m]);separator=',';} }else code.push(args.prop);code.push(') { ');code.push(args.data);code.push(' }');args.context.xajaxDelegateCall=function(){eval(code.join(''));} args.context.xajaxDelegateCall();return true;} xajax.js.wrapFunction=function(args){args.fullName='wrapFunction';var code=new Array();code.push(args.func);code.push(' = xajax.js.makeWrapper(');code.push(args.func);code.push(', args.prop, args.data, args.type, args.context);');args.context.xajaxDelegateCall=function(){eval(code.join(''));} args.context.xajaxDelegateCall();return true;} xajax.js.makeWrapper=function(origFun,args,codeBlocks,returnVariable,context){var originalCall='';if(0 < returnVariable.length){originalCall+=returnVariable;originalCall+=' = ';} var originalCall='origFun(';originalCall+=args;originalCall+='); ';var code='wrapper = function(';code+=args;code+=') { ';if(0 < returnVariable.length){code+=' var ';code+=returnVariable;code+=' = null;';} var separator='';var bLen=codeBlocks.length;for(var b=0;b < bLen;++b){code+=separator;code+=codeBlocks[b];separator=originalCall;} if(0 < returnVariable.length){code+=' return ';code+=returnVariable;code+=';';} code+=' } ';var wrapper=null;context.xajaxDelegateCall=function(){eval(code);} context.xajaxDelegateCall();return wrapper;} xajax.dom={} xajax.dom.assign=function(element,property,data){if('string'==typeof element) element=xajax.$(element);switch(property){case 'innerHTML': element.innerHTML=data;break;case 'outerHTML': if('undefined'==typeof element.outerHTML){var r=xajax.config.baseDocument.createRange();r.setStartBefore(element);var df=r.createContextualFragment(data);element.parentNode.replaceChild(df,element);}else element.outerHTML=data;break;default: if(xajax.tools.willChange(element,property,data)) eval('element.'+property+' = data;');break;} return true;} xajax.dom.append=function(element,property,data){if('string'==typeof element) element=xajax.$(element);eval('element.'+property+' += data;');return true;} xajax.dom.prepend=function(element,property,data){if('string'==typeof element) element=xajax.$(element);eval('element.'+property+' = data + element.'+property);return true;} xajax.dom.replace=function(element,sAttribute,aData){var sSearch=aData['s'];var sReplace=aData['r'];if(sAttribute=='innerHTML') sSearch=xajax.tools.getBrowserHTML(sSearch);if('string'==typeof element) element=xajax.$(element);eval('var txt = element.'+sAttribute);var bFunction=false;if('function'==typeof txt){txt=txt.join('');bFunction=true;} var start=txt.indexOf(sSearch);if(start >-1){var newTxt=[];while(start >-1){var end=start+sSearch.length;newTxt.push(txt.substr(0,start));newTxt.push(sReplace);txt=txt.substr(end,txt.length-end);start=txt.indexOf(sSearch);} newTxt.push(txt);newTxt=newTxt.join('');if(bFunction){eval('element.'+sAttribute+'=newTxt;');}else if(xajax.tools.willChange(element,sAttribute,newTxt)){eval('element.'+sAttribute+'=newTxt;');} } return true;} xajax.dom.remove=function(element){if('string'==typeof element) element=xajax.$(element);if(element&&element.parentNode&&element.parentNode.removeChild) element.parentNode.removeChild(element);return true;} xajax.dom.create=function(objParent,sTag,sId){if('string'==typeof objParent) objParent=xajax.$(objParent);var target=xajax.config.baseDocument.createElement(sTag);target.setAttribute('id',sId);if(objParent) objParent.appendChild(target);return true;} xajax.dom.insert=function(objSibling,sTag,sId){if('string'==typeof objSibling) objSibling=xajax.$(objSibling);var target=xajax.config.baseDocument.createElement(sTag);target.setAttribute('id',sId);objSibling.parentNode.insertBefore(target,objSibling);return true;} xajax.dom.insertAfter=function(objSibling,sTag,sId){if('string'==typeof objSibling) objSibling=xajax.$(objSibling);var target=xajax.config.baseDocument.createElement(sTag);target.setAttribute('id',sId);objSibling.parentNode.insertBefore(target,objSibling.nextSibling);return true;} xajax.dom.contextAssign=function(args){args.fullName='context assign';var code=[];code.push('this.');code.push(args.prop);code.push(' = data;');code=code.join('');args.context.xajaxDelegateCall=function(data){eval(code);} args.context.xajaxDelegateCall(args.data);return true;} xajax.dom.contextAppend=function(args){args.fullName='context append';var code=[];code.push('this.');code.push(args.prop);code.push(' += data;');code=code.join('');args.context.xajaxDelegateCall=function(data){eval(code);} args.context.xajaxDelegateCall(args.data);return true;} xajax.dom.contextPrepend=function(args){args.fullName='context prepend';var code=[];code.push('this.');code.push(args.prop);code.push(' = data + this.');code.push(args.prop);code.push(';');code=code.join('');args.context.xajaxDelegateCall=function(data){eval(code);} args.context.xajaxDelegateCall(args.data);return true;} xajax.css={} xajax.css.add=function(fileName,media){var oDoc=xajax.config.baseDocument;var oHeads=oDoc.getElementsByTagName('head');var oHead=oHeads[0];var oLinks=oHead.getElementsByTagName('link');var found=false;var iLen=oLinks.length;for(var i=0;i < iLen&&false==found;++i) if(0 <=oLinks[i].href.indexOf(fileName)&&oLinks[i].media==media) found=true;if(false==found){var oCSS=oDoc.createElement('link');oCSS.rel='stylesheet';oCSS.type='text/css';oCSS.href=fileName;oCSS.media=media;oHead.appendChild(oCSS);} return true;} xajax.css.remove=function(fileName,media){var oDoc=xajax.config.baseDocument;var oHeads=oDoc.getElementsByTagName('head');var oHead=oHeads[0];var oLinks=oHead.getElementsByTagName('link');var i=0;while(i < oLinks.length) if(0 <=oLinks[i].href.indexOf(fileName)&&oLinks[i].media==media) oHead.removeChild(oLinks[i]);else++i;return true;} xajax.css.waitForCSS=function(args){var oDocSS=xajax.config.baseDocument.styleSheets;var ssEnabled=[];var iLen=oDocSS.length;for(var i=0;i < iLen;++i){ssEnabled[i]=0;try{ssEnabled[i]=oDocSS[i].cssRules.length;}catch(e){try{ssEnabled[i]=oDocSS[i].rules.length;}catch(e){} } } var ssLoaded=true;var iLen=ssEnabled.length;for(var i=0;i < iLen;++i) if(0==ssEnabled[i]) ssLoaded=false;if(false==ssLoaded){if(xajax.tools.queue.retry(args,args.prop)){xajax.tools.queue.setWakeup(xajax.response,10);return false;} } return true;} xajax.forms={} xajax.forms.getInput=function(type,name,id){if('undefined'==typeof window.addEventListener){xajax.forms.getInput=function(type,name,id){return xajax.config.baseDocument.createElement('');} }else{xajax.forms.getInput=function(type,name,id){var oDoc=xajax.config.baseDocument;var Obj=oDoc.createElement('input');Obj.setAttribute('type',type);Obj.setAttribute('name',name);Obj.setAttribute('id',id);return Obj;} } return xajax.forms.getInput(type,name,id);} xajax.forms.createInput=function(command){command.fullName='createInput';var objParent=command.id;var sType=command.type;var sName=command.data;var sId=command.prop;if('string'==typeof objParent) objParent=xajax.$(objParent);var target=xajax.forms.getInput(sType,sName,sId);if(objParent&&target){objParent.appendChild(target);} return true;} xajax.forms.insertInput=function(command){command.fullName='insertInput';var objSibling=command.id;var sType=command.type;var sName=command.data;var sId=command.prop;if('string'==typeof objSibling) objSibling=xajax.$(objSibling);var target=xajax.forms.getInput(sType,sName,sId);if(target&&objSibling&&objSibling.parentNode) objSibling.parentNode.insertBefore(target,objSibling);return true;} xajax.forms.insertInputAfter=function(command){command.fullName='insertInputAfter';var objSibling=command.id;var sType=command.type;var sName=command.data;var sId=command.prop;if('string'==typeof objSibling) objSibling=xajax.$(objSibling);var target=xajax.forms.getInput(sType,sName,sId);if(target&&objSibling&&objSibling.parentNode) objSibling.parentNode.insertBefore(target,objSibling.nextSibling);return true;} xajax.events={} xajax.events.setEvent=function(command){command.fullName='addEvent';var element=command.id;var sEvent=command.prop;var code=command.data;if('string'==typeof element) element=xajax.$(element);sEvent=xajax.tools.addOnPrefix(sEvent);code=xajax.tools.doubleQuotes(code);eval('element.'+sEvent+' = function() { '+code+'; }');return true;} xajax.events.addHandler=function(element,sEvent,fun){if(window.addEventListener){xajax.events.addHandler=function(command){command.fullName='addHandler';var element=command.id;var sEvent=command.prop;var fun=command.data;if('string'==typeof element) element=xajax.$(element);sEvent=xajax.tools.stripOnPrefix(sEvent);eval('element.addEventListener("'+sEvent+'", '+fun+', false);');return true;} }else{xajax.events.addHandler=function(command){command.fullName='addHandler';var element=command.id;var sEvent=command.prop;var fun=command.data;if('string'==typeof element) element=xajax.$(element);sEvent=xajax.tools.addOnPrefix(sEvent);eval('element.attachEvent("'+sEvent+'", '+fun+', false);');return true;} } return xajax.events.addHandler(element,sEvent,fun);} xajax.events.removeHandler=function(element,sEvent,fun){if(window.removeEventListener){xajax.events.removeHandler=function(command){command.fullName='removeHandler';var element=command.id;var sEvent=command.prop;var fun=command.data;if('string'==typeof element) element=xajax.$(element);sEvent=xajax.tools.stripOnPrefix(sEvent);eval('element.removeEventListener("'+sEvent+'", '+fun+', false);');return true;} }else{xajax.events.removeHandler=function(command){command.fullName='removeHandler';var element=command.id;var sEvent=command.prop;var fun=command.data;if('string'==typeof element) element=xajax.$(element);sEvent=xajax.tools.addOnPrefix(sEvent);eval('element.detachEvent("'+sEvent+'", '+fun+', false);');return true;} } return xajax.events.removeHandler(element,sEvent,fun);} xajax.callback={} xajax.callback.create=function(){var xx=xajax;var xc=xx.config;var xcb=xx.callback;var oCB={} oCB.timers={};oCB.timers.onResponseDelay=xcb.setupTimer( (arguments.length > 0) ? arguments[0] :xc.defaultResponseDelayTime);oCB.timers.onExpiration=xcb.setupTimer( (arguments.length > 1) ? arguments[1] :xc.defaultExpirationTime);oCB.onRequest=null;oCB.onResponseDelay=null;oCB.onExpiration=null;oCB.beforeResponseProcessing=null;oCB.onFailure=null;oCB.onRedirect=null;oCB.onSuccess=null;oCB.onComplete=null;return oCB;} xajax.callback.setupTimer=function(iDelay){return{timer:null,delay:iDelay};} xajax.callback.clearTimer=function(oCallback,sFunction){if('undefined'!=typeof oCallback.timers){if('undefined'!=typeof oCallback.timers[sFunction]){clearTimeout(oCallback.timers[sFunction].timer);} }else if('object'==typeof oCallback){var iLen=oCallback.length;for(var i=0;i < iLen;++i) xajax.callback.clearTimer(oCallback[i],sFunction);} } xajax.callback.execute=function(oCallback,sFunction,args){if('undefined'!=typeof oCallback[sFunction]){var func=oCallback[sFunction];if('function'==typeof func){if('undefined'!=typeof oCallback.timers[sFunction]){oCallback.timers[sFunction].timer=setTimeout(function(){func(args);},oCallback.timers[sFunction].delay);} else{func(args);} } }else if('object'==typeof oCallback){var iLen=oCallback.length;for(var i=0;i < iLen;++i) xajax.callback.execute(oCallback[i],sFunction,args);} } xajax.callback.global=xajax.callback.create();xajax.response=xajax.tools.queue.create(xajax.config.responseQueueSize);xajax.responseSuccessCodes=['0','200'];xajax.responseErrorsForAlert=['400','401','402','403','404','500','501','502','503'];xajax.responseRedirectCodes=['301','302','307'];if('undefined'==typeof xajax.command) xajax.command={};xajax.command.create=function(sequence,request,context){var newCmd={};newCmd.cmd='*';newCmd.fullName='* unknown command name *';newCmd.sequence=sequence;newCmd.request=request;newCmd.context=context;return newCmd;} if('undefined'==typeof xajax.command.handler) xajax.command.handler={};if('undefined'==typeof xajax.command.handler.handlers) xajax.command.handler.handlers=[];xajax.command.handler.register=function(shortName,func){xajax.command.handler.handlers[shortName]=func;} xajax.command.handler.unregister=function(shortName){var func=xajax.command.handler.handlers[shortName];delete xajax.command.handler.handlers[shortName];return func;} xajax.command.handler.isRegistered=function(command){var shortName=command.cmd;if(xajax.command.handler.handlers[shortName]) return true;return false;} xajax.command.handler.call=function(command){var shortName=command.cmd;return xajax.command.handler.handlers[shortName](command);} xajax.command.handler.register('rcmplt',function(args){xajax.completeResponse(args.request);return true;});xajax.command.handler.register('css',function(args){args.fullName='includeCSS';if('undefined'==typeof args.media) args.media='screen';return xajax.css.add(args.data,args.media);});xajax.command.handler.register('rcss',function(args){args.fullName='removeCSS';if('undefined'==typeof args.media) args.media='screen';return xajax.css.remove(args.data,args.media);});xajax.command.handler.register('wcss',function(args){args.fullName='waitForCSS';return xajax.css.waitForCSS(args);});xajax.command.handler.register('as',function(args){args.fullName='assign/clear';try{return xajax.dom.assign(args.target,args.prop,args.data);}catch(e){} return true;});xajax.command.handler.register('ap',function(args){args.fullName='append';return xajax.dom.append(args.target,args.prop,args.data);});xajax.command.handler.register('pp',function(args){args.fullName='prepend';return xajax.dom.prepend(args.target,args.prop,args.data);});xajax.command.handler.register('rp',function(args){args.fullName='replace';return xajax.dom.replace(args.id,args.prop,args.data);});xajax.command.handler.register('rm',function(args){args.fullName='remove';return xajax.dom.remove(args.id);});xajax.command.handler.register('ce',function(args){args.fullName='create';return xajax.dom.create(args.id,args.data,args.prop);});xajax.command.handler.register('ie',function(args){args.fullName='insert';return xajax.dom.insert(args.id,args.data,args.prop);});xajax.command.handler.register('ia',function(args){args.fullName='insertAfter';return xajax.dom.insertAfter(args.id,args.data,args.prop);});xajax.command.handler.register('c:as',xajax.dom.contextAssign);xajax.command.handler.register('c:ap',xajax.dom.contextAppend);xajax.command.handler.register('c:pp',xajax.dom.contextPrepend);xajax.command.handler.register('s',xajax.js.sleep);xajax.command.handler.register('ino',xajax.js.includeScriptOnce);xajax.command.handler.register('in',xajax.js.includeScript);xajax.command.handler.register('rjs',xajax.js.removeScript);xajax.command.handler.register('wf',xajax.js.waitFor);xajax.command.handler.register('js',xajax.js.execute);xajax.command.handler.register('jc',xajax.js.call);xajax.command.handler.register('sf',xajax.js.setFunction);xajax.command.handler.register('wpf',xajax.js.wrapFunction);xajax.command.handler.register('al',function(args){args.fullName='alert';alert(args.data);return true;});xajax.command.handler.register('cc',xajax.js.confirmCommands);xajax.command.handler.register('ci',xajax.forms.createInput);xajax.command.handler.register('ii',xajax.forms.insertInput);xajax.command.handler.register('iia',xajax.forms.insertInputAfter);xajax.command.handler.register('ev',xajax.events.setEvent);xajax.command.handler.register('ah',xajax.events.addHandler);xajax.command.handler.register('rh',xajax.events.removeHandler);xajax.command.handler.register('dbg',function(args){args.fullName='debug message';return true;});xajax.initializeRequest=function(oRequest){var xx=xajax;var xc=xx.config;oRequest.append=function(opt,def){if('undefined'!=typeof this[opt]){for(var itmName in def) if('undefined'==typeof this[opt][itmName]) this[opt][itmName]=def[itmName];}else this[opt]=def;} oRequest.append('commonHeaders',xc.commonHeaders);oRequest.append('postHeaders',xc.postHeaders);oRequest.append('getHeaders',xc.getHeaders);oRequest.set=function(option,defaultValue){if('undefined'==typeof this[option]) this[option]=defaultValue;} oRequest.set('statusMessages',xc.statusMessages);oRequest.set('waitCursor',xc.waitCursor);oRequest.set('mode',xc.defaultMode);oRequest.set('method',xc.defaultMethod);oRequest.set('URI',xc.requestURI);oRequest.set('httpVersion',xc.defaultHttpVersion);oRequest.set('contentType',xc.defaultContentType);oRequest.set('retry',xc.defaultRetry);oRequest.set('returnValue',xc.defaultReturnValue);oRequest.set('maxObjectDepth',xc.maxObjectDepth);oRequest.set('maxObjectSize',xc.maxObjectSize);oRequest.set('context',window);var xcb=xx.callback;var gcb=xcb.global;var lcb=xcb.create();lcb.take=function(frm,opt){if('undefined'!=typeof frm[opt]){lcb[opt]=frm[opt];lcb.hasEvents=true;} delete frm[opt];} lcb.take(oRequest,'onRequest');lcb.take(oRequest,'onResponseDelay');lcb.take(oRequest,'onExpiration');lcb.take(oRequest,'beforeResponseProcessing');lcb.take(oRequest,'onFailure');lcb.take(oRequest,'onRedirect');lcb.take(oRequest,'onSuccess');lcb.take(oRequest,'onComplete');if('undefined'!=typeof oRequest.callback){if(lcb.hasEvents) oRequest.callback=[oRequest.callback,lcb];}else oRequest.callback=lcb;oRequest.status=(oRequest.statusMessages) ? xc.status.update() :xc.status.dontUpdate();oRequest.cursor=(oRequest.waitCursor) ? xc.cursor.update() :xc.cursor.dontUpdate();oRequest.method=oRequest.method.toUpperCase();if('GET'!=oRequest.method) oRequest.method='POST';oRequest.requestRetry=oRequest.retry;oRequest.append('postHeaders',{'content-type':oRequest.contentType });delete oRequest['append'];delete oRequest['set'];delete oRequest['take'];if('undefined'==typeof oRequest.URI) throw{code:10005} } xajax.processParameters=function(oRequest){var xx=xajax;var xt=xx.tools;var rd=[];var separator='';for(var sCommand in oRequest.functionName){if('constructor'!=sCommand){rd.push(separator);rd.push(sCommand);rd.push('=');rd.push(encodeURIComponent(oRequest.functionName[sCommand]));separator='&';} } var dNow=new Date();rd.push('&xjxr=');rd.push(dNow.getTime());delete dNow;if(oRequest.parameters){var i=0;var iLen=oRequest.parameters.length;while(i < iLen){var oVal=oRequest.parameters[i];if('object'==typeof oVal&&null!=oVal){try{var oGuard={};oGuard.depth=0;oGuard.maxDepth=oRequest.maxObjectDepth;oGuard.size=0;oGuard.maxSize=oRequest.maxObjectSize;oVal=xt._objectToXML(oVal,oGuard);}catch(e){oVal='';} rd.push('&xjxargs[]=');oVal=encodeURIComponent(oVal);rd.push(oVal);++i;}else{rd.push('&xjxargs[]=');oVal=xt._escape(oVal);if('undefined'==typeof oVal||null==oVal){rd.push('*');}else{var sType=typeof oVal;if('string'==sType) rd.push('S');else if('boolean'==sType) rd.push('B');else if('number'==sType) rd.push('N');oVal=encodeURIComponent(oVal);rd.push(oVal);} ++i;} } } oRequest.requestURI=oRequest.URI;if('GET'==oRequest.method){oRequest.requestURI+=oRequest.requestURI.indexOf('?')==-1 ? '?':'&';oRequest.requestURI+=rd.join('');rd=[];} oRequest.requestData=rd.join('');} xajax.prepareRequest=function(oRequest){var xx=xajax;var xt=xx.tools;oRequest.request=xt.getRequestObject();oRequest.setRequestHeaders=function(headers){if('object'==typeof headers){for(var optionName in headers) this.request.setRequestHeader(optionName,headers[optionName]);} } oRequest.setCommonRequestHeaders=function(){this.setRequestHeaders(this.commonHeaders);} oRequest.setPostRequestHeaders=function(){this.setRequestHeaders(this.postHeaders);} oRequest.setGetRequestHeaders=function(){this.setRequestHeaders(this.getHeaders);} if('asynchronous'==oRequest.mode){oRequest.request.onreadystatechange=function(){if(oRequest.request.readyState!=4) return;xajax.responseReceived(oRequest);} oRequest.finishRequest=function(){return this.returnValue;} }else{oRequest.finishRequest=function(){return xajax.responseReceived(oRequest);} } if('undefined'!=typeof oRequest.userName&&'undefined'!=typeof oRequest.password){oRequest.open=function(){this.request.open( this.method, this.requestURI, 'asynchronous'==this.mode, oRequest.userName, oRequest.password);} }else{oRequest.open=function(){this.request.open( this.method, this.requestURI, 'asynchronous'==this.mode);} } if('POST'==oRequest.method){oRequest.applyRequestHeaders=function(){this.setCommonRequestHeaders();try{this.setPostRequestHeaders();}catch(e){this.method='GET';this.requestURI+=this.requestURI.indexOf('?')==-1 ? '?':'&';this.requestURI+=this.requestData;this.requestData='';if(0==this.requestRetry)this.requestRetry=1;throw e;} } }else{oRequest.applyRequestHeaders=function(){this.setCommonRequestHeaders();this.setGetRequestHeaders();} } } xajax.request=function(){var numArgs=arguments.length;if(0==numArgs) return false;var oRequest={} if(1 < numArgs) oRequest=arguments[1];oRequest.functionName=arguments[0];var xx=xajax;xx.initializeRequest(oRequest);xx.processParameters(oRequest);while(0 < oRequest.requestRetry){try{--oRequest.requestRetry;xx.prepareRequest(oRequest);return xx.submitRequest(oRequest);}catch(e){xajax.callback.execute( [xajax.callback.global,oRequest.callback], 'onFailure',oRequest);if(0==oRequest.requestRetry) throw e;} } } xajax.call=function(){var numArgs=arguments.length;if(0==numArgs) return false;var oRequest={} if(1 < numArgs) oRequest=arguments[1];oRequest.functionName={xjxfun:arguments[0]};var xx=xajax;xx.initializeRequest(oRequest);xx.processParameters(oRequest);while(0 < oRequest.requestRetry){try{--oRequest.requestRetry;xx.prepareRequest(oRequest);return xx.submitRequest(oRequest);}catch(e){xajax.callback.execute( [xajax.callback.global,oRequest.callback], 'onFailure',oRequest);if(0==oRequest.requestRetry) throw e;} } } xajax.submitRequest=function(oRequest){oRequest.status.onRequest();var xcb=xajax.callback;var gcb=xcb.global;var lcb=oRequest.callback;xcb.execute([gcb,lcb],'onResponseDelay',oRequest);xcb.execute([gcb,lcb],'onExpiration',oRequest);xcb.execute([gcb,lcb],'onRequest',oRequest);oRequest.open();oRequest.applyRequestHeaders();oRequest.cursor.onWaiting();oRequest.status.onWaiting();xajax._internalSend(oRequest);return oRequest.finishRequest();} xajax._internalSend=function(oRequest){oRequest.request.send(oRequest.requestData);} xajax.abortRequest=function(oRequest){oRequest.aborted=true;oRequest.request.abort();xajax.completeResponse(oRequest);} xajax.responseReceived=function(oRequest){var xx=xajax;var xcb=xx.callback;var gcb=xcb.global;var lcb=oRequest.callback;if(oRequest.aborted) return;xcb.clearTimer([gcb,lcb],'onExpiration');xcb.clearTimer([gcb,lcb],'onResponseDelay');xcb.execute([gcb,lcb],'beforeResponseProcessing',oRequest);var fProc=xx.getResponseProcessor(oRequest);if('undefined'==typeof fProc){xcb.execute([gcb,lcb],'onFailure',oRequest);xx.completeResponse(oRequest);return;} return fProc(oRequest);} xajax.getResponseProcessor=function(oRequest){var fProc;if('undefined'==typeof oRequest.responseProcessor){var cTyp=oRequest.request.getResponseHeader('content-type');if(cTyp){if(0 <=cTyp.indexOf('text/xml')){fProc=xajax.responseProcessor.xml;} } }else fProc=oRequest.responseProcessor;return fProc;} xajax.executeCommand=function(command){if(xajax.command.handler.isRegistered(command)){if(command.id) command.target=xajax.$(command.id);if(false==xajax.command.handler.call(command)){xajax.tools.queue.pushFront(xajax.response,command);return false;} } return true;} xajax.completeResponse=function(oRequest){xajax.callback.execute( [xajax.callback.global,oRequest.callback], 'onComplete',oRequest);oRequest.cursor.onComplete();oRequest.status.onComplete();delete oRequest['functionName'];delete oRequest['requestURI'];delete oRequest['requestData'];delete oRequest['requestRetry'];delete oRequest['request'];delete oRequest['set'];delete oRequest['open'];delete oRequest['setRequestHeaders'];delete oRequest['setCommonRequestHeaders'];delete oRequest['setPostRequestHeaders'];delete oRequest['setGetRequestHeaders'];delete oRequest['applyRequestHeaders'];delete oRequest['finishRequest'];delete oRequest['status'];delete oRequest['cursor'];} xajax.$=xajax.tools.$;xajax.getFormValues=xajax.tools.getFormValues;xajax.isLoaded=true;xjx={} xjx.$=xajax.tools.$;xjx.getFormValues=xajax.tools.getFormValues;xjx.call=xajax.call;xjx.request=xajax.request;php-xajax-0.5/xajax_js/xajax_verbose_uncompressed.js0000644000175000017500000001053511137037724021503 0ustar dgildgil/* File: xajax_verbose.js The xajax verbose debugging module. This is an optional module, include in your project with care. :) Title: xajax verbose debugging module Please see for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajax_verbose_uncompressed 327 2007-02-28 16:55:26Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ try { if ('undefined' == typeof xajax) throw { name: 'SequenceError', message: 'Error: xajax core was not detected, verbose module disabled.' } if ('undefined' == typeof xajax.debug) throw { name: 'SequenceError', message: 'Error: xajax debugger was not detected, verbose module disabled.' } /* Class: xajax.debug.verbose Provide a high level of detail which can be used to debug hard to find problems. */ xajax.debug.verbose = {} /* Function: xajax.debug.verbose.expandObject Generate a debug message expanding all the first level members found therein. Parameters: obj - (object): The object to be enumerated. Returns: string - The textual representation of all the first level members. */ xajax.debug.verbose.expandObject = function(obj) { var rec = true; if (1 < arguments.length) rec = arguments[1]; if ('function' == typeof (obj)) { return '[Function]'; } else if ('object' == typeof (obj)) { if (true == rec) { var t = ' { '; var separator = ''; for (var m in obj) { t += separator; t += m; t += ': '; try { t += xajax.debug.verbose.expandObject(obj[m], false); } catch (e) { t += '[n/a]'; } separator = ', '; } t += ' } '; return t; } else return '[Object]'; } else return '"' + obj + '"'; } /* Function: xajax.debug.verbose.makeFunction Generate a wrapper function around the specified function. Parameters: obj - (object): The object that contains the function to be wrapped. name - (string): The name of the function to be wrapped. Returns: function - The wrapper function. */ xajax.debug.verbose.makeFunction = function(obj, name) { return function() { var fun = name; fun += '('; var separator = ''; var pLen = arguments.length; for (var p = 0; p < pLen; ++p) { fun += separator; fun += xajax.debug.verbose.expandObject(arguments[p]); separator = ','; } fun += ');'; var msg = '--> '; msg += fun; xajax.debug.writeMessage(msg); var returnValue = true; var code = 'returnValue = obj('; separator = ''; for (var p = 0; p < pLen; ++p) { code += separator; code += 'arguments[' + p + ']'; separator = ','; } code += ');'; eval(code); msg = '<-- '; msg += fun; msg += ' returns '; msg += xajax.debug.verbose.expandObject(returnValue); xajax.debug.writeMessage(msg); return returnValue; } } /* Function: xajax.debug.verbose.hook Generate a wrapper function around each of the functions contained within the specified object. Parameters: x - (object): The object to be scanned. base - (string): The base reference to be prepended to the generated wrapper functions. */ xajax.debug.verbose.hook = function(x, base) { for (var m in x) { if ('function' == typeof (x[m])) { x[m] = xajax.debug.verbose.makeFunction(x[m], base + m); } } } xajax.debug.verbose.hook(xajax, 'xajax.'); xajax.debug.verbose.hook(xajax.callback, 'xajax.callback.'); xajax.debug.verbose.hook(xajax.css, 'xajax.css.'); xajax.debug.verbose.hook(xajax.dom, 'xajax.dom.'); xajax.debug.verbose.hook(xajax.events, 'xajax.events.'); xajax.debug.verbose.hook(xajax.forms, 'xajax.forms.'); xajax.debug.verbose.hook(xajax.js, 'xajax.js.'); xajax.debug.verbose.hook(xajax.tools, 'xajax.tools.'); xajax.debug.verbose.hook(xajax.tools.queue, 'xajax.tools.queue.'); xajax.debug.verbose.hook(xajax.command, 'xajax.command.'); xajax.debug.verbose.hook(xajax.command.handler, 'xajax.command.handler.'); /* Boolean: isLoaded true - indicates that the verbose debugging module is loaded. */ xajax.debug.verbose.isLoaded = true; } catch (e) { alert(e.name + ': ' + e.message); } php-xajax-0.5/xajax_js/xajax_verbose.js0000644000175000017500000000416611045155136016713 0ustar dgildgil try{if('undefined'==typeof xajax) throw{name:'SequenceError',message:'Error: xajax core was not detected, verbose module disabled.'} if('undefined'==typeof xajax.debug) throw{name:'SequenceError',message:'Error: xajax debugger was not detected, verbose module disabled.'} xajax.debug.verbose={} xajax.debug.verbose.expandObject=function(obj){var rec=true;if(1 < arguments.length) rec=arguments[1];if('function'==typeof(obj)){return '[Function]';}else if('object'==typeof(obj)){if(true==rec){var t=' { ';var separator='';for(var m in obj){t+=separator;t+=m;t+=': ';try{t+=xajax.debug.verbose.expandObject(obj[m],false);}catch(e){t+='[n/a]';} separator=', ';} t+=' } ';return t;}else return '[Object]';}else return '"'+obj+'"';} xajax.debug.verbose.makeFunction=function(obj,name){return function(){var fun=name;fun+='(';var separator='';var pLen=arguments.length;for(var p=0;p < pLen;++p){fun+=separator;fun+=xajax.debug.verbose.expandObject(arguments[p]);separator=',';} fun+=');';var msg='--> ';msg+=fun;xajax.debug.writeMessage(msg);var returnValue=true;var code='returnValue = obj(';separator='';for(var p=0;p < pLen;++p){code+=separator;code+='arguments['+p+']';separator=',';} code+=');';eval(code);msg='<-- ';msg+=fun;msg+=' returns ';msg+=xajax.debug.verbose.expandObject(returnValue);xajax.debug.writeMessage(msg);return returnValue;} } xajax.debug.verbose.hook=function(x,base){for(var m in x){if('function'==typeof(x[m])){x[m]=xajax.debug.verbose.makeFunction(x[m],base+m);} } } xajax.debug.verbose.hook(xajax,'xajax.');xajax.debug.verbose.hook(xajax.callback,'xajax.callback.');xajax.debug.verbose.hook(xajax.css,'xajax.css.');xajax.debug.verbose.hook(xajax.dom,'xajax.dom.');xajax.debug.verbose.hook(xajax.events,'xajax.events.');xajax.debug.verbose.hook(xajax.forms,'xajax.forms.');xajax.debug.verbose.hook(xajax.js,'xajax.js.');xajax.debug.verbose.hook(xajax.tools,'xajax.tools.');xajax.debug.verbose.hook(xajax.tools.queue,'xajax.tools.queue.');xajax.debug.verbose.hook(xajax.command,'xajax.command.');xajax.debug.verbose.hook(xajax.command.handler,'xajax.command.handler.');xajax.debug.verbose.isLoaded=true;}catch(e){alert(e.name+': '+e.message);} php-xajax-0.5/xajax_js/xajax_lang_de.js0000644000175000017500000000547011100036744016631 0ustar dgildgilif('undefined'!=typeof xajax.debug){xajax.debug.text=[];xajax.debug.text[100]='WARNUNG: ';xajax.debug.text[101]='FEHLER: ';xajax.debug.text[102]='XAJAX FEHLERSUCHE NACHRICHT:\n';xajax.debug.text[103]='...\n[UMGFANGREICHE ANTWORT]\n...';xajax.debug.text[104]='SENDE ANFRAGE';xajax.debug.text[105]='GESENDET [';xajax.debug.text[106]=' bytes]';xajax.debug.text[107]='STARTE AUFRUF: ';xajax.debug.text[108]='URI: ';xajax.debug.text[109]='BEGINNE ANFRAGE';xajax.debug.text[110]='PARAMETER IN BEARBEITUNG [';xajax.debug.text[111]=']';xajax.debug.text[112]='KEINE PARAMETER ZU VERARBEITEN';xajax.debug.text[113]='BEREITE REQUEST VOR';xajax.debug.text[114]='BEGINNE XAJAX CALL (veraltet: verwendet stattdessen xajax.request)';xajax.debug.text[115]='BEGINNE XAJAX ANFRAGE';xajax.debug.text[116]='Die vom Server erhaltenen Daten konnten nicht verarbeitet werden.\n';xajax.debug.text[117]='.\nPrüfe auf Fehlermeldungen des Servers.';xajax.debug.text[118]='ERHALTEN [status: ';xajax.debug.text[119]=', Größe: ';xajax.debug.text[120]=' bytes, Zeit: ';xajax.debug.text[121]='ms]:\n';xajax.debug.text[122]='Der Server hat folgenden HTTP-Status zurück gesendet: ';xajax.debug.text[123]='\nERHALTEN:\n';xajax.debug.text[124]='Der Server lieferte einen Redirect nach:
';xajax.debug.text[125]='ABGESCHLOSSEN [';xajax.debug.text[126]='ms]';xajax.debug.text[127]='INITIALISIERE REQUEST OBJEKT';xajax.debug.exceptions=[];xajax.debug.exceptions[10001]='Ungültige XML-Antwort: die Antwort enthält ein ungültiges Tag: {data}.';xajax.debug.exceptions[10002]='GetRequestObject: XMLHttpRequest ist nicht verfügbar, XajaX ist nicht verfügbar.';xajax.debug.exceptions[10003]='Warteschleife-Überlauf: kann Objekt nicht an Warteschleife übergeben da diese voll ist.';xajax.debug.exceptions[10004]='Ungültige XML-Antwort: die Antwort enthält einen unerwarteten Tag oder Text: {data}.';xajax.debug.exceptions[10005]='Ungültige Request-URI: Ungültige oder Fehlende URI; Autoerkennung fehlgeschlagen; bitte nur eine einzige URI angeben.';xajax.debug.exceptions[10006]='Ungültiges Antwort-Befehl: Unvollständiges Objekt zurück erhalten.';xajax.debug.exceptions[10007]='Ungültiges Antwort-Befehl: Befehl [{data}] ist nicht bekannt.';xajax.debug.exceptions[10008]='Es konnte kein Element mit der ID [{data}] konnte im Dokument gefunden werden.';xajax.debug.exceptions[10009]='Ungültige Anfrage: Fehlender Funktionsparameter - name.';xajax.debug.exceptions[10010]='Ungültige Anfrage: Fehlender Funktionsparameter - object.';} if('undefined'!=typeof xajax.config){if('undefined'!=typeof xajax.config.status){xajax.config.status.update=function(){return{onRequest:function(){window.status='Sende Anfrage...';}, onWaiting:function(){window.status='Warten auf Antwort...';}, onProcessing:function(){window.status='Verarbeitung...';}, onComplete:function(){window.status='Fertig.';} } } } } php-xajax-0.5/xajax_core/0000755000175000017500000000000011345167001014017 5ustar dgildgilphp-xajax-0.5/xajax_core/plugin_layer/0000755000175000017500000000000011137074666016526 5ustar dgildgilphp-xajax-0.5/xajax_core/plugin_layer/xajaxCallableObjectPlugin.inc.php0000644000175000017500000001147411137037724025051 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxCallableObjectPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Constant: XAJAX_CALLABLE_OBJECT Specifies that the item being registered via the register> function is a object who's methods will be callable from the browser. */ if (!defined ('XAJAX_CALLABLE_OBJECT')) define ('XAJAX_CALLABLE_OBJECT', 'callable object'); //SkipAIO require dirname(__FILE__) . '/support/xajaxCallableObject.inc.php'; //EndSkipAIO /* Class: xajaxCallableObjectPlugin */ class xajaxCallableObjectPlugin extends xajaxRequestPlugin { /* Array: aCallableObjects */ var $aCallableObjects; /* String: sXajaxPrefix */ var $sXajaxPrefix; /* String: sDefer */ var $sDefer; var $bDeferScriptGeneration; /* String: sRequestedClass */ var $sRequestedClass; /* String: sRequestedMethod */ var $sRequestedMethod; /* Function: xajaxCallableObjectPlugin */ function xajaxCallableObjectPlugin() { $this->aCallableObjects = array(); $this->sXajaxPrefix = 'xajax_'; $this->sDefer = ''; $this->bDeferScriptGeneration = false; $this->sRequestedClass = NULL; $this->sRequestedMethod = NULL; if (!empty($_GET['xjxcls'])) $this->sRequestedClass = $_GET['xjxcls']; if (!empty($_GET['xjxmthd'])) $this->sRequestedMethod = $_GET['xjxmthd']; if (!empty($_POST['xjxcls'])) $this->sRequestedClass = $_POST['xjxcls']; if (!empty($_POST['xjxmthd'])) $this->sRequestedMethod = $_POST['xjxmthd']; } /* Function: configure */ function configure($sName, $mValue) { if ('wrapperPrefix' == $sName) { $this->sXajaxPrefix = $mValue; } else if ('scriptDefferal' == $sName) { if (true === $mValue) $this->sDefer = 'defer '; else $this->sDefer = ''; } else if ('deferScriptGeneration' == $sName) { if (true === $mValue || false === $mValue) $this->bDeferScriptGeneration = $mValue; else if ('deferred' === $mValue) $this->bDeferScriptGeneration = $mValue; } } /* Function: register */ function register($aArgs) { if (1 < count($aArgs)) { $sType = $aArgs[0]; if (XAJAX_CALLABLE_OBJECT == $sType) { $xco =& $aArgs[1]; //SkipDebug if (false === is_object($xco)) { trigger_error("To register a callable object, please provide an instance of the desired class.", E_USER_WARNING); return false; } //EndSkipDebug if (false === is_a($xco, 'xajaxCallableObject')) $xco =& new xajaxCallableObject($xco); if (2 < count($aArgs)) if (is_array($aArgs[2])) foreach ($aArgs[2] as $sKey => $aValue) foreach ($aValue as $sName => $sValue) $xco->configure($sKey, $sName, $sValue); $this->aCallableObjects[] =& $xco; return $xco->generateRequests($this->sXajaxPrefix); } } return false; } /* Function: generateClientScript */ function generateClientScript() { if (false === $this->bDeferScriptGeneration || 'deferred' === $this->bDeferScriptGeneration) { if (0 < count($this->aCallableObjects)) { $sCrLf = "\n"; echo $sCrLf; echo '<'; echo 'script type="text/javascript" '; echo $this->sDefer; echo 'charset="UTF-8">'; echo $sCrLf; echo '/* <'; echo '![CDATA[ */'; echo $sCrLf; foreach(array_keys($this->aCallableObjects) as $sKey) $this->aCallableObjects[$sKey]->generateClientScript($this->sXajaxPrefix); echo '/* ]]> */'; echo $sCrLf; echo '<'; echo '/script>'; echo $sCrLf; } } } /* Function: canProcessRequest */ function canProcessRequest() { if (NULL == $this->sRequestedClass) return false; if (NULL == $this->sRequestedMethod) return false; return true; } /* Function: processRequest */ function processRequest() { if (NULL == $this->sRequestedClass) return false; if (NULL == $this->sRequestedMethod) return false; $objArgumentManager =& xajaxArgumentManager::getInstance(); $aArgs = $objArgumentManager->process(); foreach (array_keys($this->aCallableObjects) as $sKey) { $xco =& $this->aCallableObjects[$sKey]; if ($xco->isClass($this->sRequestedClass)) { if ($xco->hasMethod($this->sRequestedMethod)) { $xco->call($this->sRequestedMethod, $aArgs); return true; } } } return 'Invalid request for a callable object.'; } } $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new xajaxCallableObjectPlugin(), 102); php-xajax-0.5/xajax_core/plugin_layer/xajaxFunctionPlugin.inc.php0000644000175000017500000001325111137037724024003 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxFunctionPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Constant: XAJAX_FUNCTION Specifies that the item being registered via the register> function is a php function available at global scope, or a specific function from an instance of an object. */ if (!defined ('XAJAX_FUNCTION')) define ('XAJAX_FUNCTION', 'function'); // require_once is necessary here as the xajaxEvent class will include this also //SkipAIO require_once dirname(__FILE__) . '/support/xajaxUserFunction.inc.php'; //EndSkipAIO /* Class: xajaxFunctionPlugin */ class xajaxFunctionPlugin extends xajaxRequestPlugin { /* Array: aFunctions An array of object that are registered and available via a call. */ var $aFunctions; /* String: sXajaxPrefix A configuration setting that is stored locally and used during the client script generation phase. */ var $sXajaxPrefix; /* String: sDefer Configuration option that can be used to request that the javascript file is loaded after the page has been fully loaded. */ var $sDefer; var $bDeferScriptGeneration; /* String: sRequestedFunction This string is used to temporarily hold the name of the function that is being requested (during the request processing phase). Since canProcessRequest loads this value from the get or post data, it is unnecessary to load it again. */ var $sRequestedFunction; /* Function: xajaxFunctionPlugin Constructs and initializes the . The GET and POST data is searched for xajax function call parameters. This will later be used to determine if the request is for a registered function in canProcessRequest> */ function xajaxFunctionPlugin() { $this->aFunctions = array(); $this->sXajaxPrefix = 'xajax_'; $this->sDefer = ''; $this->bDeferScriptGeneration = false; $this->sRequestedFunction = NULL; if (isset($_GET['xjxfun'])) $this->sRequestedFunction = $_GET['xjxfun']; if (isset($_POST['xjxfun'])) $this->sRequestedFunction = $_POST['xjxfun']; } /* Function: configure Sets/stores configuration options used by this plugin. */ function configure($sName, $mValue) { if ('wrapperPrefix' == $sName) { $this->sXajaxPrefix = $mValue; } else if ('scriptDefferal' == $sName) { if (true === $mValue) $this->sDefer = 'defer '; else $this->sDefer = ''; } else if ('deferScriptGeneration' == $sName) { if (true === $mValue || false === $mValue) $this->bDeferScriptGeneration = $mValue; else if ('deferred' === $mValue) $this->bDeferScriptGeneration = $mValue; } } /* Function: register Provides a mechanism for functions to be registered and made available to the page via the javascript call. */ function register($aArgs) { if (1 < count($aArgs)) { $sType = $aArgs[0]; if (XAJAX_FUNCTION == $sType) { $xuf =& $aArgs[1]; if (false === is_a($xuf, 'xajaxUserFunction')) $xuf =& new xajaxUserFunction($xuf); if (2 < count($aArgs)) if (is_array($aArgs[2])) foreach ($aArgs[2] as $sName => $sValue) $xuf->configure($sName, $sValue); $this->aFunctions[] =& $xuf; return $xuf->generateRequest($this->sXajaxPrefix); } } return false; } /* Function: generateClientScript Called by the during the client script generation phase. This is used to generate a block of javascript code that will contain function declarations that can be used on the browser through javascript to initiate xajax requests. */ function generateClientScript() { if (false === $this->bDeferScriptGeneration || 'deferred' === $this->bDeferScriptGeneration) { if (0 < count($this->aFunctions)) { echo "\n\n"; } } } /* Function: canProcessRequest Determines whether or not the current request can be processed by this plugin. Returns: boolean - True if the current request can be handled by this plugin; false otherwise. */ function canProcessRequest() { if (NULL == $this->sRequestedFunction) return false; return true; } /* Function: processRequest Called by the when a request needs to be processed. Returns: mixed - True when the request has been processed successfully. An error message when an error has occurred. */ function processRequest() { if (NULL == $this->sRequestedFunction) return false; $objArgumentManager =& xajaxArgumentManager::getInstance(); $aArgs = $objArgumentManager->process(); foreach (array_keys($this->aFunctions) as $sKey) { $xuf =& $this->aFunctions[$sKey]; if ($xuf->getName() == $this->sRequestedFunction) { $xuf->call($aArgs); return true; } } return 'Invalid function request received; no request processor found with this name.'; } } $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new xajaxFunctionPlugin(), 100); php-xajax-0.5/xajax_core/plugin_layer/support/0000755000175000017500000000000011137074666020242 5ustar dgildgilphp-xajax-0.5/xajax_core/plugin_layer/support/xajaxCallableObject.inc.php0000644000175000017500000001334311137037724025403 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxCallableObject.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajaxCallableObject A class that stores a reference to an object whose methods can be called from the client via a xajax request. will call generateClientScript> so that stub functions can be generated and sent to the browser. */ class xajaxCallableObject { /* Object: obj A reference to the callable object. */ var $obj; /* Array: aConfiguration An associative array that will contain configuration options for zero or more of the objects methods. These configuration options will define the call options for each request. The call options will be passed to the client browser when the function stubs are generated. */ var $aConfiguration; /* Function: xajaxCallableObject Constructs and initializes the obj - (object): The object to reference. */ function xajaxCallableObject(&$obj) { $this->obj =& $obj; $this->aConfiguration = array(); } /* Function: getName Returns the name of this callable object. This is typically the class name of the object. */ function getName() { return get_class($this->obj); } /* Function: configure Used to set configuration options / call options for each method. sMethod - (string): The name of the method. sName - (string): The name of the configuration option. sValue - (string): The value to be set. */ function configure($sMethod, $sName, $sValue) { $sMethod = strtolower($sMethod); if (false == isset($this->aConfiguration[$sMethod])) $this->aConfiguration[$sMethod] = array(); $this->aConfiguration[$sMethod][$sName] = $sValue; } /* Function: generateRequests Produces an array of objects, one for each method exposed by this callable object. sXajaxPrefix - (string): The prefix to be prepended to the javascript function names; this will correspond to the name used for the function stubs that are generated by the generateClientScript> call. */ function generateRequests($sXajaxPrefix) { $aRequests = array(); $sClass = get_class($this->obj); foreach (get_class_methods($this->obj) as $sMethodName) { $bInclude = true; // exclude magic __call method if ("__call" == $sMethodName) $bInclude = false; // exclude constructor if ($sClass == $sMethodName) $bInclude = false; if ($bInclude) $aRequests[strtolower($sMethodName)] =& new xajaxRequest("{$sXajaxPrefix}{$sClass}.{$sMethodName}"); } return $aRequests; } /* Function: generateClientScript Called by generateClientScript> while is generating the javascript to be sent to the browser. sXajaxPrefix - (string): The prefix to be prepended to the javascript function names. */ function generateClientScript($sXajaxPrefix) { $sClass = get_class($this->obj); echo "{$sXajaxPrefix}{$sClass} = {};\n"; foreach (get_class_methods($this->obj) as $sMethodName) { $bInclude = true; // exclude magic __call, __construct, __destruct methods if (2 < strlen($sMethodName)) if ("__" == substr($sMethodName, 0, 2)) $bInclude = false; // exclude constructor if ($sClass == $sMethodName) $bInclude = false; if ($bInclude) { echo "{$sXajaxPrefix}{$sClass}.{$sMethodName} = function() { "; echo "return xajax.request( "; echo "{ xjxcls: '{$sClass}', xjxmthd: '{$sMethodName}' }, "; echo "{ parameters: arguments"; $sSeparator = ", "; if (isset($this->aConfiguration['*'])) foreach ($this->aConfiguration['*'] as $sKey => $sValue) echo "{$sSeparator}{$sKey}: {$sValue}"; if (isset($this->aConfiguration[strtolower($sMethodName)])) foreach ($this->aConfiguration[strtolower($sMethodName)] as $sKey => $sValue) echo "{$sSeparator}{$sKey}: {$sValue}"; echo " } ); "; echo "};\n"; } } } /* Function: isClass Determins if the specified class name matches the class name of the object referenced by obj>. sClass - (string): The name of the class to check. Returns: boolean - True of the specified class name matches the class of the object being referenced; false otherwise. */ function isClass($sClass) { if(get_class($this->obj) === $sClass) return true; return false; } /* Function: hasMethod Determines if the specified method name is one of the methods of the object referenced by obj>. sMethod - (object): The name of the method to check. Returns: boolean - True of the referenced object contains the specified method, false otherwise. */ function hasMethod($sMethod) { return method_exists($this->obj, $sMethod) || method_exists($this->obj, "__call"); } /* Function: call Call the specified method of the object being referenced using the specified array of arguments. sMethod - (string): The name of the method to call. aArgs - (array): The arguments to pass to the method. */ function call($sMethod, $aArgs) { $objResponseManager =& xajaxResponseManager::getInstance(); $objResponseManager->append( call_user_func_array( array(&$this->obj, $sMethod), $aArgs ) ); } } php-xajax-0.5/xajax_core/plugin_layer/support/xajaxEvent.inc.php0000644000175000017500000000730411137037724023636 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxEvent.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ // require_once is necessary here as the function plugin also includes this //SkipAIO require_once dirname(__FILE__) . '/xajaxUserFunction.inc.php'; //EndSkipAIO /* Class: xajaxEvent A container class which holds a reference to handler functions and configuration options associated with a registered event. */ class xajaxEvent { /* String: sName The name of the event. */ var $sName; /* Array: aConfiguration Configuration / call options to be used when initiating a xajax request to trigger this event. */ var $aConfiguration; /* Array: aHandlers A list of objects associated with this registered event. Each of these functions will be called when the event is triggered. */ var $aHandlers; /* Function: xajaxEvent Construct and initialize this object. */ function xajaxEvent($sName) { $this->sName = $sName; $this->aConfiguration = array(); $this->aHandlers = array(); } /* Function: getName Returns the name of the event. Returns: string - the name of the event. */ function getName() { return $this->sName; } /* Function: configure Sets/stores configuration options that will be used when generating the client script that is sent to the browser. */ function configure($sName, $mValue) { $this->aConfiguration[$sName] = $mValue; } /* Function: addHandler Adds a object to the list of handlers that will be fired when the event is triggered. */ function addHandler(&$xuf) { $this->aHandlers[] =& $xuf; } /* Function: generateRequest Generates a object that corresponds to the event so that the client script can easily invoke this event. sXajaxPrefix - (string): The prefix that will be prepended to the client script stub function associated with this event. sEventPrefix - (string): The prefix prepended to the client script function stub and script. */ function generateRequest($sXajaxPrefix, $sEventPrefix) { $sEvent = $this->sName; return new xajaxRequest("{$sXajaxPrefix}{$sEventPrefix}{$sEvent}"); } /* Function: generateClientScript Generates a block of javascript code that declares a stub function that can be used to easily trigger the event from the browser. */ function generateClientScript($sXajaxPrefix, $sEventPrefix) { $sMode = ''; $sMethod = ''; if (isset($this->aConfiguration['mode'])) $sMode = $this->aConfiguration['mode']; if (isset($this->aConfiguration['method'])) $sMethod = $this->aConfiguration['method']; if (0 < strlen($sMode)) $sMode = ", mode: '{$sMode}'"; if (0 < strlen($sMethod)) $sMethod = ", method: '{$sMethod}'"; $sEvent = $this->sName; echo "{$sXajaxPrefix}{$sEventPrefix}{$sEvent} = function() { return xajax.request( { xjxevt: '{$sEvent}' }, { parameters: arguments{$sMode}{$sMethod} } ); };\n"; } /* Function: fire Called by the when the event has been triggered. */ function fire($aArgs) { $objResponseManager =& xajaxResponseManager::getInstance(); foreach (array_keys($this->aHandlers) as $sKey) $this->aHandlers[$sKey]->call($aArgs); } } php-xajax-0.5/xajax_core/plugin_layer/support/xajaxUserFunction.inc.php0000644000175000017500000001427611137037724025207 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxUserFunction.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajaxUserFunction Construct instances of this class to define functions that will be registered with the request processor. This class defines the parameters that are needed for the definition of a xajax enabled function. While you can still specify functions by name during registration, it is advised that you convert to using this class when you wish to register external functions or to specify call options as well. */ class xajaxUserFunction { /* String: sAlias An alias to use for this function. This is useful when you want to call the same xajax enabled function with a different set of call options from what was already registered. */ var $sAlias; /* Object: uf A string or array which defines the function to be registered. */ var $uf; /* String: sInclude The path and file name of the include file that contains the function. */ var $sInclude; /* Array: aConfiguration An associative array containing call options that will be sent to the browser curing client script generation. */ var $aConfiguration; /* Function: xajaxUserFunction Constructs and initializes the object. $uf - (mixed): A function specification in one of the following formats: - a three element array: (string) Alternate function name: when a method of a class has the same name as another function in the system, you can provide an alias to help avoid collisions. (object or class name) Class: the name of the class or an instance of the object which contains the function to be called. (string) Method: the name of the method that will be called. - a two element array: (object or class name) Class: the name of the class or an instance of the object which contains the function to be called. (string) Method: the name of the method that will be called. - a string: the name of the function that is available at global scope (not in a class. $sInclude - (string, optional): The path and file name of the include file that contains the class or function to be called. $aConfiguration - (array, optional): An associative array of call options that will be used when sending the request from the client. Examples: $myFunction = array('alias', 'myClass', 'myMethod'); $myFunction = array('alias', &$myObject, 'myMethod'); $myFunction = array('myClass', 'myMethod'); $myFunction = array(&$myObject, 'myMethod'); $myFunction = 'myFunction'; $myUserFunction = new xajaxUserFunction($myFunction, 'myFile.inc.php', array( 'method' => 'get', 'mode' => 'synchronous' )); $xajax->register(XAJAX_FUNCTION, $myUserFunction); */ function xajaxUserFunction($uf, $sInclude=NULL, $aConfiguration=array()) { $this->sAlias = ''; $this->uf =& $uf; $this->sInclude = $sInclude; $this->aConfiguration = array(); foreach ($aConfiguration as $sKey => $sValue) $this->configure($sKey, $sValue); if (is_array($this->uf) && 2 < count($this->uf)) { $this->sAlias = $this->uf[0]; $this->uf = array_slice($this->uf, 1); } //SkipDebug if (is_array($this->uf) && 2 != count($this->uf)) trigger_error( 'Invalid function declaration for xajaxUserFunction.', E_USER_ERROR ); //EndSkipDebug } /* Function: getName Get the name of the function being referenced. Returns: string - the name of the function contained within this object. */ function getName() { // Do not use sAlias here! if (is_array($this->uf)) return $this->uf[1]; return $this->uf; } /* Function: configure Call this to set call options for this instance. */ function configure($sName, $sValue) { if ('alias' == $sName) $this->sAlias = $sValue; else $this->aConfiguration[$sName] = $sValue; } /* Function: generateRequest Constructs and returns a object which is capable of generating the javascript call to invoke this xajax enabled function. */ function generateRequest($sXajaxPrefix) { $sAlias = $this->getName(); if (0 < strlen($this->sAlias)) $sAlias = $this->sAlias; return new xajaxRequest("{$sXajaxPrefix}{$sAlias}"); } /* Function: generateClientScript Called by the that is referencing this function reference during the client script generation phase. This function will generate the javascript function stub that is sent to the browser on initial page load. */ function generateClientScript($sXajaxPrefix) { $sFunction = $this->getName(); $sAlias = $sFunction; if (0 < strlen($this->sAlias)) $sAlias = $this->sAlias; echo "{$sXajaxPrefix}{$sAlias} = function() { "; echo "return xajax.request( "; echo "{ xjxfun: '{$sFunction}' }, "; echo "{ parameters: arguments"; $sSeparator = ", "; foreach ($this->aConfiguration as $sKey => $sValue) echo "{$sSeparator}{$sKey}: {$sValue}"; echo " } ); "; echo "};\n"; } /* Function: call Called by the that references this function during the request processing phase. This function will call the specified function, including an external file if needed and passing along the specified arguments. */ function call($aArgs=array()) { $objResponseManager =& xajaxResponseManager::getInstance(); if (NULL != $this->sInclude) { ob_start(); require_once $this->sInclude; $sOutput = ob_get_clean(); //SkipDebug if (0 < strlen($sOutput)) { $sOutput = 'From include file: ' . $this->sInclude . ' => ' . $sOutput; $objResponseManager->debug($sOutput); } //EndSkipDebug } $mFunction = $this->uf; $objResponseManager->append(call_user_func_array($mFunction, $aArgs)); } } ?> php-xajax-0.5/xajax_core/plugin_layer/xajaxEventPlugin.inc.php0000644000175000017500000001226411137037724023302 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxEventPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Constant: XAJAX_EVENT Specifies that the item being registered via the register> function is an event. Constant: XAJAX_EVENT_HANDLER Specifies that the item being registered via the register> function is an event handler. */ if (!defined ('XAJAX_EVENT')) define ('XAJAX_EVENT', 'xajax event'); if (!defined ('XAJAX_EVENT_HANDLER')) define ('XAJAX_EVENT_HANDLER', 'xajax event handler'); //SkipAIO require dirname(__FILE__) . '/support/xajaxEvent.inc.php'; //EndSkipAIO /* Class: xajaxEventPlugin Plugin that adds server side event handling capabilities to xajax. Events can be registered, then event handlers attached. */ class xajaxEventPlugin extends xajaxRequestPlugin { /* Array: aEvents */ var $aEvents; /* String: sXajaxPrefix */ var $sXajaxPrefix; /* String: sEventPrefix */ var $sEventPrefix; /* String: sDefer */ var $sDefer; var $bDeferScriptGeneration; /* String: sRequestedEvent */ var $sRequestedEvent; /* Function: xajaxEventPlugin */ function xajaxEventPlugin() { $this->aEvents = array(); $this->sXajaxPrefix = 'xajax_'; $this->sEventPrefix = 'event_'; $this->sDefer = ''; $this->bDeferScriptGeneration = false; $this->sRequestedEvent = NULL; if (isset($_GET['xjxevt'])) $this->sRequestedEvent = $_GET['xjxevt']; if (isset($_POST['xjxevt'])) $this->sRequestedEvent = $_POST['xjxevt']; } /* Function: configure */ function configure($sName, $mValue) { if ('wrapperPrefix' == $sName) { $this->sXajaxPrefix = $mValue; } else if ('eventPrefix' == $sName) { $this->sEventPrefix = $mValue; } else if ('scriptDefferal' == $sName) { if (true === $mValue) $this->sDefer = 'defer '; else $this->sDefer = ''; } else if ('deferScriptGeneration' == $sName) { if (true === $mValue || false === $mValue) $this->bDeferScriptGeneration = $mValue; else if ('deferred' === $mValue) $this->bDeferScriptGeneration = $mValue; } } /* Function: register $sType - (string): type of item being registered $sEvent - (string): the name of the event $ufHandler - (function name or reference): a reference to the user function to call $aConfiguration - (array): an array containing configuration options */ function register($aArgs) { if (1 < count($aArgs)) { $sType = $aArgs[0]; if (XAJAX_EVENT == $sType) { $sEvent = $aArgs[1]; if (false === isset($this->aEvents[$sEvent])) { $xe =& new xajaxEvent($sEvent); if (2 < count($aArgs)) if (is_array($aArgs[2])) foreach ($aArgs[2] as $sKey => $sValue) $xe->configure($sKey, $sValue); $this->aEvents[$sEvent] =& $xe; return $xe->generateRequest($this->sXajaxPrefix, $this->sEventPrefix); } } if (XAJAX_EVENT_HANDLER == $sType) { $sEvent = $aArgs[1]; if (isset($this->aEvents[$sEvent])) { if (isset($aArgs[2])) { $xuf =& $aArgs[2]; if (false === is_a($xuf, 'xajaxUserFunction')) $xuf =& new xajaxUserFunction($xuf); $objEvent =& $this->aEvents[$sEvent]; $objEvent->addHandler($xuf); return true; } } } } return false; } /* Function: generateClientScript */ function generateClientScript() { if (false === $this->bDeferScriptGeneration || 'deferred' === $this->bDeferScriptGeneration) { if (0 < count($this->aEvents)) { echo "\n\n"; } } } /* Function: canProcessRequest */ function canProcessRequest() { if (NULL == $this->sRequestedEvent) return false; return true; } /* Function: processRequest */ function processRequest() { if (NULL == $this->sRequestedEvent) return false; $objArgumentManager =& xajaxArgumentManager::getInstance(); $aArgs = $objArgumentManager->process(); foreach (array_keys($this->aEvents) as $sKey) { $objEvent =& $this->aEvents[$sKey]; if ($objEvent->getName() == $this->sRequestedEvent) { $objEvent->fire($aArgs); return true; } } return 'Invalid event request received; no event was registered with this name.'; } } $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new xajaxEventPlugin(), 103); php-xajax-0.5/xajax_core/plugin_layer/xajaxDefaultIncludePlugin.inc.php0000644000175000017500000002166511137037724025116 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxDefaultIncludePlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajaxIncludeClientScript Generates the SCRIPT tags necessary to 'include' the xajax javascript library on the browser. This is called when the page is first loaded. */ class xajaxIncludeClientScriptPlugin extends xajaxRequestPlugin { var $sJsURI; var $aJsFiles; var $sDefer; var $sRequestURI; var $sStatusMessages; var $sWaitCursor; var $sVersion; var $sDefaultMode; var $sDefaultMethod; var $bDebug; var $bVerboseDebug; var $nScriptLoadTimeout; var $bUseUncompressedScripts; var $bDeferScriptGeneration; var $sLanguage; var $nResponseQueueSize; function xajaxIncludeClientScriptPlugin() { $this->sJsURI = ''; $this->aJsFiles = array(); $this->sDefer = ''; $this->sRequestURI = ''; $this->sStatusMessages = 'false'; $this->sWaitCursor = 'true'; $this->sVersion = 'unknown'; $this->sDefaultMode = 'asynchronous'; $this->sDefaultMethod = 'POST'; // W3C: Method is case sensitive $this->bDebug = false; $this->bVerboseDebug = false; $this->nScriptLoadTimeout = 2000; $this->bUseUncompressedScripts = false; $this->bDeferScriptGeneration = false; $this->sLanguage = null; $this->nResponseQueueSize = null; } /* Function: configure */ function configure($sName, $mValue) { if ('javascript URI' == $sName) { $this->sJsURI = $mValue; } else if ("javascript files" == $sName) { $this->aJsFiles = $mValue; } else if ("scriptDefferal" == $sName) { if (true === $mValue) $this->sDefer = "defer "; else $this->sDefer = ""; } else if ("requestURI" == $sName) { $this->sRequestURI = $mValue; } else if ("statusMessages" == $sName) { if (true === $mValue) $this->sStatusMessages = "true"; else $this->sStatusMessages = "false"; } else if ("waitCursor" == $sName) { if (true === $mValue) $this->sWaitCursor = "true"; else $this->sWaitCursor = "false"; } else if ("version" == $sName) { $this->sVersion = $mValue; } else if ("defaultMode" == $sName) { if ("asynchronous" == $mValue || "synchronous" == $mValue) $this->sDefaultMode = $mValue; } else if ("defaultMethod" == $sName) { if ("POST" == $mValue || "GET" == $mValue) // W3C: Method is case sensitive $this->sDefaultMethod = $mValue; } else if ("debug" == $sName) { if (true === $mValue || false === $mValue) $this->bDebug = $mValue; } else if ("verboseDebug" == $sName) { if (true === $mValue || false === $mValue) $this->bVerboseDebug = $mValue; } else if ("scriptLoadTimeout" == $sName) { $this->nScriptLoadTimeout = $mValue; } else if ("useUncompressedScripts" == $sName) { if (true === $mValue || false === $mValue) $this->bUseUncompressedScripts = $mValue; } else if ('deferScriptGeneration' == $sName) { if (true === $mValue || false === $mValue) $this->bDeferScriptGeneration = $mValue; else if ('deferred' == $mValue) $this->bDeferScriptGeneration = $mValue; } else if ('language' == $sName) { $this->sLanguage = $mValue; } else if ('responseQueueSize' == $sName) { $this->nResponseQueueSize = $mValue; } } /* Function: generateClientScript */ function generateClientScript() { if (false === $this->bDeferScriptGeneration) { $this->printJavascriptConfig(); $this->printJavascriptInclude(); } else if (true === $this->bDeferScriptGeneration) { $this->printJavascriptInclude(); } else if ('deferred' == $this->bDeferScriptGeneration) { $this->printJavascriptConfig(); } } /* Function: getJavascriptConfig Generates the xajax settings that will be used by the xajax javascript library when making requests back to the server. Returns: string - The javascript code necessary to configure the settings on the browser. */ function getJavascriptConfig() { ob_start(); $this->printJavascriptConfig(); return ob_get_clean(); } /* Function: printJavascriptConfig See */ function printJavascriptConfig() { $sCrLf = "\n"; echo $sCrLf; echo '<'; echo 'script type="text/javascript" '; echo $this->sDefer; echo 'charset="UTF-8">'; echo $sCrLf; echo '/* <'; echo '![CDATA[ */'; echo $sCrLf; echo 'try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };'; echo $sCrLf; echo 'xajax.config.requestURI = "'; echo $this->sRequestURI; echo '";'; echo $sCrLf; echo 'xajax.config.statusMessages = '; echo $this->sStatusMessages; echo ';'; echo $sCrLf; echo 'xajax.config.waitCursor = '; echo $this->sWaitCursor; echo ';'; echo $sCrLf; echo 'xajax.config.version = "'; echo $this->sVersion; echo '";'; echo $sCrLf; echo 'xajax.config.legacy = false;'; echo $sCrLf; echo 'xajax.config.defaultMode = "'; echo $this->sDefaultMode; echo '";'; echo $sCrLf; echo 'xajax.config.defaultMethod = "'; echo $this->sDefaultMethod; echo '";'; if (false === (null === $this->nResponseQueueSize)) { echo $sCrLf; echo 'xajax.config.responseQueueSize = '; echo $this->nResponseQueueSize; echo ';'; } echo $sCrLf; echo '/* ]]> */'; echo $sCrLf; echo '<'; echo '/script>'; echo $sCrLf; } /* Function: getJavascriptInclude Generates SCRIPT tags necessary to load the javascript libraries on the browser. sJsURI - (string): The relative or fully qualified PATH that will be used to compose the URI to the specified javascript files. aJsFiles - (array): List of javascript files to include. Returns: string - The SCRIPT tags that will cause the browser to load the specified files. */ function getJavascriptInclude() { ob_start(); $this->printJavascriptInclude(); return ob_get_clean(); } /* Function: printJavascriptInclude See */ function printJavascriptInclude() { $aJsFiles = $this->aJsFiles; $sJsURI = $this->sJsURI; if (0 == count($aJsFiles)) { $aJsFiles[] = array($this->_getScriptFilename('xajax_js/xajax_core.js'), 'xajax'); if (true === $this->bDebug) $aJsFiles[] = array($this->_getScriptFilename('xajax_js/xajax_debug.js'), 'xajax.debug'); if (true === $this->bVerboseDebug) $aJsFiles[] = array($this->_getScriptFilename('xajax_js/xajax_verbose.js'), 'xajax.debug.verbose'); if (null !== $this->sLanguage) $aJsFiles[] = array($this->_getScriptFilename('xajax_js/xajax_lang_' . $this->sLanguage . '.js'), 'xajax'); } if ($sJsURI != '' && substr($sJsURI, -1) != '/') $sJsURI .= '/'; $sCrLf = "\n"; foreach ($aJsFiles as $aJsFile) { echo '<'; echo 'script type="text/javascript" src="'; echo $sJsURI; echo $aJsFile[0]; echo '" '; echo $this->sDefer; echo 'charset="UTF-8"><'; echo '/script>'; echo $sCrLf; } if (0 < $this->nScriptLoadTimeout) { foreach ($aJsFiles as $aJsFile) { echo '<'; echo 'script type="text/javascript" '; echo $this->sDefer; echo 'charset="UTF-8">'; echo $sCrLf; echo '/* <'; echo '![CDATA[ */'; echo $sCrLf; echo 'window.setTimeout('; echo $sCrLf; echo ' function() {'; echo $sCrLf; echo ' var scriptExists = false;'; echo $sCrLf; echo ' try { if ('; echo $aJsFile[1]; echo '.isLoaded) scriptExists = true; }'; echo $sCrLf; echo ' catch (e) {}'; echo $sCrLf; echo ' if (!scriptExists) {'; echo $sCrLf; echo ' alert("Error: the '; echo $aJsFile[1]; echo ' Javascript component could not be included. Perhaps the URL is incorrect?\nURL: '; echo $sJsURI; echo $aJsFile[0]; echo '");'; echo $sCrLf; echo ' }'; echo $sCrLf; echo ' }, '; echo $this->nScriptLoadTimeout; echo ');'; echo $sCrLf; echo '/* ]]> */'; echo $sCrLf; echo '<'; echo '/script>'; echo $sCrLf; } } } /* Function: _getScriptFilename Returns the name of the script file, based on the current settings. sFilename - (string): The base filename. Returns: string - The filename as it should be specified in the script tags on the browser. */ function _getScriptFilename($sFilename) { if ($this->bUseUncompressedScripts) { return str_replace('.js', '_uncompressed.js', $sFilename); } return $sFilename; } } /* Register the xajaxIncludeClientScriptPlugin object with the xajaxPluginManager. */ $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new xajaxIncludeClientScriptPlugin(), 99); php-xajax-0.5/xajax_core/plugin_layer/xajaxScriptPlugin.inc.php0000644000175000017500000001524611137037724023470 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxScriptPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajaxScriptPlugin Contains the code that can produce script and style data during deferred script generation. This allows the xajax generated javascript and style sheet information to be loaded via an external file reference instead of inlined into the page source. */ class xajaxScriptPlugin extends xajaxRequestPlugin { /* String: sRequest */ var $sRequest; /* String: sHash */ var $sHash; /* String: sRequestURI */ var $sRequestURI; /* Boolean: bDeferScriptGeneration */ var $bDeferScriptGeneration; /* Boolean: bValidateHash */ var $bValidateHash; /* Boolean: bWorking */ var $bWorking; /* Function: xajaxScriptPlugin Construct and initialize the xajax script plugin object. During initialization, this plugin will look for hash codes in the GET data (parameters passed on the request URI) and store them for later use. */ function xajaxScriptPlugin() { $this->sRequestURI = ''; $this->bDeferScriptGeneration = false; $this->bValidateHash = true; $this->bWorking = false; $this->sRequest = ''; $this->sHash = null; if (isset($_GET['xjxGenerateJavascript'])) { $this->sRequest = 'script'; $this->sHash = $_GET['xjxGenerateJavascript']; } if (isset($_GET['xjxGenerateStyle'])) { $this->sRequest = 'style'; $this->sHash = $_GET['xjxGenerateStyle']; } } /* Function: configure Sets/stores configuration options used by this plugin. See also: . This plugin will watch for and store the current setting for the following configuration options: - (string): The requestURI of the current script file. - (boolean): A flag that indicates whether script deferral is in effect or not. - (boolean): A flag that indicates whether or not the script hash should be validated. */ function configure($sName, $mValue) { if ('requestURI' == $sName) { $this->sRequestURI = $mValue; } else if ('deferScriptGeneration' == $sName) { if (true === $mValue || false === $mValue) $this->bDeferScriptGeneration = $mValue; } else if ('deferScriptValidateHash' == $sName) { if (true === $mValue || false === $mValue) $this->bValidateHash = $mValue; } } /* Function: generateClientScript Called by the when the text of the client script (or style) declarations are needed. This function will only output script or style information if the request URI contained an appropriate hash code and script deferral is in effect. */ function generateClientScript() { if ($this->bWorking) return; if (true === $this->bDeferScriptGeneration) { $this->bWorking = true; $sQueryBase = '?'; if (0 < strpos($this->sRequestURI, '?')) $sQueryBase = '&'; $aScripts = $this->_getSections('script'); if (0 < count($aScripts)) { // echo ""; $sHash = md5(implode($aScripts)); $sQuery = $sQueryBase . "xjxGenerateJavascript=" . $sHash; echo "\n\n"; } $aStyles = $this->_getSections('style'); if (0 < count($aStyles)) { // echo ""; $sHash = md5(implode($aStyles)); $sQuery = $sQueryBase . "xjxGenerateStyle=" . $sHash; echo "\n\n"; } $this->bWorking = false; } } /* Function: canProcessRequest Called by the to determine if this plugin can process the current request. This will return true when the requestURI contains an appropriate hash code. */ function canProcessRequest() { return ('' != $this->sRequest); } function &_getSections($sType) { $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->configure('deferScriptGeneration', 'deferred'); $aSections = array(); // buffer output ob_start(); $objPluginManager->generateClientScript(); $sScript = ob_get_clean(); // parse out blocks $aParts = explode('', $sScript); foreach ($aParts as $sPart) { $aValues = explode('<' . $sType, $sPart, 2); if (2 == count($aValues)) { list($sJunk, $sPart) = $aValues; $aValues = explode('>', $sPart, 2); if (2 == count($aValues)) { list($sJunk, $sPart) = $aValues; if (0 < strlen($sPart)) $aSections[] = $sPart; } } } $objPluginManager->configure('deferScriptGeneration', $this->bDeferScriptGeneration); return $aSections; } /* Function: processRequest Called by the when the current request should be processed. This plugin will generate the javascript or style sheet information that would normally be output by the other xajax plugin objects, when script deferral is in effect. If script deferral is disabled, this function returns without performing any functions. */ function processRequest() { if ($this->canProcessRequest()) { $aSections =& $this->_getSections($this->sRequest); // echo ""; // validate the hash $sHash = md5(implode($aSections)); if (false == $this->bValidateHash || $sHash == $this->sHash) { $sType = 'text/javascript'; if ('style' == $this->sRequest) $sType = 'text/css'; $objResponse =& new xajaxCustomResponse($sType); foreach ($aSections as $sSection) $objResponse->append($sSection . "\n"); $objResponseManager =& xajaxResponseManager::getInstance(); $objResponseManager->append($objResponse); header ('Expires: ' . gmdate('D, d M Y H:i:s', time() + (60*60*24)) . ' GMT'); return true; } return 'Invalid script or style request.'; trigger_error('Hash mismatch: ' . $this->sRequest . ': ' . $sHash . ' <==> ' . $this->sHash, E_USER_ERROR); } } } /* Register the plugin with the xajax plugin manager. */ $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new xajaxScriptPlugin(), 9999); php-xajax-0.5/xajax_core/xajaxCall.inc.php0000644000175000017500000001777411137037724017236 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxCall.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajaxCall Create a piece of javascript code that will invoke the function. This class is deprecated and will be removed in future versions; please use instead. */ class xajaxCall { /**#@+ * @access protected */ /* String: sFunction Required: The name of the xajax enabled function to call */ var $sFunction; /* String: sReturnValue Required: The value to return once the has returned. (for asynchronous calls, this is immediate) */ var $sReturnValue; /* Array: aParameters The associative array that will be used to store the parameters for this call. - key: The textual representation of the parameter. - value: A boolean value indicating whether or not to use quotes around this parameter. */ var $aParameters; /* String: sMode The mode to use for the call - 'synchronous' - 'asynchronous' */ var $sMode; /* String: sRequestType The request type that will be used for the call - 'GET' - 'POST' */ var $sRequestType; /* String: sResponseProcessor The name of the javascript function that will be invoked to handle the response. */ var $sResponseProcessor; /* String: sRequestURI The URI for where this request will be sent. */ var $sRequestURI; /* String: sContentType The content type to use for the request. */ var $sContentType; /* Constructor: xajaxCall Initializes the xajaxCall object. Parameters: sFunction - (string): The name of the xajax enabled function that will be invoked when this javascript code is executed on the browser. This function name should match a PHP function from your script. */ function xajaxCall($sFunction = '') { $this->sFunction = $sFunction; $this->aParameters = array(); $this->sMode = ''; $this->sRequestType = ''; $this->sResponseProcessor = ''; $this->sRequestURI = ''; $this->sContentType = ''; } /* Function: setFunction Override the function name set in the constructor. Parameters: sFunction - (string): The name of the xajax enabled function that will be invoked when this javascript code is executed on the browser. This function name should match a PHP function from your script. Returns: object : The object. */ function setFunction($sFunction) { $this->sFunction = $sFunction; return $this; } /* Function: clearParameters Clear the list of parameters being accumulated for this call. Returns: object : The object. */ function clearParameters() { $this->aParameters = array(); } /* Function: addParameter Adds a parameter to the list that will be specified for the request generated by this object. Parameters: sParameter - (string): The parameter value or name. bUseQuotes - (boolean): Whether or not to put quotes around this value. If you specify the name of a javascript variable, or provide a javascript function call as a parameter, do not use quotes around the value. Returns: object : The object. */ function addParameter($sParameter, $bUseQuotes = true) { $this->aParameters[] = array($sParameter, $bUseQuotes); return $this; } /* Function: addFormValuesParameter Add a parameter value that is the result of calling for the specified form. Parameters: sFormID - (string): The id of the form for which you wish to return the input values. Returns: object : The object. */ function addFormValuesParameter($sFormID) { $this->aParameters[] = array('xajax.getFormValues("'.$sFormID.'")'); return $this; } /* Function: setMode Sets the mode that will be specified for this Parameters: $sMode - (string): The mode to be set. - 'synchronous' - 'asynchronous' Returns: object : The object. */ function setMode($sMode) { $this->sMode = $sMode; return $this; } /* Function: setRequestType Sets the request type which will be specified for the generated . Parameters: - 'GET' - 'POST' Returns: object : The object. */ function setRequestType($sRequestType) { $this->sRequestType = $sRequestType; return $this; } /* Function: setResponseProcessor Sets the name of the javascript function that will be used to process this response. This is an advanced function, use with caution. Parameters: Returns: object : The object. */ function setResponseProcessor($sResponseProcessor) { $this->sResponseProcessor = $sResponseProcessor; return $this; } /* Function: setRequestURI Override the default URI with the specified one. Parameters: sRequestURI - (string): The URI that the generated request will be sent to. Returns: object : The object. */ function setRequestURI($sRequestURI) { $this->sRequestURI = $sRequestURI; return $this; } /* Function: setContentType Sets the content type that will be used by the generated request. Parameters: Returns: object : The object. */ function setContentType($sContentType) { $this->sContentType = $sContentType; } /* Function: setReturnValue Sets the value that will be returned after the generated call. Set to an empty string if no return value is desired. Parameters: Returns: object : The object. */ function setReturnValue($sReturnValue) { $this->sReturnValue = $sReturnValue; } /* Function: generate Construct a statement in javascript that can be used to make a xajax request with the parameters and settings previously configured for this object. The output from this function can be used as an event handler in your javascript code. Returns: string - The javascript statement that will invoked the function on the browser, causing a xajax request to be sent to the server. */ function generate() { $output = 'xajax.call("'; $output .= $this->sFunction; $output .= '", {'; $separator = ''; if (0 < count($this->aParameters)) { $output .= 'parameters: ['; foreach ($this->aParameters as $aParameter) { $output .= $separator; $bUseQuotes = $aParameter[1]; if ($bUseQuotes) $output .= '"'; $output .= $aParameter[0]; if ($bUseQuotes) $output .= '"'; $separator = ','; } $output .= ']'; } if (0 < strlen($this->sMode)) { $output .= $separator; $output .= 'mode:"'; $output .= $this->sMode; $output .= '"'; $separator = ','; } if (0 < strlen($this->sRequestType)) { $output .= $separator; $output .= 'requestType:"'; $output .= $this->sRequestType; $output .= '"'; $separator = ','; } if (0 < strlen($this->sResponseProcessor)) { $output .= $separator; $output .= 'responseProcessor:'; $output .= $this->sResponseProcessor; $separator = ','; } if (0 < strlen($this->sRequestURI)) { $output .= $separator; $output .= 'requestURI:"'; $output .= $this->sRequestURI; $output .= '"'; $separator = ','; } if (0 < strlen($this->sContentType)) { $output .= $separator; $output .= 'contentType:"'; $output .= $this->sContentType; $output .= '"'; $separator = ','; } $output .= '}); '; if (0 < strlen($this->sReturnValue)) { $output .= 'return '; $output .= $this->sReturnValue; } else { $output .= 'return false;'; } return $output; } } php-xajax-0.5/xajax_core/xajaxArgumentManager.inc.php0000644000175000017500000002427511137073244021427 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxArgumentManager.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ if (!defined('XAJAX_METHOD_UNKNOWN')) define('XAJAX_METHOD_UNKNOWN', 0); if (!defined('XAJAX_METHOD_GET')) define('XAJAX_METHOD_GET', 1); if (!defined('XAJAX_METHOD_POST')) define('XAJAX_METHOD_POST', 2); /* Class: xajaxArgumentManager This class processes the input arguments from the GET or POST data of the request. If this is a request for the initial page load, no arguments will be processed. During a xajax request, any arguments found in the GET or POST will be converted to a PHP array. */ class xajaxArgumentManager { /* Array: aArgs An array of arguments received via the GET or POST parameter xjxargs. */ var $aArgs; /* Boolean: bDecodeUTF8Input A configuration option used to indicate whether input data should be UTF8 decoded automatically. */ var $bDecodeUTF8Input; /* String: sCharacterEncoding The character encoding in which the input data will be received. */ var $sCharacterEncoding; /* Integer: nMethod Stores the method that was used to send the arguments from the client. Will be one of: XAJAX_METHOD_UNKNOWN, XAJAX_METHOD_GET, XAJAX_METHOD_POST */ var $nMethod; /* Array: aSequence Stores the decoding sequence table. */ var $aSequence; /* Function: convertStringToBool Converts a string to a bool var. Parameters: $sValue - (string): Returns: (bool) : true / false */ function convertStringToBool($sValue) { if (0 == strcasecmp($sValue, 'true')) return true; if (0 == strcasecmp($sValue, 'false')) return false; if (is_numeric($sValue)) { if (0 == $sValue) return false; return true; } return false; } function argumentStripSlashes(&$sArg) { if (false == is_string($sArg)) return; $sArg = stripslashes($sArg); } function argumentDecodeXML(&$sArg) { if (false == is_string($sArg)) return; if (0 == strlen($sArg)) return; $nStackDepth = 0; $aStack = array(); $aArg = array(); $nCurrent = 0; $nLast = 0; $aExpecting = array(); $nFound = 0; list($aExpecting, $nFound) = $this->aSequence['start']; $nLength = strlen($sArg); $sKey = ''; $mValue = ''; while ($nCurrent < $nLength) { $bFound = false; foreach ($aExpecting as $sExpecting => $nExpectedLength) { if ($sArg[$nCurrent] == $sExpecting[0]) { if ($sExpecting == substr($sArg, $nCurrent, $nExpectedLength)) { list($aExpecting, $nFound) = $this->aSequence[$sExpecting]; switch ($nFound) { case 3: // k $sKey = ''; break; case 4: // /k $sKey = str_replace( array('<'.'![CDATA[', ']]>'), '', substr($sArg, $nLast, $nCurrent - $nLast) ); break; case 5: // v $mValue = ''; break; case 6: // /v if ($nLast < $nCurrent) { $mValue = str_replace( array('<'.'![CDATA[', ']]>'), '', substr($sArg, $nLast, $nCurrent - $nLast) ); $cType = substr($mValue, 0, 1); $sValue = substr($mValue, 1); switch ($cType) { case 'S': $mValue = false === $sValue ? '' : $sValue; break; case 'B': $mValue = $this->convertStringToBool($sValue); break; case 'N': $mValue = floatval($sValue); break; case '*': $mValue = null; break; } } break; case 7: // /e $aArg[$sKey] = $mValue; break; case 1: // xjxobj ++$nStackDepth; array_push($aStack, $aArg); $aArg = array(); array_push($aStack, $sKey); $sKey = ''; break; case 8: // /xjxobj if (1 < $nStackDepth) { $mValue = $aArg; $sKey = array_pop($aStack); $aArg = array_pop($aStack); --$nStackDepth; } else { $sArg = $aArg; return; } break; } $nCurrent += $nExpectedLength; $nLast = $nCurrent; $bFound = true; break; } } } if (false == $bFound) { if (0 == $nCurrent) { $sArg = str_replace( array('<'.'![CDATA[', ']]>'), '', $sArg ); $cType = substr($sArg, 0, 1); $sValue = substr($sArg, 1); switch ($cType) { case 'S': $sArg = false === $sValue ? '' : $sValue; break; case 'B': $sArg = $this->convertStringToBool($sValue); break; case 'N': $sArg = floatval($sValue); break; case '*': $sArg = null; break; } return; } // for larger arg data, performance may suffer using concatenation // $sText .= $sArg[$nCurrent]; $nCurrent++; } } $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('ARGMGR:ERR:01') . $sExpecting . $objLanguageManager->getText('ARGMGR:ERR:02') . $sArg , E_USER_ERROR ); } function argumentDecodeUTF8_iconv(&$mArg) { if (is_array($mArg)) { foreach (array_keys($mArg) as $sKey) { $sNewKey = $sKey; $this->argumentDecodeUTF8_iconv($sNewKey); if ($sNewKey != $sKey) { $mArg[$sNewKey] = $mArg[$sKey]; unset($mArg[$sKey]); $sKey = $sNewKey; } $this->argumentDecodeUTF8_iconv($mArg[$sKey]); } } else if (is_string($mArg)) $mArg = iconv("UTF-8", $this->sCharacterEncoding.'//TRANSLIT', $mArg); } function argumentDecodeUTF8_mb_convert_encoding(&$mArg) { if (is_array($mArg)) { foreach (array_keys($mArg) as $sKey) { $sNewKey = $sKey; $this->argumentDecodeUTF8_mb_convert_encoding($sNewKey); if ($sNewKey != $sKey) { $mArg[$sNewKey] = $mArg[$sKey]; unset($mArg[$sKey]); $sKey = $sNewKey; } $this->argumentDecodeUTF8_mb_convert_encoding($mArg[$sKey]); } } else if (is_string($mArg)) $mArg = mb_convert_encoding($mArg, $this->sCharacterEncoding, "UTF-8"); } function argumentDecodeUTF8_utf8_decode(&$mArg) { if (is_array($mArg)) { foreach (array_keys($mArg) as $sKey) { $sNewKey = $sKey; $this->argumentDecodeUTF8_utf8_decode($sNewKey); if ($sNewKey != $sKey) { $mArg[$sNewKey] = $mArg[$sKey]; unset($mArg[$sKey]); $sKey = $sNewKey; } $this->argumentDecodeUTF8_utf8_decode($mArg[$sKey]); } } else if (is_string($mArg)) $mArg = utf8_decode($mArg); } /* Constructor: xajaxArgumentManager Initializes configuration settings to their default values and reads the argument data from the GET or POST data. */ function xajaxArgumentManager() { $this->aArgs = array(); $this->bDecodeUTF8Input = false; $this->sCharacterEncoding = 'UTF-8'; $this->nMethod = XAJAX_METHOD_UNKNOWN; $this->aSequence = array( '<'.'k'.'>' => array(array( '<'.'/k'.'>' => 4 ), 3), '<'.'/k'.'>' => array(array( '<'.'v'.'>' => 3, '<'.'/e'.'>' => 4 ), 4), '<'.'v'.'>' => array(array( '<'.'xjxobj'.'>' => 8, '<'.'/v'.'>' => 4 ), 5), '<'.'/v'.'>' => array(array( '<'.'/e'.'>' => 4, '<'.'k'.'>' => 3 ), 6), '<'.'e'.'>' => array(array( '<'.'k'.'>' => 3, '<'.'v'.'>' => 3, '<'.'/e'.'>' => 4 ), 2), '<'.'/e'.'>' => array(array( '<'.'e'.'>' => 3, '<'.'/xjxobj'.'>' => 9 ), 7), '<'.'xjxobj'.'>' => array(array( '<'.'e'.'>' => 3, '<'.'/xjxobj'.'>' => 9 ), 1), '<'.'/xjxobj'.'>' => array(array( '<'.'/v'.'>' => 4 ), 8), 'start' => array(array( '<'.'xjxobj'.'>' => 8 ), 9) ); if (isset($_POST['xjxargs'])) { $this->nMethod = XAJAX_METHOD_POST; $this->aArgs = $_POST['xjxargs']; } else if (isset($_GET['xjxargs'])) { $this->nMethod = XAJAX_METHOD_GET; $this->aArgs = $_GET['xjxargs']; } if (1 == get_magic_quotes_gpc()) array_walk($this->aArgs, array(&$this, 'argumentStripSlashes')); array_walk($this->aArgs, array(&$this, 'argumentDecodeXML')); } /* Function: getInstance Returns: object - A reference to an instance of this class. This function is used to implement the singleton pattern. */ function &getInstance() { static $obj; if (!$obj) { $obj = new xajaxArgumentManager(); } return $obj; } /* Function: configure Accepts configuration settings from the main object. Parameters: The tracks the following configuration settings: - (boolean): See bDecodeUTF8Input> - (string): See sCharacterEncoding> */ function configure($sName, $mValue) { if ('decodeUTF8Input' == $sName) { if (true === $mValue || false === $mValue) $this->bDecodeUTF8Input = $mValue; } else if ('characterEncoding' == $sName) { $this->sCharacterEncoding = $mValue; } } /* Function: getRequestMethod Returns the method that was used to send the arguments from the client. */ function getRequestMethod() { return $this->nMethod; } /* Function: process Returns the array of arguments that were extracted and parsed from the GET or POST data. */ function process() { if ($this->bDecodeUTF8Input) { $sFunction = ''; if (function_exists('iconv')) $sFunction = "iconv"; else if (function_exists('mb_convert_encoding')) $sFunction = "mb_convert_encoding"; else if ($this->sCharacterEncoding == "ISO-8859-1") $sFunction = "utf8_decode"; else { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('ARGMGR:ERR:03') , E_USER_NOTICE ); } $mFunction = array(&$this, 'argumentDecodeUTF8_' . $sFunction); array_walk($this->aArgs, $mFunction); $this->bDecodeUTF8Input = false; } return $this->aArgs; } } php-xajax-0.5/xajax_core/xajaxResponse.inc.php0000644000175000017500000012175411137037724020153 0ustar dgildgil 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-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, 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: - assign>: Assign a value to an elements property. - append>: Append a value on to an elements property. - script>: Execute a portion of javascript code. - call>: Execute an existing javascript function. - 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 setEncoding> for more information. */ var $sCharacterEncoding; /* Boolean: bOutputEntities Convert special characters to the HTML equivellent. See also bOutputEntities> and setFlag>. */ var $bOutputEntities; /* Mixed: returnValue A string, array or integer value to be returned to the caller when using 'synchronous' mode requests. See 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. Parameters: sCharacterEncoding - (string): The encoding method to use for this response. See also, 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). Parameters: 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. Parameters: 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. Parameters: 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. Parameters: 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( 'cmd'=>'cc', 'id'=>$iCmdNumber ), $sMessage ); } /* Function: assign Response command indicating that the specified value should be assigned to the given element's attribute. Parameters: 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 object. */ function assign($sTarget,$sAttribute,$sData) { return $this->addCommand( array( 'cmd'=>'as', 'id'=>$sTarget, 'prop'=>$sAttribute ), $sData ); } /* Function: append Response command that indicates the specified data should be appended to the given element's property. Parameters: 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 object. */ function append($sTarget,$sAttribute,$sData) { return $this->addCommand( array( 'cmd'=>'ap', 'id'=>$sTarget, 'prop'=>$sAttribute ), $sData ); } /* Function: prepend Response command to prepend the specified value onto the given element's property. Parameters: 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 object. */ function prepend($sTarget,$sAttribute,$sData) { return $this->addCommand( array( 'cmd'=>'pp', 'id'=>$sTarget, 'prop'=>$sAttribute ), $sData ); } /* Function: replace Replace a specified value with another value within the given element's property. Parameters: sTarget - (string): The id of the element to update. sAttribute - (string): The property to be updated. sSearch - (string): The needle to search for. sData - (string): The data to use in place of the needle. */ function replace($sTarget,$sAttribute,$sSearch,$sData) { return $this->addCommand( array( 'cmd'=>'rp', 'id'=>$sTarget, 'prop'=>$sAttribute ), array( 's' => $sSearch, 'r' => $sData ) ); } /* Function: clear Response command used to clear the specified property of the given element. Parameters: sTarget - (string): The id of the element to be updated. sAttribute - (string): The property to be clared. Returns: object - The object. */ function clear($sTarget,$sAttribute) { return $this->assign( $sTarget, $sAttribute, '' ); } /* Function: contextAssign Response command used to assign a value to a member of a javascript object (or element) that is specified by the context member of the request. The object is referenced using the 'this' keyword in the sAttribute parameter. Parameters: sAttribute - (string): The property to be updated. sData - (string): The value to assign. Returns: object : The object. */ function contextAssign($sAttribute, $sData) { return $this->addCommand( array( 'cmd'=>'c:as', 'prop'=>$sAttribute ), $sData ); } /* Function: contextAppend Response command used to append a value onto the specified member of the javascript context object (or element) specified by the context member of the request. The object is referenced using the 'this' keyword in the sAttribute parameter. Parameters: sAttribute - (string): The member to be appended to. sData - (string): The value to append. Returns: object : The object. */ function contextAppend($sAttribute, $sData) { return $this->addCommand( array( 'cmd'=>'c:ap', 'prop'=>$sAttribute ), $sData ); } /* Function: contextPrepend Response command used to prepend the speicified data to the given member of the current javascript object specified by context in the current request. The object is access via the 'this' keyword in the sAttribute parameter. Parameters: sAttribute - (string): The member to be updated. sData - (string): The value to be prepended. Returns: object : The object. */ function contextPrepend($sAttribute, $sData) { return $this->addCommand( array( 'cmd'=>'c:pp', 'prop'=>$sAttribute ), $sData ); } /* Function: contextClear Response command used to clear the value of the property specified in the sAttribute parameter. The member is access via the 'this' keyword and can be used to update a javascript object specified by context in the request parameters. Parameters: sAttribute - (string): The member to be cleared. Returns: object : The object. */ function contextClear($sAttribute) { return $this->contextAssign( $sAttribute, '' ); } /* Function: alert Response command that is used to display an alert message to the user. Parameters: sMsg - (string): The message to be displayed. Returns: object : The object. */ function alert($sMsg) { return $this->addCommand( array( 'cmd'=>'al' ), $sMsg ); } function debug($sMessage) { return $this->addCommand( array( 'cmd'=>'dbg' ), $sMessage ); } /* Function: redirect Response command that causes the browser to navigate to the specified URL. Parameters: sURL - (string): The relative or fully qualified URL. iDelay - (integer, optional): Number of seconds to delay before the redirect occurs. Returns: object : The object. */ function redirect($sURL, $iDelay=0) { //we need to parse the query part so that the values are rawurlencode()'ed //can't just use parse_url() cos we could be dealing with a relative URL which // parse_url() can't deal with. $queryStart = strpos($sURL, '?', strrpos($sURL, '/')); if ($queryStart !== FALSE) { $queryStart++; $queryEnd = strpos($sURL, '#', $queryStart); if ($queryEnd === FALSE) $queryEnd = strlen($sURL); $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart); parse_str($queryPart, $queryParts); $newQueryPart = ""; if ($queryParts) { $first = true; foreach($queryParts as $key => $value) { if ($first) $first = false; else $newQueryPart .= '&'; $newQueryPart .= rawurlencode($key).'='.rawurlencode($value); } } else if ($_SERVER['QUERY_STRING']) { //couldn't break up the query, but there's one there //possibly "http://url/page.html?query1234" type of query? //just encode it and hope it works $newQueryPart = rawurlencode($_SERVER['QUERY_STRING']); } $sURL = str_replace($queryPart, $newQueryPart, $sURL); } if ($iDelay) $this->script( 'window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');' ); else $this->script( 'window.location = "' . $sURL . '";' ); return $this; } /* Function: script Response command that is used to execute a portion of javascript on the browser. The script runs in it's own context, so variables declared locally, using the 'var' keyword, will no longer be available after the call. To construct a variable that will be accessable globally, even after the script has executed, leave off the 'var' keyword. Parameters: sJS - (string): The script to execute. Returns: object : The object. */ function script($sJS) { return $this->addCommand( array( 'cmd'=>'js' ), $sJS ); } /* Function: call Response command that indicates that the specified javascript function should be called with the given (optional) parameters. Parameters: arg1 - (string): The name of the function to call. arg2 .. argn : arguments to be passed to the function. Returns: object : The object. */ function call() { $aArgs = func_get_args(); $sFunc = array_shift($aArgs); return $this->addCommand( array( 'cmd'=>'jc', 'func'=>$sFunc ), $aArgs ); } /* Function: remove Response command used to remove an element from the document. Parameters: sTarget - (string): The id of the element to be removed. Returns: object : The object. */ function remove($sTarget) { return $this->addCommand( array( 'cmd'=>'rm', 'id'=>$sTarget), '' ); } /* Function: create Response command used to create a new element on the browser. Parameters: sParent - (string): The id of the parent element. sTag - (string): The tag name to be used for the new element. sId - (string): The id to assign to the new element. sType - (string, optional): The type of tag, deprecated, use createInput> instead. Returns: object : The object. */ function create($sParent, $sTag, $sId, $sType=null) { //SkipDebug if (false === (null === $sType)) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:CPERR:01') , E_USER_WARNING ); } //EndSkipDebug return $this->addCommand( array( 'cmd'=>'ce', 'id'=>$sParent, 'prop'=>$sId ), $sTag ); } /* Function: insert Response command used to insert a new element just prior to the specified element. Parameters: sBefore - (string): The element used as a reference point for the insertion. sTag - (string): The tag to be used for the new element. sId - (string): The id to be used for the new element. Returns: object : The object. */ function insert($sBefore, $sTag, $sId) { return $this->addCommand( array( 'cmd'=>'ie', 'id'=>$sBefore, 'prop'=>$sId ), $sTag ); } /* Function: insertAfter Response command used to insert a new element after the specified one. Parameters: sAfter - (string): The id of the element that will be used as a reference for the insertion. sTag - (string): The tag name to be used for the new element. sId - (string): The id to be used for the new element. Returns: object : The object. */ function insertAfter($sAfter, $sTag, $sId) { return $this->addCommand( array( 'cmd'=>'ia', 'id'=>$sAfter, 'prop'=>$sId ), $sTag ); } /* Function: createInput Response command used to create an input element on the browser. Parameters: sParent - (string): The id of the parent element. sType - (string): The type of the new input element. sName - (string): The name of the new input element. sId - (string): The id of the new element. Returns: object : The object. */ function createInput($sParent, $sType, $sName, $sId) { return $this->addCommand( array( 'cmd'=>'ci', 'id'=>$sParent, 'prop'=>$sId, 'type'=>$sType ), $sName ); } /* Function: insertInput Response command used to insert a new input element preceeding the specified element. Parameters: sBefore - (string): The id of the element to be used as the reference point for the insertion. sType - (string): The type of the new input element. sName - (string): The name of the new input element. sId - (string): The id of the new input element. Returns: object : The object. */ function insertInput($sBefore, $sType, $sName, $sId) { return $this->addCommand( array( 'cmd'=>'ii', 'id'=>$sBefore, 'prop'=>$sId, 'type'=>$sType ), $sName ); } /* Function: insertInputAfter Response command used to insert a new input element after the specified element. Parameters: sAfter - (string): The id of the element that is to be used as the insertion point for the new element. sType - (string): The type of the new input element. sName - (string): The name of the new input element. sId - (string): The id of the new input element. Returns: object : The object. */ function insertInputAfter($sAfter, $sType, $sName, $sId) { return $this->addCommand( array( 'cmd'=>'iia', 'id'=>$sAfter, 'prop'=>$sId, 'type'=>$sType ), $sName ); } /* Function: setEvent Response command used to set an event handler on the browser. Parameters: sTarget - (string): The id of the element that contains the event. sEvent - (string): The name of the event. sScript - (string): The javascript to execute when the event is fired. Returns: object : The object. */ function setEvent($sTarget,$sEvent,$sScript) { return $this->addCommand( array( 'cmd'=>'ev', 'id'=>$sTarget, 'prop'=>$sEvent ), $sScript ); } /* Function: addEvent Response command used to set an event handler on the browser. Parameters: sTarget - (string): The id of the element that contains the event. sEvent - (string): The name of the event. sScript - (string): The javascript to execute when the event is fired. Returns: object : The object. Note: This function is depreciated and will be removed in a future version. Use instead. */ function addEvent($sTarget,$sEvent,$sScript) { return $this->setEvent( $sTarget, $sEvent, $sScript ); } /* Function: addHandler Response command used to install an event handler on the specified element. Parameters: sTarget - (string): The id of the element. sEvent - (string): The name of the event to add the handler to. sHandler - (string): The javascript function to call when the event is fired. You can add more than one event handler to an element's event using this method. Returns: object - The object. */ function addHandler($sTarget,$sEvent,$sHandler) { return $this->addCommand( array( 'cmd'=>'ah', 'id'=>$sTarget, 'prop'=>$sEvent ), $sHandler ); } /* Function: removeHandler Response command used to remove an event handler from an element. Parameters: sTarget - (string): The id of the element. sEvent - (string): The name of the event. sHandler - (string): The javascript function that is called when the event is fired. Returns: object : The object. */ function removeHandler($sTarget,$sEvent,$sHandler) { return $this->addCommand( array( 'cmd'=>'rh', 'id'=>$sTarget, 'prop'=>$sEvent ), $sHandler); } /* Function: setFunction Response command used to construct a javascript function on the browser. Parameters: sFunction - (string): The name of the function to construct. sArgs - (string): Comma separated list of parameter names. sScript - (string): The javascript code that will become the body of the function. Returns: object : The object. */ function setFunction($sFunction, $sArgs, $sScript) { return $this->addCommand( array( 'cmd'=>'sf', 'func'=>$sFunction, 'prop'=>$sArgs ), $sScript ); } /* Function: wrapFunction Response command used to construct a wrapper function around and existing javascript function on the browser. Parameters: sFunction - (string): The name of the existing function to wrap. sArgs - (string): The comma separated list of parameters for the function. aScripts - (array): An array of javascript code snippets that will be used to build the body of the function. The first piece of code specified in the array will occur before the call to the original function, the second will occur after the original function is called. sReturnValueVariable - (string): The name of the variable that will retain the return value from the call to the original function. Returns: object : The object. */ function wrapFunction($sFunction, $sArgs, $aScripts, $sReturnValueVariable) { return $this->addCommand( array( 'cmd'=>'wpf', 'func'=>$sFunction, 'prop'=>$sArgs, 'type'=>$sReturnValueVariable ), $aScripts ); } /* Function: includeScript Response command used to load a javascript file on the browser. Parameters: sFileName - (string): The relative or fully qualified URI of the javascript file. sType - (string): Determines the script type . Defaults to 'text/javascript'. Returns: object : The object. */ function includeScript($sFileName, $sType = null, $sId = null) { $command = array('cmd' => 'in'); if (false === (null === $sType)) $command['type'] = $sType; if (false === (null === $sId)) $command['elm_id'] = $sId; return $this->addCommand( $command, $sFileName ); } /* Function: includeScriptOnce Response command used to include a javascript file on the browser if it has not already been loaded. Parameters: sFileName - (string): The relative for fully qualified URI of the javascript file. sType - (string): Determines the script type . Defaults to 'text/javascript'. Returns: object : The object. */ function includeScriptOnce($sFileName, $sType = null, $sId = null) { $command = array('cmd' => 'ino'); if (false === (null === $sType)) $command['type'] = $sType; if (false === (null === $sId)) $command['elm_id'] = $sId; return $this->addCommand( $command, $sFileName ); } /* Function: removeScript Response command used to remove a SCRIPT reference to a javascript file on the browser. Optionally, you can call a javascript function just prior to the file being unloaded (for cleanup). Parameters: sFileName - (string): The relative or fully qualified URI of the javascript file. sUnload - (string): Name of a javascript function to call prior to unlaoding the file. Returns: object : The object. */ function removeScript($sFileName, $sUnload = '') { $this->addCommand( array( 'cmd'=>'rjs', 'unld'=>$sUnload ), $sFileName ); return $this; } /* Function: includeCSS Response command used to include a LINK reference to the specified CSS file on the browser. This will cause the browser to load and apply the style sheet. Parameters: sFileName - (string): The relative or fully qualified URI of the css file. sMedia - (string): Determines the media type of the CSS file. Defaults to 'screen'. Returns: object : The object. */ function includeCSS($sFileName, $sMedia = null) { $command = array('cmd' => 'css'); if (false === (null === $sMedia)) $command['media'] = $sMedia; return $this->addCommand( $command, $sFileName ); } /* Function: removeCSS Response command used to remove a LINK reference to a CSS file on the browser. This causes the browser to unload the style sheet, effectively removing the style changes it caused. Parameters: sFileName - (string): The relative or fully qualified URI of the css file. Returns: object : The object. */ function removeCSS($sFileName, $sMedia = null) { $command = array('cmd'=>'rcss'); if (false === (null === $sMedia)) $command['media'] = $sMedia; return $this->addCommand( $command, $sFileName ); } /* Function: waitForCSS Response command instructing xajax to pause while the CSS files are loaded. The browser is not typically a multi-threading application, with regards to javascript code. Therefore, the CSS files included or removed with includeCSS> and removeCSS> respectively, will not be loaded or removed until the browser regains control from the script. This command returns control back to the browser and pauses the execution of the response until the CSS files, included previously, are loaded. Parameters: iTimeout - (integer): The number of 1/10ths of a second to pause before timing out and continuing with the execution of the response commands. Returns: object : The object. */ function waitForCSS($iTimeout = 600) { $sData = ""; $this->addCommand( array( 'cmd'=>'wcss', 'prop'=>$iTimeout ), $sData ); return $this; } /* Function: waitFor Response command instructing xajax to delay execution of the response commands until a specified condition is met. Note, this returns control to the browser, so that other script operations can execute. xajax will continue to monitor the specified condition and, when it evaulates to true, will continue processing response commands. Parameters: script - (string): A piece of javascript code that evaulates to true or false. tenths - (integer): The number of 1/10ths of a second to wait before timing out and continuing with the execution of the response commands. Returns: object : The object. */ function waitFor($script, $tenths) { return $this->addCommand( array( 'cmd'=>'wf', 'prop'=>$tenths ), $script ); } /* Function: sleep Response command which instructs xajax to pause execution of the response commands, returning control to the browser so it can perform other commands asynchronously. After the specified delay, xajax will continue execution of the response commands. Parameters: tenths - (integer): The number of 1/10ths of a second to sleep. Returns: object : The object. */ function sleep($tenths) { $this->addCommand( array( 'cmd'=>'s', 'prop'=>$tenths ), '' ); return $this; } /* Function: setReturnValue Stores a value that will be passed back as part of the response. When making synchronous requests, the calling javascript can obtain this value immediately as the return value of the function. Parameters: value - (mixed): Any value. Returns: object : The object. */ function setReturnValue($value) { $this->returnValue = $this->_encodeArray($value); return $this; } /* Function: getContentType Returns the current content type that will be used for the response packet. (typically: "text/xml") Returns: string : The content type. */ function getContentType() { return 'text/xml'; } /* Function: getOutput */ function getOutput() { ob_start(); $this->_printHeader_XML(); $this->_printResponse_XML(); return ob_get_clean(); } /* Function: printOutput Prints the output, generated from the commands added to the response, that will be sent to the browser. Returns: string : The textual representation of the response commands. */ function printOutput() { $this->_sendHeaders(); $this->_printHeader_XML(); $this->_printResponse_XML(); } /* Function: _sendHeaders Used internally to generate the response headers. */ function _sendHeaders() { $objArgumentManager =& xajaxArgumentManager::getInstance(); if (XAJAX_METHOD_GET == $objArgumentManager->getRequestMethod()) { header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); } $sCharacterSet = ''; if ($this->sCharacterEncoding && 0 < strlen(trim($this->sCharacterEncoding))) { $sCharacterSet = '; charset="' . trim($this->sCharacterEncoding) . '"'; } $sContentType = $this->getContentType(); header('content-type: ' . $sContentType . ' ' . $sCharacterSet); } /* Function: getCommandCount Returns: integer : The number of commands in the response. */ function getCommandCount() { return count($this->aCommands); } /* Function: loadCommands Merges the response commands from the specified object with the response commands in this object. Parameters: mCommands - (object): object. bBefore - (boolean): Add the new commands to the beginning of the list. */ function loadCommands($mCommands, $bBefore=false) { if (is_a($mCommands, 'xajaxResponse')) { $this->returnValue = $mCommands->returnValue; if ($bBefore) { $this->aCommands = array_merge($mCommands->aCommands, $this->aCommands); } else { $this->aCommands = array_merge($this->aCommands, $mCommands->aCommands); } } else if (is_array($mCommands)) { if ($bBefore) { $this->aCommands = array_merge($mCommands, $this->aCommands); } else { $this->aCommands = array_merge($this->aCommands, $mCommands); } } else { //SkipDebug if (!empty($mCommands)) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:LCERR:01') , E_USER_ERROR ); } //EndSkipDebug } } function absorb($objResponse) { $this->loadCommands($objResponse); } /* Function: addPluginCommand Adds a response command that is generated by a plugin. Parameters: objPlugin - (object): A reference to a plugin object. aAttributes - (array): Array containing the attributes for this response command. mData - (mixed): The data to be sent with this command. Returns: object : The object. */ function addPluginCommand($objPlugin, $aAttributes, $mData) { $aAttributes['plg'] = $objPlugin->getName(); return $this->addCommand($aAttributes, $mData); } /* Function: addCommand Add a response command to the array of commands that will be sent to the browser. Parameters: aAttributes - (array): Associative array of attributes that will describe the command. mData - (mixed): The data to be associated with this command. Returns: object : The command. */ function addCommand($aAttributes, $mData) { $aAttributes['data'] = $this->_encodeArray($mData); $this->aCommands[] = $aAttributes; return $this; } /* Function: _printHeader_XML Used internally to print XML start tag. */ function _printHeader_XML() { echo '<'; echo '?'; echo 'xml version="1.0"'; $sEncoding = trim($this->sCharacterEncoding); if ($this->sCharacterEncoding && 0 < strlen($sEncoding)) { echo ' encoding="'; echo $sEncoding; echo '"'; } echo ' ?'; echo '>'; } /* Function: _printResponse_XML Used internally to generate the command output. */ function _printResponse_XML() { echo '<'; echo 'xjx>'; if (null !== $this->returnValue) { echo '<'; echo 'xjxrv>'; $this->_printArray_XML($this->returnValue); echo '<'; echo '/xjxrv>'; } foreach(array_keys($this->aCommands) as $sKey) $this->_printCommand_XML($this->aCommands[$sKey]); echo '<'; echo '/xjx>'; } /* Function: _printCommand_XML Prints an XML representation of the command. Parameters: aAttributes - (array): Associative array of attributes for this command. */ function _printCommand_XML(&$aAttributes) { echo '<'; echo 'cmd'; $mData = ''; foreach (array_keys($aAttributes) as $sKey) { if ($sKey) { if ('data' != $sKey) { echo ' '; echo $sKey; echo '="'; echo $aAttributes[$sKey]; echo '"'; } else $mData =& $aAttributes[$sKey]; } } echo '>'; $this->_printArray_XML($mData); echo '<'; echo '/cmd>'; } /* Function: _printArray_XML Prints an XML representation of a php array suitable for inclusion in the response to the browser. Arrays sent via this method will be converted into a javascript array on the browser. Parameters: mArray - (array): Array to be converted. */ function _printArray_XML(&$mArray) { if ('object' == gettype($mArray)) $mArray = get_object_vars($mArray); if (false == is_array($mArray)) { $this->_printEscapedString_XML($mArray); return; } echo '<'; echo 'xjxobj>'; foreach (array_keys($mArray) as $sKey) { if (is_array($mArray[$sKey])) { echo '<'; echo 'e>'; foreach (array_keys($mArray[$sKey]) as $sInnerKey) { //SkipDebug if (htmlspecialchars($sInnerKey, ENT_COMPAT, 'UTF-8') != $sInnerKey) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:AKERR:01') , E_USER_ERROR ); } //EndSkipDebug if ('k' == $sInnerKey || 'v' == $sInnerKey) { echo '<'; echo $sInnerKey; echo '>'; $this->_printArray_XML($mArray[$sKey][$sInnerKey]); echo '<'; echo '/'; echo $sInnerKey; echo '>'; } else { //SkipDebug $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:IEAERR:01') , E_USER_ERROR ); //EndSkipDebug } } echo '<'; echo '/e>'; } else { //SkipDebug $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:NEAERR:01') , E_USER_ERROR ); //EndSkipDebug } } echo '<'; echo '/xjxobj>'; } /* Function: _printEscapedString_XML Escape the specified data if necessary, so special characters in the command data does not interfere with the structure of the response. This could be overridden to allow for transport encodings other than XML. Parameters: sData - (string): The data to be escaped. Returns: string : The escaped data. */ function _printEscapedString_XML(&$sData) { if (is_null($sData) || false == isset($sData)) { echo '*'; return; } if ($this->bOutputEntities) { //SkipDebug if (false === function_exists('mb_convert_encoding')) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:MBEERR:01') , E_USER_NOTICE ); } //EndSkipDebug echo call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sCharacterEncoding)); return; } $nCDATA = 0; $bNoOpenCDATA = (false === strpos($sData, '<'.'![CDATA[')); if ($bNoOpenCDATA) { $bNoCloseCDATA = (false === strpos($sData, ']]>')); if ($bNoCloseCDATA) { $bSpecialChars = (htmlspecialchars($sData, ENT_COMPAT, 'UTF-8') != $sData); if ($bSpecialChars) $nCDATA = 1; } else $nCDATA = 2; } else $nCDATA = 2; if (0 < $nCDATA) { echo '<'; echo '![CDATA['; // PHP defines numeric values as integer or float (double and real are aliases of float) if (is_string($sData)) { echo 'S'; } else if (is_int($sData) || is_float($sData)) { echo 'N'; } else if (is_bool($sData)) { echo 'B'; } if (1 < $nCDATA) { $aSegments = explode('<'.'![CDATA[', $sData); $aOutput = array(); $nOutput = 0; foreach (array_keys($aSegments) as $keySegment) { $aFragments = explode(']]>', $aSegments[$keySegment]); $aStack = array(); $nStack = 0; foreach (array_keys($aFragments) as $keyFragment) { if (0 < $nStack) array_push($aStack, ']]]]><', '![CDATA[>', $aFragments[$keyFragment]); else $aStack[] = $aFragments[$keyFragment]; ++$nStack; } if (0 < $nOutput) array_push($aOutput, '<', '![]]><', '![CDATA[CDATA[', implode('', $aStack)); else $aOutput[] = implode('', $aStack); ++$nOutput; } echo implode('', $aOutput); } else echo $sData; echo ']]>'; } else { if (is_string($sData)) { echo 'S'; } else if (is_int($sData) || is_float($sData)) { echo 'N'; } else if (is_bool($sData)) { echo 'B'; } echo $sData; } } /* Function: _encodeArray Recursively serializes a data structure in an array so that it can be sent to the browser. This can be thought of as the opposite of _parseObjXml>. Parameters: mData - (mixed): The data to be evaluated. Returns: mixed : The object constructed from the data. */ function _encodeArray(&$mData) { if ('object' === gettype($mData)) $mData = get_object_vars($mData); if (false === is_array($mData)) return $mData; $aData = array(); foreach (array_keys($mData) as $sKey) $aData[] = array( // key does not need to be encoded 'k'=>$sKey, 'v'=>$this->_encodeArray($mData[$sKey]) ); return $aData; } }// end class xajaxResponse class xajaxCustomResponse { var $sOutput; var $sContentType; var $sCharacterEncoding; var $bOutputEntities; function xajaxCustomResponse($sContentType) { $this->sOutput = ''; $this->sContentType = $sContentType; $objResponseManager =& xajaxResponseManager::getInstance(); $this->sCharacterEncoding = $objResponseManager->getCharacterEncoding(); $this->bOutputEntities = $objResponseManager->getOutputEntities(); } function setCharacterEncoding($sCharacterEncoding) { $this->sCharacterEncoding = $sCharacterEncoding; } function setOutputEntities($bOutputEntities) { $this->bOutputEntities = $bOutputEntities; } function clear() { $this->sOutput = ''; } function append($sOutput) { $this->sOutput .= $sOutput; } function absorb($objResponse) { //SkipDebug if (false == is_a($objResponse, 'xajaxCustomResponse')) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:MXRTERR') , E_USER_ERROR ); } if ($objResponse->getContentType() != $this->getContentType()) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:MXCTERR') , E_USER_ERROR ); } if ($objResponse->getCharacterEncoding() != $this->getCharacterEncoding()) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:MXCEERR') , E_USER_ERROR ); } if ($objResponse->getOutputEntities() != $this->getOutputEntities()) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXRSP:MXOEERR') , E_USER_ERROR ); } //EndSkipDebug $this->sOutput .= $objResponse->getOutput(); } function getContentType() { return $this->sContentType; } function getCharacterEncoding() { return $this->sCharacterEncoding; } function getOutputEntities() { return $this->bOutputEntities; } function getOutput() { return $this->sOutput; } function printOutput() { $sContentType = $this->sContentType; $sCharacterSet = $this->sCharacterEncoding; header("content-type: {$sContentType}; charset={$sCharacterSet}"); echo $this->sOutput; } } php-xajax-0.5/xajax_core/xajaxPluginManager.inc.php0000644000175000017500000001776711137037724021116 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxPluginManager.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ //SkipAIO require(dirname(__FILE__) . '/xajaxPlugin.inc.php'); //EndSkipAIO /* Class: xajaxPluginManager */ class xajaxPluginManager { /* Array: aRequestPlugins */ var $aRequestPlugins; /* Array: aResponsePlugins */ var $aResponsePlugins; /* Array: aConfigurable */ var $aConfigurable; /* Array: aRegistrars */ var $aRegistrars; /* Array: aProcessors */ var $aProcessors; /* Array: aClientScriptGenerators */ var $aClientScriptGenerators; /* Function: xajaxPluginManager Construct and initialize the one and only xajax plugin manager. */ function xajaxPluginManager() { $this->aRequestPlugins = array(); $this->aResponsePlugins = array(); $this->aConfigurable = array(); $this->aRegistrars = array(); $this->aProcessors = array(); $this->aClientScriptGenerators = array(); } /* Function: getInstance Implementation of the singleton pattern: returns the one and only instance of the xajax plugin manager. Returns: object : a reference to the one and only instance of the plugin manager. */ function &getInstance() { static $obj; if (!$obj) { $obj = new xajaxPluginManager(); } return $obj; } /* Function: loadPlugins Loads plugins from the folders specified. Parameters: $aFolders - (array): Array of folders to check for plugins */ function loadPlugins($aFolders) { foreach ($aFolders as $sFolder) { if (is_dir($sFolder)) if ($handle = opendir($sFolder)) { while (!(false === ($sName = readdir($handle)))) { $nLength = strlen($sName); if (8 < $nLength) { $sFileName = substr($sName, 0, $nLength - 8); $sExtension = substr($sName, $nLength - 8, 8); if ('.inc.php' == $sExtension) { require $sFolder . '/' . $sFileName . $sExtension; } } } closedir($handle); } } } /* Function: _insertIntoArray Inserts an entry into an array given the specified priority number. If a plugin already exists with the given priority, the priority is automatically incremented until a free spot is found. The plugin is then inserted into the empty spot in the array. Parameters: $aPlugins - (array): Plugins array $objPlugin - (object): A reference to an instance of a plugin. $nPriority - (number): The desired priority, used to order the plugins. */ function _insertIntoArray(&$aPlugins, &$objPlugin, $nPriority) { while (isset($aPlugins[$nPriority])) $nPriority++; $aPlugins[$nPriority] =& $objPlugin; } /* Function: registerPlugin Registers a plugin. Parameters: objPlugin - (object): A reference to an instance of a plugin. Note: Below is a table for priorities and their description: 0 thru 999: Plugins that are part of or extensions to the xajax core 1000 thru 8999: User created plugins, typically, these plugins don't care about order 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin list */ function registerPlugin(&$objPlugin, $nPriority=1000) { if (is_a($objPlugin, 'xajaxRequestPlugin')) { $this->_insertIntoArray($this->aRequestPlugins, $objPlugin, $nPriority); if (method_exists($objPlugin, 'register')) $this->_insertIntoArray($this->aRegistrars, $objPlugin, $nPriority); if (method_exists($objPlugin, 'canProcessRequest')) if (method_exists($objPlugin, 'processRequest')) $this->_insertIntoArray($this->aProcessors, $objPlugin, $nPriority); } else if (is_a($objPlugin, 'xajaxResponsePlugin')) { $this->aResponsePlugins[] =& $objPlugin; } else { //SkipDebug $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXPM:IPLGERR:01') . get_class($objPlugin) . $objLanguageManager->getText('XJXPM:IPLGERR:02') , E_USER_ERROR ); //EndSkipDebug } if (method_exists($objPlugin, 'configure')) $this->_insertIntoArray($this->aConfigurable, $objPlugin, $nPriority); if (method_exists($objPlugin, 'generateClientScript')) $this->_insertIntoArray($this->aClientScriptGenerators, $objPlugin, $nPriority); } /* Function: canProcessRequest Calls each of the request plugins and determines if the current request can be processed by one of them. If no processor identifies the current request, then the request must be for the initial page load. See canProcessRequest> for more information. */ function canProcessRequest() { $bHandled = false; $aKeys = array_keys($this->aProcessors); sort($aKeys); foreach ($aKeys as $sKey) { $mResult = $this->aProcessors[$sKey]->canProcessRequest(); if (true === $mResult) $bHandled = true; else if (is_string($mResult)) return $mResult; } return $bHandled; } /* Function: processRequest Calls each of the request plugins to request that they process the current request. If the plugin processes the request, it will return true. */ function processRequest() { $bHandled = false; $aKeys = array_keys($this->aProcessors); sort($aKeys); foreach ($aKeys as $sKey) { $mResult = $this->aProcessors[$sKey]->processRequest(); if (true === $mResult) $bHandled = true; else if (is_string($mResult)) return $mResult; } return $bHandled; } /* Function: configure Call each of the request plugins passing along the configuration setting specified. Parameters: sName - (string): The name of the configuration setting to set. mValue - (mixed): The value to be set. */ function configure($sName, $mValue) { $aKeys = array_keys($this->aConfigurable); sort($aKeys); foreach ($aKeys as $sKey) $this->aConfigurable[$sKey]->configure($sName, $mValue); } /* Function: register Call each of the request plugins and give them the opportunity to handle the registration of the specified function, event or callable object. Parameters: $aArgs - (array) : */ function register($aArgs) { $aKeys = array_keys($this->aRegistrars); sort($aKeys); foreach ($aKeys as $sKey) { $objPlugin =& $this->aRegistrars[$sKey]; $mResult =& $objPlugin->register($aArgs); if (is_a($mResult, 'xajaxRequest')) return $mResult; if (is_array($mResult)) return $mResult; if (is_bool($mResult)) if (true === $mResult) return true; } //SkipDebug $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXPM:MRMERR:01') . print_r($aArgs, true) , E_USER_ERROR ); //EndSkipDebug } /* Function: generateClientScript Call each of the request and response plugins giving them the opportunity to output some javascript to the page being generated. This is called only when the page is being loaded initially. This is not called when processing a request. */ function generateClientScript() { $aKeys = array_keys($this->aClientScriptGenerators); sort($aKeys); foreach ($aKeys as $sKey) $this->aClientScriptGenerators[$sKey]->generateClientScript(); } /* Function: getPlugin Locate the specified response plugin by name and return a reference to it if one exists. Parameters: $sName - (string): Name of the plugin. Returns: mixed : Returns plugin or false if not found. */ function &getPlugin($sName) { $aKeys = array_keys($this->aResponsePlugins); sort($aKeys); foreach ($aKeys as $sKey) if (is_a($this->aResponsePlugins[$sKey], $sName)) return $this->aResponsePlugins[$sKey]; $bFailure = false; return $bFailure; } } php-xajax-0.5/xajax_core/xajaxResponseManager.inc.php0000644000175000017500000001426611137037724021445 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxResponseManager.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajaxResponseManager This class stores and tracks the response that will be returned after processing a request. The response manager represents a single point of contact for working with objects as well as objects. */ class xajaxResponseManager { /* Object: objResponse The current response object that will be sent back to the browser once the request processing phase is complete. */ var $objResponse; /* String: sCharacterEncoding */ var $sCharacterEncoding; /* Boolean: bOutputEntities */ var $bOutputEntities; /* Array: aDebugMessages */ var $aDebugMessages; /* Function: xajaxResponseManager Construct and initialize the one and only xajaxResponseManager object. */ function xajaxResponseManager() { $this->objResponse = NULL; $this->aDebugMessages = array(); } /* Function: getInstance Implementation of the singleton pattern: provide a single instance of the to all who request it. */ function &getInstance() { static $obj; if (!$obj) { $obj = new xajaxResponseManager(); } return $obj; } /* Function: configure Called by the xajax object when configuration options are set in the main script. Option values are passed to each of the main xajax components and stored locally as needed. The will track the characterEncoding and outputEntities settings. Parameters: $sName - (string): Setting name $mValue - (mixed): Value */ function configure($sName, $mValue) { if ('characterEncoding' == $sName) { $this->sCharacterEncoding = $mValue; if (isset($this->objResponse)) $this->objResponse->setCharacterEncoding($this->sCharacterEncoding); } else if ('outputEntities' == $sName) { if (true === $mValue || false === $mValue) { $this->bOutputEntities = $mValue; if (isset($this->objResponse)) $this->objResponse->setOutputEntities($this->bOutputEntities); } } } /* Function: clear Clear the current response. A new response will need to be appended before the request processing is complete. */ function clear() { $this->objResponse = NULL; } /* Function: append Used, primarily internally, to append one response object onto the end of another. You can append one xajaxResponse to the end of another, or append a xajaxCustomResponse onto the end of another xajaxCustomResponse. However, you cannot append a standard response object onto the end of a custom response and likewise, you cannot append a custom response onto the end of a standard response. Parameters: $mResponse - (object): The new response object to be added to the current response object. If no prior response has been appended, this response becomes the main response object to which other response objects will be appended. */ function append($mResponse) { if (is_a($mResponse, 'xajaxResponse')) { if (NULL == $this->objResponse) { $this->objResponse = $mResponse; } else if (is_a($this->objResponse, 'xajaxResponse')) { if ($this->objResponse != $mResponse) $this->objResponse->absorb($mResponse); } else { $objLanguageManager =& xajaxLanguageManager::getInstance(); $this->debug( $objLanguageManager->getText('XJXRM:MXRTERR') . get_class($this->objResponse) . ')' ); } } else if (is_a($mResponse, 'xajaxCustomResponse')) { if (NULL == $this->objResponse) { $this->objResponse = $mResponse; } else if (is_a($this->objResponse, 'xajaxCustomResponse')) { if ($this->objResponse != $mResponse) $this->objResponse->absorb($mResponse); } else { $objLanguageManager =& xajaxLanguageManager::getInstance(); $this->debug( $objLanguageManager->getText('XJXRM:MXRTERR') . get_class($this->objResponse) . ')' ); } } else { $objLanguageManager =& xajaxLanguageManager::getInstance(); $this->debug($objLanguageManager->getText('XJXRM:IRERR')); } } /* Function: debug Appends a debug message on the end of the debug message queue. Debug messages will be sent to the client with the normal response (if the response object supports the sending of debug messages, see: ) Parameters: $sMessage - (string): The text of the debug message to be sent. */ function debug($sMessage) { $this->aDebugMessages[] = $sMessage; } /* Function: send Prints the response object to the output stream, thus sending the response to the client. */ function send() { if (NULL != $this->objResponse) { foreach ($this->aDebugMessages as $sMessage) $this->objResponse->debug($sMessage); $this->aDebugMessages = array(); $this->objResponse->printOutput(); } } /* Function: getCharacterEncoding Called automatically by new response objects as they are constructed to obtain the current character encoding setting. As the character encoding is changed, the will automatically notify the current response object since it would have been constructed prior to the setting change, see . */ function getCharacterEncoding() { return $this->sCharacterEncoding; } /* Function: getOutputEntities Called automatically by new response objects as they are constructed to obtain the current output entities setting. As the output entities setting is changed, the will automatically notify the current response object since it would have been constructed prior to the setting change, see . */ function getOutputEntities() { return $this->bOutputEntities; } }php-xajax-0.5/xajax_core/xajax_lang_de.inc.php0000644000175000017500000001204211137037724020072 0ustar dgildgil for a detailed description, copyright and license information. Translations provided by: (Thank you!) - mic - q_no */ /* @package xajax @version $Id: xajax_lang_de.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ //SkipAIO $objLanguageManager =& xajaxLanguageManager::getInstance(); $objLanguageManager->register('de', array( 'LOGHDR:01' => '** xajax Fehler Protokoll - ', 'LOGHDR:02' => " **\n", 'LOGHDR:03' => "\n\n\n", 'LOGERR:01' => "** Protokolliere Fehler **\n\nxajax konnte den Fehler nicht in die Protokolldatei schreiben:\n", 'LOGMSG:01' => "** PHP Fehlermeldungen: **", 'CMPRSJS:RDERR:01' => 'Die unkomprimierte JavaScript-Datei konnte nicht gefunden werden im Verzeichnis: ', 'CMPRSJS:RDERR:02' => '. Fehler ', 'CMPRSJS:WTERR:01' => 'Die komprimierte xajax JavaScript-Datei konnte nicht in das Verzeichnis ', 'CMPRSJS:WTERR:02' => ' geschrieben werden. Fehler ', 'CMPRSPHP:WTERR:01' => 'Die komprimierte xajax Datei ', 'CMPRSPHP:WTERR:02' => ' konnte nicht geschrieben werden. Fehler ', 'CMPRSAIO:WTERR:01' => 'Die komprimierte xajax Datei ', 'CMPRSAIO:WTERR:02' => '/xajaxAIO.inc.php konnte nicht geschrieben werden. Fehler ', 'DTCTURI:01' => 'xajax Fehler: xajax konnte die Request URI nicht automatisch identifizieren.', 'DTCTURI:02' => 'Bitte setzen sie die Request URI explizit wenn sie die xajax Klasse instanziieren.', 'ARGMGR:ERR:01' => 'Fehlerhaftes Objekt erhalten: ', 'ARGMGR:ERR:02' => ' <==> ', 'ARGMGR:ERR:03' => 'Die erhaltenen xajax Daten konnte nicht aus UTF8 konvertiert werden.', 'XJXCTL:IAERR:01' => 'Ungültiges Attribut [', 'XJXCTL:IAERR:02' => '] für Element [', 'XJXCTL:IAERR:03' => '].', 'XJXCTL:IRERR:01' => 'Ungültiges Request-Objekt übergeben an xajaxControl::setEvent', 'XJXCTL:IEERR:01' => 'Ungültiges Attribut (event name) [', 'XJXCTL:IEERR:02' => '] für Element [', 'XJXCTL:IEERR:03' => '].', 'XJXCTL:MAERR:01' => 'Erforderliches Attribut fehlt [', 'XJXCTL:MAERR:02' => '] für Element [', 'XJXCTL:MAERR:03' => '].', 'XJXCTL:IETERR:01' => "Ungültiges End-Tag; Sollte 'forbidden' oder 'optional' sein.\n", 'XJXCTL:ICERR:01' => "Ungültige Klasse für html control angegeben.; Sollte %inline, %block oder %flow sein.\n", 'XJXCTL:ICLERR:01' => 'Ungültige Klasse (control) an addChild übergeben; Sollte abgeleitet sein von xajaxControl.', 'XJXCTL:ICLERR:02' => 'Ungültige Klasse (control) an addChild übergeben [', 'XJXCTL:ICLERR:03' => '] für Element [', 'XJXCTL:ICLERR:04' => "].\n", 'XJXCTL:ICHERR:01' => 'Ungültiger Parameter übergeben für xajaxControl::addChildren; Array aus xajaxControl Objekten erwartet.', 'XJXCTL:MRAERR:01' => 'Erforderliches Attribut fehlt [', 'XJXCTL:MRAERR:02' => '] für Element [', 'XJXCTL:MRAERR:03' => '].', 'XJXPLG:GNERR:01' => 'Response plugin sollte die Funktion getName überschreiben.', 'XJXPLG:PERR:01' => 'Response plugin sollte die process Funktion überschreiben.', 'XJXPM:IPLGERR:01' => 'Versuch ungültiges Plugin zu registrieren: : ', 'XJXPM:IPLGERR:02' => ' Ableitung von xajaxRequestPlugin oder xajaxResponsePlugin erwartet.', 'XJXPM:MRMERR:01' => 'Konnte die Registrierungsmethode nicht finden für: : ', 'XJXRSP:EDERR:01' => 'Die Angabe der Zeichensatzkodierung in der xajaxResponse ist veraltet. Die neue Funktion lautet: $xajax->configure("characterEncoding", ...);', 'XJXRSP:MPERR:01' => 'Ungültiger oder fehlender Pluginname festgestellt im Aufruf von xajaxResponse::plugin', 'XJXRSP:CPERR:01' => "Der Parameter \$sType in addCreate ist veraltet. Die neue Funktion lautet addCreateInput()", 'XJXRSP:LCERR:01' => "Das xajax response Objeckt konnte die Befehler nich verarbeiten, da kein gültiges Array übergeben wurde.", 'XJXRSP:AKERR:01' => 'Ungültiger Tag-Name im Array.', 'XJXRSP:IEAERR:01' => 'Ungeeignet kodiertes Array.', 'XJXRSP:NEAERR:01' => 'Nicht kodiertes Array festgestellt.', 'XJXRSP:MBEERR:01' => 'Die Ausgabe vonn xajax response konnte nicht in htmlentities umgewandelt werden, da die Funktion mb_convert_encoding nicht verfügbar ist.', 'XJXRSP:MXRTERR' => 'Fehler: Kann keine verschiedenen Typen in einer einzelnen Antwort verarbeiten.', 'XJXRSP:MXCTERR' => 'Fehler: Kann keine verschiedenen Content-Types in einer einzelnen Antwort verarbeiten.', 'XJXRSP:MXCEERR' => 'Fehler: Kann keine verschiedenen Zeichensatzkodierungen in einer einzelnen Antwort verarbeiten.', 'XJXRSP:MXOEERR' => 'Fehler: Kann keine output entities (true/false) in ener einzelnen Antwort verarbeiten.', 'XJXRM:IRERR' => 'Ungültige Antwort erhalten während der Ausführung der Anfrage.', 'XJXRM:MXRTERR' => 'Fehler: Kann kkeine verschiedenen reponse types benutzen während der Ausführung einer Anfrage: ' )); //EndSkipAIOphp-xajax-0.5/xajax_core/legacy.inc.php0000644000175000017500000001211011137037724016546 0ustar dgildgilsetOutputEntities(true); } function outputEntitiesOff() { $this->setOutputEntities(false); } function addConfirmCommands() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'confirmCommands'), $temp); } function addAssign() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'assign'), $temp); } function addAppend() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'append'), $temp); } function addPrepend() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'prepend'), $temp); } function addReplace() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'replace'), $temp); } function addClear() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'clear'), $temp); } function addAlert() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'alert'), $temp); } function addRedirect() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'redirect'), $temp); } function addScript() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'script'), $temp); } function addScriptCall() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'call'), $temp); } function addRemove() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'remove'), $temp); } function addCreate() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'create'), $temp); } function addInsert() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'insert'), $temp); } function addInsertAfter() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'insertAfter'), $temp); } function addCreateInput() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'createInput'), $temp); } function addInsertInput() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'insertInput'), $temp); } function addInsertInputAfter() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'insertInputAfter'), $temp); } function addRemoveHandler() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'removeHandler'), $temp); } function addIncludeScript() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'includeScript'), $temp); } function addIncludeCSS() { $temp=func_get_args(); return call_user_func_array(array(&$this, 'includeCSS'), $temp); } function &getXML() { return $this; } } class legacyXajax extends xajax { function legacyXajax($sRequestURI='', $sWrapperPrefix='xajax_', $sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bDebug=false) { parent::xajax(); $this->configure('requestURI', $sRequestURI); $this->configure('wrapperPrefix', $sWrapperPrefix); $this->configure('characterEncoding', $sEncoding); $this->configure('debug', $bDebug); } function registerExternalFunction($mFunction, $sInclude) { $xuf =& new xajaxUserFunction($mFunction, $sInclude); $this->register(XAJAX_FUNCTION, $xuf); } function registerCatchAllFunction($mFunction) { if (is_array($mFunction)) array_shift($mFunction); $this->register(XAJAX_PROCESSING_EVENT, XAJAX_PROCESSING_EVENT_INVALID, $mFunction); } function registerPreFunction($mFunction) { if (is_array($mFunction)) array_shift($mFunction); $this->register(XAJAX_PROCESSING_EVENT, XAJAX_PROCESSING_EVENT_BEFORE, $mFunction); } function canProcessRequests() { return $this->canProcessRequest(); } function processRequests() { return $this->processRequest(); } function setCallableObject(&$oObject) { return $this->register(XAJAX_CALLABLE_OBJECT, $oObject); } function debugOn() { return $this->configure('debug',true); } function debugOff() { return $this->configure('debug',false); } function statusMessagesOn() { return $this->configure('statusMessages',true); } function statusMessagesOff() { return $this->configure('statusMessages',false); } function waitCursorOn() { return $this->configure('waitCursor',true); } function waitCursorOff() { return $this->configure('waitCursor',false); } function exitAllowedOn() { return $this->configure('exitAllowed',true); } function exitAllowedOff() { return $this->configure('exitAllowed',false); } function errorHandlerOn() { return $this->configure('errorHandler',true); } function errorHandlerOff() { return $this->configure('errorHandler',false); } function cleanBufferOn() { return $this->configure('cleanBuffer',true); } function cleanBufferOff() { return $this->configure('cleanBuffer',false); } function decodeUTF8InputOn() { return $this->configure('decodeUTF8Input',true); } function decodeUTF8InputOff() { return $this->configure('decodeUTF8Input',false); } function outputEntitiesOn() { return $this->configure('outputEntities',true); } function outputEntitiesOff() { return $this->configure('outputEntities',false); } function allowBlankResponseOn() { return $this->configure('allowBlankResponse',true); } function allowBlankResponseOff() { return $this->configure('allowBlankResponse',false); } } php-xajax-0.5/xajax_core/xajax.inc.php0000644000175000017500000011117211137037724016425 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajax.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Standard Definitions */ /* String: XAJAX_DEFAULT_CHAR_ENCODING Default character encoding used by both the and classes. */ if (!defined ('XAJAX_DEFAULT_CHAR_ENCODING')) define ('XAJAX_DEFAULT_CHAR_ENCODING', 'utf-8'); /* String: XAJAX_PROCESSING_EVENT String: XAJAX_PROCESSING_EVENT_BEFORE String: XAJAX_PROCESSING_EVENT_AFTER String: XAJAX_PROCESSING_EVENT_INVALID Identifiers used to register processing events. Processing events are essentially hooks into the xajax core that can be used to add functionality into the request processing sequence. */ if (!defined ('XAJAX_PROCESSING_EVENT')) define ('XAJAX_PROCESSING_EVENT', 'xajax processing event'); if (!defined ('XAJAX_PROCESSING_EVENT_BEFORE')) define ('XAJAX_PROCESSING_EVENT_BEFORE', 'beforeProcessing'); if (!defined ('XAJAX_PROCESSING_EVENT_AFTER')) define ('XAJAX_PROCESSING_EVENT_AFTER', 'afterProcessing'); if (!defined ('XAJAX_PROCESSING_EVENT_INVALID')) define ('XAJAX_PROCESSING_EVENT_INVALID', 'invalidRequest'); /* Class: xajax The xajax class uses a modular plug-in system to facilitate the processing of special Ajax requests made by a PHP page. It generates Javascript that the page must include in order to make requests. It handles the output of response commands (see ). Many flags and settings can be adjusted to effect the behavior of the xajax class as well as the client-side javascript. */ class xajax { /**#@+ * @access protected */ /* Array: aSettings This array is used to store all the configuration settings that are set during the run of the script. This provides a single data store for the settings in case we need to return the value of a configuration option for some reason. It is advised that individual plugins store a local copy of the settings they wish to track, however, settings are available via a reference to the object using getConfiguration>. */ var $aSettings; /* Boolean: bErrorHandler This is a configuration setting that the main xajax object tracks. It is used to enable an error handler function which will trap php errors and return them to the client as part of the response. The client can then display the errors to the user if so desired. */ var $bErrorHandler; /* Array: aProcessingEvents Stores the processing event handlers that have been assigned during this run of the script. */ var $aProcessingEvents; /* Boolean: bExitAllowed A configuration option that is tracked by the main object. Setting this to true allows to exit immediatly after processing a xajax request. If this is set to false, xajax will allow the remaining code and HTML to be sent as part of the response. Typically this would result in an error, however, a response processor on the client side could be designed to handle this condition. */ var $bExitAllowed; /* Boolean: bCleanBuffer A configuration option that is tracked by the main object. Setting this to true allows to clear out any pending output buffers so that the is (virtually) the only output when handling a request. */ var $bCleanBuffer; /* String: sLogFile A configuration setting tracked by the main object. Set the name of the file on the server that you wish to have php error messages written to during the processing of requests. */ var $sLogFile; /* String: sCoreIncludeOutput This is populated with any errors or warnings produced while including the xajax core components. This is useful for debugging core updates. */ var $sCoreIncludeOutput; /* Object: objPluginManager This stores a reference to the global */ var $objPluginManager; /* Object: objArgumentManager Stores a reference to the global */ var $objArgumentManager; /* Object: objResponseManager Stores a reference to the global */ var $objResponseManager; /* Object: objLanguageManager Stores a reference to the global */ var $objLanguageManager; /**#@-*/ /* Constructor: xajax Constructs a xajax instance and initializes the plugin system. Parameters: sRequestURI - (optional): The sRequestURI> to be used for calls back to the server. If empty, xajax fills in the current URI that initiated this request. */ function xajax($sRequestURI=null, $sLanguage=null) { $this->bErrorHandler = false; $this->aProcessingEvents = array(); $this->bExitAllowed = true; $this->bCleanBuffer = true; $this->sLogFile = ''; $this->__wakeup(); // The default configuration settings. $this->configureMany( array( 'characterEncoding' => XAJAX_DEFAULT_CHAR_ENCODING, 'decodeUTF8Input' => false, 'outputEntities' => false, 'defaultMode' => 'asynchronous', 'defaultMethod' => 'POST', // W3C: Method is case sensitive 'wrapperPrefix' => 'xajax_', 'debug' => false, 'verbose' => false, 'useUncompressedScripts' => false, 'statusMessages' => false, 'waitCursor' => true, 'scriptDeferral' => false, 'exitAllowed' => true, 'errorHandler' => false, 'cleanBuffer' => false, 'allowBlankResponse' => false, 'allowAllResponseTypes' => false, 'generateStubs' => true, 'logFile' => '', 'timeout' => 6000, 'version' => $this->getVersion() ) ); if (null !== $sRequestURI) $this->configure('requestURI', $sRequestURI); else $this->configure('requestURI', $this->_detectURI()); if (null !== $sLanguage) $this->configure('language', $sLanguage); if ('utf-8' != XAJAX_DEFAULT_CHAR_ENCODING) $this->configure("decodeUTF8Input", true); } /* Function: __sleep */ function __sleep() { $aMembers = get_class_vars(get_class($this)); if (isset($aMembers['objLanguageManager'])) unset($aMembers['objLanguageManager']); if (isset($aMembers['objPluginManager'])) unset($aMembers['objPluginManager']); if (isset($aMembers['objArgumentManager'])) unset($aMembers['objArgumentManager']); if (isset($aMembers['objResponseManager'])) unset($aMembers['objResponseManager']); if (isset($aMembers['sCoreIncludeOutput'])) unset($aMembers['sCoreIncludeOutput']); return array_keys($aMembers); } /* Function: __wakeup */ function __wakeup() { ob_start(); $sLocalFolder = dirname(__FILE__); //SkipAIO require $sLocalFolder . '/xajaxPluginManager.inc.php'; require $sLocalFolder . '/xajaxLanguageManager.inc.php'; require $sLocalFolder . '/xajaxArgumentManager.inc.php'; require $sLocalFolder . '/xajaxResponseManager.inc.php'; require $sLocalFolder . '/xajaxRequest.inc.php'; require $sLocalFolder . '/xajaxResponse.inc.php'; //EndSkipAIO // this is the list of folders where xajax will look for plugins // that will be automatically included at startup. $aPluginFolders = array(); $aPluginFolders[] = dirname($sLocalFolder) . '/xajax_plugins'; //SkipAIO $aPluginFolders[] = $sLocalFolder . '/plugin_layer'; //EndSkipAIO // Setup plugin manager $this->objPluginManager =& xajaxPluginManager::getInstance(); $this->objPluginManager->loadPlugins($aPluginFolders); $this->objLanguageManager =& xajaxLanguageManager::getInstance(); $this->objArgumentManager =& xajaxArgumentManager::getInstance(); $this->objResponseManager =& xajaxResponseManager::getInstance(); $this->sCoreIncludeOutput = ob_get_clean(); } /* Function: getGlobalResponse Returns the object preconfigured with the encoding and entity settings from this instance of . This is used for singleton-pattern response development. Returns: : A object which can be used to return response commands. See also the class. */ function &getGlobalResponse() { static $obj; if (!$obj) { $obj = new xajaxResponse(); } return $obj; } /* Function: getVersion Returns: string : The current xajax version. */ function getVersion() { return 'xajax 0.5'; } /* Function: register Call this function to register request handlers, including functions, callable objects and events. New plugins can be added that support additional registration methods and request processors. Parameters: $sType - (string): Type of request handler being registered; standard options include: XAJAX_FUNCTION: a function declared at global scope. XAJAX_CALLABLE_OBJECT: an object who's methods are to be registered. XAJAX_EVENT: an event which will cause zero or more event handlers to be called. XAJAX_EVENT_HANDLER: register an event handler function. $sFunction || $objObject || $sEvent - (mixed): when registering a function, this is the name of the function when registering a callable object, this is the object being registered when registering an event or event handler, this is the name of the event $sIncludeFile || $aCallOptions || $sEventHandler when registering a function, this is the (optional) include file. when registering a callable object, this is an (optional) array of call options for the functions being registered. when registering an event handler, this is the name of the function. */ function register($sType, $mArg) { $aArgs = func_get_args(); $nArgs = func_num_args(); if (2 < $nArgs) { if (XAJAX_PROCESSING_EVENT == $aArgs[0]) { $sEvent = $aArgs[1]; $xuf =& $aArgs[2]; if (false == is_a($xuf, 'xajaxUserFunction')) $xuf =& new xajaxUserFunction($xuf); $this->aProcessingEvents[$sEvent] =& $xuf; return true; } } if (1 < $nArgs) { // for php4 $aArgs[1] =& $mArg; } return $this->objPluginManager->register($aArgs); } /* Function: configure 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. */ function configure($sName, $mValue) { if ('errorHandler' == $sName) { if (true === $mValue || false === $mValue) $this->bErrorHandler = $mValue; } else if ('exitAllowed' == $sName) { if (true === $mValue || false === $mValue) $this->bExitAllowed = $mValue; } else if ('cleanBuffer' == $sName) { if (true === $mValue || false === $mValue) $this->bCleanBuffer = $mValue; } else if ('logFile' == $sName) { $this->sLogFile = $mValue; } $this->objLanguageManager->configure($sName, $mValue); $this->objArgumentManager->configure($sName, $mValue); $this->objPluginManager->configure($sName, $mValue); $this->objResponseManager->configure($sName, $mValue); $this->aSettings[$sName] = $mValue; } /* Function: configureMany Set an array of configuration options. Parameters: $aOptions - (array): Associative array of configuration settings */ function configureMany($aOptions) { foreach ($aOptions as $sName => $mValue) $this->configure($sName, $mValue); } /* Function: getConfiguration Get the current value of a configuration setting that was previously set via configure> or configureMany> Parameters: $sName - (string): The name of the configuration setting Returns: $mValue : (mixed): The value of the setting if set, null otherwise. */ function getConfiguration($sName) { if (isset($this->aSettings[$sName])) return $this->aSettings[$sName]; return NULL; } /* Function: canProcessRequest Determines if a call is a xajax request or a page load request. Return: boolean - True if this is a xajax request, false otherwise. */ function canProcessRequest() { return $this->objPluginManager->canProcessRequest(); } /* Function: processRequest If this is a xajax request (see canProcessRequest>), call the requested PHP function, build the response and send it back to the browser. This is the main server side engine for xajax. It handles all the incoming requests, including the firing of events and handling of the response. If your RequestURI is the same as your web page, then this function should be called before ANY headers or HTML is output from your script. This function may exit, if a request is processed. See bAllowExit> */ function processRequest() { //SkipDebug // Check to see if headers have already been sent out, in which case we can't do our job if (headers_sent($filename, $linenumber)) { echo "Output has already been sent to the browser at {$filename}:{$linenumber}.\n"; echo 'Please make sure the command $xajax->processRequest() is placed before this.'; exit(); } //EndSkipDebug if ($this->canProcessRequest()) { // Use xajax error handler if necessary if ($this->bErrorHandler) { $GLOBALS['xajaxErrorHandlerText'] = ""; set_error_handler("xajaxErrorHandler"); } $mResult = true; // handle beforeProcessing event if (isset($this->aProcessingEvents[XAJAX_PROCESSING_EVENT_BEFORE])) { $bEndRequest = false; $this->aProcessingEvents[XAJAX_PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest)); $mResult = (false === $bEndRequest); } if (true === $mResult) $mResult = $this->objPluginManager->processRequest(); if (true === $mResult) { if ($this->bCleanBuffer) { $er = error_reporting(0); while (ob_get_level() > 0) ob_end_clean(); error_reporting($er); } // handle afterProcessing event if (isset($this->aProcessingEvents[XAJAX_PROCESSING_EVENT_AFTER])) { $bEndRequest = false; $this->aProcessingEvents[XAJAX_PROCESSING_EVENT_AFTER]->call(array(&$bEndRequest)); if (true === $bEndRequest) { $this->objResponseManager->clear(); $this->objResponseManager->append($aResult[1]); } } } else if (is_string($mResult)) { if ($this->bCleanBuffer) { $er = error_reporting(0); while (ob_get_level() > 0) ob_end_clean(); error_reporting($er); } // $mResult contains an error message // the request was missing the cooresponding handler function // or an error occurred while attempting to execute the // handler. replace the response, if one has been started // and send a debug message. $this->objResponseManager->clear(); $this->objResponseManager->append(new xajaxResponse()); // handle invalidRequest event if (isset($this->aProcessingEvents[XAJAX_PROCESSING_EVENT_INVALID])) $this->aProcessingEvents[XAJAX_PROCESSING_EVENT_INVALID]->call(); else $this->objResponseManager->debug($mResult); } if ($this->bErrorHandler) { $sErrorMessage = $GLOBALS['xajaxErrorHandlerText']; if (!empty($sErrorMessage)) { if (0 < strlen($this->sLogFile)) { $fH = @fopen($this->sLogFile, "a"); if (NULL != $fH) { fwrite( $fH, $this->objLanguageManager->getText('LOGHDR:01') . strftime("%b %e %Y %I:%M:%S %p") . $this->objLanguageManager->getText('LOGHDR:02') . $sErrorMessage . $this->objLanguageManager->getText('LOGHDR:03') ); fclose($fH); } else { $this->objResponseManager->debug( $this->objLanguageManager->getText('LOGERR:01') . $this->sLogFile ); } } $this->objResponseManager->debug( $this->objLanguageManager->getText('LOGMSG:01') . $sErrorMessage ); } } $this->objResponseManager->send(); if ($this->bErrorHandler) restore_error_handler(); if ($this->bExitAllowed) exit(); } } /* Function: printJavascript Prints the xajax Javascript header and wrapper code into your page. This should be used to print the javascript code between the HEAD and /HEAD tags at the top of the page. The javascript code output by this function is dependent on the plugins that are included and the functions that are registered. Parameters: $sJsURI - (string, optional, deprecated): the path to the xajax javascript file(s) This option is deprecated and will be removed in future versions; instead please use configure> with the option name 'javascript URI' $aJsFiles - (array, optional, deprecated): an array of xajax javascript files that will be loaded via SCRIPT tags. This option is deprecated and will be removed in future versions; please use configure> with the option name 'javascript files' instead. */ function printJavascript($sJsURI="", $aJsFiles=array()) { if (0 < strlen($sJsURI)) $this->configure("javascript URI", $sJsURI); if (0 < count($aJsFiles)) $this->configure("javascript files", $aJsFiles); $this->objPluginManager->generateClientScript(); } /* Function: getJavascript See printJavascript> for more information. */ function getJavascript($sJsURI='', $aJsFiles=array()) { ob_start(); $this->printJavascript($sJsURI, $aJsFiles); return ob_get_clean(); } /* Function: autoCompressJavascript Creates a new xajax_core, xajax_debug, etc... file out of the _uncompressed file with a similar name. This strips out the comments and extraneous whitespace so the file is as small as possible without modifying the function of the code. Parameters: sJsFullFilename - (string): The relative path and name of the file to be compressed. bAlways - (boolean): Compress the file, even if it already exists. */ function autoCompressJavascript($sJsFullFilename=NULL, $bAlways=false) { $sJsFile = 'xajax_js/xajax_core.js'; if ($sJsFullFilename) { $realJsFile = $sJsFullFilename; } else { $realPath = realpath(dirname(dirname(__FILE__))); $realJsFile = $realPath . '/'. $sJsFile; } // Create a compressed file if necessary if (!file_exists($realJsFile) || true == $bAlways) { $srcFile = str_replace('.js', '_uncompressed.js', $realJsFile); if (!file_exists($srcFile)) { trigger_error( $this->objLanguageManager->getText('CMPRSJS:RDERR:01') . dirname($realJsFile) . $this->objLanguageManager->getText('CMPRSJS:RDERR:02') , E_USER_ERROR ); } require_once(dirname(__FILE__) . '/xajaxCompress.inc.php'); $javaScript = implode('', file($srcFile)); $compressedScript = xajaxCompressFile($javaScript); $fH = @fopen($realJsFile, 'w'); if (!$fH) { trigger_error( $this->objLanguageManager->getText('CMPRSJS:WTERR:01') . dirname($realJsFile) . $this->objLanguageManager->getText('CMPRSJS:WTERR:02') , E_USER_ERROR ); } else { fwrite($fH, $compressedScript); fclose($fH); } } } function _compressSelf($sFolder=null) { if (null == $sFolder) $sFolder = dirname(dirname(__FILE__)); require_once(dirname(__FILE__) . '/xajaxCompress.inc.php'); if ($handle = opendir($sFolder)) { while (!(false === ($sName = readdir($handle)))) { if ('.' != $sName && '..' != $sName && is_dir($sFolder . '/' . $sName)) { $this->_compressSelf($sFolder . '/' . $sName); } else if (8 < strlen($sName) && 0 == strpos($sName, '.compressed')) { if ('.inc.php' == substr($sName, strlen($sName) - 8, 8)) { $sName = substr($sName, 0, strlen($sName) - 8); $sPath = $sFolder . '/' . $sName . '.inc.php'; if (file_exists($sPath)) { $aParsed = array(); $aFile = file($sPath); $nSkip = 0; foreach (array_keys($aFile) as $sKey) if ('//SkipDebug' == $aFile[$sKey]) ++$nSkip; else if ('//EndSkipDebug' == $aFile[$sKey]) --$nSkip; else if (0 == $nSkip) $aParsed[] = $aFile[$sKey]; unset($aFile); $compressedScript = xajaxCompressFile(implode('', $aParsed)); $sNewPath = $sPath; $fH = @fopen($sNewPath, 'w'); if (!$fH) { trigger_error( $this->objLanguageManager->getText('CMPRSPHP:WTERR:01') . $sNewPath . $this->objLanguageManager->getText('CMPRSPHP:WTERR:02') , E_USER_ERROR ); } else { fwrite($fH, $compressedScript); fclose($fH); } } } } } closedir($handle); } } function _compile($sFolder=null, $bWriteFile=true) { if (null == $sFolder) $sFolder = dirname(__FILE__); require_once(dirname(__FILE__) . '/xajaxCompress.inc.php'); $aOutput = array(); if ($handle = opendir($sFolder)) { while (!(false === ($sName = readdir($handle)))) { if ('.' != $sName && '..' != $sName && is_dir($sFolder . '/' . $sName)) { $aOutput[] = $this->_compile($sFolder . '/' . $sName, false); } else if (8 < strlen($sName)) { if ('.inc.php' == substr($sName, strlen($sName) - 8, 8)) { $sName = substr($sName, 0, strlen($sName) - 8); $sPath = $sFolder . '/' . $sName . '.inc.php'; if ( 'xajaxAIO' != $sName && 'legacy' != $sName && 'xajaxCompress' != $sName ) { if (file_exists($sPath)) { $aParsed = array(); $aFile = file($sPath); $nSkip = 0; foreach (array_keys($aFile) as $sKey) if ('//SkipDebug' == substr($aFile[$sKey], 0, 11)) ++$nSkip; else if ('//EndSkipDebug' == substr($aFile[$sKey], 0, 14)) --$nSkip; else if ('//SkipAIO' == substr($aFile[$sKey], 0, 9)) ++$nSkip; else if ('//EndSkipAIO' == substr($aFile[$sKey], 0, 12)) --$nSkip; else if ('<'.'?php' == substr($aFile[$sKey], 0, 5)) {} else if ('?'.'>' == substr($aFile[$sKey], 0, 2)) {} else if (0 == $nSkip) $aParsed[] = $aFile[$sKey]; unset($aFile); $aOutput[] = xajaxCompressFile(implode('', $aParsed)); } } } } } closedir($handle); } if ($bWriteFile) { $fH = @fopen($sFolder . '/xajaxAIO.inc.php', 'w'); if (!$fH) { trigger_error( $this->objLanguageManager->getText('CMPRSAIO:WTERR:01') . $sFolder . $this->objLanguageManager->getText('CMPRSAIO:WTERR:02') , E_USER_ERROR ); } else { fwrite($fH, '<'.'?php '); fwrite($fH, implode('', $aOutput)); fclose($fH); } } return implode('', $aOutput); } /* Function: _detectURI Returns the current requests URL based upon the SERVER vars. Returns: string : The URL of the current request. */ function _detectURI() { $aURL = array(); // Try to get the request URL if (!empty($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = str_replace( array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $_SERVER['REQUEST_URI'] ); $aURL = parse_url($_SERVER['REQUEST_URI']); } // Fill in the empty values if (empty($aURL['scheme'])) { if (!empty($_SERVER['HTTP_SCHEME'])) { $aURL['scheme'] = $_SERVER['HTTP_SCHEME']; } else { $aURL['scheme'] = (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http'; } } if (empty($aURL['host'])) { if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0) { list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']); } else { $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST']; } } else if (!empty($_SERVER['HTTP_HOST'])) { if (strpos($_SERVER['HTTP_HOST'], ':') > 0) { list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']); } else { $aURL['host'] = $_SERVER['HTTP_HOST']; } } else if (!empty($_SERVER['SERVER_NAME'])) { $aURL['host'] = $_SERVER['SERVER_NAME']; } else { echo $this->objLanguageManager->getText('DTCTURI:01'); echo $this->objLanguageManager->getText('DTCTURI:02'); exit(); } } if (empty($aURL['port']) && !empty($_SERVER['SERVER_PORT'])) { $aURL['port'] = $_SERVER['SERVER_PORT']; } if (!empty($aURL['path'])) if (0 == strlen(basename($aURL['path']))) unset($aURL['path']); if (empty($aURL['path'])) { $sPath = array(); if (!empty($_SERVER['PATH_INFO'])) { $sPath = parse_url($_SERVER['PATH_INFO']); } else { $sPath = parse_url($_SERVER['PHP_SELF']); } if (isset($sPath['path'])) $aURL['path'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $sPath['path']); unset($sPath); } if (empty($aURL['query']) && !empty($_SERVER['QUERY_STRING'])) { $aURL['query'] = $_SERVER['QUERY_STRING']; } if (!empty($aURL['query'])) { $aURL['query'] = '?'.$aURL['query']; } // Build the URL: Start with scheme, user and pass $sURL = $aURL['scheme'].'://'; if (!empty($aURL['user'])) { $sURL.= $aURL['user']; if (!empty($aURL['pass'])) { $sURL.= ':'.$aURL['pass']; } $sURL.= '@'; } // Add the host $sURL.= $aURL['host']; // Add the port if needed if (!empty($aURL['port']) && (($aURL['scheme'] == 'http' && $aURL['port'] != 80) || ($aURL['scheme'] == 'https' && $aURL['port'] != 443))) { $sURL.= ':'.$aURL['port']; } // Add the path and the query string $sURL.= $aURL['path'].@$aURL['query']; // Clean up unset($aURL); $aURL = explode("?", $sURL); if (1 < count($aURL)) { $aQueries = explode("&", $aURL[1]); foreach ($aQueries as $sKey => $sQuery) { if ("xjxGenerate" == substr($sQuery, 0, 11)) unset($aQueries[$sKey]); } $sQueries = implode("&", $aQueries); $aURL[1] = $sQueries; $sURL = implode("?", $aURL); } return $sURL; } /* Deprecated functions */ /* Function: setCharEncoding Sets the character encoding that will be used for the HTTP output. Typically, you will not need to use this method since the default character encoding can be configured using the constant . Parameters: sEncoding - (string): The encoding to use. - examples include (UTF-8, ISO-8859-1) Note: deprecated : This function will be removed in future versions. Please use configure> instead. */ function setCharEncoding($sEncoding) { $this->configure('characterEncoding', $sEncoding); } /* Function: getCharEncoding Returns the current character encoding. See also setCharEncoding> and Returns: string : The character encoding. Note: deprecated : This function will be removed in future versions. Please use getConfiguration> instead. */ function getCharEncoding() { return $this->getConfiguration('characterEncoding'); } /* Function: setFlags Sets a series of flags. See also, setFlag>. Parameters: flags - (array): An associative array containing the name of the flag and the value to set. Note: deprecated : This function will be removed in future versions. Please use configureMany> instead. */ function setFlags($flags) { foreach ($flags as $name => $value) { $this->configure($name, $value); } } /* Function: setFlag Sets a single flag (boolean true or false). Available flags are as follows (flag, default value): - debug, false - verbose, false - statusMessages, false - waitCursor, true - scriptDeferral, false - exitAllowed, true - errorHandler, false - cleanBuffer, false - decodeUTF8Input, false - outputEntities, false - allowBlankResponse, false - allowAllResponseTypes, false - generateStubs, true Parameters: name - (string): The name of the flag to set. value - (boolean): The value to set. Note: deprecated : This function will be removed in future versions. Please use configure> instead. */ function setFlag($name, $value) { $this->configure($name, $value); } /* Function: getFlag Returns the current value of the flag. See also setFlag>. Parameters: name - (string): The name of the flag. Returns: boolean : The value currently associated with the flag. Note: deprecated : This function will be removed in future versions. Instead, use getConfiguration>. */ function getFlag($name) { return $this->getConfiguration($name); } /* Function: setRequestURI Sets the URI to which requests will be sent. Parameters: sRequestURI - (string): The URI Note: $xajax->setRequestURI("http://www.xajaxproject.org"); deprecated : This function will be removed in future versions. Please use configure> instead. */ function setRequestURI($sRequestURI) { $this->configure('requestURI', $sRequestURI); } /* Function: getRequestURI Returns: string : The current request URI that will be configured on the client side. This is the default URI for all requests made from the current page. See setRequestURI>. Note: deprecated : This function will be removed in future versions. Please use getConfiguration> instead. */ function getRequestURI() { return $this->getConfiguration('requestURI'); } /* Function: setDefaultMode Sets the default mode for requests from the browser. Parameters: sDefaultMode - (string): The mode to set as the default. - 'synchronous' - 'asynchronous' Note: deprecated : This function will be removed in future versions. Please use configure> instead. */ function setDefaultMode($sDefaultMode) { $this->configure('defaultMode', $sDefaultMode); } /* Function: getDefaultMode Get the default request mode that will be used by the browser for submitting requests to the server. See also setDefaultMode> Returns: string - The default mode to be used by the browser for each request. Note: deprecated : This function will be removed in future versions. Please use getConfiguration> instead. */ function getDefaultMode() { return $this->getConfiguration('defaultMode'); } /* Function: setDefaultMethod Sets the default method for making xajax requests. Parameters: sMethod - (string): The name of the method. - 'GET' - 'POST' Note: deprecated : This function will be removed in future versions. Please use configure> instead. */ function setDefaultMethod($sMethod) { $this->configure('defaultMethod', $sMethod); } /* Function: getDefaultMethod Gets the default method for making xajax requests. Returns: string - The current method configured. Note: deprecated : This function will be removed in future versions. Please use getConfiguration> instead. */ function getDefaultMethod() { return $this->getConfiguration('defaultMethod'); } /* Function: setWrapperPrefix Sets the prefix that will be prepended to the javascript wrapper functions. This allows a little flexibility in setting the naming for the wrapper functions. Parameters: sPrefix - (string): The prefix to be used. - default is 'xajax_' Note: deprecated : This function will be removed in future versions. Please use configure> instead. */ function setWrapperPrefix($sPrefix) { $this->configure('wrapperPrefix', $sPrefix); } /* Function: getWrapperPrefix Gets the current javascript wrapper prefix. See also, setWrapperPrefix> Returns: string - The current wrapper prefix. Note: deprecated : This function will be removed in future versions. Please use getConfiguration> instead. */ function getWrapperPrefix() { return $this->getConfiguration('wrapperPrefix'); } /* Function: setLogFile Specifies a log file that will be written to by xajax during a request. This is only used by the error handling system at this point. If you do not invoke this method or you pass in an empty string, then no log file will be written to. Parameters: sFilename - (string): The full or reletive path to the log file. Note: deprecated : This function will be removed in future versions. Please use configure> instead. */ function setLogFile($sFilename) { $this->configure('logFile', $sFilename); } /* Function: getLogFile Returns the current log file path. See also setLogFile>. Returns: string : The log file path. Note: deprecated : This function will be removed in future versions. Please use getConfiguration> instead. */ function getLogFile() { return $this->getConfiguration('logFile'); } /* Function: registerFunction Registers a PHP function or method with the xajax request processor. This makes the function available to the browser via an asynchronous (or synchronous) javascript call. Parameters: mFunction - (string or array): The string containing the function name or an array containing the following: - (string) The function name as it will be called from javascript. - (object, by reference) A reference to an instance of a class containing the specified function. - (string) The function as it is found in the class passed in the second parameter. sIncludeFile - (string, optional): The server path to the PHP file to include when calling this function. This will enable xajax to load only the include file that is needed for this function call, thus reducing server load. Note: deprecated : This function will be removed in future versions. Please use register> instead. */ function registerFunction($mFunction, $sIncludeFile=null) { $xuf =& new xajaxUserFunction($mFunction, $sIncludeFile); return $this->register(XAJAX_FUNCTION, $xuf); } /* Function: registerCallableObject Registers an object whose methods will be searched for a match to the incoming request. If more than one callable object is registered, the first on that contains the requested method will be used. Parameters: oObject - (object, by reference): The object whose methods will be registered. Note: deprecated : This function will be removed in future versions. Please use register> instead. */ function registerCallableObject(&$oObject) { $mResult = false; if (0 > version_compare(PHP_VERSION, '5.0')) // for PHP4; using eval because PHP5 will complain it is deprecated eval('$mResult = $this->register(XAJAX_CALLABLE_OBJECT, &$oObject);'); else // for PHP5 $mResult = $this->register(XAJAX_CALLABLE_OBJECT, $oObject); return $mResult; } /* Function: registerEvent Assigns a callback function with the specified xajax event. Events are triggered during the processing of a request. List: Available events: - beforeProcessing: triggered before the request is processed. - afterProcessing: triggered after the request is processed. - invalidRequest: triggered if no matching function/method is found. Parameters: mCallback - (function): The function or object callback to be assigned. sEventName - (string): The name of the event. Note: deprecated : This function will be removed in future versions. Please use register> instead. */ function registerEvent($sEventName, $mCallback) { $this->register(XAJAX_PROCESSING_EVENT, $sEventName, $mCallback); } } /* Section: Global functions */ /* Function xajaxErrorHandler This function is registered with PHP's set_error_handler if the xajax error handling system is enabled. See bUserErrorHandler> */ function xajaxErrorHandler($errno, $errstr, $errfile, $errline) { $errorReporting = error_reporting(); if (($errno & $errorReporting) == 0) return; if ($errno == E_NOTICE) { $errTypeStr = 'NOTICE'; } else if ($errno == E_WARNING) { $errTypeStr = 'WARNING'; } else if ($errno == E_USER_NOTICE) { $errTypeStr = 'USER NOTICE'; } else if ($errno == E_USER_WARNING) { $errTypeStr = 'USER WARNING'; } else if ($errno == E_USER_ERROR) { $errTypeStr = 'USER FATAL ERROR'; } else if (defined('E_STRICT') && $errno == E_STRICT) { return; } else { $errTypeStr = 'UNKNOWN: ' . $errno; } $sCrLf = "\n"; ob_start(); echo $GLOBALS['xajaxErrorHandlerText']; echo $sCrLf; echo '----'; echo $sCrLf; echo '['; echo $errTypeStr; echo '] '; echo $errstr; echo $sCrLf; echo 'Error on line '; echo $errline; echo ' of file '; echo $errfile; $GLOBALS['xajaxErrorHandlerText'] = ob_get_clean(); } php-xajax-0.5/xajax_core/xajax_lang_nl.inc.php0000644000175000017500000001122511135023512020101 0ustar dgildgil for a detailed description, copyright and license information. Translations provided by: (Thank you!) - Jeffrey */ //SkipAIO $objLanguageManager =& xajaxLanguageManager::getInstance(); $objLanguageManager->register('nl', array( 'LOGHDR:01' => '** xajax Foutmelding logboek - ', 'LOGHDR:02' => " **\n", 'LOGHDR:03' => "\n\n\n", 'LOGERR:01' => "** Logboek fouten **\n\nxajax was niet in staat om te schrijven naar het logboek:\n", 'LOGMSG:01' => "** PHP Foutmeldingen: **", 'CMPRSJS:RDERR:01' => 'Het xajax ongecomprimeerde Javascript bestand kon niet worden gevonden in de: ', 'CMPRSJS:RDERR:02' => '. map. ', 'CMPRSJS:WTERR:01' => 'Het xajax gecomprimeerde Javascript bestand kon niet worden geschreven in de: ', 'CMPRSJS:WTERR:02' => ' map. Fout ', 'CMPRSPHP:WTERR:01' => 'Naar het xajax gecomprimeerde bestand ', 'CMPRSPHP:WTERR:02' => ' kon niet worden geschreven. Fout ', 'CMPRSAIO:WTERR:01' => 'Naar het xajax gecomprimeerde bestand ', 'CMPRSAIO:WTERR:02' => '/xajaxAIO.inc.php kon niet worden geschreven. Fout ', 'DTCTURI:01' => 'xajax Fout: xajax kon de Request URI niet automatisch identificeren.', 'DTCTURI:02' => 'Alstublieft, specificeer de Request URI expliciet bij het initiëren van het xajax object.', 'ARGMGR:ERR:01' => 'Misvormd object argument ontvangen: ', 'ARGMGR:ERR:02' => ' <==> ', 'ARGMGR:ERR:03' => 'De binnenkomende xajax data kon niet wordt geconverteerd van UTF-8.', 'XJXCTL:IAERR:01' => 'Ongeldig attribuut [', 'XJXCTL:IAERR:02' => '] voor element [', 'XJXCTL:IAERR:03' => '].', 'XJXCTL:IRERR:01' => 'Ongeldige object aanvraag doorgegeven aan xajaxControl::setEvent', 'XJXCTL:IEERR:01' => 'Ongeldig attribuut (event name) [', 'XJXCTL:IEERR:02' => '] voor element [', 'XJXCTL:IEERR:03' => '].', 'XJXCTL:MAERR:01' => 'Ontbrekend attribuut [', 'XJXCTL:MAERR:02' => '] voor element [', 'XJXCTL:MAERR:03' => '].', 'XJXCTL:IETERR:01' => "Ongeldige eind-tag; zou 'forbidden' of 'optional' moeten zijn..\n", 'XJXCTL:ICERR:01' => "Ongeldige klasse gespecificeerd voor html control.; zou %inline, %block of %flow moeten zijn.\n", 'XJXCTL:ICLERR:01' => 'Ongeldige (control) doorgegeven aan addChild; Zou moeten worden afgeleid van xajaxControl.', 'XJXCTL:ICLERR:02' => 'Ongeldige (control) doorgegeven aan addChild [', 'XJXCTL:ICLERR:03' => '] voor element [', 'XJXCTL:ICLERR:04' => "].\n", 'XJXCTL:ICHERR:01' => 'Ongeldige parameter doorgegeven aan xajaxControl::addChildren; Array moet bestaan uit xajaxControl objecten.', 'XJXCTL:MRAERR:01' => 'Ontbrekend attribuut [', 'XJXCTL:MRAERR:02' => '] voor element [', 'XJXCTL:MRAERR:03' => '].', 'XJXPLG:GNERR:01' => 'Retourneer plugin zou de getName functie moeten overschrijven.', 'XJXPLG:PERR:01' => 'Retourneer plugin zou de proces functie moeten overschrijven.', 'XJXPM:IPLGERR:01' => 'Poging om ongeldige plugin te registreren: : ', 'XJXPM:IPLGERR:02' => ' afleiding moet komen van xajaxRequestPlugin of xajaxResponsePlugin.', 'XJXPM:MRMERR:01' => 'Localisatie van registratie methode faalde voor het volgende: : ', 'XJXRSP:EDERR:01' => 'Doorgeven van karakter decodering naar de xajaxResponse constructie is verouderd. De nieuwe functie luidt: $xajax->configure("characterEncoding", ...);', 'XJXRSP:MPERR:01' => 'Ongeldige of ontbrekende plugin naam gedetecteerd in een aanvraag naar xajaxResponse::plugin', 'XJXRSP:CPERR:01' => "De parameter \$sType in addCreate is verouderd.. De nieuwe functie luidt addCreateInput()", 'XJXRSP:LCERR:01' => "Het xajax antwoord object kon de commando's niet laden, gezien de meegegeven data geen geldige array is.", 'XJXRSP:AKERR:01' => 'Ongeldige ge-encodeerde tag naam in array', 'XJXRSP:IEAERR:01' => 'Ungeeignet kodiertes Array.', 'XJXRSP:NEAERR:01' => 'Niet gecodeerde array gedetecteerd.', 'XJXRSP:MBEERR:01' => 'De xajax output kon niet worden geconverteerd naar HTML entities, gezien mb_convert_encoding niet beschikbaar is.', 'XJXRSP:MXRTERR' => 'Fout: Kann keine verschiedenen Typen in einer einzelnen Antwort verarbeiten.', 'XJXRSP:MXCTERR' => 'Fout: Kan geen meerdere typen verwisselen in een enkele teruggave.', 'XJXRSP:MXCEERR' => 'Fout: Kan geen meerdere karakter decoderingen verwerken in een enkele teruggave.', 'XJXRSP:MXOEERR' => 'Fout: kan geen output entities (true/false) in een enkele teruggave verwerken.', 'XJXRM:IRERR' => 'Een ongeldig antwoord is geretourneerd tijdens het verwerken van deze aanvraag.', 'XJXRM:MXRTERR' => 'Fout: Kan geen meerdere typen verwisselen tijdens het verwerken van een enkele aanvraag: ' )); //EndSkipAIOphp-xajax-0.5/xajax_core/xajaxRequest.inc.php0000644000175000017500000002062211137037724017775 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxRequest.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Constant: XAJAX_FORM_VALUES Specifies that the parameter will consist of an array of form values. */ if (!defined ('XAJAX_FORM_VALUES')) define ('XAJAX_FORM_VALUES', 'get form values'); /* Constant: XAJAX_INPUT_VALUE Specifies that the parameter will contain the value of an input control. */ if (!defined ('XAJAX_INPUT_VALUE')) define ('XAJAX_INPUT_VALUE', 'get input value'); /* Constant: XAJAX_CHECKED_VALUE Specifies that the parameter will consist of a boolean value of a checkbox. */ if (!defined ('XAJAX_CHECKED_VALUE')) define ('XAJAX_CHECKED_VALUE', 'get checked value'); /* Constant: XAJAX_ELEMENT_INNERHTML Specifies that the parameter value will be the innerHTML value of the element. */ if (!defined ('XAJAX_ELEMENT_INNERHTML')) define ('XAJAX_ELEMENT_INNERHTML', 'get element innerHTML'); /* Constant: XAJAX_QUOTED_VALUE Specifies that the parameter will be a quoted value (string). */ if (!defined ('XAJAX_QUOTED_VALUE')) define ('XAJAX_QUOTED_VALUE', 'quoted value'); /* Constant: XAJAX_JS_VALUE Specifies that the parameter will be a non-quoted value (evaluated by the browsers javascript engine at run time. */ if (!defined ('XAJAX_JS_VALUE')) define ('XAJAX_JS_VALUE', 'unquoted value'); /* Class: xajaxRequest Used to store and generate the client script necessary to invoke a xajax request from the browser to the server script. This object is typically generated by the register> method and can be used to quickly generate the javascript that is used to initiate a xajax request to the registered function, object, event or other xajax call. */ class xajaxRequest { /* String: sName The name of the function. */ var $sName; /* String: sQuoteCharacter A string containing either a single or a double quote character that will be used during the generation of the javascript for this function. This can be set prior to calling printScript> */ var $sQuoteCharacter; /* Array: aParameters An array of parameters that will be used to populate the argument list for this function when the javascript is output in printScript> */ var $aParameters; /* Function: xajaxRequest Construct and initialize this request. sName - (string): The name of this request. */ function xajaxRequest($sName) { $this->aParameters = array(); $this->sQuoteCharacter = '"'; $this->sName = $sName; } /* Function: useSingleQuote Call this to instruct the request to use single quotes when generating the javascript. */ function useSingleQuote() { $this->sQuoteCharacter = "'"; } /* Function: useDoubleQuote Call this to instruct the request to use double quotes while generating the javascript. */ function useDoubleQuote() { $this->sQuoteCharacter = '"'; } /* Function: clearParameters Clears the parameter list associated with this request. */ function clearParameters() { $this->aParameters = array(); } /* Function: addParameter Adds a parameter value to the parameter list for this request. sType - (string): The type of the value to be used. sValue - (string: The value to be used. See Also: See setParameter> for details. */ function addParameter() { $aArgs = func_get_args(); if (1 < count($aArgs)) $this->setParameter( count($this->aParameters), $aArgs[0], $aArgs[1]); } /* Function: setParameter Sets a specific parameter value. Parameters: nParameter - (number): The index of the parameter to set sType - (string): The type of value sValue - (string): The value as it relates to the specified type Note: Types should be one of the following , , , , . The value should be as follows: - Use the ID of the form you want to process. - The string data to be passed. - A string containing valid javascript (either a javascript variable name that will be in scope at the time of the call or a javascript function call whose return value will become the parameter. */ function setParameter() { $aArgs = func_get_args(); if (2 < count($aArgs)) { $nParameter = $aArgs[0]; $sType = $aArgs[1]; if (XAJAX_FORM_VALUES == $sType) { $sFormID = $aArgs[2]; $this->aParameters[$nParameter] = "xajax.getFormValues(" . $this->sQuoteCharacter . $sFormID . $this->sQuoteCharacter . ")"; } else if (XAJAX_INPUT_VALUE == $sType) { $sInputID = $aArgs[2]; $this->aParameters[$nParameter] = "xajax.$(" . $this->sQuoteCharacter . $sInputID . $this->sQuoteCharacter . ").value"; } else if (XAJAX_CHECKED_VALUE == $sType) { $sCheckedID = $aArgs[2]; $this->aParameters[$nParameter] = "xajax.$(" . $this->sQuoteCharacter . $sCheckedID . $this->sQuoteCharacter . ").checked"; } else if (XAJAX_ELEMENT_INNERHTML == $sType) { $sElementID = $aArgs[2]; $this->aParameters[$nParameter] = "xajax.$(" . $this->sQuoteCharacter . $sElementID . $this->sQuoteCharacter . ").innerHTML"; } else if (XAJAX_QUOTED_VALUE == $sType) { $sValue = $aArgs[2]; $this->aParameters[$nParameter] = $this->sQuoteCharacter . $sValue . $this->sQuoteCharacter; } else if (XAJAX_JS_VALUE == $sType) { $sValue = $aArgs[2]; $this->aParameters[$nParameter] = $sValue; } } } /* Function: getScript Returns a string representation of the script output (javascript) from this request object. See also: */ function getScript() { ob_start(); $this->printScript(); return ob_get_clean(); } /* Function: printScript Generates a block of javascript code that can be used to invoke the specified xajax request. */ function printScript() { echo $this->sName; echo '('; $sSeparator = ''; foreach ($this->aParameters as $sParameter) { echo $sSeparator; echo $sParameter; $sSeparator = ', '; } echo ')'; } } /* Class: xajaxCustomRequest This class extends the class such that simple javascript can be put in place of a xajax request to the server. The primary purpose of this class is to provide simple scripting services to the based objects, like , and . */ class xajaxCustomRequest extends xajaxRequest { /* Array: aVariables; */ var $aVariables; /* String: sScript; */ var $sScript; /* Function: xajaxCustomRequest Constructs and initializes an instance of the object. Parameters: sScript - (string): The javascript (template) that will be printed upon request. aVariables - (associative array, optional): An array of variable name, value pairs that will be passed to setVariable> */ function xajaxCustomRequest($sScript) { $this->aVariables = array(); $this->sScript = $sScript; } /* Function: clearVariables Clears the array of variables that will be used to modify the script before it is printed and sent to the client. */ function clearVariables() { $this->aVariables = array(); } /* Function: setVariable Sets a value that will be used to modify the script before it is sent to the browser. The object will perform a string replace operation on each of the values set with this function. Parameters: $sName - (string): Variable name $sValue - (string): Value */ function setVariable($sName, $sValue) { $this->aVariables[$sName] = $sValue; } /* Function: printScript */ function printScript() { $sScript = $this->sScript; foreach ($this->aVariables as $sKey => $sValue) $sScript = str_replace($sKey, $sValue, $sScript); echo $sScript; } } php-xajax-0.5/xajax_core/xajaxPlugin.inc.php0000644000175000017500000001177011137037724017607 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajaxPlugin The base class for all xajax plugins. */ class xajaxPlugin { } /* Class: xajaxRequestPlugin The base class for all xajax request plugins. Request plugins handle the registration, client script generation and processing of xajax enabled requests. Each plugin should have a unique signature for both the registration and processing of requests. During registration, the user will specify a type which will allow the plugin to detect and handle it. During client script generation, the plugin will generate a stub with the prescribed call options and request signature. During request processing, the plugin will detect the signature generated previously and process the request accordingly. */ class xajaxRequestPlugin extends xajaxPlugin { /* Function: configure Called by the when a configuration setting is changing. Plugins should store a local copy of the settings they wish to use during registration, client script generation or request processing. */ function configure($sName, $mValue) { } /* Function: register Called by the when a user script when a function, event or callable object is to be registered. Additional plugins may support other registration types. */ function register($aArgs) { return false; } /* Function: generateClientScript Called by when the page's HTML is being sent to the browser. This allows each plugin to inject some script / style or other appropriate tags into the HEAD of the document. Each block must be appropriately enclosed, meaning javascript code must be enclosed in SCRIPT and /SCRIPT tags. */ function generateClientScript() { } /* Function: canProcessRequest Called by the when a request has been received to determine if the request is for a xajax enabled function or for the initial page load. */ function canProcessRequest() { return false; } /* Function: processRequest Called by the when a request is being processed. This will only occur when has determined that the current request is a valid (registered) xajax enabled function via canProcessRequest>. Returns: false */ function processRequest() { return false; } } /* Class: xajaxResponsePlugin Base class for all xajax response plugins. A response plugin provides additional services not already provided by the class with regard to sending response commands to the client. In addition, a response command may send javascript to the browser at page load to aid in the processing of it's response commands. */ class xajaxResponsePlugin extends xajaxPlugin { /* Object: objResponse A reference to the current object that is being used to build the response that will be sent to the client browser. */ var $objResponse; /* Function: setResponse Called by the object that is currently being used to build the response that will be sent to the client browser. Parameters: objResponse - (object): A reference to the object */ function setResponse(&$objResponse) { $this->objResponse =& $objResponse; } /* Function: addCommand Used internally to add a command to the response command list. This will call addPluginCommand> using the reference provided in setResponse>. */ function addCommand($aAttributes, $sData) { $this->objResponse->addPluginCommand($this, $aAttributes, $sData); } /* Function: getName Called by the when the user script requests a plugin. This name must match the plugin name requested in the called to plugin>. */ function getName() { //SkipDebug $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXPLG:GNERR:01') , E_USER_ERROR ); //EndSkipDebug } /* Function: process Called by when a user script requests the service of a response plugin. The parameters provided by the user will be used to determine which response command and parameters will be sent to the client upon completion of the xajax request process. */ function process() { //SkipDebug $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXPLG:PERR:01') , E_USER_ERROR ); //EndSkipDebug } } php-xajax-0.5/xajax_core/xajaxControl.inc.php0000644000175000017500000004126111137037724017767 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxControl.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Constant: XAJAX_HTML_CONTROL_DOCTYPE_FORMAT Defines the doctype of the current document; this will effect how the HTML is formatted when the html control library is used to construct html documents and fragments. This can be one of the following values: 'XHTML' - (default) Typical effects are that certain elements are closed with '/>' 'HTML' - Typical differences are that closing tags for certain elements cannot be '/>' */ if (false == defined('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT')) define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'XHTML'); /* Constant: XAJAX_HTML_CONTROL_DOCTYPE_VERSION */ if (false == defined('XAJAX_HTML_CONTROL_DOCTYPE_VERSION')) define('XAJAX_HTML_CONTROL_DOCTYPE_VERSION', '1.0'); /* Constant: XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION */ if (false == defined('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION')) define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL'); /* Class: xajaxControl The base class for all xajax enabled controls. Derived classes will generate the HTML and javascript code that will be sent to the browser via printHTML> or sent to the browser in a via getHTML>. */ class xajaxControl { /* String: sTag */ var $sTag; /* Boolean: sEndTag 'required' - (default) Indicates the control must have a full end tag 'optional' - The control may have an abbr. begin tag or a full end tag 'forbidden' - The control must have an abbr. begin tag and no end tag */ var $sEndTag; /* Array: aAttributes An associative array of attributes that will be used in the generation of the HMTL code for this control. */ var $aAttributes; /* Array: aEvents An associative array of events that will be assigned to this control. Each event declaration will include a reference to a object; it's script will be extracted using printScript> or getScript>. */ var $aEvents; /* String: sClass Contains a declaration of the class of this control. %inline controls do not need to be indented, %block controls should be indented. */ var $sClass; /* Function: xajaxControl Parameters: $aConfiguration - (array): An associative array that contains a variety of configuration options for this object. Note: This array may contain the following entries: 'attributes' - (array): An associative array containing attributes that will be passed to the setAttribute> function. 'children' - (array): An array of derived objects that will be the children of this control. */ function xajaxControl($sTag, $aConfiguration=array()) { $this->sTag = $sTag; $this->clearAttributes(); if (isset($aConfiguration['attributes'])) if (is_array($aConfiguration['attributes'])) foreach ($aConfiguration['attributes'] as $sKey => $sValue) $this->setAttribute($sKey, $sValue); $this->clearEvents(); if (isset($aConfiguration['event'])) call_user_func_array(array(&$this, 'setEvent'), $aConfiguration['event']); else if (isset($aConfiguration['events'])) if (is_array($aConfiguration['events'])) foreach ($aConfiguration['events'] as $aEvent) call_user_func_array(array(&$this, 'setEvent'), $aEvent); $this->sClass = '%block'; $this->sEndTag = 'forbidden'; } /* Function: getClass Returns the *adjusted* class of the element */ function getClass() { return $this->sClass; } /* Function: clearAttributes Removes all attributes assigned to this control. */ function clearAttributes() { $this->aAttributes = array(); } /* Function: setAttribute Call to set various control specific attributes to be included in the HTML script that is returned when printHTML> or getHTML> is called. Parameters: $sName - (string): The attribute name to set the value. $sValue - (string): The value to be set. */ function setAttribute($sName, $sValue) { //SkipDebug if (class_exists('clsValidator')) { $objValidator =& clsValidator::getInstance(); if (false == $objValidator->attributeValid($this->sTag, $sName)) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:IAERR:01') . $sName . $objLanguageManager->getText('XJXCTL:IAERR:02') . $this->sTag . $objLanguageManager->getText('XJXCTL:IAERR:03') , E_USER_ERROR ); } } //EndSkipDebug $this->aAttributes[$sName] = $sValue; } /* Function: getAttribute Call to obtain the value currently associated with the specified attribute if set. Parameters: sName - (string): The name of the attribute to be returned. Returns: mixed : The value associated with the attribute, or null. */ function getAttribute($sName) { if (false == isset($this->aAttributes[$sName])) return null; return $this->aAttributes[$sName]; } /* Function: clearEvents Clear the events that have been associated with this object. */ function clearEvents() { $this->aEvents = array(); } /* Function: setEvent Call this function to assign a object as the handler for the specific DOM event. The printScript> function will be called to generate the javascript for this request. Parameters: sEvent - (string): A string containing the name of the event to be assigned. objRequest - (xajaxRequest object): The object to be associated with the specified event. aParameters - (array, optional): An array containing parameter declarations that will be passed to this object just before the javascript is generated. sBeforeRequest - (string, optional): a string containing a snippet of javascript code to execute prior to calling the xajaxRequest function sAfterRequest - (string, optional): a string containing a snippet of javascript code to execute after calling the xajaxRequest function */ function setEvent($sEvent, &$objRequest, $aParameters=array(), $sBeforeRequest='', $sAfterRequest='; return false;') { //SkipDebug if (false == is_a($objRequest, 'xajaxRequest')) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:IRERR:01') . $this->backtrace() , E_USER_ERROR ); } if (class_exists('clsValidator')) { $objValidator =& clsValidator::getInstance(); if (false == $objValidator->attributeValid($this->sTag, $sEvent)) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:IEERR:01') . $sEvent . $objLanguageManager->getText('XJXCTL:IEERR:02') . $this->sTag . $objLanguageManager->getText('XJXCTL:IEERR:03') , E_USER_ERROR ); } } //EndSkipDebug $this->aEvents[$sEvent] = array( &$objRequest, $aParameters, $sBeforeRequest, $sAfterRequest ); } /* Function: getHTML Generates and returns the HTML representation of this control and it's children. Returns: string : The HTML representation of this control. */ function getHTML($bFormat=false) { ob_start(); if ($bFormat) $this->printHTML(); else $this->printHTML(false); return ob_get_clean(); } /* Function: printHTML Generates and prints the HTML representation of this control and it's children. Returns: string : The HTML representation of this control. */ function printHTML($sIndent='') { //SkipDebug if (class_exists('clsValidator')) { $objValidator =& clsValidator::getInstance(); $sMissing = ''; if (false == $objValidator->checkRequiredAttributes($this->sTag, $this->aAttributes, $sMissing)) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:MAERR:01') . $sMissing . $objLanguageManager->getText('XJXCTL:MAERR:02') . $this->sTag . $objLanguageManager->getText('XJXCTL:MAERR:03') , E_USER_ERROR ); } } //EndSkipDebug $sClass = $this->getClass(); if ('%inline' != $sClass) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) echo $sIndent; echo '<'; echo $this->sTag; echo ' '; $this->_printAttributes(); $this->_printEvents(); if ('forbidden' == $this->sEndTag) { if ('HTML' == XAJAX_HTML_CONTROL_DOCTYPE_FORMAT) echo '>'; else if ('XHTML' == XAJAX_HTML_CONTROL_DOCTYPE_FORMAT) echo '/>'; if ('%inline' != $sClass) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) echo "\n"; return; } else if ('optional' == $this->sEndTag) { echo '/>'; if ('%inline' == $sClass) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) echo "\n"; return; } //SkipDebug else { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:IETERR:01') . $this->backtrace() , E_USER_ERROR ); } //EndSkipDebug } function _printAttributes() { // NOTE: Special case here: disabled='false' does not work in HTML; does work in javascript foreach ($this->aAttributes as $sKey => $sValue) if ('disabled' != $sKey || 'false' != $sValue) echo "{$sKey}='{$sValue}' "; } function _printEvents() { foreach (array_keys($this->aEvents) as $sKey) { $aEvent =& $this->aEvents[$sKey]; $objRequest =& $aEvent[0]; $aParameters = $aEvent[1]; $sBeforeRequest = $aEvent[2]; $sAfterRequest = $aEvent[3]; foreach ($aParameters as $aParameter) { $nParameter = $aParameter[0]; $sType = $aParameter[1]; $sValue = $aParameter[2]; $objRequest->setParameter($nParameter, $sType, $sValue); } $objRequest->useDoubleQuote(); echo "{$sKey}='{$sBeforeRequest}"; $objRequest->printScript(); echo "{$sAfterRequest}' "; } } function backtrace() { // debug_backtrace was added to php in version 4.3.0 // version_compare was added to php in version 4.0.7 if (0 <= version_compare(PHP_VERSION, '4.3.0')) return '
Backtrace:
' 
				. print_r(debug_backtrace(), true) 
				. '
'; return ''; } } /* Class: xajaxControlContainer This class is used as the base class for controls that will contain other child controls. */ class xajaxControlContainer extends xajaxControl { /* Array: aChildren An array of child controls. */ var $aChildren; /* Boolean: sChildClass Will contain '%inline' if all children are class = '%inline', '%block' if all children are '%block' or '%flow' if both '%inline' and '%block' elements are detected. */ var $sChildClass; /* Function: xajaxControlContainer Called to construct and configure this control. Parameters: aConfiguration - (array): See xajaxControl> for more information. */ function xajaxControlContainer($sTag, $aConfiguration=array()) { xajaxControl::xajaxControl($sTag, $aConfiguration); $this->clearChildren(); if (isset($aConfiguration['child'])) $this->addChild($aConfiguration['child']); else if (isset($aConfiguration['children'])) $this->addChildren($aConfiguration['children']); $this->sEndTag = 'required'; } /* Function: getClass Returns the *adjusted* class of the element */ function getClass() { $sClass = xajaxControl::getClass(); if (0 < count($this->aChildren) && '%flow' == $sClass) return $this->getContentClass(); else if (0 == count($this->aChildren) || '%inline' == $sClass || '%block' == $sClass) return $sClass; $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:ICERR:01') . $this->backtrace() , E_USER_ERROR ); } /* Function: getContentClass Returns the *adjusted* class of the content (children) of this element */ function getContentClass() { $sClass = ''; foreach (array_keys($this->aChildren) as $sKey) { if ('' == $sClass) $sClass = $this->aChildren[$sKey]->getClass(); else if ($sClass != $this->aChildren[$sKey]->getClass()) return '%flow'; } if ('' == $sClass) return '%inline'; return $sClass; } /* Function: clearChildren Clears the list of child controls associated with this control. */ function clearChildren() { $this->sChildClass = '%inline'; $this->aChildren = array(); } /* Function: addChild Adds a control to the array of child controls. Child controls must be derived from . */ function addChild(&$objControl) { //SkipDebug if (false == is_a($objControl, 'xajaxControl')) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:ICLERR:01') . $this->backtrace() , E_USER_ERROR ); } if (class_exists('clsValidator')) { $objValidator =& clsValidator::getInstance(); if (false == $objValidator->childValid($this->sTag, $objControl->sTag)) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:ICLERR:02') . $objControl->sTag . $objLanguageManager->getText('XJXCTL:ICLERR:03') . $this->sTag . $objLanguageManager->getText('XJXCTL:ICLERR:04') . $this->backtrace() , E_USER_ERROR ); } } //EndSkipDebug $this->aChildren[] =& $objControl; } function addChildren(&$aChildren) { //SkipDebug if (false == is_array($aChildren)) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:ICHERR:01') . $this->backtrace() , E_USER_ERROR ); } //EndSkipDebug foreach (array_keys($aChildren) as $sKey) $this->addChild($aChildren[$sKey]); } function printHTML($sIndent='') { //SkipDebug if (class_exists('clsValidator')) { $objValidator =& clsValidator::getInstance(); $sMissing = ''; if (false == $objValidator->checkRequiredAttributes($this->sTag, $this->aAttributes, $sMissing)) { $objLanguageManager =& xajaxLanguageManager::getInstance(); trigger_error( $objLanguageManager->getText('XJXCTL:MRAERR:01') . $sMissing . $objLanguageManager->getText('XJXCTL:MRAERR:02') . $this->sTag . $objLanguageManager->getText('XJXCTL:MRAERR:03') , E_USER_ERROR ); } } //EndSkipDebug $sClass = $this->getClass(); if ('%inline' != $sClass) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) echo $sIndent; echo '<'; echo $this->sTag; echo ' '; $this->_printAttributes(); $this->_printEvents(); if (0 == count($this->aChildren)) { if ('optional' == $this->sEndTag) { echo '/>'; if ('%inline' != $sClass) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) echo "\n"; return; } //SkipDebug else if ('required' != $this->sEndTag) trigger_error("Invalid end tag designation; should be optional or required.\n" . $this->backtrace(), E_USER_ERROR ); //EndSkipDebug } echo '>'; $sContentClass = $this->getContentClass(); if ('%inline' != $sContentClass) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) echo "\n"; $this->_printChildren($sIndent); if ('%inline' != $sContentClass) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) echo $sIndent; echo '<' . '/'; echo $this->sTag; echo '>'; if ('%inline' != $sClass) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) echo "\n"; } function _printChildren($sIndent='') { if (false == is_a($this, 'clsDocument')) // this odd syntax is necessary to detect request for no formatting if (false === (false === $sIndent)) $sIndent .= "\t"; // children foreach (array_keys($this->aChildren) as $sKey) { $objChild =& $this->aChildren[$sKey]; $objChild->printHTML($sIndent); } } } php-xajax-0.5/xajax_core/xajaxCompress.inc.php0000644000175000017500000000663711137037724020152 0ustar dgildgil will call this function internally to compress the javascript code for more efficient delivery. Parameters: $sFile - (stirng): The file to be compressed. */ function xajaxCompressFile($sFile) { //remove windows cariage returns $sFile = str_replace("\r",'',$sFile); //array to store replaced literal strings $literal_strings = array(); //explode the string into lines $lines = explode("\n",$sFile); //loop through all the lines, building a new string at the same time as removing literal strings $clean = ''; $inComment = false; $literal = ''; $inQuote = false; $escaped = false; $quoteChar = ''; $iLen = count($lines); for($i=0; $i<$iLen; ++$i) { $line = $lines[$i]; $inNormalComment = false; //loop through line's characters and take out any literal strings, replace them with ___i___ where i is the index of this string $jLen = strlen($line); for($j=0; $j<$jLen; ++$j) { $c = substr($line,$j,1); $d = substr($line,$j,2); //look for start of quote if(!$inQuote && !$inComment) { //is this character a quote or a comment if(($c=='"' || $c=="'") && !$inComment && !$inNormalComment) { $inQuote = true; $inComment = false; $escaped = false; $quoteChar = $c; $literal = $c; } else if($d=="/*" && !$inNormalComment) { $inQuote = false; $inComment = true; $escaped = false; $quoteChar = $d; $literal = $d; $j++; } else if($d=="//") //ignore string markers that are found inside comments { $inNormalComment = true; } else { if (!$inNormalComment) $clean .= $c; } } else //allready in a string so find end quote { if($c == $quoteChar && !$escaped && !$inComment) { $inQuote = false; $literal .= $c; //subsitute in a marker for the string $clean .= "___" . count($literal_strings) . "___"; //push the string onto our array array_push($literal_strings,$literal); } else if($inComment && $d=="*/") { $inComment = false; $literal .= $d; ++$j; } else if($c == "\\" && !$escaped) $escaped = true; else $escaped = false; $literal .= $c; } } if($inComment) $literal .= "\n"; $clean .= "\n"; } //explode the clean string into lines again $lines = explode("\n",$clean); //now process each line at a time $iLen = count($lines); for($i=0; $i<$iLen; ++$i) { $line = $lines[$i]; //remove comments $line = preg_replace("/\/\/(.*)/","",$line); //strip leading and trailing whitespace $line = trim($line); //remove all whitespace with a single space $line = preg_replace("/\s+/"," ",$line); //remove any whitespace that occurs after/before an operator $line = preg_replace("/\s*([!\}\{;,&=\|\-\+\*\/\)\(:])\s*/","\\1",$line); $lines[$i] = $line; } //implode the lines $sFile = implode("\n",$lines); //make sure there is a max of 1 \n after each line $sFile = preg_replace("/[\n]+/","\n",$sFile); //strip out line breaks that immediately follow a semi-colon $sFile = preg_replace("/;\n/",";",$sFile); //curly brackets aren't on their own $sFile = preg_replace("/[\n]*\{[\n]*/","{",$sFile); //finally loop through and replace all the literal strings: $iLen = count($literal_strings); for($i=0; $i<$iLen; ++$i) $sFile = str_replace('___'.$i.'___',$literal_strings[$i],$sFile); return $sFile; } php-xajax-0.5/xajax_core/xajaxLanguageManager.inc.php0000644000175000017500000001635411137037724021372 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxLanguageManager.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Class: xajaxLanguageManager This class contains the default language (english) and the code used to supply debug and error messages upon request; as well as the code used to load alternate language text as requested via the function. */ class xajaxLanguageManager { /* Array: aMessages An array of the currently registered languages. */ var $aMessages; /* String: sLanguage The currently configured language. */ var $sLanguage; /* Function: xajaxLanguageManager Construct and initialize the one and only xajax language manager object. */ function xajaxLanguageManager() { $this->aMessages = array(); $this->aMessages['en'] = array( 'LOGHDR:01' => '** xajax Error Log - ', 'LOGHDR:02' => " **\n", 'LOGHDR:03' => "\n\n\n", 'LOGERR:01' => "** Logging Error **\n\nxajax was unable to write to the error log file:\n", 'LOGMSG:01' => "** PHP Error Messages: **", 'CMPRSJS:RDERR:01' => 'The xajax uncompressed Javascript file could not be found in the ', 'CMPRSJS:RDERR:02' => ' folder. Error ', 'CMPRSJS:WTERR:01' => 'The xajax compressed javascript file could not be written in the ', 'CMPRSJS:WTERR:02' => ' folder. Error ', 'CMPRSPHP:WTERR:01' => 'The xajax compressed file ', 'CMPRSPHP:WTERR:02' => ' could not be written to. Error ', 'CMPRSAIO:WTERR:01' => 'The xajax compressed file ', 'CMPRSAIO:WTERR:02' => '/xajaxAIO.inc.php could not be written to. Error ', 'DTCTURI:01' => 'xajax Error: xajax failed to automatically identify your Request URI.', 'DTCTURI:02' => 'Please set the Request URI explicitly when you instantiate the xajax object.', 'ARGMGR:ERR:01' => 'Malformed object argument received: ', 'ARGMGR:ERR:02' => ' <==> ', 'ARGMGR:ERR:03' => 'The incoming xajax data could not be converted from UTF-8', 'XJXCTL:IAERR:01' => 'Invalid attribute [', 'XJXCTL:IAERR:02' => '] for element [', 'XJXCTL:IAERR:03' => '].', 'XJXCTL:IRERR:01' => 'Invalid request object passed to xajaxControl::setEvent', 'XJXCTL:IEERR:01' => 'Invalid attribute (event name) [', 'XJXCTL:IEERR:02' => '] for element [', 'XJXCTL:IEERR:03' => '].', 'XJXCTL:MAERR:01' => 'Missing required attribute [', 'XJXCTL:MAERR:02' => '] for element [', 'XJXCTL:MAERR:03' => '].', 'XJXCTL:IETERR:01' => "Invalid end tag designation; should be forbidden or optional.\n", 'XJXCTL:ICERR:01' => "Invalid class specified for html control; should be %inline, %block or %flow.\n", 'XJXCTL:ICLERR:01' => 'Invalid control passed to addChild; should be derived from xajaxControl.', 'XJXCTL:ICLERR:02' => 'Invalid control passed to addChild [', 'XJXCTL:ICLERR:03' => '] for element [', 'XJXCTL:ICLERR:04' => "].\n", 'XJXCTL:ICHERR:01' => 'Invalid parameter passed to xajaxControl::addChildren; should be array of xajaxControl objects', 'XJXCTL:MRAERR:01' => 'Missing required attribute [', 'XJXCTL:MRAERR:02' => '] for element [', 'XJXCTL:MRAERR:03' => '].', 'XJXPLG:GNERR:01' => 'Response plugin should override the getName function.', 'XJXPLG:PERR:01' => 'Response plugin should override the process function.', 'XJXPM:IPLGERR:01' => 'Attempt to register invalid plugin: ', 'XJXPM:IPLGERR:02' => ' should be derived from xajaxRequestPlugin or xajaxResponsePlugin.', 'XJXPM:MRMERR:01' => 'Failed to locate registration method for the following: ', 'XJXRSP:EDERR:01' => 'Passing character encoding to the xajaxResponse constructor is deprecated, instead use $xajax->configure("characterEncoding", ...);', 'XJXRSP:MPERR:01' => 'Invalid or missing plugin name detected in call to xajaxResponse::plugin', 'XJXRSP:CPERR:01' => "The \$sType parameter of addCreate has been deprecated. Use the addCreateInput() method instead.", 'XJXRSP:LCERR:01' => "The xajax response object could not load commands as the data provided was not a valid array.", 'XJXRSP:AKERR:01' => 'Invalid tag name encoded in array.', 'XJXRSP:IEAERR:01' => 'Improperly encoded array.', 'XJXRSP:NEAERR:01' => 'Non-encoded array detected.', 'XJXRSP:MBEERR:01' => 'The xajax response output could not be converted to HTML entities because the mb_convert_encoding function is not available', 'XJXRSP:MXRTERR' => 'Error: Cannot mix types in a single response.', 'XJXRSP:MXCTERR' => 'Error: Cannot mix content types in a single response.', 'XJXRSP:MXCEERR' => 'Error: Cannot mix character encodings in a single response.', 'XJXRSP:MXOEERR' => 'Error: Cannot mix output entities (true/false) in a single response.', 'XJXRM:IRERR' => 'An invalid response was returned while processing this request.', 'XJXRM:MXRTERR' => 'Error: You cannot mix response types while processing a single request: ' ); $this->sLanguage = 'en'; } /* Function: getInstance Implements the singleton pattern: provides a single instance of the xajax language manager object to all object which request it. */ function &getInstance() { static $obj; if (!$obj) { $obj = new xajaxLanguageManager(); } return $obj; } /* Function: configure Called by the main xajax object as configuration options are set. See also: . The tracks the following configuration options. Parameters: - language (string, default 'en'): The currently selected language. */ function configure($sName, $mValue) { if ('language' == $sName) { if ($mValue !== $this->sLanguage) { $sFolder = dirname(__FILE__); @include $sFolder . '/xajax_lang_' . $mValue . '.inc.php'; // require $sFolder . '/xajax_lang_' . $mValue . '.inc.php'; $this->sLanguage = $mValue; } } } /* Function: register Called to register an array of alternate language messages. Parameters: sLanguage - (string): the character code which represents the language being registered. aMessages - (array): the array of translated debug and error messages */ function register($sLanguage, $aMessages) { $this->aMessages[$sLanguage] = $aMessages; } /* Function: getText Called by the main xajax object and other objects during the initial page generation or request processing phase to obtain language specific debug and error messages. sMessage - (string): A code indicating the message text being requested. */ function getText($sMessage) { if (isset($this->aMessages[$this->sLanguage])) if (isset($this->aMessages[$this->sLanguage][$sMessage])) return $this->aMessages[$this->sLanguage][$sMessage]; return '(Unknown language or message identifier)' . $this->sLanguage . '::' . $sMessage; } } php-xajax-0.5/xajax_controls/0000755000175000017500000000000011345167001014732 5ustar dgildgilphp-xajax-0.5/xajax_controls/misc.inc.php0000644000175000017500000000517711137037724017167 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: misc.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Description This file contains the class declarations for the following HTML Controls: (whatever does not fit elsewhere) - object, param - a, img, button - area, map The following tags are deprecated as of HTML 4.01, therefore, they will not be supported: - applet, embed */ class clsObject extends xajaxControlContainer { function clsObject($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('object', $aConfiguration); $this->sClass = '%block'; $this->sEndTag = 'required'; } } class clsParam extends xajaxControl { function clsParam($aConfiguration=array()) { xajaxControl::xajaxControl('param', $aConfiguration); $this->sClass = '%block'; } } class clsAnchor extends xajaxControlContainer { function clsAnchor($aConfiguration=array()) { if (false == isset($aConfiguration['attributes'])) $aConfiguration['attributes'] = array(); if (false == isset($aConfiguration['attributes']['href'])) $aConfiguration['attributes']['href'] = '#'; xajaxControlContainer::xajaxControlContainer('a', $aConfiguration); $this->sClass = '%inline'; $this->sEndTag = 'required'; } function setEvent($sEvent, &$objRequest, $aParameters=array(), $sBeforeRequest='if (false == ', $sAfterRequest=') return false; ') { xajaxControl::setEvent($sEvent, $objRequest, $aParameters, $sBeforeRequest, $sAfterRequest); } } class clsImg extends xajaxControl { function clsImg($aConfiguration=array()) { xajaxControl::xajaxControl('img', $aConfiguration); $this->sClass = '%inline'; } } class clsButton extends xajaxControlContainer { function clsButton($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('button', $aConfiguration); $this->sClass = '%inline'; } } class clsArea extends xajaxControl { function clsArea($aConfiguration=array()) { xajaxControl::xajaxControl('area', $aConfiguration); $this->sClass = '%block'; } } class clsMap extends xajaxControlContainer { function clsMap($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('map', $aConfiguration); $this->sClass = '%block'; } } php-xajax-0.5/xajax_controls/group.inc.php0000644000175000017500000003124511137037724017363 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: group.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Description This file contains the class declarations for the following HTML Controls: - ol, ul, li - dl, dt, dd - table, caption, colgroup, col, thead, tfoot, tbody, tr, td, th The following tags are deprecated as of HTML 4.01, therefore, they will not be supported: - dir, menu */ class clsList extends xajaxControlContainer { function clsList($sTag, $aConfiguration=array()) { $this->clearEvent_AddItem(); xajaxControlContainer::xajaxControlContainer($sTag, $aConfiguration); $this->sClass = '%block'; } function addItem($mItem, $mConfiguration=null) { if (null != $this->eventAddItem) { $objItem =& call_user_func($this->eventAddItem, $mItem, $mConfiguration); $this->addChild($objItem); } else { $objItem =& $this->_onAddItem($mItem, $mConfiguration); $this->addChild($objItem); } } function addItems($aItems, $mConfiguration=null) { foreach ($aItems as $mItem) $this->addItem($mItem, $mConfiguration); } function clearEvent_AddItem() { $this->eventAddItem = null; } function setEvent_AddItem($mFunction) { $this->eventAddItem = $mFunction; } function &_onAddItem($mItem, $mConfiguration) { $objItem =& new clsLI(array( 'child' => new clsLiteral($mItem) )); return $objItem; } } class clsUL extends clsList { function clsUL($aConfiguration=array()) { clsList::clsList('ul', $aConfiguration); } } class clsOL extends clsList { function clsOL($aConfiguration=array()) { clsList::clsList('ol', $aConfiguration); } } class clsLI extends xajaxControlContainer { function clsLI($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('li', $aConfiguration); $this->sClass = '%flow'; $this->sEndTag = 'optional'; } } class clsDl extends xajaxControlContainer { function clsDl($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('dl', $aConfiguration); $this->sClass = '%block'; } } class clsDt extends xajaxControlContainer { function clsDt($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('dt', $aConfiguration); $this->sClass = '%block'; $this->sEndTag = 'optional'; } } class clsDd extends xajaxControlContainer { function clsDd($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('dd', $aConfiguration); $this->sClass = '%flow'; $this->sEndTag = 'optional'; } } class clsTableRowContainer extends xajaxControlContainer { var $eventAddRow; var $eventAddRowCell; function clsTableRowContainer($sTag, $aConfiguration=array()) { $this->clearEvent_AddRow(); $this->clearEvent_AddRowCell(); xajaxControlContainer::xajaxControlContainer($sTag, $aConfiguration); $this->sClass = '%block'; } function addRow($aCells, $mConfiguration=null) { if (null != $this->eventAddRow) { $objRow =& call_user_func($this->eventAddRow, $aCells, $mConfiguration); $this->addChild($objRow); } else { $objRow =& $this->_onAddRow($aCells, $mConfiguration); $this->addChild($objRow); } } function addRows($aRows, $mConfiguration=null) { foreach ($aRows as $aCells) $this->addRow($aCells, $mConfiguration); } function clearEvent_AddRow() { $this->eventAddRow = null; } function clearEvent_AddRowCell() { $this->eventAddRowCell = null; } function setEvent_AddRow($mFunction) { $mPrevious = $this->eventAddRow; $this->eventAddRow = $mFunction; return $mPrevious; } function setEvent_AddRowCell($mFunction) { $mPrevious = $this->eventAddRowCell; $this->eventAddRowCell = $mFunction; return $mPrevious; } function &_onAddRow($aCells, $mConfiguration=null) { $objTableRow =& new clsTr(); if (null != $this->eventAddRowCell) $objTableRow->setEvent_AddCell($this->eventAddRowCell); $objTableRow->addCells($aCells, $mConfiguration); return $objTableRow; } } /* Class: clsTable A derived class that aids in the construction of HTML tables. Inherently, and derived classes support based events using the setEvent> method. */ class clsTable extends xajaxControlContainer { var $eventAddHeader; var $eventAddHeaderRow; var $eventAddHeaderRowCell; var $eventAddBody; var $eventAddBodyRow; var $eventAddBodyRowCell; var $eventAddFooter; var $eventAddFooterRow; var $eventAddFooterRowCell; /* Function: clsTable Constructs and initializes an instance of the class. */ function clsTable($aConfiguration=array()) { $this->clearEvent_AddHeader(); $this->clearEvent_AddHeaderRow(); $this->clearEvent_AddHeaderRowCell(); $this->clearEvent_AddBody(); $this->clearEvent_AddBodyRow(); $this->clearEvent_AddBodyRowCell(); $this->clearEvent_AddFooter(); $this->clearEvent_AddFooterRow(); $this->clearEvent_AddFooterRowCell(); xajaxControlContainer::xajaxControlContainer('table', $aConfiguration); $this->sClass = '%block'; } function addHeader($aRows, $mConfiguration=null) { if (null != $this->eventAddHeader) { $objHeader =& call_user_func($this->eventAddHeader, $aRows, $mConfiguration); $this->addChild($objHeader); } else { $objHeader =& $this->_onAddHeader($aRows, $mConfiguration); $this->addChild($objHeader); } } function addBody($aRows, $mConfiguration=null) { if (null != $this->eventAddBody) { $objBody =& call_user_func($this->eventAddBody, $aRows, $mConfiguration); $this->addChild($objBody); } else { $objBody =& $this->_onAddBody($aRows, $mConfiguration); $this->addChild($objBody); } } function addFooter($aRows, $mConfiguration=null) { if (null != $this->eventAddFooter) { $objFooter =& call_user_func($this->eventAddFooter, $aRows, $mConfiguration); $this->addChild($objFooter); } else { $objFooter =& $this->_onAddFooter($aRows, $mConfiguration); $this->addChild($objFooter); } } function addBodies($aBodies, $mConfiguration=null) { foreach ($aBodies as $aRows) $this->addBody($aRows, $mConfiguration); } function clearEvent_AddHeader() { $this->eventAddHeader = null; } function clearEvent_AddHeaderRow() { $this->eventAddHeaderRow = null; } function clearEvent_AddHeaderRowCell() { $this->eventAddHeaderRowCell = null; } function clearEvent_AddBody() { $this->eventAddBody = null; } function clearEvent_AddBodyRow() { $this->eventAddBodyRow = null; } function clearEvent_AddBodyRowCell() { $this->eventAddBodyRowCell = null; } function clearEvent_AddFooter() { $this->eventAddFooter = null; } function clearEvent_AddFooterRow() { $this->eventAddFooterRow = null; } function clearEvent_AddFooterRowCell() { $this->eventAddFooterRowCell = null; } function setEvent_AddHeader($mFunction) { $mPrevious = $this->eventAddHeader; $this->eventAddHeader = $mFunction; return $mPrevious; } function setEvent_AddHeaderRow($mFunction) { $mPrevious = $this->eventAddHeaderRow; $this->eventAddHeaderRow = $mFunction; return $mPrevious; } function setEvent_AddHeaderRowCell($mFunction) { $mPrevious = $this->eventAddHeaderRowCell; $this->eventAddHeaderRowCell = $mFunction; return $mPrevious; } function setEvent_AddBody($mFunction) { $mPrevious = $this->eventAddBody; $this->eventAddBody = $mFunction; return $mPrevious; } function setEvent_AddBodyRow($mFunction) { $mPrevious = $this->eventAddBodyRow; $this->eventAddBodyRow = $mFunction; return $mPrevious; } function setEvent_AddBodyRowCell($mFunction) { $mPrevious = $this->eventAddBodyRowCell; $this->eventAddBodyRowCell = $mFunction; return $mPrevious; } function setEvent_AddFooter($mFunction) { $mPrevious = $this->eventAddFooter; $this->eventAddFooter = $mFunction; return $mPrevious; } function setEvent_AddFooterRow($mFunction) { $mPrevious = $this->eventAddFooterRow; $this->eventAddFooterRow = $mFunction; return $mPrevious; } function setEvent_AddFooterRowCell($mFunction) { $mPrevious = $this->eventAddFooterRowCell; $this->eventAddFooterRowCell = $mFunction; return $mPrevious; } function &_onAddHeader($aRows, $mConfiguration) { $objTableHeader =& new clsThead(); if (null != $this->eventAddHeaderRow) $objTableHeader->setEvent_AddRow($this->eventAddHeaderRow); if (null != $this->eventAddHeaderRowCell) $objTableHeader->setEvent_AddRowCell($this->eventAddHeaderRowCell); $objTableHeader->addRows($aRows, $mConfiguration); return $objTableHeader; } function &_onAddBody($aRows, $mConfiguration) { $objTableBody =& new clsTbody(); if (null != $this->eventAddBodyRow) $objTableBody->setEvent_AddRow($this->eventAddBodyRow); if (null != $this->eventAddBodyRowCell) $objTableBody->setEvent_AddRowCell($this->eventAddBodyRowCell); $objTableBody->addRows($aRows, $mConfiguration); return $objTableBody; } function &_onAddFooter($aRows, $mConfiguration) { $objTableFooter =& new clsTfoot(); if (null != $this->eventAddFooterRow) $objTableFooter->setEvent_AddRow($this->eventAddFooterRow); if (null != $this->eventAddFooterRowCell) $objTableFooter->setEvent_AddRowCell($this->eventAddFooterRowCell); $objTableFooter->addRows($aRows, $mConfiguration); return $objTableFooter; } } class clsCaption extends xajaxControlContainer { function clsCaption($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('caption', $aConfiguration); $this->sClass = '%block'; } } class clsColgroup extends xajaxControlContainer { function clsColgroup($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('colgroup', $aConfiguration); $this->sClass = '%block'; $this->sEndTag = 'optional'; } } class clsCol extends xajaxControl { function clsCol($aConfiguration=array()) { xajaxControl::xajaxControl('col'); $this->sClass = '%block'; } } /* Class: clsThead */ class clsThead extends clsTableRowContainer { /* Function: clsThead Constructs and initializes an instance of the class. */ function clsThead($aConfiguration=array()) { clsTableRowContainer::clsTableRowContainer('thead', $aConfiguration); } } /* Class: clsTbody */ class clsTbody extends clsTableRowContainer { /* Function: clsTbody Constructs and initializes an instance of the class. */ function clsTbody($aConfiguration=array()) { clsTableRowContainer::clsTableRowContainer('tbody', $aConfiguration); } } /* Class: clsTfoot */ class clsTfoot extends clsTableRowContainer { /* Function: clsTfoot Constructs and initializes an instance of the class. */ function clsTfoot($aConfiguration=array()) { clsTableRowContainer::clsTableRowContainer('tfoot', $aConfiguration); } } /* Class: clsTr */ class clsTr extends xajaxControlContainer { var $eventAddCell; /* Function: clsTr Constructs and initializes an instance of the class. */ function clsTr($aConfiguration=array()) { $this->clearEvent_AddCell(); xajaxControlContainer::xajaxControlContainer('tr', $aConfiguration); $this->sClass = '%block'; } function addCell($mCell, $mConfiguration=null) { if (null != $this->eventAddCell) { $objCell =& call_user_func($this->eventAddCell, $mCell, $mConfiguration); $this->addChild($objCell); } else { $objCell =& $this->_onAddCell($mCell, $mConfiguration); $this->addChild($objCell); } } function addCells($aCells, $mConfiguration=null) { foreach ($aCells as $mCell) $this->addCell($mCell, $mConfiguration); } function clearEvent_AddCell() { $this->eventAddCell = null; } function setEvent_AddCell($mFunction) { $mPrevious = $this->eventAddCell; $this->eventAddCell = $mFunction; return $mPrevious; } function &_onAddCell($mCell, $mConfiguration=null) { return new clsTd(array( 'child' => new clsLiteral($mCell) )); } } /* Class: clsTd */ class clsTd extends xajaxControlContainer { /* Function: clsTd Constructs and initializes an instance of the class. */ function clsTd($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('td', $aConfiguration); $this->sClass = '%flow'; } } /* Class: clsTh */ class clsTh extends xajaxControlContainer { /* Function: clsTh Constructs and initializes an instance of the class. */ function clsTh($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('th', $aConfiguration); $this->sClass = '%flow'; } } php-xajax-0.5/xajax_controls/form.inc.php0000644000175000017500000001715611137037724017177 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: form.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Description This file contains the class declarations for the following HTML Controls: - form - input, textarea, select, optgroup, option - label - fieldset, legend The following tags are deprecated as of HTML 4.01, therefore, they will not be supported: - isindex */ class clsForm extends xajaxControlContainer { function clsForm($aConfiguration=array()) { if (false == isset($aConfiguration['attributes'])) $aConfiguration['attributes'] = array(); if (false == isset($aConfiguration['attributes']['method'])) $aConfiguration['attributes']['method'] = 'POST'; if (false == isset($aConfiguration['attributes']['action'])) $aConfiguration['attributes']['action'] = '#'; xajaxControlContainer::xajaxControlContainer('form', $aConfiguration); } } class clsInput extends xajaxControl { function clsInput($aConfiguration=array()) { xajaxControl::xajaxControl('input', $aConfiguration); } } class clsInputWithLabel extends clsInput { var $objLabel; var $sWhere; var $objBreak; function clsInputWithLabel($sLabel, $sWhere, $aConfiguration=array()) { clsInput::clsInput($aConfiguration); $this->objLabel =& new clsLabel(array( 'child' => new clsLiteral($sLabel) )); $this->objLabel->setControl($this); $this->sWhere = $sWhere; $this->objBreak =& new clsBr(); } function printHTML($sIndent='') { if ('left' == $this->sWhere || 'above' == $this->sWhere) $this->objLabel->printHTML($sIndent); if ('above' == $this->sWhere) $this->objBreak->printHTML($sIndent); clsInput::printHTML($sIndent); if ('below' == $this->sWhere) $this->objBreak->printHTML($sIndent); if ('right' == $this->sWhere || 'below' == $this->sWhere) $this->objLabel->printHTML($sIndent); } } /* Class: clsSelect A derived class that assists in the construction of an HTML select control. This control can only accept controls as children. */ class clsSelect extends xajaxControlContainer { /* Function: clsSelect Construct and initialize an instance of the class. See for details regarding the aConfiguration parameter. */ function clsSelect($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('select', $aConfiguration); } /* Function: addOption Used to add a single option to the options list. sValue - (string): The value that is returned as the form value when this option is the selected option. sText - (string): The text that is displayed in the select box when this option is the selected option. */ function addOption($sValue, $sText) { $optionNew =& new clsOption(); $optionNew->setValue($sValue); $optionNew->setText($sText); $this->addChild($optionNew); } /* Function: addOptions Used to add a list of options. aOptions - (associative array): A list of key/value pairs that will be passed to addOption>. */ function addOptions($aOptions, $aFields=array()) { if (0 == count($aFields)) foreach ($aOptions as $sValue => $sText) $this->addOption($sValue, $sText); else if (1 < count($aFields)) foreach ($aOptions as $aOption) $this->addOption($aOption[$aFields[0]], $aOption[$aFields[1]]); else trigger_error('Invalid list of fields passed to clsSelect::addOptions; should be array of two strings.' . $this->backtrace(), E_USER_ERROR ); } } /* Class: clsOptionGroup A derived class that can be used around a list of objects to help the user find items in a select list. */ class clsOptionGroup extends xajaxControlContainer { function clsOptionGroup($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('optgroup', $aConfiguration); } /* Function: addOption Used to add a single option to the options list. sValue - (string): The value that is returned as the form value when this option is the selected option. sText - (string): The text that is displayed in the select box when this option is the selected option. */ function addOption($sValue, $sText) { $optionNew =& new clsOption(); $optionNew->setValue($sValue); $optionNew->setText($sText); $this->addChild($optionNew); } /* Function: addOptions Used to add a list of options. aOptions - (associative array): A list of key/value pairs that will be passed to addOption>. */ function addOptions($aOptions, $aFields=array()) { if (0 == count($aFields)) foreach ($aOptions as $sValue => $sText) $this->addOption($sValue, $sText); else if (1 < count($aFields)) foreach ($aOptions as $aOption) $this->addOption($aOption[$aFields[0]], $aOption[$aFields[1]]); else trigger_error('Invalid list of fields passed to clsOptionGroup::addOptions; should be array of two strings.' . $this->backtrace(), E_USER_ERROR ); } } /* Class: clsOption A derived class that assists with the construction of HTML option tags that will be assigned to an HTML select tag. This control can only accept objects as children. */ class clsOption extends xajaxControlContainer { /* Function: clsOption Constructs and initializes an instance of this class. See for more information regarding the aConfiguration parameter. */ function clsOption($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('option', $aConfiguration); } /* Function: setValue Used to set the value associated with this option. The value is sent as the value of the select control when this is the selected option. */ function setValue($sValue) { $this->setAttribute('value', $sValue); } /* Function: setText Sets the text to be shown in the select control when this is the selected option. */ function setText($sText) { $this->clearChildren(); $this->addChild(new clsLiteral($sText)); } } class clsTextArea extends xajaxControlContainer { function clsTextArea($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('textarea', $aConfiguration); $this->sClass = '%block'; } } class clsLabel extends xajaxControlContainer { var $objFor; function clsLabel($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('label', $aConfiguration); } function setControl(&$objControl) { if (false == is_a($objControl, 'xajaxControl')) trigger_error( 'Invalid control passed to clsLabel::setControl(); should be xajaxControl.' . $this->backtrace(), E_USER_ERROR); $this->objFor =& $objControl; } function printHTML($sIndent='') { $this->aAttributes['for'] = $this->objFor->aAttributes['id']; xajaxControlContainer::printHTML($sIndent); } } class clsFieldset extends xajaxControlContainer { function clsFieldset($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('fieldset', $aConfiguration); $this->sClass = '%block'; } } class clsLegend extends xajaxControlContainer { function clsLegend($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('legend', $aConfiguration); $this->sClass = '%inline'; } } php-xajax-0.5/xajax_controls/content.inc.php0000644000175000017500000001351511137037724017701 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: content.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Description This file contains class declarations for the following HTML tags: - literal - br, hr - sub, sup, q, em, strong, cite, dfn, code, samp, kbd, var, abbr, acronym, tt, i, b, big, small, ins, del - h1 ... h6, address, p, blockquote, pre The following tags are deprecated as of HTML 4.01 and therefore they are not supported. - font, strike, s, u, center */ class clsLiteral extends xajaxControl { function clsLiteral($sText) { xajaxControl::xajaxControl('CDATA'); $this->sClass = '%inline'; $this->sText = $sText; } function printHTML($sIndent='') { echo $this->sText; } } class clsBr extends xajaxControl { function clsBr($aConfiguration=array()) { xajaxControl::xajaxControl('br', $aConfiguration); $this->sClass = '%inline'; $this->sEndTag = 'optional'; } } class clsHr extends xajaxControl { function clsHr($aConfiguration=array()) { xajaxControl::xajaxControl('hr', $aConfiguration); $this->sClass = '%inline'; $this->sEndTag = 'optional'; } } class clsInlineContainer extends xajaxControlContainer { function clsInlineContainer($sTag, $aConfiguration) { xajaxControlContainer::xajaxControlContainer($sTag, $aConfiguration); $this->sClass = '%inline'; $this->sEndTag = 'required'; } } class clsSub extends clsInlineContainer { function clsSub($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('sub', $aConfiguration); } } class clsSup extends xajaxControlContainer { function clsSup($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('sup', $aConfiguration); } } class clsEm extends clsInlineContainer { function clsEm($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('em', $aConfiguration); } } class clsStrong extends clsInlineContainer { function clsStrong($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('strong', $aConfiguration); } } class clsCite extends clsInlineContainer { function clsCite($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('cite', $aConfiguration); } } class clsDfn extends clsInlineContainer { function clsDfn($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('dfn', $aConfiguration); } } class clsCode extends clsInlineContainer { function clsCode($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('code', $aConfiguration); } } class clsSamp extends clsInlineContainer { function clsSamp($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('samp', $aConfiguration); } } class clsKbd extends clsInlineContainer { function clsKbd($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('kbd', $aConfiguration); } } class clsVar extends clsInlineContainer { function clsVar($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('var', $aConfiguration); } } class clsAbbr extends clsInlineContainer { function clsAbbr($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('abbr', $aConfiguration); } } class clsAcronym extends clsInlineContainer { function clsAcronym($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('acronym', $aConfiguration); } } class clsTt extends clsInlineContainer { function clsTt($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('tt', $aConfiguration); } } class clsItalic extends clsInlineContainer { function clsItalic($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('i', $aConfiguration); } } class clsBold extends clsInlineContainer { function clsBold($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('b', $aConfiguration); } } class clsBig extends clsInlineContainer { function clsBig($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('big', $aConfiguration); } } class clsSmall extends clsInlineContainer { function clsSmall($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('small', $aConfiguration); } } class clsIns extends clsInlineContainer { function clsIns($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('ins', $aConfiguration); } } class clsDel extends clsInlineContainer { function clsDel($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('del', $aConfiguration); } } class clsHeadline extends xajaxControlContainer { function clsHeadline($sType, $aConfiguration=array()) { if (0 < strpos($sType, '123456')) trigger_error('Invalid type for headline control; should be 1,2,3,4,5 or 6.' . $this->backtrace(), E_USER_ERROR ); xajaxControlContainer::xajaxControlContainer('h' . $sType, $aConfiguration); $this->sClass = '%inline'; } } class clsAddress extends clsInlineContainer { function clsAddress($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('address', $aConfiguration); } } class clsParagraph extends clsInlineContainer { function clsParagraph($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('p', $aConfiguration); } } class clsBlockquote extends clsInlineContainer { function clsBlockquote($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('blockquote', $aConfiguration); } } class clsPre extends clsInlineContainer { function clsPre($aConfiguration=array()) { clsInlineContainer::clsInlineContainer('pre', $aConfiguration); } } php-xajax-0.5/xajax_controls/document.inc.php0000644000175000017500000001724411137037724020050 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: document.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Description This file contains the class declarations for the following HTML Controls: - document, doctype, html, head, body - meta, link, script, style - title, base - noscript - frameset, frame, iframe, noframes The following controls are deprecated as of HTML 4.01, so they will not be supported: - basefont */ class clsDocument extends xajaxControlContainer { function clsDocument($aConfiguration=array()) { if (isset($aConfiguration['attributes'])) trigger_error( 'clsDocument objects cannot have attributes.' . $this->backtrace(), E_USER_ERROR); xajaxControlContainer::xajaxControlContainer('DOCUMENT', $aConfiguration); $this->sClass = '%block'; } function printHTML() { $tStart = microtime(); $this->_printChildren(); $tStop = microtime(); echo '<' . '!--'; echo ' page generation took '; $nTime = $tStop - $tStart; $nTime *= 1000; echo $nTime; echo ' --' . '>'; } } class clsDoctype extends xajaxControlContainer { var $sText; var $sFormat; var $sVersion; var $sValidation; var $sEncoding; function clsDocType($sFormat=null, $sVersion=null, $sValidation=null, $sEncoding='UTF-8') { if (null === $sFormat && false == defined('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT')) trigger_error('You must specify a doctype format.', E_USER_ERROR); if (null === $sVersion && false == defined('XAJAX_HTML_CONTROL_DOCTYPE_VERSION')) trigger_error('You must specify a doctype version.', E_USER_ERROR); if (null === $sValidation && false == defined('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION')) trigger_error('You must specify a doctype validation.', E_USER_ERROR); if (null === $sFormat) $sFormat = XAJAX_HTML_CONTROL_DOCTYPE_FORMAT; if (null === $sVersion) $sVersion = XAJAX_HTML_CONTROL_DOCTYPE_VERSION; if (null === $sValidation) $sValidation = XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION; xajaxControlContainer::xajaxControlContainer('DOCTYPE', array()); $this->sText = '<'.'!DOCTYPE html PUBLIC "-//W3C//DTD '; $this->sText .= $sFormat; $this->sText .= ' '; $this->sText .= $sVersion; if ('TRANSITIONAL' == $sValidation) $this->sText .= ' Transitional'; else if ('FRAMESET' == $sValidation) $this->sText .= ' Frameset'; $this->sText .= '//EN" '; if ('HTML' == $sFormat) { if ('4.0' == $sVersion) { if ('STRICT' == $sValidation) $this->sText .= '"http://www.w3.org/TR/html40/strict.dtd"'; else if ('TRANSITIONAL' == $sValidation) $this->sText .= '"http://www.w3.org/TR/html40/loose.dtd"'; } else if ('4.01' == $sVersion) { if ('STRICT' == $sValidation) $this->sText .= '"http://www.w3.org/TR/html401/strict.dtd"'; else if ('TRANSITIONAL' == $sValidation) $this->sText .= '"http://www.w3.org/TR/html401/loose.dtd"'; else if ('FRAMESET' == $sValidation) $this->sText .= '"http://www.w3.org/TR/html4/frameset.dtd"'; } } else if ('XHTML' == $sFormat) { if ('1.0' == $sVersion) { if ('STRICT' == $sValidation) $this->sText .= '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"'; else if ('TRANSITIONAL' == $sValidation) $this->sText .= '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"'; } else if ('1.1' == $sVersion) { $this->sText .= '"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"'; } } else trigger_error('Unsupported DOCTYPE tag.' . $this->backtrace(), E_USER_ERROR ); $this->sText .= '>'; $this->sFormat = $sFormat; $this->sVersion = $sVersion; $this->sValidation = $sValidation; $this->sEncoding = $sEncoding; } function printHTML($sIndent='') { header('content-type: text/html; charset=' . $this->sEncoding); if ('XHTML' == $this->sFormat) print '<' . '?' . 'xml version="1.0" encoding="' . $this->sEncoding . '" ' . '?' . ">\n"; print $this->sText; print "\n"; xajaxControlContainer::_printChildren($sIndent); } } class clsHtml extends xajaxControlContainer { function clsHtml($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('html', $aConfiguration); $this->sClass = '%block'; $this->sEndTag = 'optional'; } } class clsHead extends xajaxControlContainer { var $objXajax; function clsHead($aConfiguration=array()) { $this->objXajax = null; if (isset($aConfiguration['xajax'])) $this->setXajax($aConfiguration['xajax']); xajaxControlContainer::xajaxControlContainer('head', $aConfiguration); $this->sClass = '%block'; $this->sEndTag = 'optional'; } function setXajax(&$objXajax) { $this->objXajax =& $objXajax; } function _printChildren($sIndent='') { if (null != $this->objXajax) $this->objXajax->printJavascript(); xajaxControlContainer::_printChildren($sIndent); } } class clsBody extends xajaxControlContainer { function clsBody($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('body', $aConfiguration); $this->sClass = '%block'; $this->sEndTag = 'optional'; } } class clsScript extends xajaxControlContainer { function clsScript($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('script', $aConfiguration); $this->sClass = '%block'; } } class clsStyle extends xajaxControlContainer { function clsStyle($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('style', $aConfiguration); $this->sClass = '%block'; } } class clsLink extends xajaxControl { function clsLink($aConfiguration=array()) { xajaxControl::xajaxControl('link', $aConfiguration); $this->sClass = '%block'; } } class clsMeta extends xajaxControl { function clsMeta($aConfiguration=array()) { xajaxControl::xajaxControl('meta', $aConfiguration); $this->sClass = '%block'; } } class clsTitle extends xajaxControlContainer { function clsTitle($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('title', $aConfiguration); $this->sClass = '%block'; } function setEvent($sEvent, &$objRequest) { trigger_error( 'clsTitle objects do not support events.' . $this->backtrace(), E_USER_ERROR); } } class clsBase extends xajaxControl { function clsBase($aConfiguration=array()) { xajaxControl::xajaxControl('base', $aConfiguration); $this->sClass = '%block'; } } class clsNoscript extends xajaxControlContainer { function clsNoscript($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('noscript', $aConfiguration); $this->sClass = '%flow'; } } class clsIframe extends xajaxControlContainer { function clsIframe($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('iframe', $aConfiguration); $this->sClass = '%block'; } } class clsFrameset extends xajaxControlContainer { function clsFrameset($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('frameset', $aConfiguration); $this->sClass = '%block'; } } class clsFrame extends xajaxControl { function clsFrame($aConfiguration=array()) { xajaxControl::xajaxControl('frame', $aConfiguration); $this->sClass = '%block'; } } class clsNoframes extends xajaxControlContainer { function clsNoframes($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('noframes', $aConfiguration); $this->sClass = '%flow'; } } php-xajax-0.5/xajax_controls/validate_XHTML10TRANSITIONAL.inc.php0000644000175000017500000003504511137037724022767 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: validate_XHTML10TRANSITIONAL.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Description This file contains the validation rules for the XHTML 1.0 Transitional standard as defined by the W3C */ $aAttributes = array( '%coreattrs' => array( 'id', 'class', 'style', 'title' ), '%i18n' => array( 'lang', 'xml:lang', 'dir' ), '%events' => array( 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup' ), '%focus' => array( 'accesskey', 'tabindex', 'onfocus', 'onblur' ), '%attrs' => array( '%coreattrs', '%i18n', '%events' ), '%TextAlign' => array('align'), 'html' => array( '%i18n', 'id', 'xmlns' ), 'head' => array( '%i18n', 'id', 'profile' ), 'title' => array( '%i18n', 'id' ), 'base' => array( 'id', 'href', 'target' ), 'meta' => array( '%i18n', 'id', 'http-equiv', 'name', 'content', 'scheme' ), 'link' => array( '%attrs', 'charset', 'href', 'hreflang', 'type', 'rel', 'rev', 'media', 'target' ), 'style' => array( '%i18n', 'id', 'type', 'media', 'title', 'xml:space' ), 'script' => array( 'id', 'charset', 'type', 'language', 'src', 'defer', 'xml:space' ), 'noscript' => array('%attrs'), 'iframe' => array( '%coreattrs', 'longdesc', 'name', 'src', 'frameborder', 'marginwidth', 'marginheight', 'scrolling', 'align', 'height', 'width' ), 'noframes' => array('%attrs'), 'body' => array( '%attrs', 'onload', 'onunload', 'background', 'bgcolor', 'text', 'link', 'vlink', 'alink' ), 'div' => array( '%attrs', '%TextAlign' ), 'p' => array( '%attrs', '%TextAlign' ), 'h1' => array( '%attrs', '%TextAlign' ), 'h2' => array( '%attrs', '%TextAlign' ), 'h3' => array( '%attrs', '%TextAlign' ), 'h4' => array( '%attrs', '%TextAlign' ), 'h5' => array( '%attrs', '%TextAlign' ), 'h6' => array( '%attrs', '%TextAlign' ), 'ul' => array( '%attrs', 'type', 'compact' ), 'ol' => array( '%attrs', 'type', 'compact', 'start' ), 'menu' => array( '%attrs', 'compact' ), 'dir' => array( '%attrs', 'compact' ), 'li' => array( '%attrs', 'type', 'value' ), 'dl' => array( '%attrs', 'compact' ), 'dt' => array('%attrs'), 'dd' => array('%attrs'), 'address' => array( '%attrs' ), 'hr' => array( '%attrs', 'align', 'noshade', 'size', 'width' ), 'pre' => array( '%attrs', 'width', 'xml:space' ), 'blockquote' => array( '%attrs', 'cite' ), 'center' => array('%attrs'), 'ins' => array( '%attrs', 'cite', 'datetime' ), 'del' => array( '%attrs', 'cite', 'datetime' ), 'a' => array( '%attrs', '%focus', 'charset', 'type', 'name', 'href', 'hreflang', 'rel', 'rev', 'shape', 'coords', 'target' ), 'span' => array('%attrs'), 'bdo' => array( '%coreattrs', '%events', 'lang', 'xml:lang', 'dir' ), 'br' => array( '%coreattrs', 'clear' ), 'em' => array('%attrs'), 'strong' => array('%attrs'), 'dfn' => array('%attrs'), 'code' => array('%attrs'), 'samp' => array('%attrs'), 'kbd' => array('%attrs'), 'var' => array('%attrs'), 'cite' => array('%attrs'), 'abbr' => array('%attrs'), 'acronym' => array('%attrs'), 'q' => array('%attrs','cite'), 'sub' => array('%attrs'), 'sup' => array('%attrs'), 'tt' => array('%attrs'), 'i' => array('%attrs'), 'b' => array('%attrs'), 'big' => array('%attrs'), 'small' => array('%attrs'), 'u' => array('%attrs'), 's' => array('%attrs'), 'strike' => array('%attrs'), 'basefont' => array( 'id', 'size', 'color', 'face' ), 'font' => array( '%coreattrs', '%i18n', 'size', 'color', 'face' ), 'object' => array( '%attrs', 'declare', 'classid', 'codebase', 'data', 'type', 'codetype', 'archive', 'standby', 'height', 'width', 'usemap', 'name', 'tabindex', 'align', 'border', 'hspace', 'vspace' ), 'param' => array( 'id', 'name', 'value', 'valuetype', 'type' ), 'applet' => array( '%coreattrs', 'codebase', 'archive', 'code', 'object', 'alt', 'name', 'width', 'height', 'align', 'hspace', 'vspace' ), 'img' => array( '%attrs', 'src', 'alt', 'name', 'longdesc', 'height', 'width', 'usemap', 'ismap', 'align', 'border', 'hspace', 'vspace' ), 'map' => array( '%i18n', '%events', 'id', 'class', 'style', 'title', 'name' ), 'area' => array( '%attrs', '%focus', 'shape', 'coords', 'href', 'nohref', 'alt', 'target' ), 'form' => array( '%attrs', 'action', 'method', 'name', 'enctype', 'onsubmit', 'onreset', 'accept', 'accept-charset', 'target' ), 'label' => array( '%attrs', 'for', 'accesskey', 'onfocus', 'onblur' ), 'input' => array( '%attrs', '%focus', 'type', 'name', 'value', 'checked', 'disabled', 'readonly', 'size', 'maxlength', 'src', 'alt', 'usemap', 'onselect', 'onchange', 'accept', 'align' ), 'select' => array( '%attrs', 'name', 'size', 'multiple', 'disabled', 'tabindex', 'onfocus', 'onblur', 'onchange' ), 'optgroup' => array( '%attrs', 'disabled', 'label' ), 'option' => array( '%attrs', 'selected', 'disabled', 'label', 'value' ), 'textarea' => array( '%attrs', '%focus', 'name', 'rows', 'cols', 'disabled', 'readonly', 'onselect', 'onchange' ), 'fieldset' => array('%attrs'), 'legend' => array( '%attrs', 'accesskey', 'align' ), 'button' => array( '%attrs', '%focus', 'name', 'value', 'type', 'disabled' ), 'isindex' => array( '%coreattrs', '%i18n', 'prompt' ), 'table' => array( '%attrs', 'summary', 'width', 'border', 'frame', 'rules', 'cellspacing', 'cellpadding', 'align', 'bgcolor' ), 'caption' => array( '%attrs', 'align' ), 'colgroup' => array( '%attrs', 'span', 'width', '%cellhalign', '%cellvalign' ), 'col' => array( '%attrs', 'span', 'width', '%cellhalign', '%cellvalign' ), 'thead' => array( '%attrs', '%cellhalign', '%cellvalign' ), 'tfoot' => array( '%attrs', '%cellhalign', '%cellvalign' ), 'tbody' => array( '%attrs', '%cellhalign', '%cellvalign' ), 'tr' => array( '%attrs', '%cellhalign', '%cellvalign', 'bgcolor' ), 'th' => array( '%attrs', 'abbr', 'axis', 'headers', 'scope', 'rowspan', 'colspan', '%cellhalign', '%cellvalign', 'nowrap', 'bgcolor', 'width', 'height' ), 'td' => array( '%attrs', 'abbr', 'axis', 'headers', 'scope', 'rowspan', 'colspan', '%cellhalign', '%cellvalign', 'nowrap', 'bgcolor', 'width', 'height' ), ); $aTags = array( '%special.extra' => array( 'object', 'applet', 'img', 'map', 'iframe' ), '%special.basic' => array( 'br', 'span', 'bdo' ), '%special' => array( '%special.basic', '%special.extra' ), '%fontstyle.extra' => array( 'big', 'small', 'font', 'basefont' ), '%fontstyle.basic' => array( 'tt', 'i', 'b', 'u', 's', 'strike' ), '%fontstyle' => array( '%fontstyle.basic', '%fontstyle.extra' ), '%phrase.extra' => array( 'sub', 'sup' ), '%phrase.basic' => array( 'em', 'strong', 'dfn', 'code', 'q', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym' ), '%phrase' => array( '%phrase.basic', '%phrase.extra' ), '%inline.forms' => array( 'input', 'select', 'textarea', 'label', 'button' ), '%misc.inline' => array( 'ins', 'del', 'script' ), '%misc' => array( 'noscript', '%misc.inline' ), '%inline' => array( 'a', '%special', '%fontstyle', '%phrase', '%inline.forms' ), '%Inline' => array( 'cdata', '%inline', '%misc.inline' ), '%heading' => array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ), '%lists' => array( 'ul', 'ol', 'dl', 'menu', 'dir' ), '%blocktext' => array( 'pre', 'hr', 'blockquote', 'address', 'center', 'noframes' ), '%block' => array( 'p', '%heading', 'div', '%lists', '%blocktext', 'isindex', 'fieldset', 'table' ), '%Flow' => array( 'cdata', '%block', 'form', '%inline', '%misc' ), '%a.content' => array( 'cdata', '%special', '%fontstyle', '%phrase', '%inline.forms', '%misc.inline' ), '%pre.content' => array( 'cdata', 'a', '%special.basic', '%fontstyle.basic', '%phrase.basic', '%inline.forms', '%misc.inline' ), '%form.content' => array( 'cdata', '%block', '%inline', '%misc' ), '%button.content' => array( 'cdata', 'p', '%heading', 'div', '%lists', '%blocktext', 'table', 'br', 'span', 'bdo', 'object', 'applet', 'img', 'map', '%fontstyle', '%phrase', '%misc' ), '%head.misc' => array( 'script', 'style', 'meta', 'link', 'object' ), 'html' => array( 'head', 'body' ), 'head' => array( '%head.misc', 'title', 'base' ), 'title' => array('cdata'), 'base' => array(), 'meta' => array(), 'link' => array(), 'style' => array('cdata'), 'script' => array('cdata'), 'noscript' => array('%Flow'), 'iframe' => array('%Flow'), 'noframes' => array('%Flow'), 'body' => array('%Flow'), 'div' => array('%Flow'), 'p' => array('%Inline'), 'h1' => array('%Inline'), 'h2' => array('%Inline'), 'h3' => array('%Inline'), 'h4' => array('%Inline'), 'h5' => array('%Inline'), 'h6' => array('%Inline'), 'ul' => array('li'), 'ol' => array('li'), 'menu' => array('li'), 'dir' => array('li'), 'li' => array('%Flow'), 'dl' => array( 'dt', 'dd' ), 'dt' => array('%Inline'), 'dd' => array('%Flow'), 'address' => array('cdata', '%inline', '%misc.inline', 'p'), 'hr' => array(), 'pre' => array('%pre.content'), 'blockquote' => array('%Flow'), 'center' => array('%Flow'), 'ins' => array('%Flow'), 'del' => array('%Flow'), 'a' => array('%a.content'), 'span' => array('%Inline'), 'bdo' => array('%Inline'), 'br' => array(), 'em' => array('%Inline'), 'strong' => array('%Inline'), 'dfn' => array('%Inline'), 'code' => array('%Inline'), 'samp' => array('%Inline'), 'kbd' => array('%Inline'), 'var' => array('%Inline'), 'cite' => array('%Inline'), 'abbr' => array('%Inline'), 'acronym' => array('%Inline'), 'q' => array('%Inline'), 'sub' => array('%Inline'), 'sup' => array('%Inline'), 'tt' => array('%Inline'), 'i' => array('%Inline'), 'b' => array('%Inline'), 'big' => array('%Inline'), 'small' => array('%Inline'), 'u' => array('%Inline'), 's' => array('%Inline'), 'strike' => array('%Inline'), 'basefont' => array(), 'font' => array('%Inline'), 'object' => array( 'cdata', 'param', '%block', 'form', '%inline', '%misc' ), 'param' => array(), 'applet' => array( 'cdata', 'param', '%block', 'form', '%inline', '%misc' ), 'img' => array(), 'map' => array( '%block', 'form', '%misc', 'area' ), 'area' => array(), 'form' => array('%form.content'), 'label' => array('%Inline'), 'input' => array(), 'select' => array('optgroup','option'), 'optgroup' => array('option'), 'option' => array('cdata'), 'textarea' => array('cdata'), 'fieldset' => array('cdata','legend','%block','form','%inline','%misc'), 'legend' => array('%Inline'), 'button' => array('%button.content'), 'isindex' => array(), 'table' => array('caption','col','colgroup','thead','tfoot','tbody','tr'), 'caption' => array('%Inline'), 'thead' => array('tr'), 'tfoot' => array('tr'), 'tbody' => array('tr'), 'colgroup' => array('col'), 'col' => array(), 'tr' => array('th','td'), 'th' => array('%Flow'), 'td' => array('%Flow'), 'document' => array( 'doctype', 'html' ), 'doctype' => array( 'cdata' ) ); $aRequiredAttributes = array( 'html' => array( 'xmlns', 'xml:lang', 'lang' ), 'style' => array('type'), 'script' => array('type'), 'meta' => array('content'), 'optgroup' => array('label'), 'textarea' => array('rows', 'cols'), 'img' => array('src', 'alt') ); class clsValidator { var $aTags; var $aAttributes; var $aRequiredAttributes; function clsValidator() { global $aTags; global $aAttributes; global $aRequiredAttributes; $this->aTags = array(); $this->aAttributes = array(); $this->aRequiredAttributes = array(); foreach (array_keys($aTags) as $sTag) { $this->aTags[$sTag] = array(); $this->_expand($this->aTags[$sTag], $aTags[$sTag], $aTags); } foreach (array_keys($aAttributes) as $sAttribute) { $this->aAttributes[$sAttribute] = array(); $this->_expand($this->aAttributes[$sAttribute], $aAttributes[$sAttribute], $aAttributes); } foreach (array_keys($aRequiredAttributes) as $sElement) { $this->aRequiredAttributes[$sElement] = array(); $this->_expand($this->aRequiredAttributes[$sElement], $aRequiredAttributes[$sElement], $aRequiredAttributes); } } function &getInstance() { static $obj; if (!$obj) { $obj = new clsValidator(); } return $obj; } function _expand(&$aDestination, &$aSource, &$aDictionary) { foreach ($aSource as $sChild) { if ('%' == substr($sChild, 0, 1)) $this->_expand($aDestination, $aDictionary[$sChild], $aDictionary); else $aDestination[] = $sChild; } } function elementValid($sElement) { return isset($this->aTags[strtolower($sElement)]); } function attributeValid($sElement, $sAttribute) { if (false == isset($this->aAttributes[strtolower($sElement)])) return false; return in_array(strtolower($sAttribute), $this->aAttributes[strtolower($sElement)]); } function childValid($sParent, $sElement) { if (false == isset($this->aTags[strtolower($sParent)])) return false; return in_array(strtolower($sElement), $this->aTags[strtolower($sParent)]); } // verify that required attributes have been specified function checkRequiredAttributes($sElement, &$aAttributes, &$sMissing) { if (isset($this->aRequiredAttributes[strtolower($sElement)])) foreach ($this->aRequiredAttributes[strtolower($sElement)] as $sRequiredAttribute) if (false == isset($aAttributes[$sRequiredAttribute])) { $sMissing = $sRequiredAttribute; return false; } return true; } } php-xajax-0.5/xajax_controls/validate_HTML401TRANSITIONAL.inc.php0000644000175000017500000003533511137037724022725 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: validate_HTML401TRANSITIONAL.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Description This file contains the validation rules for the HTML 4.01 Transitional standard as defined by the W3C */ $aAttributes = array( '%bodycolors' => array( 'bgcolor', 'text', 'link', 'vlink', 'alink' ), '%coreattrs' => array( 'id', 'class', 'style', 'title' ), '%i18n' => array( 'lang', 'dir' ), '%events' => array( 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup' ), '%attrs' => array( '%coreattrs', '%i18n', '%events' ), '%align' => array( 'left', 'center', 'right', 'justify' ), '%cellhalign' => array( 'align' ), '%cellvalign' => array( 'valign' ), 'TT' => array('%attrs'), 'I' => array('%attrs'), 'B' => array('%attrs'), 'U' => array('%attrs'), 'S' => array('%attrs'), 'STRIKE' => array('%attrs'), 'BIG' => array('%attrs'), 'SMALL' => array('%attrs'), 'EM' => array('%attrs'), 'STRONG' => array('%attrs'), 'DFN' => array('%attrs'), 'CODE' => array('%attrs'), 'SAMP' => array('%attrs'), 'KBD' => array('%attrs'), 'VAR' => array('%attrs'), 'CITE' => array('%attrs'), 'ABBR' => array('%attrs'), 'ACRONYM' => array('%attrs'), 'SUB' => array('%attrs'), 'SUP' => array('%attrs'), 'SPAN' => array( '%attrs' // , // '%reserved' ), 'BDO' => array( '%coreattrs', 'lang', 'dir' ), 'BASEFONT' => array( 'id', 'size', 'color', 'face' ), 'FONT' => array( '%coreattrs', '%i18n', 'size', 'color', 'face' ), 'BR' => array( '%coreattrs', 'clear' ), 'BODY' => array( '%attrs', 'onload', 'onunload', 'background', '%bodycolors' ), 'ADDRESS' => array('%attrs'), 'DIV' => array( '%attrs', '%align' // , // '%reserved' ), 'CENTER' => array('%attrs'), 'A' => array( '%attrs', 'charset', 'type', 'name', 'href', 'hreflang', 'target', 'rel', 'rev', 'accesskey', 'shape', 'coords', 'tabindex', 'onfocus', 'onblur' ), 'MAP' => array( '%attrs', 'name' ), 'AREA' => array( '%attrs', 'shape', 'coords', 'href', 'target', 'nohref', 'alt', 'tabindex', 'accesskey', 'onfocus', 'onblur' ), 'LINK' => array( '%attrs', 'charset', 'href', 'hreflang', 'type', 'rel', 'rev', 'media', 'target' ), 'IMG' => array( '%attrs', 'src', 'alt', 'longdesc', 'name', 'height', 'width', 'usemap', 'ismap', 'align', 'border', 'hspace', 'vspace' ), 'OBJECT' => array( '%attrs', 'declare', 'classid', 'codebase', 'data', 'type', 'codetype', 'archive', 'standby', 'height', 'width', 'usemap', 'name', 'tabindex', 'align', 'border', 'hspace', 'vspace' // , // '%reserved' ), 'PARAM' => array( 'id', 'name', 'value', 'valuetype', 'type' ), 'APPLET' => array( '%coreattrs', 'codebase', 'archive', 'code', 'object', 'alt', 'name', 'width', 'height', 'align', 'hspace', 'vspace' ), 'HR' => array( '%attrs', 'align', 'noshade', 'size', 'width' ), 'P' => array( '%attrs', '%align' ), 'H1' => array( '%attrs', '%align' ), 'H2' => array( '%attrs', '%align' ), 'H3' => array( '%attrs', '%align' ), 'H4' => array( '%attrs', '%align' ), 'H5' => array( '%attrs', '%align' ), 'H6' => array( '%attrs', '%align' ), 'PRE' => array( '%attrs', 'width' ), 'Q' => array( '%attrs', 'cite' ), 'BLOCKQUOTE' => array( '%attrs', 'cite' ), 'INS' => array( '%attrs', 'cite', 'datetime' ), 'DEL' => array( '%attrs', 'cite', 'datetime' ), 'DL' => array( '%attrs', 'compact' ), 'DT' => array('%attrs'), 'DD' => array('%attrs'), 'OL' => array( '%attrs', 'type', 'compact', 'start' ), 'UL' => array( '%attrs', 'type', 'compact' ), 'DIR' => array( '%attrs', 'compact' ), 'MENU' => array( '%attrs', 'compact' ), 'LI' => array( '%attrs', 'type', 'value' ), 'FORM' => array( '%attrs', 'action', 'method', 'enctype', 'accept', 'name', 'onsubmit', 'onreset', 'target', 'accept-charset' ), 'LABEL' => array( '%attrs', 'for', 'accesskey', 'onfocus', 'onblur' ), 'INPUT' => array( '%attrs', 'type', 'name', 'value', 'checked', 'disabled', 'readonly', 'size', 'maxlength', 'src', 'alt', 'usemap', 'ismap', 'tabindex', 'accesskey', 'onfocus', 'onblur', 'onselect', 'onchange', 'accept', 'align' // , // '%reserved' ), 'SELECT' => array( '%attrs', 'name', 'size', 'multiple', 'disabled', 'tabindex', 'onfocus', 'onblur', 'onchange' // , // '%reserved' ), 'OPTGROUP' => array( '%attrs', 'disabled', 'label' ), 'OPTION' => array( '%attrs', 'selected', 'disabled', 'label', 'value' ), 'TEXTAREA' => array( '%attrs', 'name', 'rows', 'cols', 'disabled', 'readonly', 'tabindex', 'accesskey', 'onfocus', 'onblur', 'onselect', 'onchange' // , // '%reserved' ), 'FIELDSET' => array('%attrs'), 'LEGEND' => array( '%attrs', 'accesskey', 'align' ), 'BUTTON' => array( '%attrs', 'name', 'value', 'type', 'disabled', 'tabindex', 'accesskey', 'onfocus', 'onblur' // , // '%reserved' ), 'TABLE' => array( '%attrs', 'summary', 'width', 'border', 'frame', 'rules', 'cellspacing', 'cellpadding', 'align', 'bgcolor', // '%reserved', 'datapagesize' ), 'CAPTION' => array('%attrs', 'align'), 'COLGROUP' => array( '%attrs', 'span', 'width', '%cellhalign', '%cellvalign' ), 'COL' => array( '%attrs', 'span', 'width', '%cellhalign', '%cellvalign' ), 'THEAD' => array( '%attrs', '%cellhalign', '%cellvalign' ), 'TBODY' => array( '%attrs', '%cellhalign', '%cellvalign' ), 'TFOOT' => array( '%attrs', '%cellhalign', '%cellvalign' ), 'TR' => array( '%attrs', '%cellhalign', '%cellvalign', 'bgcolor' ), 'TH' => array( '%attrs', 'abbr', 'axis', 'headers', 'scope', 'rowspan', 'colspan', '%cellhalign', '%cellvalign', 'nowrap', 'bgcolor', 'width', 'height' ), 'TD' => array( '%attrs', 'abbr', 'axis', 'headers', 'scope', 'rowspan', 'colspan', '%cellhalign', '%cellvalign', 'nowrap', 'bgcolor', 'width', 'height' ), 'IFRAME' => array( '%coreattrs', 'longdesc', 'name', 'src', 'frameborder', 'marginwidth', 'marginheight', 'scrolling', 'align', 'height', 'width' ), 'NOFRAMES' => array('%attrs'), 'HEAD' => array( '%i18n', 'profile' ), 'TITLE' => array('%i18n'), 'BASE' => array( 'href', 'target' ), 'META' => array( '%i18n', 'http-equiv', 'name', 'content', 'scheme' ), 'STYLE' => array( '%i18n', 'type', 'media', 'title' ), 'SCRIPT' => array( 'charset', 'type', 'language', 'src', 'defer', 'event', 'for' ), 'NOSCRIPT' => array('%attrs'), 'HTML' => array('%i18n') // , '%version') ); $aTags = array( '%heading' => array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ), '%list' => array( 'UL', 'OL', 'DIR', 'MENU' ), '%preformatted' => array('PRE'), '%fontstyle' => array( 'TT', 'I', 'B', 'U', 'S', 'STRIKE', 'BIG', 'SMALL' ), '%phrase' => array( 'EM', 'STRONG', 'DFN', 'CODE', 'SAMP', 'KBD', 'VAR', 'CITE', 'ABBR', 'ACRONYM' ), '%special' => array( 'A', 'IMG', 'APPLET', 'OBJECT', 'FONT', 'BASEFONT', 'BR', 'SCRIPT', 'MAP', 'Q', 'SUB', 'SUP', 'SPAN', 'BDO', 'IFRAME' ), '%formctrl' => array( 'INPUT', 'SELECT', 'TEXTAREA', 'LABEL', 'BUTTON' ), '%inline' => array( 'CDATA', '%fontstyle', '%phrase', '%special', '%formctrl' ), '%block' => array( 'P', '%heading', '%list', '%preformatted', 'DL', 'DIV', 'CENTER', 'NOSCRIPT', 'NOFRAMES', 'BLOCKQUOTE', 'INS', 'DEL', 'FORM', 'ISINDEX', 'HR', 'TABLE', 'FIELDSET', 'ADDRESS' ), '%flow' => array( '%block', '%inline' ), 'TT' => array('%inline'), // fontstyle 'I' => array('%inline'), 'B' => array('%inline'), 'U' => array('%inline'), 'S' => array('%inline'), 'STRIKE' => array('%inline'), 'BIG' => array('%inline'), 'SMALL' => array('%inline'), 'EM' => array('%inline'), // phrase 'STRONG' => array('%inline'), 'DFN' => array('%inline'), 'CODE' => array('%inline'), 'SAMP' => array('%inline'), 'KBD' => array('%inline'), 'VAR' => array('%inline'), 'CITE' => array('%inline'), 'ABBR' => array('%inline'), 'ACRONYM' => array('%inline'), 'SUB' => array('%inline'), 'SUP' => array('%inline'), 'SPAN' => array('%inline'), 'BDO' => array('%inline'), 'BASEFONT' => array(), 'FONT' => array('%inline'), 'BR' => array(), 'BODY' => array( '%flow', 'INS', 'DEL' ), 'ADDRESS' => array( '%inline', 'P' ), 'DIV' => array('%flow'), 'CENTER' => array('%flow'), 'A' => array('%inline'), 'MAP' => array( '%block', 'AREA' ), 'AREA' => array(), 'LINK' => array(), 'IMG' => array(), 'OBJECT' => array( 'PARAM', '%flow' ), 'PARAM' => array(), 'HR' => array(), 'P' => array('%inline'), 'H1' => array('%inline'), 'H2' => array('%inline'), 'H3' => array('%inline'), 'H4' => array('%inline'), 'H5' => array('%inline'), 'H6' => array('%inline'), 'PRE' => array('%inline'), 'Q' => array('%inline'), 'BLOCKQUOTE' => array('%flow'), 'INS' => array('%flow'), 'DEL' => array('%flow'), 'DL' => array( 'DT', 'DD' ), 'DT' => array('%inline'), 'DD' => array('%flow'), 'OL' => array('LI'), 'UL' => array('LI'), 'DIR' => array('LI'), 'MENU' => array('LI'), 'LI' => array('%flow'), 'FORM' => array('%flow'), 'LABEL' => array('%inline'), 'INPUT' => array(), 'SELECT' => array( 'OPTGROUP', 'OPTION' ), 'OPTGROUP' => array('OPTION'), 'OPTION' => array('CDATA'), 'TEXTAREA' => array('CDATA'), 'FIELDSET' => array( 'CDATA', 'LEGEND', '%flow' ), 'LEGEND' => array('%inline'), 'BUTTON' => array('%flow'), 'TABLE' => array( 'CAPTION', 'COL', 'COLGROUP', 'THEAD', 'TFOOT', 'TBODY' ), 'CAPTION' => array('%inline'), 'THEAD' => array('TR'), 'TFOOT' => array('TR'), 'TBODY' => array('TR'), 'COLGROUP' => array('COL'), 'COL' => array(), 'TR' => array( 'TH', 'TD' ), 'TH' => array('%flow'), 'TD' => array('%flow'), 'IFRAME' => array('%flow'), 'NOFRAMES' => array('%flow'), 'HEAD' => array( 'TITLE', 'BASE', 'SCRIPT', 'STYLE', 'META', 'LINK', 'OBJECT' ), 'TITLE' => array('CDATA'), 'META' => array(), 'STYLE' => array('CDATA'), 'SCRIPT' => array('CDATA'), 'NOSCRIPT' => array('%flow'), 'BASE' => array(), 'HTML' => array( 'HEAD', 'BODY' ), 'DOCUMENT' => array( 'DOCTYPE', 'HTML' ) ); $aExclusions = array( 'A' => array('A'), 'PRE' => array( 'IMG', 'OBJECT', 'APPLET', 'BIG', 'SMALL', 'SUB', 'SUP', 'FONT', 'BASEFONT' ), 'DIR' => array('%block'), 'MENU' => array('%block'), 'FORM' => array('FORM'), 'LABEL' => array('LABEL'), 'BUTTON' => array( 'A', '%formctrl', 'FORM', 'ISINDEX', 'FIELDSET', 'IFRAME' ) ); $aRequiredAttributes = array( 'style' => array('type'), 'script' => array('type'), 'meta' => array('content'), 'optgroup' => array('label'), 'textarea' => array('rows', 'cols'), 'img' => array('src', 'alt') ); class clsValidator { var $aTags; var $aAttributes; var $aRequiredAttributes; function clsValidator() { global $aTags; global $aAttributes; global $aRequiredAttributes; $this->aTags = array(); $this->aAttributes = array(); $this->aRequiredAttributes = array(); foreach (array_keys($aTags) as $sTag) { $this->aTags[$sTag] = array(); $this->_expand($this->aTags[$sTag], $aTags[$sTag], $aTags); } foreach (array_keys($aAttributes) as $sAttribute) { $this->aAttributes[$sAttribute] = array(); $this->_expand($this->aAttributes[$sAttribute], $aAttributes[$sAttribute], $aAttributes); } foreach (array_keys($aRequiredAttributes) as $sElement) { $this->aRequiredAttributes[$sElement] = array(); $this->_expand($this->aRequiredAttributes[$sElement], $aRequiredAttributes[$sElement], $aRequiredAttributes); } } function &getInstance() { static $obj; if (!$obj) { $obj = new clsValidator(); } return $obj; } function _expand(&$aDestination, &$aSource, &$aDictionary) { foreach ($aSource as $sChild) { if ('%' == substr($sChild, 0, 1)) { $this->_expand($aDestination, $aDictionary[$sChild], $aDictionary); } else $aDestination[] = $sChild; } } function elementValid($sElement) { return isset($this->aTags[strtoupper($sElement)]); } function attributeValid($sElement, $sAttribute) { if (false == isset($this->aAttributes[strtoupper($sElement)])) return false; return in_array(strtolower($sAttribute), $this->aAttributes[strtoupper($sElement)]); } function childValid($sParent, $sElement) { if (false == isset($this->aTags[strtoupper($sParent)])) return false; return in_array(strtoupper($sElement), $this->aTags[strtoupper($sParent)]); } // verify that required attributes have been specified function checkRequiredAttributes($sElement, &$aAttributes, &$sMissing) { if (isset($this->aRequiredAttributes[strtolower($sElement)])) foreach ($this->aRequiredAttributes[strtolower($sElement)] as $sRequiredAttribute) if (false == isset($aAttributes[$sRequiredAttribute])) { $sMissing = $sRequiredAttribute; return false; } return true; } } php-xajax-0.5/xajax_controls/structure.inc.php0000644000175000017500000000205511137037724020264 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: structure.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Description This file contains the class declarations for the following HTML Controls: - div, span */ class clsDiv extends xajaxControlContainer { function clsDiv($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('div', $aConfiguration); $this->sClass = '%block'; } } class clsSpan extends xajaxControlContainer { function clsSpan($aConfiguration=array()) { xajaxControlContainer::xajaxControlContainer('span', $aConfiguration); $this->sClass = '%inline'; } } php-xajax-0.5/tests/0000755000175000017500000000000011345167001013036 5ustar dgildgilphp-xajax-0.5/tests/searchReplaceTest.php0000644000175000017500000000543511104471032017152 0ustar dgildgilreplace> which will replace a specified piece of text with another. Title: Test the object. Please see for a detailed description, copyright and license information. */ /* @package xajax @version $Id: searchReplaceTest.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 */ require_once( "../xajax_core/xajax.inc.php" ); function replace( $aForm ) { $objResponse=new xajaxResponse(); $objResponse->replace( 'content', "innerHTML", $aForm['search'], $aForm['replace'] ); return $objResponse; } $xajax=new xajax(); $xajax->setFlag( "debug", true ); $xajax->registerFunction( "replace" ); $xajax->processRequest(); ?> Search and Replace Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

Search and Replace Test

< div id="content"" style="border: 1px solid gray"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi fermentum. Phasellus non nibh. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla id ligula sit amet purus tristique dictum. Fusce at arcu. Maecenas ipsum leo, tincidunt eu, vehicula id, elementum feugiat, enim. Nam fringilla mi ac ligula. Quisque tempus, lacus ut molestie dignissim, massa ipsum sodales arcu, eget rhoncus sapien diam at velit. Morbi fermentum, dui vel tempus vestibulum, diam metus nonummy ligula, ac ultrices lacus est ac sapien. Pellentesque luctus dictum massa. Cras ullamcorper ullamcorper massa. Etiam erat odio, gravida eget, ornare vitae, dapibus nec, nunc. Phasellus ligula arcu, rutrum at, pellentesque et, varius feugiat, velit. Etiam erat magna, eleifend vel, vulputate eget, dignissim non, lectus. Nam at metus. Aenean mollis ligula viverra ipsum.
Search:
Replace:
php-xajax-0.5/tests/includeExternalScriptTest.php0000644000175000017500000000234511104471032020721 0ustar dgildgilincludeScript($sFilename); return $objResponse; } $xajax = new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction("includeScript"); $xajax->processRequest(); ?> Include External Javascript Test | xajax Tests printJavascript("../") ?>

xajax Tests

Include External Javascript Test

Click Me
php-xajax-0.5/tests/redirectTest.php0000644000175000017500000000206511104471032016206 0ustar dgildgilredirect( "http://www.xajaxproject.org" ); return $objResponse; } $xajax=new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction( "redirect" ); $xajax->processRequest(); ?> Redirect Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

Redirect Test

php-xajax-0.5/tests/callTechniquesTest.php0000644000175000017500000001440311104471032017350 0ustar dgildgilalert( "Hello world!" ); $objResponse->assign( "submittedDiv", "style.visibility", "inherit" ); return $objResponse; } function testForm( $formData, $doDelay=false ) { if ( $doDelay ) { sleep( 5 ); } $objResponse=new xajaxResponse(); $objResponse->alert( "POST\nformData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } function testForm2( $formData ) { $objResponse=new xajaxResponse(); $objResponse->alert( "GET\nformData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); $objResponse->assign( "submittedDiv", "style.visibility", "hidden" ); return $objResponse; } function testFormFail( $formData ) { sleep( 2 ); header( "HTTP/1.1 500 Internal Server Error" ); header( "Status: 500" ); echo " \n"; exit; } function testFormExpire( $formData ) { sleep( 15 ); $objResponse=new xajaxResponse(); $objResponse->alert( "POST\nformData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } $xajax=new xajax(); // SEE file list below! //$xajax->setFlag("debug", true); $xajax->registerFunction( "saySomething" ); $xajax->registerFunction( "testForm" ); $xajax->registerFunction( "testForm2" ); $xajax->registerFunction( "testFormFail" ); $xajax->registerFunction( "testFormExpire" ); $xajax->processRequest(); ?> Call Techniques Test | xajax Tests printJavascript( "../", $xajax_files ) ?>

xajax Tests

Call Techniques Test

Say Something

php-xajax-0.5/tests/catchAllFunctionTest.php0000644000175000017500000000510111104471032017620 0ustar dgildgilalert( "formData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } 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->setFlag( "errorHandler", true ); $xajax->registerEvent( XAJAX_PROCESSING_EVENT_INVALID, "onInvalidRequest" ); if ( isset( $_GET['registerFunction'] ) ) if ( 1 == $_GET['registerFunction'] ) $xajax->registerFunction( "testForm" ); $xajax->processRequest(); ?> onMissingFunction Event (used to be catch-all) Function Test | xajax Tests printJavascript() ?>

xajax Tests

invalidRequest Event Handler

Disable Normal Handler Enable Normal Handler
php-xajax-0.5/tests/preFunctionTest.php0000644000175000017500000000721711104471032016705 0ustar dgildgilalert( "formData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } function beforeProcessing( &$bEndRequest ) { $objResponse=new xajaxResponse(); $objArgumentManager=&xajaxArgumentManager::getInstance(); $args=$objArgumentManager->process(); if ( $args[1] == 0 ) { $get=print_r( $_GET, true ); $post=print_r( $_POST, true ); $objResponse->alert( 'This is from the processing event handler, beforeProcessing, which will now allow the request to continue:' . "\n" . $get . $post ); return $objResponse; } $bEndRequest=true; $objResponse->alert( "This is from the pre-function, which will now end the request." ); return $objResponse; } class myPreObject { var $message="This is from the pre-function object method"; function beforeProcessing( &$bEndRequest ) { $objResponse=new xajaxResponse(); $objArgumentManager=&xajaxArgumentManager::getInstance(); $args=$objArgumentManager->process(); if ( $args[1] == 0 ) { $get=print_r( $_GET, true ); $post=print_r( $_POST, true ); $objResponse->alert( $this->message . ', which will now allow the request to continue:' . "\n" . $get . $post ); return $objResponse; } $bEndRequest=true; $objResponse->alert( $this->message . ", which will now end the request." ); return $objResponse; } } $xajax=new xajax(); //$xajax->setFlag("debug", true); if ( isset( $_GET['useObjects'] ) ) { if ( 'true' == $_GET['useObjects'] ) { $preObj=new myPreObject(); $xajax->registerEvent( XAJAX_PROCESSING_EVENT_BEFORE, array ( &$preObj, "beforeProcessing" )); } } else { $xajax->registerEvent( XAJAX_PROCESSING_EVENT_BEFORE, "beforeProcessing" ); } $xajax->registerFunction( "testRegularFunction" ); $xajax->processRequest(); ?> beforeProcessing Event (used to be pre-function) Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

beforeProcessing Event (used to be pre-function) Test

Reload using object

php-xajax-0.5/tests/formSubmissionTest.php0000644000175000017500000001447411104471032017433 0ustar dgildgilalert( "formData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } $xajax=new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction( "testForm" ); $xajax->processRequest(); ?> Form Submission Test| xajax Tests printJavascript( "../" ) ?>

xajax Tests

Form Submission Test

Test Form
Text Input
Password Input
Textarea
Radio Input
Select
Multiple Select
php-xajax-0.5/tests/phpWhitespaceTest.php0000644000175000017500000000247011104471032017211 0ustar dgildgilcanProcessRequest() ) echo ' '; $xajax->configure( 'debug', true ); $xajax->register( XAJAX_FUNCTION, 'showOutput' ); $xajax->processRequest(); function showOutput( ) { $objResponse=new xajaxResponse(); $objResponse->alert( "Hello" ); return $objResponse; } ?> PHP Whitespace Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

PHP Whitespace Test

This tests what happens when there's whitespace before the <?php token in the PHP file (thus possibly causing the XML response to be invalid).

php-xajax-0.5/tests/changeEventTest.php0000644000175000017500000000235710641226120016641 0ustar dgildgiladdEvent($sId, "onclick", $sCode); return $objResponse; } $xajax = new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction("addEvent"); $xajax->processRequest(); ?> Change Event Test | xajax Tests printJavascript("../") ?>

xajax Tests

Change Event Test

Click Me
php-xajax-0.5/tests/callScriptTest.php0000644000175000017500000000433711104471032016511 0ustar dgildgilcall( "myJSFunction", "arg1", 9432.12, array ( "myKey" => "some value", "key2" => $value2 )); return $response; } function callOtherScript( ) { $response=new xajaxResponse(); $response->call( "myOtherJSFunction" ); return $response; } $xajax=new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction( "callScript" ); $xajax->registerFunction( "callOtherScript" ); $xajax->processRequest(); ?> call Script Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

call Script Test

Howdy.

Result:

[blank]

Expecting:

arg1 and 9532.12
        some value | this is a string
php-xajax-0.5/tests/largeResponseTest.php0000644000175000017500000000236411104471032017220 0ustar dgildgilHere is paragraph $i for your reading pleasure.

\n"; } $objResponse->assign( "submittedDiv", "innerHTML", $myResponse ); return $objResponse; } $xajax=new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction( "largeResponse" ); $xajax->processRequest(); ?> Large Response Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

Large Response Test

php-xajax-0.5/tests/disabledFormElementsTest.php0000644000175000017500000000256610641226120020504 0ustar dgildgilalert("formData: " . print_r($formData, true)); $objResponse->assign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); return $objResponse; } $xajax = new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction("testForm"); $xajax->processRequest(); ?> Disabled Form Elements Test | xajax Tests printJavascript("../") ?>

xajax Tests

Disabled Form Elements Test

php-xajax-0.5/tests/legacy_tests/0000755000175000017500000000000011137074666015541 5ustar dgildgilphp-xajax-0.5/tests/legacy_tests/catchAllFunctionTest.php0000644000175000017500000000425410760021500022314 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: catchAllFunctionTest.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 */ require_once("../../xajax_core/xajax.inc.php"); require_once("../../xajax_core/legacy.inc.php"); function test2ndFunction($formData, $objResponse) { $objResponse->addAlert("formData: " . print_r($formData, true)); $objResponse->addAssign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); return $objResponse->getXML(); } function myCatchAllFunction($funcName, $args) { $objResponse = new legacyXajaxResponse(); $objResponse->addAlert("This is from the catch all function"); // return $objResponse; return test2ndFunction($args[0], $objResponse); } function testForm($formData) { $objResponse = new legacyXajaxResponse(); $objResponse->addAlert("This is from the regular function"); return test2ndFunction($formData, $objResponse); } $xajax = new legacyXajax(); $xajax->registerCatchAllFunction("myCatchAllFunction"); //$xajax->registerFunction("testForm"); $xajax->processRequests(); ?> Catch-all Function Test (Legacy) | xajax Tests printJavascript("../../") ?>

xajax Legacy Mode Tests

Catch-all Function Test (Legacy)

php-xajax-0.5/tests/legacy_tests/preFunctionTest.php0000644000175000017500000000574210760021500021372 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: preFunctionTest.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 */ require_once("../../xajax_core/xajax.inc.php"); require_once("../../xajax_core/legacy.inc.php"); function testRegularFunction($formData) { $objResponse = new legacyXajaxResponse(); $objResponse->addAlert("formData: " . print_r($formData, true)); $objResponse->addAssign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); return $objResponse->getXML(); } function myPreFunction($funcName, $args) { $objResponse = new legacyXajaxResponse(); if ($args[1] == 0) { $objResponse->addAlert("This is from the pre-function, which will now call " . $funcName); return $objResponse; } $objResponse->addAlert("This is from the pre-function, which will now end the request."); return array(false, $objResponse); } class myPreObject { var $message = "This is from the pre-function object method"; function preMethod($funcName, $args) { $objResponse = new legacyXajaxResponse(); if ($args[1] == 0) { $objResponse->addAlert($this->message . ", which will now call " . $funcName); return $objResponse; } $objResponse->addAlert($this->message . ", which will now end the request."); return array(false, $objResponse); } } $xajax = new legacyXajax(); $xajax->debugOn(); if (@$_GET['useObjects'] == "true") { $preObj = new myPreObject(); $xajax->registerPreFunction(array("myPreFunction", &$preObj, "preMethod")); } else { $xajax->registerPreFunction("myPreFunction"); } $xajax->registerFunction("testRegularFunction"); $xajax->processRequests(); ?> Pre-function Test (Legacy) | xajax Tests printJavascript("../../") ?>

xajax Legacy Mode Tests

Pre-function Test (Legacy)

Reload using object

php-xajax-0.5/tests/legacy_tests/jsLoadingTest.php0000644000175000017500000000374710760021500021013 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: jsLoadingTest.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 */ require_once("../../xajax_core/xajax.inc.php"); require_once("../../xajax_core/legacy.inc.php"); function testForm($formData) { sleep(4); $objResponse = new legacyXajaxResponse(); $objResponse->addAlert("This is from the function"); $objResponse->addAssign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); return $objResponse; } $xajax = new legacyXajax(); $xajax->registerFunction("testForm"); $xajax->processRequests(); ?> Javascript Loading Function Test (Legacy) | xajax Tests printJavascript("../../") ?>

xajax Legacy Mode Tests

Javascript Loading Function Test (Legacy)

php-xajax-0.5/tests/legacy_tests/index.php0000644000175000017500000000210510760021500017333 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: index.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 */ echo '<' . '?xml version="1.0" encoding="UTF-8"?' . '>'; ?> xajax Legacy Mode Tests

xajax Legacy Mode Tests

Back to normal tests

php-xajax-0.5/tests/nonXajaxResponseTest.php0000644000175000017500000000654411104471032017720 0ustar dgildgilassign( 'DataDiv', 'innerHTML', 'Xajax Response Data' ); return $objResponse; } function testXmlResponse( ) { $objResponse=new xajaxCustomResponse( 'text/xml' ); $objResponse->setCharacterEncoding( 'UTF-8' ); $objResponse->append( 'text' ); 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(); ?> Non-xajaxResponse XML and Text Responses Test | xajax Tests printJavascript() ?>

xajax Tests

Non-xajaxResponse XML and Text Responses Test

php-xajax-0.5/tests/errorHandlingTest.php0000644000175000017500000000603011104471032017177 0ustar dgildgil for a detailed description, copyright and license information. */ /* @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 - instantiate the 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 bErrorHandler> using setFlag> or setFlags> - set the log file using setLogFile> */ $xajax->configure( 'errorHandler', true ); $xajax->configure( 'logFile', 'xajax_error_log.log' ); /* Section: Define error ridden function - syntax is correct, but logic errors will be generated at runtime. */ function myErrorRiddenFunction( ) { $value=$silly['nuts']; $objResponse=new xajaxResponse(); $objResponse->alert( "Bad array value: $value" ); include( "file_doesnt_exist.php" ); return $objResponse; } /* - register the error ridden function */ $xajax->register( XAJAX_FUNCTION, "myErrorRiddenFunction" ); /* Section: Process the request or generate the initial page - standard call to processRequest> */ $xajax->processRequest(); /* - if this is xajax request, it is handled and the script is exited - else, generate the html for the page */ echo ''; ?> Error Handling Test | xajax Tests printJavascript() ?>

xajax Tests

Error Handling Test

php-xajax-0.5/tests/xajax_error_log.log0000644000175000017500000000005610650477552016744 0ustar dgildgil** xajax Error Log - Nov 2006 10:55:19 PM ** php-xajax-0.5/tests/basicPluginTest.php0000644000175000017500000000545711000570314016653 0ustar dgildgilconfigure('debug', true); $xajax->configure('javascript URI', '../'); require_once $core . '/xajaxPlugin.inc.php'; require_once $core . '/xajaxPluginManager.inc.php'; class testPlugin extends xajaxResponsePlugin { var $sDefer; function testPlugin() { $this->sDefer = ''; } function getName() { return 'testPlugin'; } function generateClientScript() { echo "\n\n"; } function testMethod() { $this->addCommand(array('n'=>'testPlg'), 'abcde]]>fg'); } } $objPluginManager = &xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new testPlugin()); function showOutput() { $testResponse = new xajaxResponse(); $testResponse->alert("Edit this test and uncomment lines in the showOutput() method to test plugin calling"); // PHP4 & PHP5 $testResponse->plugin("testPlugin", "testMethod"); // PHP5 ONLY - Uncomment to test //$testResponse->plugin("testPlugin")->testMethod(); // PHP5 ONLY - Uncomment to test //$testResponse->testPlugin->testMethod(); $testResponseOutput = htmlspecialchars($testResponse->getOutput()); $objResponse = new xajaxResponse(); $objResponse->assign("submittedDiv", "innerHTML", $testResponseOutput); $objResponse->plugin('testPlugin', 'testMethod'); return $objResponse; } $reqShowOutput =& $xajax->register(XAJAX_FUNCTION, "showOutput"); $xajax->processRequest(); include_once($core . '/xajaxControl.inc.php'); $controls = dirname(dirname(__FILE__)) . '/xajax_controls'; include_once($controls . '/content.inc.php'); include_once($controls . '/misc.inc.php'); $buttonShowOutput = new clsButton(array( 'attributes' => array( 'id' => 'btnShowOutput', 'name' => 'btnShowOutput' ), 'children' => array( new clsLiteral('Show Response XML') ) )); $buttonShowOutput->setEvent('onclick', $reqShowOutput); ?> Basic Plugin Test | xajax Tests printJavascript() ?>

xajax Tests

Basic Plugin Test

printHTML(); ?>

php-xajax-0.5/tests/performance.php0000644000175000017500000001262511104471032016051 0ustar dgildgilstart(); //require('../xajax_core/xajax.inc.php'); require( '../xajax_core/xajaxAIO.inc.php' ); $timer->setMarker( 'xajax included' ); // -- testing session serialization for xajax object //session_start(); // //unset($_SESSION['xjxcore']); // //$xajax = null; // //if (false == isset($_SESSION['xjxcore'])) //{ // $xajax =& new xajax(); // // $_SESSION['xjxcore'] =& $xajax; //} //else //{ // $xajax =& $_SESSION['xjxcore']; //} // -- end testing $xajax=new xajax(); $xajax->registerFunction( 'argumentDecode' ); $xajax->registerFunction( 'roundTrip' ); $xajax->registerFunction( 'compress' ); $xajax->registerFunction( 'compile' ); $timer->setMarker( 'xajax constructed' ); $trips=3000; $timer->setMarker( 'begin process request' ); $xajax->processRequest(); $timer->setMarker( 'after process request' ); function argumentDecode( $nTimes, $aArgs ) { global $timer; global $trips; $objResponse=new xajaxResponse(); if ( $nTimes < $trips ) { $nTimes+=1; $objResponse->script( 'xajax_argumentDecode(' . $nTimes . ', jsArray);' ); $objResponse->assign( 'submittedDiv', 'innerHTML', 'Working...' ); $objResponse->append( 'submittedDiv', 'innerHTML', print_r( $aArgs, true ) ); } else { $objResponse->assign( 'submittedDiv', 'innerHTML', 'Done' ); ob_start(); var_dump( xdebug_get_code_coverage()); $objResponse->append( 'submittedDiv', 'innerHTML', ob_get_clean() ); } $timer->stop(); $objResponse->call( 'accumulateTime', $timer->timeElapsed() ); $objResponse->call( 'printTime' ); return $objResponse; } function roundTrip( $nTimes ) { global $timer; global $trips; $objResponse=new xajaxResponse(); if ( $nTimes < $trips ) { $nTimes+=1; $objResponse->script( 'xajax_roundTrip(' . $nTimes . ');' ); $objResponse->assign( 'submittedDiv', 'innerHTML', 'Working...' ); } else { $objResponse->assign( 'submittedDiv', 'innerHTML', 'Done' ); } $timer->stop(); $objResponse->call( 'accumulateTime', $timer->timeElapsed() ); $objResponse->call( 'printTime' ); return $objResponse; } function compress( ) { global $xajax; $xajax->_compressSelf(); $objResponse=new xajaxResponse(); $objResponse->assign( 'submittedDiv', 'innerHTML', 'Compressed' ); return $objResponse; } function compile( ) { global $xajax; $xajax->_compile(); $objResponse=new xajaxResponse(); $objResponse->assign( 'submittedDiv', 'innerHTML', 'Compiled' ); return $objResponse; } ?> Performance Test printJavascript( '../' ); ?>

xajax Tests

Redirect Test

stop(); $timer->display(); if ( function_exists( 'xdebug_get_code_coverage' ) ) var_dump( xdebug_get_code_coverage()); ?> php-xajax-0.5/tests/eventHandlerTest.php0000644000175000017500000000451510641226120017027 0ustar dgildgiladdHandler($sId, "click", $sHandler); $objResponse->append('log', 'innerHTML', "{$sHandler} enabled.
"); return $objResponse; } function removeHandler($sId,$sHandler) { $objResponse = new xajaxResponse(); $objResponse->removeHandler($sId, "click", $sHandler); $objResponse->append('log', 'innerHTML', "{$sHandler} disabled.
"); return $objResponse; } $xajax = new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction("addHandler"); $xajax->registerFunction("removeHandler"); $xajax->processRequest(); ?> Event Handler Test | xajax Tests printJavascript("../") ?>

xajax Tests

Event Handler Test

Click Me
Click handler 1: Enabled Disabled
Click handler 2: Enabled Disabled
Log (clear)
php-xajax-0.5/tests/createFormInputTest.php0000644000175000017500000001152611104471032017516 0ustar dgildgilalert( "formData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } // adds an option to the select function addInput( $aInputData ) { $sId=$aInputData['inputId']; $sName=$aInputData['inputName']; $sType=$aInputData['inputType']; $sValue=$aInputData['inputValue']; $objResponse=new xajaxResponse(); $sParentId="testForm1"; if ( isset( $aInputData['inputWrapper'] ) ) { $sDivId=$sId . '_div'; $objResponse->append( $sParentId, "innerHTML", '
' ); $sParentId=$sDivId; } $objResponse->alert( "inputData: " . print_r( $aInputData, true ) ); $objResponse->createInput( $sParentId, $sType, $sName, $sId ); $objResponse->assign( $sId, "value", $sValue ); return $objResponse; } // adds an option to the select function insertInput( $aInputData ) { $sId=$aInputData['inputId']; $sName=$aInputData['inputName']; $sType=$aInputData['inputType']; $sValue=$aInputData['inputValue']; $sBefore=$aInputData['inputBefore']; $objResponse=new xajaxResponse(); $objResponse->alert( "inputData: " . print_r( $aInputData, true ) ); $objResponse->insertInput( $sBefore, $sType, $sName, $sId ); $objResponse->assign( $sId, "value", $sValue ); return $objResponse; } function removeInput( $aInputData ) { $sId=$aInputData['inputId']; $objResponse=new xajaxResponse(); $objResponse->remove( $sId ); return $objResponse; } $xajax=new xajax(); //$xajax->setFlag("debug", true); $xajax->registerFunction( "testForm" ); $xajax->registerFunction( "addInput" ); $xajax->registerFunction( "insertInput" ); $xajax->registerFunction( "removeInput" ); $xajax->processRequest(); ?> Create Form Input Test| xajax Tests printJavascript( "../" ) ?>

xajax Tests

Create Form Input Test

type:
Id:
Name:
Value:
Place inside DIV
php-xajax-0.5/tests/customResponseClassTest.php0000644000175000017500000000764111104471032020431 0ustar dgildgilconfigure( 'javascript URI', '../' ); //$xajax->configure('debug', true); // Custom Response Class extends xajaxResponse class customXajaxResponse extends xajaxResponse { function createOption( $sSelectId, $sOptionId, $sOptionText, $sOptionValue ) { $this->script( "addOption('" . $sSelectId . "','" . $sOptionId . "','" . $sOptionText . "','" . $sOptionValue . "');" ); } } // tests the select form function testForm( $formData ) { $objResponse=new customXajaxResponse(); $objResponse->alert( "formData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } // adds an option to the select function addOption( $selectId, $optionData ) { $objResponse=new customXajaxResponse(); $objResponse->createOption( $selectId, $optionData['optionId'], $optionData['optionText'], $optionData['optionValue'] ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $optionData, true ) ) ); return $objResponse; } $xajax->registerFunction( "testForm" ); $xajax->registerFunction( "addOption" ); $xajax->processRequest(); ?> Custom Response Class Test| xajax Tests printJavascript() ?>

xajax Tests

Custom Response Class Test

Select
New Option
Id:
Text:
Value:
php-xajax-0.5/tests/charEncodingTest.php0000644000175000017500000001077010663241344017005 0ustar dgildgilalert("Your options have been saved."); return $objResponse; } function testForm($strText, $formData, $arrArray) { //global $useEncoding, $htmlEntities; //$objResponse = new xajaxResponse($useEncoding, $htmlEntities); // encoding parameters are not retreived automatically from the xajax object $objResponse = new xajaxResponse(); $data = "Text:\n" . $strText; $data .= "\n\nFormData:\n" . print_r($formData, true); $data .= "\n\nArray:\n" .print_r($arrArray, true); $objResponse->alert($data); $objResponse->assign("submittedDiv", "innerHTML", "
".$data."
"); return $objResponse; } $useEncoding = "UTF-8"; $htmlEntities = false; $decodeUTF8 = false; session_start(); session_name("xajaxCharEncodingTest"); 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->registerFunction('setOptions'); $xajax->registerFunction('testForm'); $xajax->processRequest(); ?> Character Encoding Test | xajax Tests printJavascript() ?>

xajax Tests

Character Encoding Test

Options Form

NOTE: if you change these options, make sure you click the Save Options button or the options won't be used.

Encoding:
Output HTML Entities? /> Yes /> No
Decode UTF-8 Input? /> Yes /> No

Clear and Refresh

Text Test Form

Here are some Unicode examples you can paste into the text box below. You can see more examples and a list of standard encoding schemes here.

php-xajax-0.5/tests/registerObjectTest.php0000644000175000017500000001213511104471032017357 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: registerObjectTest.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 */ require_once( "../xajax_core/xajax.inc.php" ); class myObjectTest { var $myValue='default'; function testInstanceMethod( $formData ) { $objResponse=new xajaxResponse(); $objResponse->alert( "My value is: {$this->myValue}" ); $objResponse->alert( "formData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } function testClassMethod( $formData ) { $objResponse=new xajaxResponse(); $objResponse->alert( "This is a class method." ); $objResponse->alert( "formData: " . print_r( $formData, true ) ); $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) ); return $objResponse; } } class objectMethodsTest { var $myValue='default'; function firstMethod( ) { $objResponse=new xajaxResponse(); $objResponse->alert( "In firstMethod. My value is: {$this->myValue}" ); return $objResponse; } function second_method( ) { $objResponse=new xajaxResponse(); $objResponse->alert( "In second_method. My value is: {$this->myValue}" ); return $objResponse; } } class objectMethodsTest2 extends objectMethodsTest { function thirdMethod( $arg1 ) { $objResponse=new xajaxResponse(); $objResponse->alert( "In thirdMethod. My value is: {$this->myValue} and arg1: $arg1" ); return $objResponse; } } $xajax=new xajax(); //$xajax->setFlag("debug", true); $myObj2=new objectMethodsTest(); if ( 0 <= version_compare( '5.0', PHP_VERSION ) ) // for PHP4 eval( '$aMethodsTest =& $xajax->register(XAJAX_CALLABLE_OBJECT, &$myObj2);' ); else $aMethodsTest=&$xajax->register( XAJAX_CALLABLE_OBJECT, $myObj2 ); $myObj2->myValue='right:2'; $myObj3=new objectMethodsTest2(); if ( 0 <= version_compare( '5.0', PHP_VERSION ) ) // for PHP4 eval( '$aMethodsTest2 =& $xajax->register(XAJAX_CALLABLE_OBJECT, &$myObj3);' ); else $aMethodsTest2=&$xajax->register( XAJAX_CALLABLE_OBJECT, $myObj3 ); $aMethodsTest2['thirdmethod']->setParameter( 0, XAJAX_QUOTED_VALUE, 'howdy' ); $myObj3->myValue='right:3'; $myObj=new myObjectTest(); $myObj->myValue='wrong'; $requestInstanceMethod=&$xajax->registerFunction( array ( "testForm", &$myObj, "testInstanceMethod" )); $requestInstanceMethod->setParameter( 0, XAJAX_FORM_VALUES, 'testForm1' ); $requestClassMethod=&$xajax->registerFunction( array ( "testForm2", "myObjectTest", "testClassMethod" )); $requestClassMethod->setParameter( 0, XAJAX_FORM_VALUES, 'testForm1' ); $myObj->myValue='right'; $xajax->processRequest(); ?> Register Object Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

Register Object Test

printScript(); ?>; return false;'>Test Callable Object:2
printScript(); ?>; return false;'>Test Callable Object:2
printScript(); ?>; return false;'>Test Callable Object:3
printScript(); ?>; return false;'>Test Callable Object:3

php-xajax-0.5/tests/xajaxResponseTest.php0000644000175000017500000000406111104471032017235 0ustar dgildgil object. Title: Test the object. Please see for a detailed description, copyright and license information. */ /* @package xajax @version $Id: xajaxResponseTest.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 */ require_once( "../xajax_core/xajax.inc.php" ); function showOutput( ) { $testResponse=new xajaxResponse(); $testResponse->alert( "Hello" ); $testResponse2=new xajaxResponse(); $testResponse2->loadCommands( $testResponse ); $testResponse2->replace( "this", "is", "a", "replacement]]>" ); $testResponseOutput=htmlspecialchars( $testResponse2->getOutput() ); $objResponse=new xajaxResponse(); $objResponse->assign( "submittedDiv", "innerHTML", $testResponseOutput ); $aValues=array(); $aValues[]="Yippie"; $objResponse->setReturnValue( $aValues ); return $objResponse; } $xajax=new xajax(); $xajax->setFlag( "debug", true ); $xajax->registerFunction( "showOutput" ); $xajax->processRequest(); ?> xajaxResponse Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

xajaxResponse Test

php-xajax-0.5/tests/suite/0000755000175000017500000000000011137074666014204 5ustar dgildgilphp-xajax-0.5/tests/suite/xajax_tests.css0000644000175000017500000000070710760021500017233 0ustar dgildgil body { font-size:13px; font-family:"Lucida Grande","Trebuchet MS",Verdana,sans-serif; color:#333; background:#fff; } h1 { margin:4px 4px 12px 0px; color:#7F1F3A; border-bottom:1px solid #7F1F3A; } h2 { color:#7F1F3A; margin:4px 2px 2px 0px; } h3 { margin:12px 2px 2px 0px; } a { color:#C20229; } ul { margin:0px; } controlPanel { } .controlPanel_cell { float: left; position: relative; width: 50%; }php-xajax-0.5/tests/suite/alert_confirm_external.inc.php0000644000175000017500000000024710641226120022175 0ustar dgildgilalert(print_r($aFormValues, true)); return $objResponse; } ?>php-xajax-0.5/tests/suite/css1.css0000644000175000017500000000050710641226120015550 0ustar dgildgil.loadCSS1 { visibility: hidden; } .unloadCSS1 { visibility: visible; } .frame { border: 1px solid #4444aa; background: #bbbbff; padding: 2px; } .headerText { background: #ffffff; color: #111177; font-weight: bold; } .bodyText { color: #4444aa; } .tagline { color: #4444aa; font-size: smaller; }php-xajax-0.5/tests/suite/scriptContext.php0000644000175000017500000001645610745604744017602 0ustar dgildgilscript> - call> - waitFor> - contextAssign> - contextAppend> - etc... */ require_once("./options.inc.php"); require_once('./testScriptPlugin.inc.php'); $objResponse = new xajaxResponse(); function modifyValue() { $objResponse = new xajaxResponse(); $objResponse->script('if (undefined == this.value) this.value = 1; else this.value += 1;'); $objResponse->call('this.logValue'); return $objResponse; } function callFunction() { $value = 'no value provided'; if (0 < func_num_args()) { $args = func_get_args(); $value = $args[0]; } $objResponse = new xajaxResponse(); $objResponse->call('this.myFunction', null, 0, -10.5, 'abc', true, false, $value); return $objResponse; } $req_Mv = $xajax->register(XAJAX_FUNCTION, 'modifyValue'); $req_Cf = $xajax->register(XAJAX_FUNCTION, 'callFunction'); $req_Mv_Mo = $xajax->register(XAJAX_FUNCTION, 'modifyValue', array('context' => 'myObject', 'alias' => 'modifyValue_myObject')); $req_Cf_Mo = $xajax->register(XAJAX_FUNCTION, 'callFunction', array('context' => 'myObject', 'alias' => 'callFunction_myObject')); $xajax->processRequest(); ob_start(); ?> printHeader($xajax, "Script Context", ob_get_clean()); ob_start(); ?>
Global:
Object level:
Miscellaneous:
printScript(); ?>; return false;' />
printScript(); ?>; return false;' />
printScript(); ?>; return false;' />
printControlPanel(ob_get_clean()); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); $objTestScriptPlugin->printDescriptionPanel( "The purpose of this test script is to show how you can use xajax to " . "invoke functions and access variables on the browser from the server, " . "whereby the javascript on the browser determines the location of those " . "functions and variables. This is called Script Context; the context " . "of the script on the browser is maintained accross the server call. " . "The script set's the current context (either global scope or a " . "javascript object), then calls the server script. The server script " . "then uses the 'this' keyword to access the functions and variables that " . "it needs and xajax ensures that the proper context is maintained and " . "used for the processing of that xajax call." ); $objTestScriptPlugin->printFooter(); ?> php-xajax-0.5/tests/suite/delayEvents.php0000644000175000017500000003426410760021500017165 0ustar dgildgilsleep>, call> and a variety of callback request options to show the progress of a series of requests. */ require_once("./options.inc.php"); require_once('./testScriptPlugin.inc.php'); $objResponse = new xajaxResponse(); class clsRequests { function clsRequests() { } function clearLog() { global $objResponse; $objResponse->clear('log', 'innerHTML'); return $objResponse; } function shortDelay($sleepTimes) { global $objResponse; foreach ($sleepTimes AS $sleepTime) sleep((int)$sleepTime); $objResponse->append('log', 'innerHTML', 'Message from server: Request completed before abort.
'); $objResponse->sleep(30); $objResponse->call('finished', $sleepTimes); return $objResponse; } function mediumDelay($sleepTimes) { global $objResponse; foreach ($sleepTimes AS $sleepTime) sleep((int)$sleepTime); $objResponse->append('log', 'innerHTML', 'Message from server: Request completed before abort.
'); $objResponse->call('finished', $sleepTimes); return $objResponse; } function longDelay() { global $objResponse; sleep(15); $objResponse->append('log', 'innerHTML', 'Message from server: Request completed before abort.
'); return $objResponse; } function shortDelayS() { global $objResponse; sleep(5); $objResponse->append('log', 'innerHTML', 'Message from server: Request completed before abort.
'); $objResponse->setReturnValue('shortDelayS'); return $objResponse; } function mediumDelayS() { global $objResponse; sleep(9); $objResponse->append('log', 'innerHTML', 'Message from server: Request completed before abort.
'); $objResponse->setReturnValue('mediumDelayS'); return $objResponse; } function longDelayS() { global $objResponse; sleep(15); $objResponse->append('log', 'innerHTML', 'Message from server: Request completed before abort.
'); $objResponse->setReturnValue('longDelayS'); return $objResponse; } } $configuration = array( 'shortdelay' => array('callback' => 'local.callback'), 'mediumdelay' => array( 'callback' => '[local.callback, special.callback]', 'onRequest' => 'function() { xajax.$("log").innerHTML += "explicit callback onRequest called
"; }', 'returnValue' => 'true'), 'longdelay' => array('callback' => 'local.callback'), 'shortdelays' => array('callback' => 'local.callback', 'mode' => '"synchronous"'), 'mediumdelays' => array('callback' => 'local.callback', 'mode' => '"synchronous"'), 'longdelays' => array('callback' => 'local.callback', 'mode' => '"synchronous"') ); $objRequests =& new clsRequests(); $aRequests = $xajax->register(XAJAX_CALLABLE_OBJECT, $objRequests, $configuration); $xajax->processRequest(); $sRoot = dirname(dirname(dirname(__FILE__))); if (false == class_exists('xajaxControl')) { $sCore = '/xajax_core'; include_once($sRoot . $sCore . '/xajaxControl.inc.php'); } $sControls = '/xajax_controls'; foreach (array( '/document.inc.php', '/content.inc.php', '/group.inc.php', '/structure.inc.php', '/misc.inc.php') as $sFile) include_once($sRoot . $sControls . $sFile); $shortDelay_Async = new clsAnchor(); $shortDelay_Async->addChild(new clsLiteral("Short Delay (Async)")); $shortDelay_Async->setEvent('onclick', $aRequests['shortdelay'], array(array(0, XAJAX_JS_VALUE, '{a:1, b:2, c:"&amp;nbsp;two>", "0":1, "ä":"ä"}')) ); $mediumDelay_Async = new clsAnchor(); $mediumDelay_Async->setAttribute('href', '#log'); $mediumDelay_Async->addChild(new clsLiteral("Medium Delay (Async)")); $mediumDelay_Async->setEvent('onclick', $aRequests['mediumdelay'], array(array(0, XAJAX_JS_VALUE, '[1,2,3,3]')) ); $longDelay_Async = new clsAnchor(); $longDelay_Async->addChild(new clsLiteral("Long Delay (Async)")); $longDelay_Async->setEvent('onclick', $aRequests['longdelay']); $shortDelay_Sync = new clsAnchor(); $shortDelay_Sync->addChild(new clsLiteral("Short Delay (Sync)")); $shortDelay_Sync->setEvent('onclick', $aRequests['shortdelays'], array(), 'var oRet = ', '; xajax.$("log").innerHTML += "Function returned: " + oRet + "
"; return false;'); $mediumDelay_Sync = new clsAnchor(); $mediumDelay_Sync->addChild(new clsLiteral("Medium Delay (Sync)")); $mediumDelay_Sync->setEvent('onclick', $aRequests['mediumdelays'], array(), 'var oRet = ', '; xajax.$("log").innerHTML += "Function returned: " + oRet + "
"; return false;'); $longDelay_Sync = new clsAnchor(); $longDelay_Sync->addChild(new clsLiteral("Long Delay (Sync)")); $longDelay_Sync->setEvent('onclick', $aRequests['longdelays'], array(), 'var oRet = ', '; xajax.$("log").innerHTML += "Function returned: " + oRet + "
"; return false;'); echo '<' . '?' . 'xml encoding=' . $xajax->getConfiguration('characterEncoding') . ' ?' . '>'; ob_start(); ?> printHeader($xajax, "Callback Event Handlers", ob_get_clean(),"setupCallbacks();"); ob_start(); ?> printControlPanel(ob_get_clean()); ob_start(); ?>
Event (Clear) Global Local Special
onRequest
onResponseDelay
beforeResponseProcessing
onSuccess
onExpiration
onFailure
onRedirect
onComplete
printStatusPanel(ob_get_clean()); $objTestScriptPlugin->printLogPanel(); $objTestScriptPlugin->printDescriptionPanel(" This test shows how callback functions are invoked during the call process. The links along the top left represent various xajax enabled function calls. Each function will sleep for a period of time on the php side, causing the browser to wait for the response. As the call progresses, xajax will call the various callback event handlers at the prescribed time. The check boxes along the top right show when each event handler is called.

During a synchronous call, you will notice that the browser will block javascript events until after the response has been received. This is due to the nature of a synchronous call.

(note: due to the nature of synchronous calls, xajax is not able to abort the request; only the browser can abort the request based on the browsers time-out settings) "); $objTestScriptPlugin->printFooter();php-xajax-0.5/tests/suite/server_events.php0000644000175000017500000000456310760021500017573 0ustar dgildgilregister> to register an event and some event handlers to process requests from the client. */ require_once("./options.inc.php"); require_once('./testScriptPlugin.inc.php'); function eventHandlerOne() { $objResponse = new xajaxResponse(); $objResponse->append('log', 'innerHTML', 'Message from event handler one.
'); return $objResponse; } function eventHandlerTwo() { $objResponse = new xajaxResponse(); $objResponse->append('log', 'innerHTML', 'Message from event handler two.
'); return $objResponse; } class clsEventHandlers { function eventHandlerThree() { $objResponse = new xajaxResponse(); $objResponse->append('log', 'innerHTML', 'Message from event handler three.
'); $objResponse->setReturnValue('return value from event handler three.'); return $objResponse; } } $objEventHandlers = new clsEventHandlers(); $objEventHandlerThree = new xajaxUserFunction(array(&$objEventHandlers, 'eventHandlerThree')); $requestEvent = $xajax->register(XAJAX_EVENT, 'theOneAndOnly', array("mode" => "synchronous")); $xajax->register(XAJAX_EVENT_HANDLER, 'theOneAndOnly', 'eventHandlerOne'); $xajax->register(XAJAX_EVENT_HANDLER, 'theOneAndOnly', 'eventHandlerTwo'); $xajax->register(XAJAX_EVENT_HANDLER, 'theOneAndOnly', $objEventHandlerThree); $xajax->processRequest(); ob_start(); ?> printHeader($xajax, "Server-side Events", ob_get_clean()); ob_start(); ?> printControlPanel(ob_get_clean()); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); ob_start(); ?> This script demonstrates xajax's ability to register multiple 'handler' functions that will be called (in the order they are registered) in response to a single request. A variety of call options can be set for the event request including mode, method and context. printDescriptionPanel(ob_get_clean()); $objTestScriptPlugin->printFooter(); php-xajax-0.5/tests/suite/css2.css0000644000175000017500000000040510641226120015546 0ustar dgildgil.loadCSS2 { visibility: hidden; } .unloadCSS2 { visibility: visible; } .frame { border: 1px solid #4444aa; } .headerText { text-align: center; padding: 3px; } .bodyText { padding: 2px; } .tagline { padding: 2px; visibility: visible; }php-xajax-0.5/tests/suite/frame_left.htm0000644000175000017500000000046110653577044017023 0ustar dgildgil Frame Left

This is the left side frame (HTML)

php-xajax-0.5/tests/suite/theFrame.html0000644000175000017500000000036610641226120016611 0ustar dgildgil xajax Test iFrame
This is the iframe
php-xajax-0.5/tests/suite/events.php0000644000175000017500000002005510760021500016177 0ustar dgildgiladdHandler> and removeHandler> to effect the active event handlers on the browser. */ require_once("./options.inc.php"); require_once('./testScriptPlugin.inc.php'); function addHandler($sId, $sHandler) { $objResponse = new xajaxResponse(); $objResponse->addHandler($sId, "click", $sHandler); $objResponse->append('log', 'innerHTML', '
*-- '.$sHandler.' (attached)
'); return $objResponse; } function removeHandler($sId, $sHandler) { $objResponse = new xajaxResponse(); $objResponse->removeHandler($sId, "click", $sHandler); $objResponse->remove('handler'.$sHandler); return $objResponse; } function toggleButtons() { $objResponse = new xajaxResponse(); $aArgs = func_get_args(); if (3 < count($aArgs)) { $aDisable = $aArgs[2]; $aEnable = $aArgs[3]; foreach ($aDisable as $sDisableId) $objResponse->assign($sDisableId, 'disabled', 'disabled'); foreach ($aEnable as $sEnableId) $objResponse->assign($sEnableId, 'disabled', ''); } return $objResponse; } $requestAdd = $xajax->register(XAJAX_EVENT, 'add_clicked'); $xajax->register(XAJAX_EVENT_HANDLER, 'add_clicked', 'addHandler'); $xajax->register(XAJAX_EVENT_HANDLER, 'add_clicked', 'toggleButtons'); $requestRemove = $xajax->register(XAJAX_EVENT, 'remove_clicked'); $xajax->register(XAJAX_EVENT_HANDLER, 'remove_clicked', 'removeHandler'); $xajax->register(XAJAX_EVENT_HANDLER, 'remove_clicked', 'toggleButtons'); $xajax->processRequest(); $sRoot = dirname(dirname(dirname(__FILE__))); if (false == class_exists('xajaxControl')) { $sCore = '/xajax_core'; include_once($sRoot . $sCore . '/xajaxControl.inc.php'); } /* Class: clsMutuallyExclusiveButton Only one button can be disabled at a given time. */ class clsMutuallyExclusiveButton extends xajaxControl { var $aPartners; function clsMutuallyExclusiveButton($sId, $sName, $sValue) { xajaxControl::xajaxControl('input', array( 'attributes' => array( 'id' => $sId, 'type' => 'submit', 'name' => $sName, 'value' => $sValue ) )); $this->aPartners = array(); } function getId() { if (isset($this->aAttributes['id'])) return $this->aAttributes['id']; trigger_error('An ID is requred for a mux. button.', E_USER_ERROR); } function addPartner(&$objPartnerNew) { if (false == is_a($objPartnerNew, 'clsMutuallyExclusiveButton')) trigger_error('Invalid partner specified; should be a clsMutuallyExclusiveButton', E_USER_ERROR); foreach (array_keys($this->aPartners) as $sKey) { $objPartner =& $this->aPartners[$sKey]; $objPartner->privateAddPartner($objPartnerNew); $objPartnerNew->privateAddPartner($objPartner); } $this->privateAddPartner($objPartnerNew); $objPartnerNew->privateAddPartner($this); } function privateAddPartner(&$objPartner) { $this->aPartners[] =& $objPartner; } function setAttribute($sName, $sValue) { if ('disabled' == $sName) { if ('disabled' == $sValue) { foreach (array_keys($this->aPartners) as $sKey) { $objPartner =& $this->aPartners[$sKey]; $objPartner->setAttribute('disabled', 'false'); } } } xajaxControl::setAttribute($sName, $sValue); } function printHtml($sIndent='') { $sEnable = '['; $sSeparator = '"'; $sTerminator = ']'; foreach (array_keys($this->aPartners) as $sKey) { $objPartner =& $this->aPartners[$sKey]; $sEnable .= $sSeparator; $sEnable .= $objPartner->getId(); $sSeparator = '", "'; $sTerminator = '"]'; } $sEnable .= $sTerminator; $sDisable = '["' . $this->getId() . '"]'; $aRequest =& $this->aEvents['onclick']; $objRequest =& $aRequest[0]; $objRequest->setParameter(0, XAJAX_QUOTED_VALUE, ''); $objRequest->setParameter(1, XAJAX_QUOTED_VALUE, ''); $objRequest->setParameter(2, XAJAX_JS_VALUE, $sDisable); $objRequest->setParameter(3, XAJAX_JS_VALUE, $sEnable); xajaxControl::printHTML($sIndent); } } // one $inputAddOne =& new clsMutuallyExclusiveButton('add_one', 'add_one', 'Add'); $inputAddOne->setEvent('onclick', $requestAdd, array( array(0, XAJAX_QUOTED_VALUE, 'clicker'), array(1, XAJAX_QUOTED_VALUE, 'clickHandlerOne') ) ); $inputRemoveOne =& new clsMutuallyExclusiveButton('remove_one', 'remove_one', 'Remove'); $inputRemoveOne->setEvent('onclick', $requestRemove, array( array(0, XAJAX_QUOTED_VALUE, 'clicker'), array(1, XAJAX_QUOTED_VALUE, 'clickHandlerOne') ) ); $inputAddOne->addPartner($inputRemoveOne); $inputRemoveOne->setAttribute('disabled', 'disabled'); // two $inputAddTwo =& new clsMutuallyExclusiveButton('add_two', 'add_two', 'Add'); $inputAddTwo->setEvent('onclick', $requestAdd, array( array(0, XAJAX_QUOTED_VALUE, 'clicker'), array(1, XAJAX_QUOTED_VALUE, 'clickHandlerTwo') ) ); $inputRemoveTwo =& new clsMutuallyExclusiveButton('remove_two', 'remove_two', 'Remove'); $inputRemoveTwo->setEvent('onclick', $requestRemove, array( array(0, XAJAX_QUOTED_VALUE, 'clicker'), array(1, XAJAX_QUOTED_VALUE, 'clickHandlerTwo') ) ); $inputAddTwo->addPartner($inputRemoveTwo); $inputRemoveTwo->setAttribute('disabled', 'disabled'); ob_start(); ?> printHeader($xajax, "Client-side Event Handlers", ob_get_clean()); ob_start(); ?>
Click here to trigger event
Event handler one: printHTML(); ?> printHTML(); ?>
Event handler two: printHTML(); ?> printHTML(); ?>
printControlPanel(ob_get_clean()); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); $objTestScriptPlugin->printDescriptionPanel(" This page tests the ability to attach event handlers to DOM objects. The DIV above labeled 'Click Here' has an onclick event that simply appends *click* to the output area. To attach additional even handlers, click 'Add' for either event handler One, Two or Both. Event handlers attached to the DIV are listed below it. "); $objTestScriptPlugin->printFooter();php-xajax-0.5/tests/suite/googleMap.php0000644000175000017500000000563310661222606016624 0ustar dgildgilconfigure('requestURI', basename(__FILE__)); $xajax->configure('javascript URI', '../../'); require $sXajaxPlugins . '/response/googleMap.inc.php'; $requestCreateMap =& $xajax->register(XAJAX_FUNCTION, 'createMap'); $requestZoom5 =& $xajax->register(XAJAX_FUNCTION, 'zoom'); $requestZoom5->setParameter(0, XAJAX_QUOTED_VALUE, 'myMap'); $requestZoom5->setParameter(1, XAJAX_JS_VALUE, 5); $requestZoom10 =& $xajax->register(XAJAX_FUNCTION, 'zoom'); $requestZoom10->setParameter(0, XAJAX_QUOTED_VALUE, 'myMap'); $requestZoom10->setParameter(1, XAJAX_JS_VALUE, 10); $requestZoom14 =& $xajax->register(XAJAX_FUNCTION, 'zoom'); $requestZoom14->setParameter(0, XAJAX_QUOTED_VALUE, 'myMap'); $requestZoom14->setParameter(1, XAJAX_JS_VALUE, 14); $requestSetMarker =& $xajax->register(XAJAX_FUNCTION, 'setMarker'); $requestSetMarker->setParameter(0, XAJAX_QUOTED_VALUE, 'myMap'); $requestSetMarker->setParameter(1, XAJAX_FORM_VALUES, 'marker'); $xajax->processRequest(); $objPluginManager =& xajaxPluginManager::getInstance(); $objGoogleMapPlugin =& $objPluginManager->getPlugin('clsGoogleMap'); $objGoogleMapPlugin->setGoogleSiteKey( 'INSERT_YOUR_SITE_KEY_HERE' ); ?> printJavascript(); ?> Create Map
Zoom 5
Zoom 10
Zoom 14
Lat:
Lon:
Text:
Set Marker
plugin('clsGoogleMap', 'create', 'myMap', 'myMapPlaceholder'); return $objResponse; } function zoom($sMap, $nLevel) { $objResponse = new xajaxResponse(); $objResponse->plugin('clsGoogleMap', 'zoom', $sMap, $nLevel); return $objResponse; } function setMarker($sMap, $aFormValues) { $nLat = $aFormValues['lat']; $nLon = $aFormValues['lon']; $sText = $aFormValues['text']; $objResponse = new xajaxResponse(); $objResponse->plugin('clsGoogleMap', 'setMarker', $sMap, $nLat, $nLon, $sText); return $objResponse; } ?>php-xajax-0.5/tests/suite/callScriptTest.php0000644000175000017500000000743210745604744017663 0ustar dgildgilcall> command to execute a function call on the browser. */ require_once("./options.inc.php"); require_once('./testScriptPlugin.inc.php'); function callScript() { $response = new xajaxResponse(); $value2 = "this is a string"; $response->call("myJSFunction", "arg1", 9432.12, 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__))); if (false == class_exists('xajaxControl')) { $sCore = '/xajax_core'; include_once($sRoot . $sCore . '/xajaxControl.inc.php'); } $sControls = '/xajax_controls'; foreach (array( '/document.inc.php', '/structure.inc.php', '/content.inc.php', '/misc.inc.php' ) as $sInclude) include $sRoot . $sControls . $sInclude; $buttonCallScript = new clsButton(array( 'attributes' => array('id' => 'call_script'), 'children' => array(new clsLiteral('Click Me')) )); $buttonCallScript->setEvent('onclick', $requestCallScript); $buttonCallOtherScript = new clsButton(array( 'attributes' => array('id' => 'call_other_script'), 'children' => array(new clsLiteral('or Click Me')) )); $buttonCallOtherScript->setEvent('onclick', $requestCallOtherScript); ob_start(); ?> printHeader($xajax, "Call Script Test", ob_get_clean()); ob_start(); ?>

printHTML(); ?>

Expecting:

arg1 and 9532.12
some value | this is a string

printHTML(); ?>

Expecting:

No parameters needed
for this function.

printControlPanel(ob_get_clean()); ob_start(); ?>

Result:

[blank]
printStatusPanel(ob_get_clean()); $objTestScriptPlugin->printLogPanel(); ob_start(); ?>

This script demonstrates the ability for xajax to send data to and call javascript functions on the client browser.

The first button, Click Me, will call a xajax function on the server, which will in turn send a response command back to the client to call myJSFunction. myJSFunction accepts three parameters which should match the text following 'Expecting:'.

The second button, or Click Me, will call a xajax function on the server which will return a response command back to the client to call myOtherJSFunction. myOtherJSFunction does not accept any parameters and simply pops up and alert explaining so. printDescriptionPanel(ob_get_clean()); $objTestScriptPlugin->printFooter(); ?> php-xajax-0.5/tests/suite/tables.php0000644000175000017500000005323011046052100016144 0ustar dgildgilregister(XAJAX_FUNCTION, 'premadeTable'); $nUnique = 100000; function generateUniqueID() { global $nUnique; return ++$nUnique; } $objResponse = new xajaxResponse(); class clsPage { function clsPage() { } function generateTable() { global $objResponse; $objResponse->clear("content", "innerHTML"); $objResponse->plugin('clsTableUpdater', 'appendTable', 'theTable', 'content'); return $objResponse; } function appendRow() { global $objResponse; global $aRequests; $row = time(); $row = "row_" . $row; $objResponse->plugin('clsTableUpdater', 'appendRow', $row, 'theTable'); $objAnchor = new clsAnchor(array( 'event' => array('onclick', &$aRequests['setrownumber'], array( array(0, XAJAX_QUOTED_VALUE, $row) )), 'child' => new clsLiteral($row) )); $objResponse->plugin('clsTableUpdater', 'assignRow', array($objAnchor->getHTML()), $row); return $objResponse; } function insertRow($old_row) { global $objResponse; global $aRequests; $row = time(); $row = "row_" . $row; $id = " id='"; $id .= $row; $id .= "'"; $objResponse->plugin('clsTableUpdater', 'insertRow', $row, 'theTable', $old_row); $aRequests['setrownumber']->setParameter(0, XAJAX_QUOTED_VALUE, $row); $link = "getScript() . "'>{$row}"; $objResponse->plugin('clsTableUpdater', 'assignRow', array($link), $row); return $objResponse; } function replaceRow($old_row) { global $objResponse; global $aRequests; $row = time(); $row = "row_" . $row; $id = " id='"; $id .= $row; $id .= "'"; $objResponse->plugin('clsTableUpdater', 'replaceRow', $row, 'theTable', $old_row); $aRequests['setrownumber']->setParameter(0, XAJAX_QUOTED_VALUE, $row); $link = "getScript() . "'>{$row}"; $objResponse->plugin('clsTableUpdater', 'assignRow', array($link), $row); $objResponse->clear("RowNumber", "value"); return $objResponse; } function removeRow($row) { global $objResponse; $objResponse->plugin('clsTableUpdater', 'deleteRow', $row); $objResponse->clear("RowNumber", "value"); return $objResponse; } function setRowNumber($row) { global $objResponse; $objResponse->assign("RowNumber", "value", $row); return $objResponse; } function appendColumn() { global $objResponse; global $aRequests; $column = time(); $column = "column_" . $column; $id = " id='"; $id .= $column; $id .= "'"; $aRequests['setcolumnnumber']->setParameter(0, XAJAX_QUOTED_VALUE, $column); $link = "getScript() . "'>{$column}"; $objResponse->plugin('clsTableUpdater', 'appendColumn', array("name"=>$link, "id"=>$column), 'theTable'); return $objResponse; } function insertColumn($old_column) { global $objResponse; global $aRequests; $column = time(); $column = "column_" . $column; $id = " id='"; $id .= $column; $id .= "'"; $aRequests['setcolumnnumber']->setParameter(0, XAJAX_QUOTED_VALUE, $column); $link = "getScript() . "'>{$column}"; $objResponse->plugin('clsTableUpdater', 'insertColumn', array('id'=>$column, 'name'=>$link), $old_column); return $objResponse; } function replaceColumn($old_column) { global $objResponse; global $aRequests; $column = time(); $column = "column_" . $column; $id = " id='"; $id .= $column; $id .= "'"; $aRequests['setcolumnnumber']->setParameter(0, XAJAX_QUOTED_VALUE, $column); $link = "getScript() . "'>{$column}"; $objResponse->plugin('clsTableUpdater', 'replaceColumn', array('id'=>$column, 'name'=>$link), $old_column); $objResponse->clear("ColumnNumber", "value"); return $objResponse; } function removeColumn($column) { global $objResponse; $objResponse->plugin('clsTableUpdater', 'deleteColumn', $column); $objResponse->clear("ColumnNumber", "value"); return $objResponse; } function setColumnNumber($column) { global $objResponse; $objResponse->assign("ColumnNumber", "value", $column); return $objResponse; } function setCellValue($row, $column, $value) { global $objResponse; if (0 == strlen($row) || 0 == strlen($column)) { $objResponse->alert("Please select a row and column."); return $objResponse; } $objResponse->plugin('clsTableUpdater', 'assignCell', $row, $column, $value); return $objResponse; } function setCellProperty($row, $column, $property, $value) { global $objResponse; if (0 == strlen($row) || 0 == strlen($column)) { $objResponse->alert("Please select a row and column."); return $objResponse; } $objResponse->plugin('clsTableUpdater', 'assignCellProperty', $row, $column, $property, $value); return $objResponse; } function setRowProperty($row, $property, $value) { global $objResponse; if (0 == strlen($row)) { $objResponse->alert("Please select a row."); return $objResponse; } $objResponse->plugin('clsTableUpdater', 'assignRowProperty', $property, $value, $row); return $objResponse; } function setColumnProperty($column, $property, $value) { global $objResponse; if (0 == strlen($column)) { $objResponse->alert("Please select a column"); return $objResponse; } $objResponse->plugin('clsTableUpdater', 'assignColumnProperty', $property, $value, $column); return $objResponse; } } $page = new clsPage(); $aRequests =& $xajax->registerCallableObject($page); // rows $aRequests['removerow']->setParameter(0, XAJAX_INPUT_VALUE, 'RowNumber'); $aRequests['replacerow']->setParameter(0, XAJAX_INPUT_VALUE, 'RowNumber'); $aRequests['insertrow']->setParameter(0, XAJAX_INPUT_VALUE, 'RowNumber'); // columns $aRequests['removecolumn']->setParameter(0, XAJAX_INPUT_VALUE, 'ColumnNumber'); $aRequests['replacecolumn']->setParameter(0, XAJAX_INPUT_VALUE, 'ColumnNumber'); $aRequests['insertcolumn']->setParameter(0, XAJAX_INPUT_VALUE, 'ColumnNumber'); // cells $aRequests['setcellvalue']->setParameter(0, XAJAX_INPUT_VALUE, 'RowNumber'); $aRequests['setcellvalue']->setParameter(1, XAJAX_INPUT_VALUE, 'ColumnNumber'); $aRequests['setcellvalue']->setParameter(2, XAJAX_INPUT_VALUE, 'Value'); $aRequests['setcellproperty']->setParameter(0, XAJAX_INPUT_VALUE, 'RowNumber'); $aRequests['setcellproperty']->setParameter(1, XAJAX_INPUT_VALUE, 'ColumnNumber'); $aRequests['setcellproperty']->setParameter(2, XAJAX_INPUT_VALUE, 'Property'); $aRequests['setcellproperty']->setParameter(3, XAJAX_INPUT_VALUE, 'PropertyValue'); $aRequests['setrowproperty']->setParameter(0, XAJAX_INPUT_VALUE, 'RowNumber'); $aRequests['setrowproperty']->setParameter(1, XAJAX_INPUT_VALUE, 'RowProperty'); $aRequests['setrowproperty']->setParameter(2, XAJAX_INPUT_VALUE, 'RowPropertyValue'); $aRequests['setcolumnproperty']->setParameter(0, XAJAX_INPUT_VALUE, 'ColumnNumber'); $aRequests['setcolumnproperty']->setParameter(1, XAJAX_INPUT_VALUE, 'ColumnProperty'); $aRequests['setcolumnproperty']->setParameter(2, XAJAX_INPUT_VALUE, 'ColumnPropertyValue'); if (false == class_exists('xajaxControl')) { $folderCore = dirname(dirname(dirname(__FILE__))) . '/xajax_core'; include $folderCore . '/xajaxControl.inc.php'; } $folderControls = dirname(dirname(dirname(__FILE__))) . '/xajax_controls'; include $folderControls . '/content.inc.php'; include $folderControls . '/group.inc.php'; include $folderControls . '/misc.inc.php'; $xajax->processRequest(); include $folderControls . '/form.inc.php'; function &onAddColumn($mData, $mConfiguration) { // $mData contains the text for the column header $column = generateUniqueID(); $column = "column_" . $column; $objCell = new clsTd(array( 'attributes' => array( 'id' => $column ), 'child' => new clsAnchor(array( 'events' => array( array('onclick', $mConfiguration['column'], array( array(0, XAJAX_QUOTED_VALUE, $column) )) ), 'child' => new clsLiteral($mData) )) )); return $objCell; } function &onAddCell($mData, $mConfiguration) { // $mData contains the text for the cell $objCell = new clsTd(array( 'child' => new clsLiteral($mData) )); return $objCell; } function &onAddHeader($mData, $mConfiguration) { $objTableHeader = new clsThead(); $objTableHeader->setAttribute('id', 'theTable_header'); $objTableHeader->setEvent_AddRow('onAddRow'); $objTableHeader->addRows($mData, $mConfiguration); return $objTableHeader; } function &onAddBody($mData, $mConfiguration) { $objTableBody = new clsTbody(); $objTableBody->setAttribute('id', 'theTable_body'); $objTableBody->setEvent_AddRow('onAddRow'); $objTableBody->addRows($mData, $mConfiguration); return $objTableBody; } function &onAddRow($mData, $mConfiguration) { // $mData contains an array with three elements // if $mConfiguration has only 1 element, then // this is a request for a header row // else a request for a body row $objTableRow = new clsTr(); if (1 == count($mConfiguration)) { $objTableRow->setEvent_AddCell('onAddColumn'); $objTableRow->addChild(new clsTd()); $objTableRow->addCells($mData, $mConfiguration); } else { $row = generateUniqueID(); $row = "row_" . $row; $objTableRow->setAttribute('id', $row); $objTableRow->setEvent_AddCell('onAddCell'); $objTableRow->addChild(new clsTd(array( 'child' => new clsAnchor(array( 'event' => array('onclick', $mConfiguration['row'], array( array(0, XAJAX_QUOTED_VALUE, $row) )), 'child' => new clsLiteral('select >>') )) ))); $objTableRow->addCells($mData, $mConfiguration); } return $objTableRow; } function &onAddFooterRow($mData, $mConfiguration) { // $mData contains an array with one element // need to use colspan to expand to fit whole table $objRow = new clsTr(array( 'child' => new clsTd(array( 'attributes' => array( 'colspan' => 4 ), 'child' => new clsLiteral($mData[0]) )) )); return $objRow; } function premadeTable() { global $aRequests; $aHeader = array(array('Name', 'Occupation', 'Date Hired')); $aBody = array( array('John Smith', 'Operations Manager', '2000/10/20'), array('Wolfgang Mitz', 'Forklift Driver', '1999/01/25'), array('Thomas Woodhouse', 'Loading Dock Operator', '2002/04/12') ); $aFooter = array(array('xajax rocks')); $objTable = new clsTable(); $objTable->setAttribute('id', 'theTable'); $objTable->setEvent_AddHeader('onAddHeader'); $objTable->setEvent_AddBody('onAddBody'); $objTable->setEvent_AddFooterRow('onAddFooterRow'); $objTable->addHeader($aHeader, array( 'column' => &$aRequests['setcolumnnumber'] )); $objTable->addBody($aBody, array( 'column' => &$aRequests['setcolumnnumber'], 'row' => &$aRequests['setrownumber'] )); $objTable->addFooter($aFooter); $objResponse = new xajaxResponse(); $objResponse->assign('content', 'innerHTML', $objTable->getHTML()); return $objResponse; } $litPlusSpace = new clsLiteral('+-- '); $litSpaceBar = new clsLiteral(' |'); $anchorRemoveRow = new clsAnchor(array( 'children' => array(new clsLiteral('Remove Row')) )); $anchorRemoveRow->setEvent('onclick', $aRequests['removerow']); $anchorReplaceRow = new clsAnchor(array( 'children' => array(new clsLiteral('Replace Row')) )); $anchorReplaceRow->setEvent('onclick', $aRequests['replacerow']); $anchorInsertRow = new clsAnchor(array( 'children' => array(new clsLiteral('Insert Row Before')) )); $anchorInsertRow->setEvent('onclick', $aRequests['insertrow']); $anchorRemoveColumn = new clsAnchor(array( 'children' => array(new clsLiteral('Remove Column')) )); $anchorRemoveColumn->setEvent('onclick', $aRequests['removecolumn']); $anchorReplaceColumn = new clsAnchor(array( 'children' => array(new clsLiteral('Replace Column')) )); $anchorReplaceColumn->setEvent('onclick', $aRequests['replacecolumn']); $anchorInsertColumn = new clsAnchor(array( 'children' => array(new clsLiteral('Insert Column Before')) )); $anchorInsertColumn->setEvent('onclick', $aRequests['insertcolumn']); $anchorSetCellValue = new clsAnchor(array( 'children' => array(new clsLiteral('Set Value')) )); $anchorSetCellValue->setEvent('onclick', $aRequests['setcellvalue']); $aPropertyOptions = array( new clsOption(array( 'attributes' => array('value' => 'style.backgroundColor'), 'children' => array(new clsLiteral('Background Color')) )), new clsOption(array( 'attributes' => array('value' => 'style.padding'), 'children' => array(new clsLiteral('Padding')) )), new clsOption(array( 'attributes' => array('value' => 'style.border'), 'children' => array(new clsLiteral('Border')) )) ); $anchorSetCellProperty = new clsAnchor(array( 'children' => array(new clsLiteral('Set Property')) )); $anchorSetCellProperty->setEvent('onclick', $aRequests['setcellproperty']); $anchorSetRowProperty = new clsAnchor(array( 'children' => array(new clsLiteral('Set Property')) )); $anchorSetRowProperty->setEvent('onclick', $aRequests['setrowproperty']); $anchorSetColumnProperty = new clsAnchor(array( 'children' => array(new clsLiteral('Set Property')) )); $anchorSetColumnProperty->setEvent('onclick', $aRequests['setcolumnproperty']); $table = new clsTable(array( 'children' => array( new clsThead(array( 'children' => array( new clsTr(array( 'children' => array( new clsTd(array( 'children' => array( new clsLiteral('Click or type a row'), new clsBr(), new clsLiteral('that is in the table') ) )), new clsTd(array( 'children' => array( new clsLiteral('Click or type a column'), new clsBr(), new clsLiteral('that is in the table') ) )), new clsTd(array( 'children' => array( new clsLiteral('Select a row and column'), new clsBr(), new clsLiteral('then enter a value') ) )), new clsTd(array( 'children' => array( new clsLiteral('Select a row and column'), new clsBr(), new clsLiteral('then select a property and value') ) )), new clsTd(array( 'children' => array( new clsLiteral('Select a row'), new clsBr(), new clsLiteral('then select a property and value') ) )), new clsTd(array( 'children' => array( new clsLiteral('Select a column'), new clsBr(), new clsLiteral('then select a property and value') ) )) ) )) ) )), new clsTbody(array( 'children' => array( new clsTr(array( 'children' => array( new clsTd(array( 'attributes' => array('valign' => 'top'), 'children' => array( new clsInput(array( 'attributes' => array( 'id' => 'RowNumber', 'name' => 'RowNumber', 'type' => 'text' ) )), new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorRemoveRow, new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorReplaceRow, new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorInsertRow, new clsBr(), new clsBr() ) )), new clsTd(array( 'attributes' => array('valign' => 'top'), 'children' => array( new clsInput(array( 'attributes' => array( 'id' => 'ColumnNumber', 'name' => 'ColumnNumber', 'type' => 'text' ) )), new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorRemoveColumn, new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorReplaceColumn, new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorInsertColumn, new clsBr(), new clsBr() ) )), new clsTd(array( 'attributes' => array('valign' => 'top'), 'children' => array( new clsInput(array( 'attributes' => array( 'id' => 'Value', 'name' => 'Value', 'type' => 'text' ) )), new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorSetCellValue, new clsBr(), new clsBr() ) )), new clsTd(array( 'attributes' => array('valign' => 'top'), 'children' => array( new clsSelect(array( 'attributes' => array('id' => 'Property', 'name' => 'Property'), 'children' => array( new clsOption(array( 'attributes' => array('value' => 'style.backgroundColor'), 'children' => array(new clsLiteral('Background Color')) )), new clsOption(array( 'attributes' => array('value' => 'style.padding'), 'children' => array(new clsLiteral('Padding')) )), new clsOption(array( 'attributes' => array('value' => 'style.border'), 'children' => array(new clsLiteral('Border')) )) ) )), new clsBr(), new clsInput(array( 'attributes' => array( 'id' => 'PropertyValue', 'name' => 'PropertyValue', 'type' => 'text' ) )), new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorSetCellProperty, new clsBr(), new clsBr() ) )), new clsTd(array( 'attributes' => array('valign' => 'top'), 'children' => array( new clsSelect(array( 'attributes' => array('id' => 'RowProperty', 'name' => 'RowProperty'), 'children' => $aPropertyOptions )), new clsBr(), new clsInput(array( 'attributes' => array( 'id' => 'RowPropertyValue', 'name' => 'RowPropertyValue', 'type' => 'text' ) )), new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorSetRowProperty, new clsBr(), new clsBr() ) )), new clsTd(array( 'attributes' => array('valign' => 'top'), 'children' => array( new clsSelect(array( 'attributes' => array('id' => 'ColumnProperty', 'name' => 'ColumnProperty'), 'children' => $aPropertyOptions )), new clsBr(), new clsInput(array( 'attributes' => array( 'id' => 'ColumnPropertyValue', 'name' => 'ColumnPropertyValue', 'type' => 'text' ) )), new clsBr(), $litSpaceBar, new clsBr(), $litPlusSpace, $anchorSetColumnProperty, new clsBr(), new clsBr() ) )) ) )) ) )), new clsTfoot(array( 'children' => array( new clsTr(array( 'children' => array( new clsTd(array( 'attributes' => array( 'colspan' => 6 ), 'children' => array( new clsLiteral('The table will appear below...') ) )) ) )) ) )) ) )); ob_start(); ?> printHeader($xajax, "xajax Test Suite - Assign / Append", ob_get_clean()); ?> printScript(); ?>'>Generate the table then  printScript(); ?>'>Append one or more columns then  printScript(); ?>'>Append one or more rows

Or Use a pre-made table
printHTML(); ?>

printStatusPanel(); $objTestScriptPlugin->printLogPanel(); $objTestScriptPlugin->printDescriptionPanel(); $objTestScriptPlugin->printFooter(); ?> php-xajax-0.5/tests/suite/theFrame.php0000644000175000017500000000172110650477552016451 0ustar dgildgilconfigure('requestURI', basename(__FILE__)); $xajax->configure('javascript URI', '../../'); class clsFunctions { function clsFunctions() { } function confirm($seconds) { sleep($seconds); $objResponse = new xajaxResponse(); $objResponse->append('outputDIV', 'innerHTML', '
confirmation from theFrame.php call'); return $objResponse; } } $xajax->register(XAJAX_CALLABLE_OBJECT, new clsFunctions()); $xajax->processRequest(); ?> xajax Test iFrame printJavascript(); ?>
This is the iframe
php-xajax-0.5/tests/suite/frameset.php0000644000175000017500000000210710653577044016523 0ustar dgildgil array( new clsDoctype('HTML', '4.01', 'FRAMESET'), new clsHtml(array( 'children' => array( new clsHead(array( 'child' => new clsTitle(array('child' => new clsLiteral('Title'))) )), new clsFrameset(array( 'attributes' => array( 'cols' => '50%, 50%' ), 'children' => array( new clsFrame(array( 'attributes' => array( 'name' => 'frame_left', 'src' => 'frame_left.htm' ) )), new clsFrame(array( 'attributes' => array( 'name' => 'frame_right', 'src' => 'frame_right.php' ) )) ) )) ) )) ) )); $objDocument->printHTML(); php-xajax-0.5/tests/suite/controls_xhtml_10_transitional.php0000644000175000017500000003024210661214532023051 0ustar dgildgil */ define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'XHTML'); define('XAJAX_HMTL_CONTROL_DOCTYPE_VERSION', '1.0'); define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL'); $sBaseFolder = dirname(dirname(dirname(__FILE__))); $sCoreFolder = '/xajax_core'; $sCtrlFolder = '/xajax_controls'; include $sBaseFolder . $sCoreFolder . '/xajax.inc.php'; $xajax = new xajax(); $xajax->configure('javascript URI', '../../'); include $sBaseFolder . $sCtrlFolder . '/validate_XHTML10TRANSITIONAL.inc.php'; include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php'; foreach (array( '/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) include $sBaseFolder . $sCtrlFolder . $sFile; $objDocument = new clsDocument(array( 'children' => array( new clsDoctype(), new clsHtml(array( 'attributes' => array( 'xmlns' => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', 'lang' => 'en' ), 'children' => array( new clsHead(array( 'xajax' => $xajax, 'children' => array( generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase() ) )), new clsBody(array( 'children' => array( generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe() ) )) ) )) ) )); function generateTitle() { return new clsTitle(array( 'child' => new clsLiteral('Title') )); } function generateStyle() { return new clsStyle(array( 'attributes' => array( 'type' => 'text/css' ), 'child' => new clsLiteral('styleOne { background: #ffdddd; }') )); } function generateScript() { return new clsScript(array( 'attributes' => array( 'type' => 'text/javascript' ), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };') )); } function generateMeta() { return new clsMeta(array( 'attributes' => array( 'name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax' ) )); } function generateLink() { return new clsLink(array( 'attributes' => array( 'type' => 'text/css', 'href' => './style.css' ) )); } function generateBase() { global $xajax; return new clsBase(array( 'attributes' => array( 'href' => dirname($xajax->_detectURI()) . '/' ) )); } function generateOrderedList() { return new clsOl(array( 'children' => array( new clsLi(array('child' => new clsLiteral('List Item One'))), new clsLi(array('child' => new clsLiteral('List Item Two'))), new clsLi(array('child' => new clsLiteral('List Item Three'))), new clsLi(array('child' => new clsLiteral('List Item Four'))) ) )); } function generateUnorderedList() { return new clsUl(array( 'children' => array( new clsLi(array('child' => new clsLiteral('List Item One'))), new clsLi(array('child' => new clsLiteral('List Item Two'))), new clsLi(array('child' => new clsLiteral('List Item Three'))), new clsLi(array('child' => new clsLiteral('List Item Four'))) ) )); } function generateDefinitionList() { return new clsDl(array( 'children' => array( new clsDt(array('child' => new clsLiteral('Data term one'))), new clsDd(array('child' => new clsLiteral('Data term one definition'))), new clsDt(array('child' => new clsLiteral('Data term two'))), new clsDd(array('child' => new clsLiteral('Data term two definition'))), new clsDt(array('child' => new clsLiteral('Data term three'))), new clsDd(array('child' => new clsLiteral('Data term three definition'))) ) )); } function generateTable() { return new clsTable(array( 'children' => array( new clsCaption(array('child' => new clsLiteral('Table Caption'))), new clsColgroup(array( 'attributes' => array( 'width' => '20' ), 'children' => array( new clsCol(array( 'attributes' => array( 'span' => '2' ) )), new clsCol(array( 'attributes' => array( 'class' => 'styleOne' ) )) ) )), new clsThead(array( 'child' => new clsTr(array( 'children' => array( new clsTh(array( 'child' => new clsLiteral('Column One') )), new clsTh(array( 'child' => new clsLiteral('Column Two') )), new clsTh(array( 'child' => new clsLiteral('Column Three') )) ) )) )), new clsTfoot(array( 'child' => new clsTr(array( 'children' => array( new clsTd(array( 'child' => new clsLiteral('Footer') )), new clsTd(array( 'child' => new clsLiteral('is') )), new clsTd(array( 'child' => new clsLiteral('here.') )) ) )) )), new clsTbody(array( 'children' => array( new clsTr(array( 'children' => array( new clsTd(array( 'child' => new clsLiteral('R1 C1') )), new clsTd(array( 'child' => new clsLiteral('R1 C2') )), new clsTd(array( 'child' => new clsLiteral('R1 C3') )) ) )), new clsTr(array( 'children' => array( new clsTd(array( 'child' => new clsLiteral('R2 C1') )), new clsTd(array( 'child' => new clsLiteral('R2 C2') )), new clsTd(array( 'child' => new clsLiteral('R2 C3') )) ) )), new clsTr(array( 'children' => array( new clsTd(array( 'child' => new clsLiteral('R3 C1') )), new clsTd(array( 'child' => new clsLiteral('R3 C2') )), new clsTd(array( 'child' => new clsLiteral('R3 C3') )) ) )), ) )) ) )); } function generateForm() { return new clsDiv(array( 'children' => array( new clsFieldset(array( 'children' => array( new clsLegend(array('child' => new clsLiteral('Fieldset one'))), generateSelect(), generateInputText() ) )), new clsFieldset(array( 'children' => array( new clsLegend(array('child' => new clsLiteral('Fieldset two'))), generateInputCheckbox(), generateInputRadioButton(), generateInputTextArea(), generateInputButton(), generateInputHidden() ) )) ) )); } function generateSelect() { return new clsSelect(array( 'attributes' => array( 'name' => 'InputSelect', 'id' => 'InputSelect' ), 'children' => array( new clsOptionGroup(array( 'attributes' => array( 'label' => 'Option Group One' ), 'children' => array( new clsOption(array( 'attributes' => array( 'value' => 'OptionGroupOne_OptionOne' ), 'child' => new clsLiteral('Option Group One: Option One') )), new clsOption(array( 'attributes' => array( 'value' => 'OptionGroupOne_OptionTwo' ), 'child' => new clsLiteral('Option Group One: Option Two') )) ) )), new clsOptionGroup(array( 'attributes' => array( 'label' => 'Option Group Two' ), 'children' => array( new clsOption(array( 'attributes' => array( 'value' => 'OptionGroupTwo_OptionOne' ), 'child' => new clsLiteral('Option Group Two: Option One') )), new clsOption(array( 'attributes' => array( 'value' => 'OptionGroupTwo_OptionTwo' ), 'child' => new clsLiteral('Option Group Two: Option Two') )) ) )) ) )); } function generateInputText() { return new clsInputWithLabel('Text: ', 'left', array( 'attributes' => array( 'type' => 'text', 'name' => 'InputText', 'id' => 'InputText' ) )); } function generateInputCheckbox() { return new clsInputWithLabel('Checkbox: ', 'left', array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'InputCheckbox', 'id' => 'InputCheckbox' ) )); } function generateInputRadioButton() { return new clsInputWithLabel('Radio: ', 'left', array( 'attributes' => array( 'type' => 'radio', 'name' => 'InputRadio', 'id' => 'InputRadio' ) )); } function generateInputTextArea() { return new clsTextarea(array( 'attributes' => array( 'name' => 'InputTextarea', 'id' => 'InputTextarea', 'rows' => '20', 'cols' => '20' ) )); } function generateInputButton() { return new clsInput(array( 'attributes' => array( 'type' => 'button', 'name' => 'InputButton', 'id' => 'InputButton' ) )); } function generateInputHidden() { return new clsInputWithLabel('Hidden: ', 'left', array( 'attributes' => array( 'type' => 'hidden', 'name' => 'InputHidden', 'id' => 'InputHidden' ) )); } function generateContent() { $nbsp = new clsLiteral(' '); return new clsDiv(array( 'children' => array( new clsLiteral('literal text'), new clsBr(), new clsHr(), new clsSub(array('child' => new clsLiteral('sub'))), $nbsp, new clsSup(array('child' => new clsLiteral('sup'))), $nbsp, new clsEm(array('child' => new clsLiteral('em'))), $nbsp, new clsStrong(array('child' => new clsLiteral('strong'))), $nbsp, new clsCite(array('child' => new clsLiteral('cite'))), $nbsp, new clsDfn(array('child' => new clsLiteral('dfn'))), $nbsp, new clsCode(array('child' => new clsLiteral('code'))), $nbsp, new clsSamp(array('child' => new clsLiteral('samp'))), $nbsp, new clsKbd(array('child' => new clsLiteral('kbd'))), $nbsp, new clsVar(array('child' => new clsLiteral('var'))), $nbsp, new clsAbbr(array('child' => new clsLiteral('abbr'))), $nbsp, new clsAcronym(array('child' => new clsLiteral('acronym'))), $nbsp, new clsTt(array('child' => new clsLiteral('tt'))), $nbsp, new clsItalic(array('child' => new clsLiteral('italic'))), $nbsp, new clsBold(array('child' => new clsLiteral('bold'))), $nbsp, new clsBig(array('child' => new clsLiteral('big'))), $nbsp, new clsSmall(array('child' => new clsLiteral('small'))), $nbsp, new clsIns(array('child' => new clsLiteral('ins'))), $nbsp, new clsDel(array('child' => new clsLiteral('del'))), new clsHeadline('1', array('child' => new clsLiteral('h1'))), new clsHeadline('2', array('child' => new clsLiteral('h2'))), new clsHeadline('3', array('child' => new clsLiteral('h3'))), new clsHeadline('4', array('child' => new clsLiteral('h4'))), new clsHeadline('5', array('child' => new clsLiteral('h5'))), new clsHeadline('6', array('child' => new clsLiteral('h6'))), new clsAddress(array('child' => new clsLiteral('address'))), new clsParagraph(array('child' => new clsLiteral('paragraph'))), new clsBlockquote(array('child' => new clsLiteral('blockquote'))), new clsPre(array('child' => new clsLiteral('pre'))) ) )); } function generateValidation() { return new clsDiv(array( 'child' => new clsParagraph(array( 'child' => new clsAnchor(array( 'attributes' => array( 'href' => 'http://validator.w3.org/check?uri=referer', 'target' => '_new' ), 'child' => new clsImg(array( 'attributes' => array( 'src' => 'http://www.w3.org/Icons/valid-xhtml10-blue', 'alt' => 'Valid XHTML 1.0 Transitional', 'height' => 31, 'width' => 88 ) )) )) )) )); } function generateIframe() { return new clsIframe(array( 'attributes' => array( 'src' => 'frameset.php' ) )); } $objDocument->printHTML(); php-xajax-0.5/tests/suite/transport.php0000644000175000017500000000464710760021500016740 0ustar dgildgilalert($data); $objResponse->assign("status", "innerHTML", "
".$data."
"); return $objResponse; } $testForm = $xajax->register(XAJAX_FUNCTION, "testForm"); $testForm->useSingleQuote(); $testForm->addParameter(XAJAX_INPUT_VALUE, "textField1"); $testForm->addParameter(XAJAX_FORM_VALUES, "testForm1"); $testForm->addParameter(XAJAX_JS_VALUE, "getTestArray()"); $xajax->processRequest(); echo '<' . '?xml version=1.0' . ' encoding=' . $xajax->getConfiguration('characterEncoding') . ' ?' . '>' . "\n"; ob_start(); ?> printHeader($xajax, "Character Encoding Test | xajax Tests", ob_get_clean()); ob_start(); ?>

Text Test Form

Here are some Unicode examples you can paste into the text box below.

You can see more examples and a list of standard encoding schemes here.

printControlPanel(ob_get_clean()); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); $objTestScriptPlugin->printDescriptionPanel(); $objTestScriptPlugin->printFooter();php-xajax-0.5/tests/suite/frame_right.php0000644000175000017500000000171210653577044017205 0ustar dgildgil array( new clsDoctype('HTML', '4.01', 'TRANSITIONAL'), new clsHtml(array( 'children' => array( new clsHead(array( 'children' => array( new clsTitle(array( 'child' => new clsLiteral('Title') )) ) )), new clsBody(array( 'child' => new clsDiv(array( 'child' => new clsParagraph(array( 'child' => new clsLiteral('This is the right side frame (PHP)') )) )) )) ) )) ) )); $objDocument->printHTML(); php-xajax-0.5/tests/suite/functions.php0000644000175000017500000001267210760021500016711 0ustar dgildgilsetFunction>, wrapFunction>, script> and call> to build, modify, remove and call javascript functions on the browser. */ require_once("./options.inc.php"); require_once('./testScriptPlugin.inc.php'); class clsRequests { function clsRequests() { } function insertFunction() { $objResponse = new xajaxResponse(); $objResponse->setFunction('myFunction', '', 'xajax.$("log").innerHTML += "called myFunction
";'); return $objResponse; } function wrapFunction() { $objResponse = new xajaxResponse(); $objResponse->wrapFunction( 'myFunction', '', array( 'xajax.$("log").innerHTML += "entered wrapper function
";', 'xajax.$("log").innerHTML += "leaving wrapper function
";' ), '' ); return $objResponse; } function deleteFunction() { $objResponse = new xajaxResponse(); $objResponse->script('myFunction = undefined;'); return $objResponse; } function callFunction() { $objResponse = new xajaxResponse(); $objResponse->call('myFunction'); return $objResponse; } } $objRequests =& new clsRequests(); $aRequests = $xajax->register(XAJAX_CALLABLE_OBJECT, $objRequests); $xajax->processRequest(); ob_start(); ?> printHeader($xajax, "Javascript Functions", ob_get_clean()); ?>
 
printScript(); ?>; return false;' /> printScript(); ?>; return false;' /> printScript(); ?>; return false;' /> printScript(); ?>; return false;' />
printControlPanel(ob_get_clean()); ?>
printStatusPanel(); $objTestScriptPlugin->printLogPanel(); ob_start(); ?> This page tests the ability to add, remove, wrap and call javascript functions. The status (above) will update every second indicating whether the function (called myFunction) is present in the javascript environment on the browser. Click the add button to have the xajax function "install" the function on the browser. If it already exists, it will be replaced. Click the remove button to have the function removed from the javascript environment.

By clicking the call button, you can have the xajax enabled function invoke the function from the server. The function, if present, will pop up an alert indicating that it was called.

The wrap button will cause the xajax enabled function to generate a function wrapper around the existing javascript function. The wrapper function will pop up an alert message before calling the original function, then another alert message once the function returns. The wrapper function can be added around the original function any number of times. Each time the wrapper function is applied, it will add a new "layer" where the before and after alert messages are displayed. Click the call button after wrapping the function to see the result. printDescriptionPanel(ob_get_clean()); $objTestScriptPlugin->printFooter(); php-xajax-0.5/tests/suite/img/0000755000175000017500000000000011137074666014760 5ustar dgildgilphp-xajax-0.5/tests/suite/img/content_bg.gif0000644000175000017500000000075010760021500017547 0ustar dgildgilGIF89a!,@#~dYrhV,'t=xQ7@p)HrIh*Ѕ@Xv`xL)zi/xgN{x|a/zH)(,-/.23549;:>?@DFEHLMQRUVW[\]acbfghklnmqruy{}lj68̍ */ define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'HTML'); define('XAJAX_HTML_CONTROL_DOCTYPE_VERSION', '4.01'); define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL'); $sBaseFolder = dirname(dirname(dirname(__FILE__))); $sCoreFolder = '/xajax_core'; $sCtrlFolder = '/xajax_controls'; include $sBaseFolder . $sCoreFolder . '/xajax.inc.php'; $xajax = new xajax(); $xajax->configure('javascript URI', '../../'); include $sBaseFolder . $sCtrlFolder . '/validate_HTML401TRANSITIONAL.inc.php'; include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php'; foreach (array( '/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) include $sBaseFolder . $sCtrlFolder . $sFile; $objDocument = new clsDocument(array( 'children' => array( new clsDoctype(), new clsHtml(array( 'children' => array( new clsHead(array( 'xajax' => $xajax, 'children' => array( generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase() ) )), new clsBody(array( 'children' => array( generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe() ) )) ) )) ) )); function generateTitle() { return new clsTitle(array( 'child' => new clsLiteral('Title') )); } function generateStyle() { return new clsStyle(array( 'attributes' => array( 'type' => 'text/css' ), 'child' => new clsLiteral('styleOne { background: #ffdddd; }') )); } function generateScript() { return new clsScript(array( 'attributes' => array( 'type' => 'text/javascript' ), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };') )); } function generateMeta() { return new clsMeta(array( 'attributes' => array( 'name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax' ) )); } function generateLink() { return new clsLink(array( 'attributes' => array( 'type' => 'text/css', 'href' => './style.css' ) )); } function generateBase() { global $xajax; return new clsBase(array( 'attributes' => array( 'href' => dirname($xajax->_detectURI()) . '/' ) )); } function generateOrderedList() { return new clsOl(array( 'children' => array( new clsLi(array('child' => new clsLiteral('List Item One'))), new clsLi(array('child' => new clsLiteral('List Item Two'))), new clsLi(array('child' => new clsLiteral('List Item Three'))), new clsLi(array('child' => new clsLiteral('List Item Four'))) ) )); } function generateUnorderedList() { return new clsUl(array( 'children' => array( new clsLi(array('child' => new clsLiteral('List Item One'))), new clsLi(array('child' => new clsLiteral('List Item Two'))), new clsLi(array('child' => new clsLiteral('List Item Three'))), new clsLi(array('child' => new clsLiteral('List Item Four'))) ) )); } function generateDefinitionList() { return new clsDl(array( 'children' => array( new clsDt(array('child' => new clsLiteral('Data term one'))), new clsDd(array('child' => new clsLiteral('Data term one definition'))), new clsDt(array('child' => new clsLiteral('Data term two'))), new clsDd(array('child' => new clsLiteral('Data term two definition'))), new clsDt(array('child' => new clsLiteral('Data term three'))), new clsDd(array('child' => new clsLiteral('Data term three definition'))) ) )); } function generateTable() { return new clsTable(array( 'children' => array( new clsCaption(array('child' => new clsLiteral('Table Caption'))), new clsColgroup(array( 'attributes' => array( 'width' => '20' ), 'children' => array( new clsCol(array( 'attributes' => array( 'span' => '2' ) )), new clsCol(array( 'attributes' => array( 'class' => 'styleOne' ) )) ) )), new clsThead(array( 'child' => new clsTr(array( 'children' => array( new clsTh(array( 'child' => new clsLiteral('Column One') )), new clsTh(array( 'child' => new clsLiteral('Column Two') )), new clsTh(array( 'child' => new clsLiteral('Column Three') )) ) )) )), new clsTfoot(array( 'child' => new clsTr(array( 'children' => array( new clsTd(array( 'child' => new clsLiteral('Footer') )), new clsTd(array( 'child' => new clsLiteral('is') )), new clsTd(array( 'child' => new clsLiteral('here.') )) ) )) )), new clsTbody(array( 'children' => array( new clsTr(array( 'children' => array( new clsTd(array( 'child' => new clsLiteral('R1 C1') )), new clsTd(array( 'child' => new clsLiteral('R1 C2') )), new clsTd(array( 'child' => new clsLiteral('R1 C3') )) ) )), new clsTr(array( 'children' => array( new clsTd(array( 'child' => new clsLiteral('R2 C1') )), new clsTd(array( 'child' => new clsLiteral('R2 C2') )), new clsTd(array( 'child' => new clsLiteral('R2 C3') )) ) )), new clsTr(array( 'children' => array( new clsTd(array( 'child' => new clsLiteral('R3 C1') )), new clsTd(array( 'child' => new clsLiteral('R3 C2') )), new clsTd(array( 'child' => new clsLiteral('R3 C3') )) ) )), ) )) ) )); } function generateForm() { return new clsDiv(array( 'children' => array( new clsFieldset(array( 'children' => array( new clsLegend(array('child' => new clsLiteral('Fieldset one'))), generateSelect(), generateInputText() ) )), new clsFieldset(array( 'children' => array( new clsLegend(array('child' => new clsLiteral('Fieldset two'))), generateInputCheckbox(), generateInputRadioButton(), generateInputTextArea(), generateInputButton(), generateInputHidden() ) )) ) )); } function generateSelect() { return new clsSelect(array( 'attributes' => array( 'name' => 'InputSelect', 'id' => 'InputSelect' ), 'children' => array( new clsOptionGroup(array( 'attributes' => array( 'label' => 'Option Group One' ), 'children' => array( new clsOption(array( 'attributes' => array( 'value' => 'OptionGroupOne_OptionOne' ), 'child' => new clsLiteral('Option Group One: Option One') )), new clsOption(array( 'attributes' => array( 'value' => 'OptionGroupOne_OptionTwo' ), 'child' => new clsLiteral('Option Group One: Option Two') )) ) )), new clsOptionGroup(array( 'attributes' => array( 'label' => 'Option Group Two' ), 'children' => array( new clsOption(array( 'attributes' => array( 'value' => 'OptionGroupTwo_OptionOne' ), 'child' => new clsLiteral('Option Group Two: Option One') )), new clsOption(array( 'attributes' => array( 'value' => 'OptionGroupTwo_OptionTwo' ), 'child' => new clsLiteral('Option Group Two: Option Two') )) ) )) ) )); } function generateInputText() { return new clsInputWithLabel('Text: ', 'left', array( 'attributes' => array( 'type' => 'text', 'name' => 'InputText', 'id' => 'InputText' ) )); } function generateInputCheckbox() { return new clsInputWithLabel('Checkbox: ', 'left', array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'InputCheckbox', 'id' => 'InputCheckbox' ) )); } function generateInputRadioButton() { return new clsInputWithLabel('Radio: ', 'left', array( 'attributes' => array( 'type' => 'radio', 'name' => 'InputRadio', 'id' => 'InputRadio' ) )); } function generateInputTextArea() { return new clsTextarea(array( 'attributes' => array( 'name' => 'InputTextarea', 'id' => 'InputTextarea', 'rows' => '20', 'cols' => '20' ) )); } function generateInputButton() { return new clsInput(array( 'attributes' => array( 'type' => 'button', 'name' => 'InputButton', 'id' => 'InputButton' ) )); } function generateInputHidden() { return new clsInputWithLabel('Hidden: ', 'left', array( 'attributes' => array( 'type' => 'hidden', 'name' => 'InputHidden', 'id' => 'InputHidden' ) )); } function generateContent() { $nbsp = new clsLiteral(' '); return new clsDiv(array( 'children' => array( new clsLiteral('literal text'), new clsBr(), new clsHr(), new clsSub(array('child' => new clsLiteral('sub'))), $nbsp, new clsSup(array('child' => new clsLiteral('sup'))), $nbsp, new clsEm(array('child' => new clsLiteral('em'))), $nbsp, new clsStrong(array('child' => new clsLiteral('strong'))), $nbsp, new clsCite(array('child' => new clsLiteral('cite'))), $nbsp, new clsDfn(array('child' => new clsLiteral('dfn'))), $nbsp, new clsCode(array('child' => new clsLiteral('code'))), $nbsp, new clsSamp(array('child' => new clsLiteral('samp'))), $nbsp, new clsKbd(array('child' => new clsLiteral('kbd'))), $nbsp, new clsVar(array('child' => new clsLiteral('var'))), $nbsp, new clsAbbr(array('child' => new clsLiteral('abbr'))), $nbsp, new clsAcronym(array('child' => new clsLiteral('acronym'))), $nbsp, new clsTt(array('child' => new clsLiteral('tt'))), $nbsp, new clsItalic(array('child' => new clsLiteral('italic'))), $nbsp, new clsBold(array('child' => new clsLiteral('bold'))), $nbsp, new clsBig(array('child' => new clsLiteral('big'))), $nbsp, new clsSmall(array('child' => new clsLiteral('small'))), $nbsp, new clsIns(array('child' => new clsLiteral('ins'))), $nbsp, new clsDel(array('child' => new clsLiteral('del'))), new clsHeadline('1', array('child' => new clsLiteral('h1'))), new clsHeadline('2', array('child' => new clsLiteral('h2'))), new clsHeadline('3', array('child' => new clsLiteral('h3'))), new clsHeadline('4', array('child' => new clsLiteral('h4'))), new clsHeadline('5', array('child' => new clsLiteral('h5'))), new clsHeadline('6', array('child' => new clsLiteral('h6'))), new clsAddress(array('child' => new clsLiteral('address'))), new clsParagraph(array('child' => new clsLiteral('paragraph'))), new clsBlockquote(array('child' => new clsLiteral('blockquote'))), new clsPre(array('child' => new clsLiteral('pre'))) ) )); } function generateValidation() { return new clsDiv(array( 'child' => new clsParagraph(array( 'child' => new clsAnchor(array( 'attributes' => array( 'href' => 'http://validator.w3.org/check?uri=referer', 'target' => '_new' ), 'child' => new clsImg(array( 'attributes' => array( 'src' => 'http://www.w3.org/Icons/valid-html401-blue', 'alt' => 'Valid HTML 4.01 Transitional', 'height' => 31, 'width' => 88 ) )) )) )) )); } function generateIframe() { return new clsIframe(array( 'attributes' => array( 'src' => 'frameset.php' ) )); } $objDocument->printHTML(); php-xajax-0.5/tests/suite/pluginTest.php0000644000175000017500000001234111000570314017030 0ustar dgildgil_detectURI(); $requestURI = str_replace('methodOne=1', '', $requestURI); $requestURI = str_replace('methodTwo=1', '', $requestURI); $requestURI = str_replace('methodThree=1', '', $requestURI); $reqShowOutput =& $xajax->register(XAJAX_FUNCTION, "showOutput"); class testPlugin extends xajaxResponsePlugin { function getName() { return "testPlugin"; } function generateClientScript() { echo "\n\n"; } function testMethod() { $this->addCommand(array('n'=>'testPlg'), 'abcde]]>fg'); } } $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin(new testPlugin()); $xajax->processRequest(); $sRoot = dirname(dirname(dirname(__FILE__))); if (false == class_exists('xajaxControl')) { $sCore = '/xajax_core'; include_once($sRoot . $sCore . '/xajaxControl.inc.php'); } $sControls = '/xajax_controls'; foreach (array( '/document.inc.php', '/content.inc.php', '/group.inc.php', '/structure.inc.php', '/misc.inc.php') as $sFile) include_once($sRoot . $sControls . $sFile); $buttonShowOutput = new clsButton(array( 'attributes' => array('id' => 'btnShowOutput'), 'child' => new clsLiteral('Show Response XML'), 'event' => array('onclick', $reqShowOutput) )); $objTestScriptPlugin->printHeader($xajax, "Basic Plugin Test"); ob_start(); ?>

setAttribute('disabled', 'disabled'); ?>

printHTML(); ?>

Please select a method appropriate to the version of php running on your host:
PHP4 & PHP5 "; $newRequestURI = $requestURI . $sSeparator . 'methodTwo=1'; $newRequestURI = str_replace('?&', '?', str_replace('&&', '&', $newRequestURI)); echo "PHP5 "; $newRequestURI = $requestURI . $sSeparator . 'methodThree=1'; $newRequestURI = str_replace('?&', '?', str_replace('&&', '&', $newRequestURI)); echo "PHP5 (type 2)"; ?>
printControlPanel(ob_get_clean()); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); ob_start(); ?>

This test script demonstrates the ability to declare and register response plugins then use the registered plugin to send back new response commands to the client.

To use this script, select an option (above) that matches your server configuration; all methods can be used on a PHP5 based server.

The plugin will register a javascript command handler, then, upon request, it will add a response command that will be sent back to the client, invoking the command on the browser.

In this case, the plugin simply shows an alert dialog beginning with the text 'Test plugin command received:' then some data sent from the server.

The test script also outputs a preformatted string that represents a response object that includes the plugin response command. NOTE: This is not a copy of the response that IS sent to the browser, just an example of one. printDescriptionPanel(ob_get_clean()); $objTestScriptPlugin->printFooter(); function showOutput() { $testResponse = new xajaxResponse(); $testResponse->alert("This is the text that would be displayed in an alert box."); // PHP4 & PHP5 if (isset($_GET['methodOne'])) eval('$testResponse->plugin("testPlugin", "testMethod");'); // PHP5 ONLY - Uncomment to test if (isset($_GET['methodTwo'])) eval('$testResponse->plugin("testPlugin")->testMethod();'); // PHP5 ONLY - Uncomment to test if (isset($_GET['methodThree'])) eval('$testResponse->testPlugin->testMethod();'); $testResponseOutput = '

' 
		. htmlspecialchars(str_replace("><", ">\n<", $testResponse->getOutput())) 
		. '
'; $objResponse = new xajaxResponse(); $objResponse->assign("status", "innerHTML", $testResponseOutput); if (isset($_GET['methodOne'])) eval('$objResponse->plugin("testPlugin", "testMethod");'); if (isset($_GET['methodTwo'])) eval('$objResponse->plugin("testPlugin")->testMethod();'); if (isset($_GET['methodThree'])) eval('$objResponse->testPlugin->testMethod();'); return $objResponse; } ?>php-xajax-0.5/tests/suite/none.php0000644000175000017500000000044410760021500015632 0ustar dgildgilprintHeader($xajax, "Xajax Test Suite"); ?> Please select the xajax options above, then select a test page from the drop down. printFooter(); php-xajax-0.5/tests/suite/css3.css0000644000175000017500000000013411045155136015555 0ustar dgildgil.loadCSS1_Print { visibility: hidden; } .unloadCSS1_Print { visibility: visible; }php-xajax-0.5/tests/suite/assign_append.php0000644000175000017500000001160411045056136017520 0ustar dgildgil commands: - assign> - append> */ include_once('options.inc.php'); require_once('./testScriptPlugin.inc.php'); $objResponse = new xajaxResponse(); class clsPage { function clsPage() { } function sendAssignInnerHTML() { global $objResponse; $objResponse->assign("status", "innerHTML", "Message from the php function sendAssignInnerHTML."); return $objResponse; } function sendAssignStyleBackground($color) { global $objResponse; $objResponse->assign("status", "style.backgroundColor", $color); return $objResponse; } function sendAssignOuterHTML() { global $objResponse; $objResponse->assign("status", "innerHTML", "
This div should appear and remain here.
This div should appear then disappear.
This div should appear and remain here also.
"); $objResponse->assign("ReplaceMe", "outerHTML", "
Successfully replaced the old element with this element via outerHTML
"); return $objResponse; } function sendAppendInnerHTML() { global $objResponse; $objResponse->append("status", "innerHTML", "
This div should be appended to the end.
"); return $objResponse; } } $page = new clsPage(); $aRequests = $xajax->register(XAJAX_CALLABLE_OBJECT, $page); $xajax->processRequest(); $sRoot = dirname(dirname(dirname(__FILE__))); if (false == class_exists('xajaxControl')) { $sCore = '/xajax_core'; include_once($sRoot . $sCore . '/xajaxControl.inc.php'); } $sControls = '/xajax_controls'; foreach (array( '/document.inc.php', '/structure.inc.php', '/content.inc.php', '/misc.inc.php' ) as $sInclude) include $sRoot . $sControls . $sInclude; $litNonBreakSpace = new clsLiteral(' '); $divPage = new clsDiv(); $divAssignInnerHTML = new clsDiv(); $aSAIH = new clsAnchor(); $aSAIH->setEvent('onclick', $aRequests['sendassigninnerhtml']); $aSAIH->addChild(new clsLiteral('Update Content via an assign on the innerHTML property.')); $divAssignInnerHTML->addChild($aSAIH); $divPage->addChild($divAssignInnerHTML); $divStyle = new clsDiv(); $divMessage = new clsDiv(); $divMessage->addChild(new clsLiteral('Update style.background property via assign: ')); $divStyle->addChild($divMessage); $divColor = new clsDiv(); $aSASB_Red = new clsAnchor(); $aSASB_Red->setEvent('onclick', $aRequests['sendassignstylebackground'], array(array(0, XAJAX_QUOTED_VALUE, '#ff5555'))); $aSASB_Red->addChild(new clsLiteral('Red')); $divColor->addChild($aSASB_Red); $divColor->addChild($litNonBreakSpace); $aSASB_Green = new clsAnchor(); $aSASB_Green->setEvent('onclick', $aRequests['sendassignstylebackground'], array(array(0, XAJAX_QUOTED_VALUE, '#55ff55'))); $aSASB_Green->addChild(new clsLiteral('Green')); $divColor->addChild($aSASB_Green); $divColor->addChild($litNonBreakSpace); $aSASB_Blue = new clsAnchor(); $aSASB_Blue->setEvent('onclick', $aRequests['sendassignstylebackground'], array(array(0, XAJAX_QUOTED_VALUE, '#5555ff'))); $aSASB_Blue->addChild(new clsLiteral('Blue')); $divColor->addChild($aSASB_Blue); $divColor->addChild($litNonBreakSpace); $aSASB_White = new clsAnchor(); $aSASB_White->setEvent('onclick', $aRequests['sendassignstylebackground'], array(array(0, XAJAX_QUOTED_VALUE, '#ffffff'))); $aSASB_White->addChild(new clsLiteral('White')); $divColor->addChild($aSASB_White); $divColor->addChild($litNonBreakSpace); $divStyle->addChild($divColor); $divPage->addChild($divStyle); $divOuterHTML = new clsDiv(); $aSAOH = new clsAnchor(); $aSAOH->setEvent('onclick', $aRequests['sendassignouterhtml']); $aSAOH->addChild(new clsLiteral('Test an update using the outerHTML property.')); $divOuterHTML->addChild($aSAOH); $divPage->addChild($divOuterHTML); $divInnerHTML = new clsDiv(); $aSPIH = new clsAnchor(); $aSPIH->setEvent('onclick', $aRequests['sendappendinnerhtml']); $aSPIH->addChild(new clsLiteral('Test an append using the innerHTML property.')); $divInnerHTML->addChild($aSPIH); $divPage->addChild($divInnerHTML); $divContent = new clsDiv(array( 'attributes' => array('id' => 'content'), 'children' => array( new clsLiteral('This content has not been modified, click an option above to execute a test.') ) )); $divPage->addChild($divContent); $objTestScriptPlugin->printHeader($xajax, "xajax Test Suite - Assign / Append", ob_get_clean()); ob_start(); $divPage->printHTML(); $objTestScriptPlugin->printControlPanel(ob_get_clean()); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); $objTestScriptPlugin->printDescriptionPanel(''); $objTestScriptPlugin->printFooter();php-xajax-0.5/tests/suite/css.php0000644000175000017500000001707011045155136015500 0ustar dgildgilincludeCSS> and removeCSS> to effect the active style information on the page dynamically. */ error_reporting(E_ALL^E_NOTICE); ini_set("display_errors", 1); require_once("./options.inc.php"); require_once('./testScriptPlugin.inc.php'); $objResponse = new xajaxResponse(); class clsFunctions { function clsFunctions() { } function loadCSS1() { global $objResponse; $objResponse->includeCSS('css1.css'); $objResponse->append('log', 'innerHTML', 'CSS1 loaded.
'); return $objResponse; } function unloadCSS1() { global $objResponse; $objResponse->removeCSS('css1.css'); $objResponse->append('log', 'innerHTML', 'CSS1 unloaded.
'); return $objResponse; } function loadCSS2() { global $objResponse; $objResponse->includeCSS('css2.css'); $objResponse->append('log', 'innerHTML', 'CSS2 loaded.
'); return $objResponse; } function unloadCSS2() { global $objResponse; $objResponse->removeCSS('css2.css'); $objResponse->append('log', 'innerHTML', 'CSS2 unloaded.
'); return $objResponse; } function loadCSS1_Print() { global $objResponse; $objResponse->includeCSS('css3.css'); $objResponse->includeCSS('css1.css', 'print'); $objResponse->append('log', 'innerHTML', 'CSS1 loaded for Print media.
'); return $objResponse; } function unloadCSS1_Print() { global $objResponse; $objResponse->removeCSS('css3.css'); $objResponse->removeCSS('css1.css', 'print'); $objResponse->append('log', 'innerHTML', 'CSS1 unloaded for Print media.
'); return $objResponse; } function loadCSS2_Print() { global $objResponse; $objResponse->includeCSS('css4.css'); $objResponse->includeCSS('css2.css', 'print'); $objResponse->append('log', 'innerHTML', 'CSS2 loaded for Print media.
'); return $objResponse; } function unloadCSS2_Print() { global $objResponse; $objResponse->removeCSS('css4.css'); $objResponse->removeCSS('css2.css', 'print'); $objResponse->append('log', 'innerHTML', 'CSS2 unloaded for Print media.
'); return $objResponse; } } $functions = new clsFunctions(); $aFunctions = $xajax->register(XAJAX_CALLABLE_OBJECT, $functions); $xajax->processRequest(); $sRoot = dirname(dirname(dirname(__FILE__))); if (false == class_exists('xajaxControl')) { $sCore = '/xajax_core'; include_once($sRoot . $sCore . '/xajaxControl.inc.php'); } $sControls = '/xajax_controls'; include_once($sRoot . $sControls . '/document.inc.php'); include_once($sRoot . $sControls . '/content.inc.php'); include_once($sRoot . $sControls . '/group.inc.php'); include_once($sRoot . $sControls . '/form.inc.php'); include_once($sRoot . $sControls . '/misc.inc.php'); $buttonLoadCSS1 = new clsButton(array( 'attributes' => array( 'class' => 'loadCSS1', 'id' => 'loadCSS1' ), 'children' => array(new clsLiteral('Load CSS 1')), 'event' => array('onclick', $aFunctions['loadcss1']) )); $buttonUnloadCSS1 = new clsButton(array( 'attributes' => array( 'class' => 'initiallyHidden unloadCSS1', 'id' => 'unloadCSS1' ), 'children' => array(new clsLiteral('Unload CSS 1')), 'event' => array('onclick', $aFunctions['unloadcss1']) )); $buttonLoadCSS2 = new clsButton(array( 'attributes' => array( 'class' => 'loadCSS2', 'id' => 'loadCSS2' ), 'children' => array(new clsLiteral('Load CSS 2')), 'event' => array('onclick', $aFunctions['loadcss2']) )); $buttonUnloadCSS2 = new clsButton(array( 'attributes' => array( 'class' => 'initiallyHidden unloadCSS2', 'id' => 'unloadCSS2' ), 'children' => array(new clsLiteral('Unload CSS 2')), 'event' => array('onclick', $aFunctions['unloadcss2']) )); $buttonLoadCSS1_Print = new clsButton(array( 'attributes' => array( 'class' => 'loadCSS1_Print', 'id' => 'loadCSS1_Print' ), 'children' => array(new clsLiteral('Load CSS 1 (print)')), 'event' => array('onclick', $aFunctions['loadcss1_print']) )); $buttonUnloadCSS1_Print = new clsButton(array( 'attributes' => array( 'class' => 'initiallyHidden unloadCSS1_Print', 'id' => 'unloadCSS1_Print' ), 'children' => array(new clsLiteral('Unload CSS 1 (print)')), 'event' => array('onclick', $aFunctions['unloadcss1_print']) )); $buttonLoadCSS2_Print = new clsButton(array( 'attributes' => array( 'class' => 'loadCSS2_Print', 'id' => 'loadCSS2_Print' ), 'children' => array(new clsLiteral('Load CSS 2 (print)')), 'event' => array('onclick', $aFunctions['loadcss2_print']) )); $buttonUnloadCSS2_Print = new clsButton(array( 'attributes' => array( 'class' => 'initiallyHidden unloadCSS2_Print', 'id' => 'unloadCSS2_Print' ), 'children' => array(new clsLiteral('Unload CSS 2 (print)')), 'event' => array('onclick', $aFunctions['unloadcss2_print']) )); ob_start(); ?> printHeader($xajax, "Load / Unload CSS files",ob_get_clean()); ob_start(); ?>
printHTML(); ?>printHTML(); ?>
printHTML(); ?>printHTML(); ?>
Header Text
This is the body text.
This is the tagline.
printHTML(); ?>printHTML(); ?>
printHTML(); ?>printHTML(); ?>
printControlPanel(ob_get_clean()); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); $objTestScriptPlugin->printDescriptionPanel(" This test script demonstrates the ability to request the loading and unloading of CSS files from the server side. Click the load button for either CSS1 or CSS2 and watch the browser apply the style changes to the page nearly instantly. Once loaded, the style changes can be removed with the unload button. *NEW* This test script now shows the use of the new media (optional parameter). When you click the load or unload CSS1 and CSS2 for print, you can see the changes only in the print preview or on a printed page. "); $objTestScriptPlugin->printFooter();php-xajax-0.5/tests/suite/iframe.php0000644000175000017500000001023410760021500016134 0ustar dgildgilregister(XAJAX_CALLABLE_OBJECT, new clsFunctions()); $aFunctions['showformvalues']->addParameter(XAJAX_FORM_VALUES, 'theForm'); $objResponse = new xajaxResponse(); $xajax->processRequest(); class clsContext { function begin($iframe) { global $objResponse; $objResponse->script("var theFrame = xajax.$('".$iframe."'); xajax.config.baseDocument = (theFrame.contentDocument || theFrame.contentWindow.document);"); } function end() { global $objResponse; $objResponse->script("xajax.config.baseDocument = document;"); } } class clsFunctions { function clsFunctions() { } function showIsLoaded() { global $objResponse; clsContext::begin("theFrame"); $objResponse->script('try { if (iframe.code.loaded) xajax.$("outputDIV").innerHTML += "
iframe.js loaded"; } catch (e) { xajax.$("outputDIV").innerHTML += "
iframe.js *NOT* loaded"; }'); clsContext::end(); $objResponse->script('try { if (iframe.code.loaded) xajax.$("outputDIV").innerHTML += "
iframe.js loaded in iframe context"; } catch (e) { xajax.$("outputDIV").innerHTML += "
iframe.js *NOT* loaded in iframe context"; }'); } function showFormValues($aFormValues) { global $objResponse; clsContext::begin("theFrame"); $objResponse->assign("outputDIV", "innerHTML", print_r($aFormValues, true)); $objResponse->includeScriptOnce("iframe.js"); clsContext::end(); $objResponse->assign("outputDIV", "innerHTML", print_r($aFormValues, true)); $objResponse->waitFor("iframe.code.loaded", 90); $this->showIsLoaded(); return $objResponse; } function clear() { global $objResponse; clsContext::begin('theFrame'); $objResponse->assign('outputDIV', 'innerHTML', ''); $objResponse->removeScript('iframe.js', 'iframe.code.unload();'); clsContext::end(); $objResponse->assign('outputDIV', 'innerHTML', ''); $this->showIsLoaded(); return $objResponse; } } $objTestScriptPlugin->printHeader($xajax, "Iframe",'',''); ?>
printScript(); ?>; return false;'>


This test application demonstrates a number of features:
  • The ability to create and manipulate elements within an iframe.
  • The ability to load a javascript file(s) inside an iframe
  • The ability for iframes to have their own instance of xajax
  • The ability for an iframe to communicate back to the parent
  • The response command waitFor... which can wait for a custom condition to evaluate to true.
When you click the submit button, it will send a xajax request which in turn triggers the following:
The form values are displayed in the iframe and the main document.
The iframe is instructed to load a javascript file (iframe.js)
The main document frame waits until the javascript file is fully loaded (using waitFor)
The iframe.js invokes a xajax request (in the iframe to theFrame.php) which sleeps for 2 seconds, then returns 'iframe.js loaded'.
The iframe.js waits 4 seconds, then notifies the parent (main document) that the iframe.js file is fully loaded.
The main document displays that the iframe.js file is loaded in the iframe context.
printControlPanel(); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); $objTestScriptPlugin->printDescriptionPanel(); $objTestScriptPlugin->printFooter();php-xajax-0.5/tests/suite/testScriptPlugin.inc.php0000644000175000017500000001261211045075056021002 0ustar dgildgilbDeferScriptGeneration = false; } /* Function: configure Sets/stores configuration options used by this plugin. */ function configure($sName, $mValue) { if ('deferScriptGeneration' == $sName) { if (true === $mValue || false === $mValue) $this->bDeferScriptGeneration = $mValue; else if ('deferred' === $mValue) $this->bDeferScriptGeneration = $mValue; } } /* Function: generateClientScript Called by the during the client script generation phase. This is used to generate a block of javascript code that will contain function declarations that can be used on the browser through javascript to initiate xajax requests. */ function generateClientScript() { if (false === $this->bDeferScriptGeneration || 'deferred' === $this->bDeferScriptGeneration) { echo "\n\n"; echo "\n\n"; } } function printHeader($xajax, $sTitle, $sOptional='',$onload='') { echo '' . "\n"; echo '' . "\n"; echo " \n"; echo " {$sTitle}\n"; echo " \n"; echo $sOptional; $xajax->printJavascript(); echo " \n"; echo " \n"; echo "

{$sTitle}

\n"; } function printFooter() { echo " \n"; echo "\n"; } function printControlPanel($sControls) { echo "
\n"; echo "
\n"; echo "
\n"; echo " Controls\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo $sControls; echo "
\n"; } function printStatusPanel($sStatus='') { echo "
\n"; echo "
\n"; echo " Status\n"; echo "
\n"; echo "
{$sStatus}
\n"; echo "
\n"; echo "
\n"; } function printLogPanel() { echo "
\n"; echo "
\n"; echo " Log\n"; echo " \n"; echo " (Clear)\n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo "
\n"; echo "
\n"; } function printDescriptionPanel($description='') { echo "
\n"; echo $description; echo "
\n"; echo "
\n"; } } $objTestScriptPlugin = new testScriptPlugin(); $objPluginManager =& xajaxPluginManager::getInstance(); $objPluginManager->registerPlugin($objTestScriptPlugin); php-xajax-0.5/tests/suite/iframe.js0000644000175000017500000000123610641226120015766 0ustar dgildgiltry { if (undefined == iframe.code) { iframe.code = {} } } catch (e) { iframe = {} iframe.code = {} } finally { parent.iframe = iframe; } xajax.request( { xjxcls: 'clsfunctions', xjxmthd: 'confirm' }, { parameters: [2] } ); iframe.code.loaded = false; // simulate a 4 second delay in loading the .js file for the iframe setTimeout('iframe.code.loaded = true;', 4000); iframe.code.unload = function() { iframe.code = {} iframe = {} parent.iframe = {} xajax.$('outputDIV').innerHTML += '
iframe.js being unloaded'; } xajax.$('outputDIV').innerHTML += '
iframe.js loaded, sleeping for 4 seconds to simulate network delay';php-xajax-0.5/tests/suite/options.inc.php0000644000175000017500000000240711045160170017143 0ustar dgildgilconfigure('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"); if (isset($_GET['useEncoding'])) $xajax->configure("characterEncoding", $_GET['useEncoding']); if (isset($_GET['outputEntities'])) if (0 != $_GET['outputEntities']) $xajax->configure("outputEntities", true); if (isset($_GET['decodeUTF8Input'])) if (0 != $_GET['decodeUTF8Input']) $xajax->configure("decodeUTF8Input", true); if (isset($_GET['scriptDeferral'])) if (0 != $_GET['scriptDeferral']) $xajax->configure('deferScriptGeneration', true); if (isset($_GET['lang'])) $xajax->configure('language', $_GET['lang']); ?>php-xajax-0.5/tests/suite/alert_confirm.php0000644000175000017500000001232210745604744017541 0ustar dgildgil commands: - alert> - confirmCommands> */ require_once("./options.inc.php"); require_once('./testScriptPlugin.inc.php'); /* Function: sendAlert See sendAlert> */ function sendAlert($sValue) { global $page; return $page->sendAlert($sValue); } /* Function: sendConfirmCommands See sendAlert> */ function sendConfirmCommands() { global $page; return $page->sendConfirmCommands(); } /* Class: clsPage Contains functions that will be registered and called from the browser. */ class clsPage { /* Function: clsPage Constructor */ function clsPage() { } /* Function: sendAlert Generates a alert> command that displays a message. */ function sendAlert($sValue) { $objResponse = new xajaxResponse(); $objResponse->alert("Message from the sendAlert handler [{$sValue}]."); return $objResponse; } /* Function: sendConfirmCommands Generates a confirmCommands> command that will prompt the user if they want to see the alert, then a alert> command. */ function sendConfirmCommands() { $objResponse = new xajaxResponse(); $objResponse->confirmCommands(1, 'Do you want to see an alert next?'); $objResponse->alert("Here is the alert!"); return $objResponse; } function somePrivateFunction() { } function anotherPrivateFunction() { } function xajax_public() { // this is intended to return only the functions that should // be made available via xajax; however, for testing, we include // anotherPrivateFunction which will be excluded explicitly by // xajax_private. return array( 'sendAlert', 'sendConfirmCommands', 'anotherPrivateFunction' ); } function xajax_private() { return array( 'anotherPrivateFunction' ); } } $page = new clsPage(); $aPageRequests =& $xajax->register(XAJAX_CALLABLE_OBJECT, $page); $aPageRequests["sendalert"]->addParameter(XAJAX_QUOTED_VALUE, 'from callable object'); $requestSendAlert =& $xajax->register(XAJAX_FUNCTION, 'sendAlert'); $requestSendAlert->addParameter(XAJAX_QUOTED_VALUE, 'from function at global scope'); $requestSendConfirmCommands =& $xajax->register(XAJAX_FUNCTION, 'sendConfirmCommands'); $requestShowFormValues =& $xajax->register( XAJAX_FUNCTION, new xajaxUserFunction('showFormValues', 'alert_confirm_external.inc.php'), array('mode'=>'"synchronous"')); $requestShowFormValues->addParameter(XAJAX_FORM_VALUES, 'theForm'); $requestSendBothEvent =& $xajax->register(XAJAX_EVENT, 'sendBoth'); $requestSendBothEvent->addParameter(XAJAX_QUOTED_VALUE, 'from event handler'); $xajax->register(XAJAX_EVENT_HANDLER, 'sendBoth', 'sendAlert'); $xajax->register(XAJAX_EVENT_HANDLER, 'sendBoth', 'sendConfirmCommands'); $xajax->processRequest(); ob_start(); ?> printHeader($xajax, "Alert / Confirm", ob_get_clean()); ob_start(); ?>
Functions at
Global Scope:
Send Alert
Send Confirm
Functions registered as
Event Handlers:
Send Both
Using function at global scope from an external (include) file :
Send Alert
printControlPanel(ob_get_clean()); $objTestScriptPlugin->printStatusPanel(); $objTestScriptPlugin->printLogPanel(); ob_start(); ?> The purpose of this script is to test the invocation of the alert and confirm dialogs on the browser from the php script. It also tests the use of 'global functions', 'callable objects' and 'event handlers'. Last, it tests the ability to include a php script that contains the request handler only at the time of the request. printDescriptionPanel(ob_get_clean()); $objTestScriptPlugin->printFooter(); ?> php-xajax-0.5/tests/suite/xajax.css0000644000175000017500000000150011046052100015777 0ustar dgildgil body { font-size:13px; font-family:"Lucida Grande","Trebuchet MS",Verdana,sans-serif; color:#333; background:url(img/content_bg.gif) top left repeat-x; } h1 { margin:4px; margin-left:20px; color:#7F1F3A; } h2 { color:#7F1F3A; margin:4px 2px 2px 0px; border-bottom:1px solid #7F1F3A; } h3 { margin:12px 2px 2px 0px; } a { color:#C20229; } ul { margin:0px; } #options { display:inline; margin-right:10px; float:left; } #encoding { display:inline; padding: 5px; float:left; } #control_panel { border: 1px solid #ccc; background: #fff; padding: 5px; } #testFrame { margin-top:10px; width: 100%; height: 400px; border: 1px solid #ccc; } #languages { float:left; } #statusMessage { padding: 3px; color: red; }php-xajax-0.5/tests/suite/css4.css0000644000175000017500000000013411045155136015556 0ustar dgildgil.loadCSS2_Print { visibility: hidden; } .unloadCSS2_Print { visibility: visible; }php-xajax-0.5/tests/suite/index.php0000644000175000017500000004426111046052100016005 0ustar dgildgilconfigure('javascript URI', '../../'); // $xajax->configure('deferScriptGeneration', true); // $xajax->configure('debug', true); $sRoot = dirname(dirname(dirname(__FILE__))); $sCoreFolder = $sRoot . '/xajax_core'; $sControlsFolder = $sRoot . '/xajax_controls'; require_once $sControlsFolder . '/validate_HTML401TRANSITIONAL.inc.php'; require_once $sCoreFolder . '/xajaxControl.inc.php'; $aRequests = $xajax->register(XAJAX_CALLABLE_OBJECT, new clsRequests()); $aRequests['gototest']->addParameter(XAJAX_FORM_VALUES, "settings"); $objResponse = new xajaxResponse(); $xajax->processRequest(); foreach (array( '/document.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php', '/structure.inc.php') as $sFile) require $sControlsFolder . $sFile; $brk = new clsBr(); $clear = new clsBr(array("attributes"=>array("style"=>"clear:both;"))); $space = new clsLiteral(' '); $objTitle = new clsTitle(array( 'children' => array(new clsLiteral('xajax Test Suite')) )); ob_start(); ?> array( 'type' => 'text/css' ), 'child' => new clsLiteral(ob_get_clean()) )); $objHead = new clsHead(array( 'xajax' => $xajax, 'children' => array( $objTitle, $objStyle, new clsMeta(array( 'attributes' => array( 'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8' ) )), new clsLink(array( 'attributes' => array( 'rel' => 'stylesheet', 'href' => 'xajax.css', 'type' => 'text/css' ) )) ) )); $objForm = new clsForm(array( 'attributes' => array('id' => 'settings'), 'child' => new clsDiv(array( 'children' => array( new clsSpan(array( 'attributes' => array('id' => 'testSelection') )), new clsInput(array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'control_panel_visible', 'id' => 'control_panel_visible', 'style' => 'visibility: hidden; position: absolute;', 'value' => 1, 'checked' => 'checked' ) )), new clsAnchor(array( 'child' => new clsLiteral('Next Test'), 'event' => array( 'onclick', $aRequests['nexttest'], array(array(0, XAJAX_FORM_VALUES, 'settings')) ) )), $space, new clsAnchor(array( 'child' => new clsLiteral('Show/Hide Control Panel'), 'event' => array( 'onclick', $aRequests['togglecontrolpanel'], array(array(0, XAJAX_CHECKED_VALUE, 'control_panel_visible')) ) )), $space, new clsAnchor(array( 'child' => new clsLiteral('Compress Javascript Files'), 'event' => array('onclick', $aRequests['recompressjavascript']) )), $space, new clsAnchor(array( 'child' => new clsLiteral('Compile Core Files'), 'event' => array('onclick', $aRequests['recompilecore']) )), $space, new clsAnchor(array( 'child' => new clsLiteral('Refresh Test Page'), 'event' => array('onclick', $aRequests['gototest']) )), new clsDiv(array( 'attributes' => array('id' => 'control_panel'), 'children' => array( // Controls //---------------------------------------------------------------------------------------------------------------------------- new clsDiv(array( "attributes" => array("id" => "options"), "children" => array( new clsInputWithLabel('Enable Debugging', 'right', array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'debug', 'id' => 'debug', 'value' => '1' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Enable Verbose Debugging', 'right', array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'verbose', 'id' => 'verbose', 'value' => '1' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Enable Status Messages', 'right', array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'status', 'id' => 'status', 'value' => '1' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Set default mode to Synchronous', 'right', array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'synchronous', 'id' => 'synchronous', 'value' => '1' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Inline javascript', 'right', array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'inlineJS', 'id' => 'inlineJS', 'value' => '1', 'checked' => 'checked' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Use compiled core', 'right', array( 'attributes' => array( 'type' => 'checkbox', 'name' => 'AIO', 'id' => 'AIO', 'value' => '1' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, ))), // ENCODING //---------------------------------------------------------------------------------------------------------------------------- new clsDiv(array( 'attributes' => array('id' => 'encoding'), 'children' => array( new clsInputWithLabel('Encoding: ', 'left', array( 'attributes' => array( 'type' => 'text', 'name' => 'useEncoding', 'id' => 'useEncoding', 'value' => 'UTF-8' ) )), $brk, new clsLiteral('Output HTML Entities? '), new clsInputWithLabel('Yes', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'htmlEntities', 'id' => 'htmlEntitiesYes', 'value' => 1 ) )), new clsInputWithLabel('No', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'htmlEntities', 'id' => 'htmlEntitiesNo', 'value' => 0, 'checked' => 'checked' ) )), $brk, new clsLiteral('Decode UTF-8 Input? '), new clsInputWithLabel('Yes', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'decodeUTF8Input', 'id' => 'decodeUTF8InputYes', 'value' => 1 ) )), new clsInputWithLabel('No', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'decodeUTF8Input', 'id' => 'decodeUTF8InputNo', 'value' => 0, 'checked' => 'checked' ) )), $brk, new clsInput(array( 'attributes' => array( 'type' => 'submit', 'name' => 'set_options', 'value' => 'Set Options' ), 'event' => array( 'onclick', $aRequests['gototest'] ) )) ) )), new clsDiv(array( 'attributes' => array('id' => 'languages'), 'children' => array( new clsInputWithLabel('Load language module (en)', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'lang', 'id' => 'lang_en', 'value' => 'en', 'checked' => 'checked' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Load language module (de)', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'lang', 'id' => 'lang_de', 'value' => 'de' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Load language module (es)', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'lang', 'id' => 'lang_es', 'value' => 'es' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Load language module (fr)', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'lang', 'id' => 'lang_fr', 'value' => 'fr' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Load language module (nl)', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'lang', 'id' => 'lang_nl', 'value' => 'nl' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Load language module (tr)', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'lang', 'id' => 'lang_tr', 'value' => 'tr' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk, new clsInputWithLabel('Load language module (bg)', 'right', array( 'attributes' => array( 'type' => 'radio', 'name' => 'lang', 'id' => 'lang_bg', 'value' => 'bg' ), 'event' => array( 'onclick', $aRequests['gototest'], array(), '', '; return true;' ) )), $brk ) )), $clear, new clsDiv(array( 'attributes' => array('id' => 'statusMessage') )) ) )) ) )) )); $objIframe = new clsIframe(array( 'attributes' => array( 'id' => 'testFrame', 'src' => './none.php' ) )); $objBody = new clsBody(array( 'children' => array( $objForm, $objIframe ), 'event' => array( 'onload', $aRequests['loadtests'] ) )); $document = new clsDocument(array( 'children' => array( new clsDoctype(), new clsHtml(array( 'children' => array( $objHead, $objBody ) )) ) )); $document->printHTML(); class clsRequests { var $tests = array(); function clsRequests() { $this->tests['./none.php'] = '--- Select Test ---'; $this->tests['./alert_confirm.php'] = 'Alert and Confirm Commands'; $this->tests['./assign_append.php'] = 'Assign and Append'; $this->tests['./tables.php'] = 'Tables'; $this->tests['./transport.php'] = 'Transport'; $this->tests['./delayEvents.php'] = 'Callbacks'; $this->tests['./events.php'] = 'Client-side Events'; $this->tests['./iframe.php'] = 'iFrame'; $this->tests['./css.php'] = 'CSS'; $this->tests['./functions.php'] = 'Functions'; $this->tests['./scriptContext.php'] = 'Script Context'; $this->tests['./server_events.php'] = 'Server-side Events'; $this->tests['./pluginTest.php'] = 'Response Plugin'; $this->tests['./callScriptTest.php'] = 'Call javascript Function'; } function loadTests() { global $objResponse; global $aRequests; global $sControlsFolder; require $sControlsFolder . '/form.inc.php'; require $sControlsFolder . '/content.inc.php'; $select = new clsSelect(array( 'attributes' => array( 'id' => 'selectedTest', 'name' => 'selectedTest' ), 'event' => array('onchange', $aRequests['gototest']) )); foreach ($this->tests as $key => $value) $select->addChild( new clsOption(array( 'attributes' => array('value' => $key), 'children' => array(new clsLiteral($value)) )) ); $objResponse->assign("testSelection", "innerHTML", $select->getHTML()); return $objResponse; } function nextTest($values) { global $objResponse; $test = $values['selectedTest']; $last = ''; $count = 0; foreach ($this->tests as $key => $value) { if ($test == $last) { $objResponse->assign('selectedTest', 'selectedIndex', $count); $values['selectedTest'] = $key; return $this->gotoTest($values); } $last = $key; $count += 1; } return $objResponse; } function recompressJavascript() { global $xajax; global $objResponse; global $aRequests; $xajax->autoCompressJavascript("../../xajax_js/xajax_core.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_debug.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_legacy.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_verbose.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_lang_de.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_lang_es.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_lang_fr.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_lang_nl.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_lang_tr.js", true); $xajax->autoCompressJavascript("../../xajax_js/xajax_lang_bg.js", true); sleep(1); $objResponse->assign('statusMessage', 'innerHTML', 'xajax javascript files recompressed...'); $objResponse->script($aRequests['gototest']->getScript()); $objResponse->script("setTimeout(function() { xajax.\$('statusMessage').innerHTML = ''; }, 4000);"); return $objResponse; } function recompileCore() { global $xajax; global $objResponse; global $aRequests; $xajax->_compile(); sleep(1); $objResponse->assign('statusMessage', 'innerHTML', 'xajax core recompiled...'); $objResponse->script($aRequests['gototest']->getScript()); $objResponse->script("setTimeout(function() { xajax.\$('statusMessage').innerHTML = ''; }, 4000);"); return $objResponse; } function gotoTest($values) { global $objResponse; $test = $values['selectedTest']; $delimiter = "?"; if (isset($values['status'])) { $test .= $delimiter; $test .= "status=1"; $delimiter = "&"; } if (isset($values['debug'])) { $test .= $delimiter; $test .= "debugging=1"; $delimiter = "&"; } if (isset($values['verbose'])) { $test .= $delimiter; $test .= "verbose=1"; $delimiter = "&"; } if (isset($values['useEncoding'])) { $test .= $delimiter; $test .= "useEncoding="; $test .= $values['useEncoding']; $delimiter = "&"; } if (isset($values['htmlEntities'])) { if ("0" != $values['htmlEntities']) { $test .= $delimiter; $test .= "htmlEntities="; $test .= $values['htmlEntities']; $delimiter = "&"; } } if (isset($values['decodeUTF8Input'])) { if ("0" != $values['decodeUTF8Input']) { $test .= $delimiter; $test .= "decodeUTF8Input="; $test .= $values['decodeUTF8Input']; $delimiter = "&"; } } if (isset($values['synchronous'])) { $test .= $delimiter; $test .= "synchronous=1"; $delimiter = "&"; } if (false == isset($values['inlineJS'])) { $test .= $delimiter; $test .= "scriptDeferral=1"; $delimiter = "&"; } if (isset($values['AIO'])) { $test .= $delimiter; $test .= "AIO=1"; $delimiter = "&"; } if (isset($values['lang'])) { $test .= $delimiter; $test .= "lang={$values['lang']}"; $delimiter = "&"; } $objResponse->assign('testFrame', 'src', ''); $objResponse->assign('testFrame', 'src', $test); return $objResponse; } function toggleControlPanel($bControlPanelVisible) { $objResponse = new xajaxResponse(); if ('true' == $bControlPanelVisible) { $objResponse->assign('control_panel_visible', 'checked', false); $objResponse->assign('control_panel', 'style.visibility', 'hidden'); $objResponse->assign('control_panel', 'style.display', 'none'); $objResponse->assign('control_panel', 'style.position', 'absolute'); } else { $objResponse->assign('control_panel_visible', 'checked', true); $objResponse->assign('control_panel', 'style.visibility', 'visible'); $objResponse->assign('control_panel', 'style.display', 'block'); $objResponse->assign('control_panel', 'style.position', 'static'); } return $objResponse; } } php-xajax-0.5/tests/registerExternalFunctionTest.php0000644000175000017500000000256111104471032021443 0ustar dgildgilconfigure( 'debug', true ); $xajax->registerFunction( "myExternalFunction", dirname( __FILE__ ) . "/myExternalFunction.php" ); $xajax->registerFunction( array ( "myFunction", "myExternalClass", "myMethod" ), dirname( __FILE__ ) . "/myExternalFunction.php" ); $xajax->processRequest(); ?> registerExternalFunction Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

registerExternalFunction Test

php-xajax-0.5/tests/fluentInterfaceTest.php0000644000175000017500000000201211104471032017513 0ustar dgildgilgetGlobalResponse()->alert( "Here is an alert." )->assign( "submittedDiv", "innerHTML", "Here is some HTML text." ); } $xajax->registerFunction( "testFluentInterface" ); $xajax->processRequest(); ?> Fluent Interface Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

Fluent Interface Test (PHP 5+ only)

Perform Test

php-xajax-0.5/tests/myExternalFunction.js0000644000175000017500000000021710760021500017223 0ustar dgildgilfunction myFunction() { alert('Congratulations!\n You have successfully included the\n myExternalFunction.js without reloading the page.'); }php-xajax-0.5/tests/HTTPStatusTest.php0000644000175000017500000000272711104471032016375 0ustar dgildgilsetFlag( "debug", true ); $xajax->registerFunction( "returnStatus" ); $xajax->processRequest(); ?> HTTP Status Test | xajax Tests printJavascript( "../" ) ?>

xajax Tests

HTTP Status Test

php-xajax-0.5/tests/myExternalFunction.php0000644000175000017500000000114410641226120017401 0ustar dgildgilalert('External function successfully included and executed'); return $objResponse; } class myExternalClass { function myMethod() // static (can't hardwire that in because of PHP 4) { $objResponse = new xajaxResponse(); $objResponse->alert('External class successfully included and method executed'); return $objResponse; } } ?>

This is some content that should be ignored by an asynchronous request through xajax, but will show up if the file is otherwise included into the script.

php-xajax-0.5/tests/index.php0000644000175000017500000000605611104471032014660 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: index.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 */ ?> xajax Tests

xajax Tests

Legacy Mode Tests

php-xajax-0.5/examples/0000755000175000017500000000000011345167002013513 5ustar dgildgilphp-xajax-0.5/examples/thewall/0000755000175000017500000000000011137100770015151 5ustar dgildgilphp-xajax-0.5/examples/thewall/brick.jpg0000644000175000017500000000213710641226120016745 0ustar dgildgilJFIF,,C  !"$"$C==" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?0AS$e4' NZt7A>CV2}j9d(Sw8S@nG?mm*n}yDFO0!kUO=Sk vg)ҹ@L&jlZdc< c4KXUX1,1ҭs֓'ց"9%(ou\o?MQٟ4|<'* aB65{'֓'ր?SJ, for a detailed description, copyright and license information. */ /* Section: Files - - - */ /* @package xajax @version $Id: xajax.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ require_once("thewall.common.php"); echo '' ?> The Graffiti Wall printJavascript(); ?>
Handle:
Graffiti:
To see xajax's UTF-8 support, try posting words in other languages. You can copy and paste from here
powered by xajax
php-xajax-0.5/examples/thewall/thewall.server.php0000644000175000017500000001231311137044046020632 0ustar dgildgil for a detailed description, copyright and license information. */ /* Section: Files - - - */ /* @package xajax @version $Id: xajax.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Define constants Integer: MAX_SCRIBBLES The number of scribbles that will be retained. The default is 5. */ if (!defined ('MAX_SCRIBBLES')) { define ('MAX_SCRIBBLES', 5); } /* String: DATA_FILE The file that will be used to store the messages on the server. */ if (!defined ('DATA_FILE')) { define ('DATA_FILE', "thewall.dta"); } /* Class: graffiti */ class graffiti { /* String: html Stores the html that is being generated for the current request. */ var $html; /* Boolean: isValid Indicates that the html generated for this request is valid and can be added to the wall . */ var $isValid = false; /* Constructor: graffiti Builds the output and sets the indicator. */ function graffiti($sHandle, $sWords) { if (trim($sHandle) == "" || trim($sWords) == "") { return; } $this->html = "\n
getRandomAlignment(); $this->html .= ";color:".$this->getRandomColor().";\">"; $this->html .= "getRandomFontSize()."%;\">"; $this->html .= strip_tags(stripslashes($sWords)); $this->html .= "
"; $this->html .= " ~ ".strip_tags(stripslashes($sHandle))." ".date("m/d/Y H:i:s")."
"; $this->isValid = true; } /* Function: getRandomFontSize Generate a font size based off a random number. */ function getRandomFontSize() { srand((double)microtime()*1000003); return rand(100,300); } /* Function: getRandomColor Generate a browser safe color based on a random number. */ function getRandomColor() { $sColor = "rgb("; srand((double)microtime()*1000003); $sColor .= rand(0,255).","; srand((double)microtime()*1000003); $sColor .= rand(0,255).","; $sColor .= rand(0,255).")"; return $sColor; } /* Function: getRandomAlignment Generates a text-alignment value based on a random number. */ function getRandomAlignment() { $sAlign = ""; srand((double)microtime()*1000003); $textAlign = rand(0,2); switch($textAlign) { case 0: $sAlign = "left"; break; case 1: $sAlign = "right"; break; case 2: $sAlign = "center"; break; } return $sAlign; } /* Function: save Writes the current html> to the when isValid> or returns an error message. */ function save() { if ($this->isValid) { $rFile = @fopen(DATA_FILE,"a+"); if (!$rFile) { return "ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder."; } fwrite($rFile, $this->html); fclose($rFile); return null; } else { return "Please supply both a handle and some graffiti to scribble on the wall."; } } } /* Section: xajax request handlers Function: scribble Processes the users form input and passes the values to an instance of the class. If the graffiti class generates and error, it is returned to the browser using alert>, otherwise, script> is used to instruct the browser to make a request to and clear> is used to clear the form input. */ function scribble($aFormValues) { $sHandle = $aFormValues['handle']; $sWords = $aFormValues['words']; $objResponse = new xajaxResponse(); $objGraffiti = new graffiti($sHandle,$sWords); $sErrMsg = $objGraffiti->save(); if (!$sErrMsg) { $objResponse->script("xajax_updateWall();"); $objResponse->clear("words","value"); } else $objResponse->alert($sErrMsg); return $objResponse; } /* Function: updateWall Processes the data previously written to the by save>. */ function updateWall() { $objResponse = new xajaxResponse(); if (file_exists(DATA_FILE)) { $aFile = @file(DATA_FILE); if (!$aFile) { $objResponse->addAlert("ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder."); return $objResponse; } $sHtmlSave = implode("\n",array_slice($aFile, -MAX_SCRIBBLES)); $sHtmlSave=str_replace("\n\n","\n",$sHtmlSave); } else { $sHtmlSave = ""; $aFile = array(); } $rFile = @fopen(DATA_FILE,"w+"); if (!$rFile) { $objResponse->alert("ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder."); return $objResponse; } fwrite($rFile, $sHtmlSave); fclose($rFile); $sHtml = implode("\n",array_reverse(array_slice($aFile, -MAX_SCRIBBLES))); $objResponse->assign("theWall","innerHTML",$sHtml); return $objResponse; } require("thewall.common.php"); $xajax->processRequest(); ?>php-xajax-0.5/examples/thewall/thewall.common.php0000644000175000017500000000157411137100254020615 0ustar dgildgil for a detailed description, copyright and license information. */ /* Section: Files - - - */ /* @package xajax @version $Id: xajax.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ require_once ("../../xajax_core/xajax.inc.php"); $xajax = new xajax("thewall.server.php"); $xajax->configure('javascript URI','../../'); $xajax->register(XAJAX_FUNCTION,"scribble"); $xajax->register(XAJAX_FUNCTION,"updateWall"); ?>php-xajax-0.5/examples/helloworld.php0000644000175000017500000000671610663215756016425 0ustar dgildgil for a detailed description, copyright and license information. */ /* @package xajax @version $Id: helloworld.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 - instantiate main 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; } /* Function: setColor Modify the style.color of div1 */ function setColor($sColor) { $objResponse = new xajaxResponse(); $objResponse->assign('div1', 'style.color', $sColor); return $objResponse; } /* Section: Register functions - - */ $reqHelloWorldMixed =& $xajax->registerFunction('helloWorld'); $reqHelloWorldMixed->setParameter(0, XAJAX_JS_VALUE, 0); $reqHelloWorldAllCaps =& $xajax->registerFunction('helloWorld'); $reqHelloWorldAllCaps->setParameter(0, XAJAX_JS_VALUE, 1); $reqSetColor =& $xajax->registerFunction('setColor'); $reqSetColor->setParameter(0, XAJAX_INPUT_VALUE, 'colorselect'); /* Section: processRequest This will detect an incoming xajax request, process it and exit. If this is not a xajax request, then it is a request to load the initial contents of the page (HTML). Everything prior to this statement will be executed upon each request (whether it is for the initial page load or a xajax request. Everything after this statement will be executed only when the page is first loaded. */ $xajax->processRequest(); echo ''; ?> xajax example printJavascript(); ?>
 

php-xajax-0.5/examples/signup/0000755000175000017500000000000011137100770015016 5ustar dgildgilphp-xajax-0.5/examples/signup/signup.server.php0000644000175000017500000000737011137044046020353 0ustar dgildgil for a detailed description, copyright and license information. */ /* Section: Files - - - */ /* @package xajax @version $Id: xajax.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ require_once ("signup.common.php"); function processForm($aFormValues) { if (array_key_exists("username",$aFormValues)) { return processAccountData($aFormValues); } else if (array_key_exists("firstName",$aFormValues)) { return processPersonalData($aFormValues); } } function processAccountData($aFormValues) { $objResponse = new xajaxResponse(); $bError = false; if (trim($aFormValues['username']) == "") { $objResponse->alert("Please enter a username."); $bError = true; } if (trim($aFormValues['newPass1']) == "") { $objResponse->alert("You may not have a blank password."); $bError = true; } if ($aFormValues['newPass1'] != $aFormValues['newPass2']) { $objResponse->alert("Passwords do not match. Try again."); $bError = true; } if (!$bError) { $_SESSION = array(); $_SESSION['newaccount']['username'] = trim($aFormValues['username']); $_SESSION['newaccount']['password'] = trim($aFormValues['newPass1']); $sForm = "
"; $sForm .="
First Name:
"; $sForm .="
Last Name:
"; $sForm .="
Email:
"; $sForm .="
"; $sForm .="
"; $objResponse->assign("formDiv","innerHTML",$sForm); $objResponse->assign("formWrapper","style.backgroundColor", "rgb(67,149,97)"); $objResponse->assign("outputDiv","innerHTML","\$_SESSION:
".var_export($_SESSION,true)."
"); } else { $objResponse->assign("submitButton","value","continue ->"); $objResponse->assign("submitButton","disabled",false); } return $objResponse; } function processPersonalData($aFormValues) { $objResponse = new xajaxResponse(); $bError = false; if (trim($aFormValues['firstName']) == "") { $objResponse->alert("Please enter your first name."); $bError = true; } if (trim($aFormValues['lastName']) == "") { $objResponse->alert("Please enter your last name."); $bError = true; } if (!eregi("^[a-zA-Z0-9]+[_a-zA-Z0-9-]*(\.[_a-z0-9-]+)*@[a-z??????0-9]+(-[a-z??????0-9]+)*(\.[a-z??????0-9-]+)*(\.[a-z]{2,4})$", $aFormValues['email'])) { $objResponse->alert("Please enter a valid email address."); $bError = true; } if (!$bError) { $_SESSION['newaccount']['firstname'] = $aFormValues['firstName']; $_SESSION['newaccount']['lastname'] = $aFormValues['lastName']; $_SESSION['newaccount']['email'] = $aFormValues['email']; $objResponse->assign("formDiv","style.textAlign","center"); $sForm = "Account created.
Thank you."; $objResponse->assign("formDiv","innerHTML",$sForm); $objResponse->assign("formWrapper","style.backgroundColor", "rgb(67,97,149)"); $objResponse->assign("outputDiv","innerHTML","\$_SESSION:
".var_export($_SESSION,true)."
"); } else { $objResponse->assign("submitButton","value","done"); $objResponse->assign("submitButton","disabled",false); } return $objResponse; } $xajax->processRequest(); ?>php-xajax-0.5/examples/signup/signup.php0000644000175000017500000000413611137044046017043 0ustar dgildgil for a detailed description, copyright and license information. */ /* Section: Files - - - */ /* @package xajax @version $Id: xajax.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ require_once('signup.common.php'); echo '' ?> printJavascript(); ?>
Create a New Account
Username:
Password:
Confirm Password:
php-xajax-0.5/examples/signup/signup.common.php0000644000175000017500000000152511137044046020331 0ustar dgildgil for a detailed description, copyright and license information. */ /* Section: Files - - - */ /* @package xajax @version $Id: xajax.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ require_once ("../../xajax_core/xajax.inc.php"); session_start(); $xajax = new xajax("signup.server.php"); $xajax->configure('javascript URI','../../'); $xajax->register(XAJAX_FUNCTION,"processForm"); ?>php-xajax-0.5/examples/xul/0000755000175000017500000000000011137100770014321 5ustar dgildgilphp-xajax-0.5/examples/xul/xulServer.php0000644000175000017500000000244011137044046017034 0ustar dgildgil for a detailed description, copyright and license information. */ /* Section: XUL example - (this file) - - */ /* @package xajax @version $Id: xajax.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $ @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson @copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson @license http://www.xajaxproject.org/bsd_license.txt BSD License */ /* Section: Standard xajax startup - include - instantiate main object */ require_once("../../xajax_core/xajax.inc.php"); $xajax = new xajax(); /* Function: test alert 'hallo', then update the testButton's label to 'Success' */ function test() { $objResponse = new xajaxResponse(); $objResponse->alert("hallo"); $objResponse->assign('testButton','label','Success!'); return $objResponse; } /* - Register the function */ $xajax->register(XAJAX_FUNCTION,"test"); /* Section: processRequest */ $xajax->processRequest(); ?>php-xajax-0.5/examples/xul/xulClient.xul0000644000175000017500000000301111137044046017020 0ustar dgildgil'; echo ''; ?>