From d895b852a6e160496ffc760d46d3719a3d62ff86 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sun, 3 Feb 2008 23:23:24 +0000 Subject: Initial checkin of nutridb.org and basic subversion directory structure --- lib/xajax_0.2.4/tests/preFunctionTest.php | 74 +++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lib/xajax_0.2.4/tests/preFunctionTest.php (limited to 'lib/xajax_0.2.4/tests/preFunctionTest.php') diff --git a/lib/xajax_0.2.4/tests/preFunctionTest.php b/lib/xajax_0.2.4/tests/preFunctionTest.php new file mode 100644 index 0000000..e72d903 --- /dev/null +++ b/lib/xajax_0.2.4/tests/preFunctionTest.php @@ -0,0 +1,74 @@ +addAlert("formData: " . print_r($formData, true)); + $objResponse->addAssign("submittedDiv", "innerHTML", nl2br(print_r($formData, true))); + return $objResponse->getXML(); +} + +function myPreFunction($funcName, $args) +{ + $objResponse = new xajaxResponse(); + 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 xajaxResponse(); + 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 xajax(); +//$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 | xajax Tests +printJavascript("../") ?> + + + +

xajax Tests

+

Pre-function Test

+ +
+

+

+

+
+ +

Reload using object

+ +
+ + + \ No newline at end of file -- cgit v1.2.3