Corrent template description in Macro/AdminBar.
Added POD for two macros. Internationalized the If error message.
This commit is contained in:
parent
b621f3f605
commit
01816cd806
4 changed files with 65 additions and 5 deletions
|
|
@ -31,14 +31,14 @@ Package WebGUI::Macro::AdminBar
|
|||
|
||||
Macro for displaying administrative functions to a user with Admin turned on.
|
||||
|
||||
=head2 process ( [template ] )
|
||||
=head2 process ( [templateId ] )
|
||||
|
||||
process takes one optional parameters for customizing the layout
|
||||
of the Admin bar.
|
||||
|
||||
=head3 template
|
||||
=head3 templateId
|
||||
|
||||
A template to use for formatting the link. The default template creates the sliding
|
||||
The ID for a template to use for formatting the link. The default template creates the sliding
|
||||
Admin bar to the left of the screen.
|
||||
|
||||
=cut
|
||||
|
|
|
|||
|
|
@ -16,6 +16,31 @@ use WebGUI::Asset::Template;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::H_homeLink
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Returns a templated link for the default page, determined by the WebGUI settings.
|
||||
|
||||
=head2 process ( [label, templateUrl] )
|
||||
|
||||
=head3 label
|
||||
|
||||
The text to present to the user as a link to the home page. If left blank, an
|
||||
internationalized label will be used. If the label is the word "linkonly",
|
||||
the macro will just return the bare link, with no templating.
|
||||
|
||||
=head3 templateUrl
|
||||
|
||||
A URL for a template to use to style the link. This can be used to add
|
||||
images or other stuff. If left blank, a default template will
|
||||
be used.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($label, $templateUrl) = @_;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,37 @@ package WebGUI::Macro::If;
|
|||
|
||||
|
||||
use strict;
|
||||
use WebGUI::International;
|
||||
use Safe;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::If
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
A macro for implementing a simple conditional.
|
||||
|
||||
=head2 process ( expression, trueResult, falseResult )
|
||||
|
||||
Returns trueResult if expression is true, falseResult if the expression
|
||||
is false and an error message if there was a problem evaluating the
|
||||
expression.
|
||||
|
||||
=head3 expression
|
||||
|
||||
A perl expression that will be evaulated in a Safe compartment.
|
||||
|
||||
=head3 trueResult
|
||||
|
||||
Text that will be returned if the expression is true.
|
||||
|
||||
=head3 falseResult
|
||||
|
||||
Text that will be returned if the expression is false.
|
||||
|
||||
=cut
|
||||
|
||||
sub process {
|
||||
my ($expression, $true, $false) = @_;
|
||||
my $output = $false;
|
||||
|
|
@ -22,8 +51,8 @@ sub process {
|
|||
my $compartment = new Safe;
|
||||
my $return = $compartment->reval($expression);
|
||||
|
||||
return "<p><b>If Macro failed:</b> $@ <p>Expression: $expression
|
||||
<br />Display if true: $true<br />Display if false: $false" if ($@);
|
||||
return sprintf(WebGUI::International::get('eval error', 'Macro_If'),
|
||||
$@,$expression,$true,$false) if ($@);
|
||||
|
||||
$output = $true if ($return);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@ our $I18N = {
|
|||
lastUpdated => 1128838656,
|
||||
},
|
||||
|
||||
'eval error' => {
|
||||
message => q|<p><b>If Macro failed:</b> %s <p>Expression: %s
|
||||
<br />Display if true: %s<br />Display if false: %s|,
|
||||
lastUpdated => 1134967651,
|
||||
},
|
||||
|
||||
'if title' => {
|
||||
message => q|If Macro|,
|
||||
lastUpdated => 1112466408,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue