0.2beta Release Notes






0.2beta Release Notes

Package-wide Changes

  • xajax.inc.php has been split into "xajax.inc.php" (containing the xajax PHP class and related constants) and "xajaxResponse.inc.php" (which is loaded by "xajax.inc.php").
  • The Javascript component of xajax has been completely transferred over to "xajax_uncompressed.js", which is located in a sub-folder called "xajax_js". This verbose version of the Javascript code is compressed and saved to "xajax.js" (also in the "xajax_js" sub-folder) only if that file does not already exist. Note that if xajax is in debug mode, "xajax_uncompressed.js" is copied without compression to "xajax.js" on every request. The compression function is located in "xajax_js/xajaxCompress.php".
  • In order for the browser to locate the new Javascript file "xajax.js", you may need to include a relative URL to the xajax installation folder when you call the printJavascript() or getJavascript() methods. See the inline comments for details.
  • Examples have been moved to the new "examples" folder and updated to work with these codebase changes.
  • The XML structure in the xajax response output has been significantly altered. See the "xajaxResponse.inc.php" release notes for details.
  • A new folder "tests" has been created and is populated with a large number of visual browser pages testing various bits of xajax functionality. While not automated, these are useful in the same way as unit tests and will ensure that future changes to xajax don't break core functionality. You can use them to test your particular server configuration and show that xajax behaves as expected on your system.

xajax.inc.php Changes

  • Changed constants GET and POST to XAJAX_GET and XAJAX_POST.
  • Added XAJAX_DEFAULT_CHAR_ENCODING constant which is used by both "xajax.inc.php" and "xajaxResponse.inc.php" for the XML and HTTP output character encoding method by default. You can set the xajax class's encoding independently of the constant by using the setCharEncoding() method. See "xajaxResponse.inc.php" release notes for information on how its character encoding can be altered.
  • All private methods in the xajax class are now prefixed by an underscore and grouped together at the bottom of the file.
  • The methods previously marked as deprecated have been removed.
  • Added new request information methods: canProcessRequests() and getRequestMode().
  • Added registerExternalFunction() which allows you to register a function located in another PHP file. That PHP file will be included automatically by xajax prior to the function being called during a request.
  • You can now register a catch-all function via registerCatchAllFunction() to be called if the requested function cannot be found (possible if you call a different PHP file than the one which registered the functions, or if you use the alternate xajax.call() notation in the Javascript).
  • You can now register a pre-function via registerPreFunction() which gets called before the requested function.
  • All of the registering methods in xajax now support both object instance methods and static class methods in addition to regular PHP functions. Use a three-element array rather than a single string as the first argument to set up the object callback (see the inline comments for details).
  • You can now return an xajaxResponse instance directly rather than the output of its getXML() method if you wish. Either one will work the same for your function's return value.
  • Added error handling and logging. The errorHandlerOn() method turns on xajax's new custom error handler (PHP 4 and 5 compatible) which will send PHP errors down to the browser as an alert response. Optional logging of these errors can be set using the setLogFile() method.
  • If you don't want xajax to close (via the exit keyword) the entire PHP request after it processes an xajax request, use the new exitAllowedOff() method to disable that functionality.
  • Modified the _detectURI method to support more server configurations (courtesy of Gilles vd Hoven).
  • Because of its interference with many AJAX-style data transfers, xajax will now purposefully eliminate any escaped quotes if magic quotes is turned on. So beware: if you're putting data transfered via an xajax request directly into an SQL database, make sure you escape your quotes appropriately EVEN IF magic quotes is turned on.

xajaxResponse.inc.php Changes

  • The character encoding method for the XML response data will now honor the XAJAX_DEFAULT_CHAR_ENCODING constant defined in "xajax.inc.php" by default. To change a specific XML response, use the setCharEncoding() method to specify the encoding method. Note that this will be ignored when multiple XML responses are joined via the loadXML() method (see below).
  • Added loadXML() which will join the response commands of the supplied response object to the object whose method is being called. In other words, if you call loadXML on response A and pass in response B, the commands of response B will be added to response A after response A's existing commands.
  • Added addRedirect() so you can easily change the page being viewed in the client browser (courtesy of Gilles vd Hoven).
  • Added methods addEvent(), addHandler(), addRemoveHandler() which allow you to attach Javascript event code and event handlers to HTML elements dynamically.
  • Added addIncludeScript() which can instruct the client to load a new Javascript file from a URL dynamically.
  • Added addInsert() which allows you to insert a new HTML element before an existing one.
  • Added addCreateInput() and addInsertInput() which allow you to construct form controls dynamically (note that addCreate() should no longer be used for this purpose and its $sType parameter has been depricated).
  • The XML structure for each command is much simpler and highly compressed in order to cut down on transfer size. The new _cmdXML() method aids in formation of command elements and is used throught the class, and it's recommended you utilize it in your xajaxResponse subclasses (if any) as much as possible. Further details of the new XML structure will be posted on the xajax Wiki.

xajax_uncompressed.js Changes

  • xajax's Javascript component has been significantly refactored and can be used to a much greater extent as a client-side aid to dynamic DOM and script manipulation. In fact, most of xajaxResponse's commands have direct 1:1 correspondance with methods of the Xajax Javascript class. Documentation will be forthcoming.
  • The call() method is now easier to use on the client in lieu of "wrapped" functions. Usage: xajax.call("myFunctionName", ["argument1", "argument2", "etc."])
  • Changed getFormValues() so that data in disabled form controls doesn't get sent to the server by default. Set the optional second argument to true to send all form data regardless of state. Also, multiple select controls should now work in a similar manner to a standard form submit from a PHP standpoint.
  • Invalid XML responses or XML processing problems will cause error alerts to appear, making the AJAX calls easier to debug.
  • The response dialog that appears when xajax's debug mode is on is now limited to 1000 characters so IE users don't have major speed and UI issues.
  • Removed the "waiting" Javascript alert window that would come up while the request was being processed in debug mode, since it was interfering with some browsers.