Finish POD and AssetHelper base class sample code.

This commit is contained in:
Colin Kuskie 2009-11-24 13:40:56 -08:00
parent dd8674c49b
commit 33bf0bad97

View file

@ -21,6 +21,10 @@ Package WebGUI::AssetHelper
Base class for all Asset Helpers, which provide editing and administrative controls for Assets inside Base class for all Asset Helpers, which provide editing and administrative controls for Assets inside
the Admin Console. the Admin Console.
=head1 SYNOPSIS
Despite using OO style methods, there are no AssetHelper objects. This is simply to provide inheritance.
=head1 METHODS =head1 METHODS
These methods are available from this class: These methods are available from this class:
@ -29,14 +33,61 @@ These methods are available from this class:
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 process ( ) =head2 process ( $class, $asset )
Default method called by the Asset Helper content handler. This is a class method. Process is the default method called by the Asset Helper content handler.
It returns a hashref, that is converted by the content handler to JSON to be passed back to the
Admin Console.
=head3 $class
The name of the class this method was called as.
=head3 $asset
A WebGUI::Asset object.
=head3 Hashref Payload
=head4 error
Displays an error message to the user. Should always be internationalized.
=head4 message
Displays an informational message to the user. Should always be internationalized.
=head4 redirect
Will open a tab in the Admin Console. Anything returned by the URL will be displayed in the tab.
=head4 scriptFile
Loads the requested JavaScript file, referenced by URL.
=head4 scriptMethod
Calls this method.
=head4 scriptArgs
An array reference of arguments that, when used with C<scriptMethod>, will be passed to the javascript method.
=cut =cut
sub process { sub process {
my ($class, $asset) = @_;
##This method can do work, or it can delegate out to other methods.
return {
error => q{User, we have a problem.},
message => q{A friendly informational method},
redirect => '?op=assetHelper;className=WebGUI::AssetHelper;method=editBranch',
scriptFile => q{URL},
scriptMethod => q{methodName},
scriptArgs => [ 'arg1', { another => 'argument' } ],
};
} }
1; 1;