Module "wsf_action"
===================

A module which implements a WSF Component with support for dynamically
registered callbacks (usually using closures) in the templates.
 
object WsfAction WsfComponent
-----------------------------

A WSF Component with support for dynamically registered callbacks.
An example:

	var mywsfaction = new WsfAction(function() {
		return #file-as-template *demotpl; }, undef);

	#embedded-file demotpl EOT
	<div id="$id">
		<a ${add_href("${cgi.url}?sid=${sid}&mode=foobar")}>FooBar</a>
		action("foobar", function() { debug "FooBar!!"; });
	</div>
	EOT

Usually the callbacks are created on-demand by a more complex logic and
detailed information for the context of the callback is passed using a
closure.

This object is derived from WsfComponent.
 

var WsfAction.action_list;
~~~~~~~~~~~~~~~~~~~~~~~~~~

A hash containing the function pointers for the registered actions.
	 

var WsfAction.template_function;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The function pointer passed to the constructor.
	 

var WsfAction.template_options;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The options hash passed to the constructor.
	 

var WsfAction.data;
~~~~~~~~~~~~~~~~~~~

This variable can be used to save persistent data between calls
of template_function.
	 

method WsfAction.action_reset();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This method must be executed by get_html() before evaluating
the template. It resets action_list.
	 

method WsfAction.action(name, callback);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Registeres an action. If the name is set as CGI parameter, the
callback is called from main().

When the callback is called, the following named arguments are
passed to it:

	- action:
		the name under which this callback has been registered

	- obj:
		this WsfAction instance

	- all the options in the template_options variable
	 

method WsfAction.main();
~~~~~~~~~~~~~~~~~~~~~~~~

Overloaded WsfComponent.main().

Calls the registered actions and sets the dirty flag. The calling
convention for the actions is described in the section about the
action() method above.
	 

method WsfAction.get_html();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Overloaded WsfComponent.get_html().

This calls template_function() to generate the html text for
this component. The named arguments declared in template_options
are passed to template_function(). The function is called in
the context of this WsfAction instance.
	 

method WsfAction.init(_template_function, %_template_options);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The Constructor.
	 
