/usr/share/php/xajax/tests/suite/assign_append.php is in php-xajax 0.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | <?php
/*
File: assign_append.php
Test script that uses the following <xajaxResponse> commands:
- <xajaxResponse->assign>
- <xajaxResponse->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", "<div id=\"ImStaying\">This div should appear and remain here.</div><div id=\"ReplaceMe\">This div should appear then disappear.</div><div id=\"ImNotGoing\">This div should appear and remain here also.</div>");
$objResponse->assign("ReplaceMe", "outerHTML", "<div id=\"TheReplacement\">Successfully replaced the old element with this element via outerHTML</div>");
return $objResponse;
}
function sendAppendInnerHTML() {
global $objResponse;
$objResponse->append("status", "innerHTML", "<div>This div should be appended to the end.</div>");
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();
|