Wednesday, June 14, 2006

What is ActionForm? (2)

XCube_ActionForm is an abstract class. So you have to define the sub class of XCube_ActionForm to use ActionForm mechanism. To read example source code, open /modules/myannounce/admin/forms/MessageEditForm.class.php. There is too large class here.

This is the sub class of XCube_ActionForm. This class sets form properties and field properties in prepare(), and implements load() and update() member functions. You might think that it's difficult to such complex class, but developers don't need to define such class directly. It's possible to generate a sub class from XML configuration files with tools. See /modules/myannounce/admin/.xml/message_edit.xml. This is a configuration file for defining a sub class of XCube_ActionForm.

There are two important things about defining a sub class:

  1. You can generate sub classes of XCube_ActionForm from XML configuration file by cubson or another tool.
  2. Also, you can generate the XML configuration file from database structure or XML data object configuration file.

The core team thinks that it's unpossible to define user's ActionForm handy in the design of XCube_ActionForm. So we plan to add the official converter to XOOPS Cube Legacy 2.1 release. The converter doesn't have other functions which are like cubson. But, anybody can run it because it's PHP program.

BTW, if you know struts, you might notice that the format of these XML is struts like. But, this format is not important matter because XOOPS Cube never handles these XML directly. Who wants the format is converters, and each formats are different in each tools. You come able to select your favorite format if various tools which handle various formats are released.

No comments: