The SystemApp provides a foundation for building stand-alone portal apps. A SystemApp is not associated with any object instantiation. It does not require use of any particular db tables or require the implementation of any particular interface methods. Therefore, it allows new 'application functionality' to be added to the system without needing to modify existing code. Metadot::SystemApp is an 'abstract' class; the actual apps should be subclassed from it. SystemApp inherits from Portal and Auditable.
A SystemApp subclass is invoked by giving the full path to the SystemApp module as the 'isa' parameter of the cgi query, as in this example:
http://127.0.0.1/metadot/index.pl?isa=Metadot::SystemApp::TestApp&op=show
The 'op' parameter will be used to call the www_<op> method of the system app ('www_show' in this example).
SystemApp, as an abstract class, provides a set of access control methods, and implements the method
www_show
.
www_show
calls the method '
main
', which is expected to be implemented by every SystemApp subclass. The subclass' implementation of '
main
' must return an html string, which will be wrapped in
SystemApp->www_show
by code to generate headers and footers, in order to generate a result page. Therefore, for the 'show' op, the SystemApp subclass need only generate its content html via the implementation of '
main
', not the entire result page. See
Metadot::SystemApp::TestApp
for an example.
A SystemApp subclass may implement any other op it wishes in addition to 'show'; however, it must generate the full result page in that case, including any desired headers, etc.
SystemApps inherit from Auditable to take advantage of Metadot's built-in access control mechanism. See Section 3 for more information about how to add access control to your classes. SystemApps will by default show the "change permissions" (key) icon when the show operation is invoked on them and editing is enabled. If your system app implements other operations you will have to invoke the inherited method called "show_portal_panel" to generate the html for the change permissions icon and add it to your page.
A system app has access to the system globals
$PARAMS,%FORM, $SESSION
, and
$USER
. It can be invoked with arbitrary parameters as well. E.g., below is an example of invoking a "FormDemo" system app and passing it a set of parameter values:
http://127.0.0.1/metadot/index.pl?isa=Metadot::SystemApp::FormDemo&op=show&mode=edit&form_descr=formdata_demo&pkey=instance.iid,1642&pkey=message.mid,40