Added POD to several macros.
Updated POD in Storage/Iimage.pm Internationalized error messages from RandomAssetProxy.
This commit is contained in:
parent
3b44d47123
commit
d430f570f4
8 changed files with 106 additions and 7 deletions
|
|
@ -21,6 +21,7 @@ Package WebGUI::Macro::Extras
|
|||
|
||||
Macro for returning the extrasURL set up in the site's WebGUI.conf
|
||||
file.
|
||||
|
||||
=head2 process
|
||||
|
||||
Returns the extrasURL. A trailing slash '/' is appended to the URL.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,25 @@ package WebGUI::Macro::Page;
|
|||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::Page
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for pulling information from the Asset in which it's embedded.
|
||||
|
||||
=head2 process ( property )
|
||||
|
||||
If the macro is called from outside of an Asset, or if there's no asset in
|
||||
session variable, returns a single space.
|
||||
|
||||
=head3 property
|
||||
|
||||
The name of the property to retrieve from the assset via $session{asset}->get()
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
if (exists $session{asset}) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,22 @@ package WebGUI::Macro::PageTitle;
|
|||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::PageTitle
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for returning the title of the current Asset.
|
||||
|
||||
=head2 process ( )
|
||||
|
||||
Returns the title of the current Asset. If a WebGUI operation or function
|
||||
is active, then the title is returned as a link to the Asset. If there's
|
||||
no asset cached in the session variable, nothing is returned.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
if (exists $session{asset}) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,20 @@ use strict;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::URL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::Page
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for displaying the url for the current asset.
|
||||
|
||||
=head2 process ( )
|
||||
|
||||
process is really a wrapper around WebGUI::URL::page();
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
return WebGUI::URL::page();
|
||||
|
|
|
|||
|
|
@ -13,6 +13,24 @@ package WebGUI::Macro::Quote;
|
|||
use strict;
|
||||
use WebGUI::SQL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::Quote
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for quoting data to make it safe for use in SQL queries.
|
||||
|
||||
=head2 process ( text )
|
||||
|
||||
process is really a wrapper around WebGUI::SQL::quote();
|
||||
|
||||
=head3 text
|
||||
|
||||
The text to quote.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
return quote(shift);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,25 @@ package WebGUI::Macro::RandomAssetProxy;
|
|||
use strict;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::RandomAssetProxy
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for displaying a random asset.
|
||||
|
||||
=head2 process ( url )
|
||||
|
||||
=head3 url
|
||||
|
||||
The URL of an asset from the site. A random asset will be chosen
|
||||
from among that asset's children. Error message will be returned
|
||||
if no asset exists at that url, or if the asset has no children.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
|
|
@ -28,10 +47,10 @@ sub process {
|
|||
$randomAsset->toggleToolbar;
|
||||
return $randomAsset->canView ? $randomAsset->view() : undef;
|
||||
} else {
|
||||
return "Asset has no children.";
|
||||
return WebGUI::International::get('childless','Macro_RandomAssetProxy');
|
||||
}
|
||||
} else {
|
||||
return "Invalid asset URL.";
|
||||
return WebGUI::International::get('invalid url','Macro_RandomAssetProxy');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ These methods are available from this class:
|
|||
my $boolean = $self->generateThumbnail($filename);
|
||||
my $url = $self->getThumbnailUrl;
|
||||
my $boolean = $self->isImage;
|
||||
my ($captchaFile, $challenge) = $self->addFileFromCaptcha;
|
||||
$self->resize($imageFile, $width, $height);
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
|||
|
|
@ -12,16 +12,26 @@ our $I18N = {
|
|||
lastUpdated => 1112315917,
|
||||
},
|
||||
|
||||
'random asset proxy body' => {
|
||||
message => q|
|
||||
'random asset proxy body' => {
|
||||
message => q|
|
||||
<P><B>^RandomAssetProxy</B>();<BR>
|
||||
<B>^RandomAssetProxy</B>(<i>Asset URL</i>);<BR>
|
||||
This macro works similarly to the ^<B>AssetProxy</B>(); macro except instead of displaying the
|
||||
Asset, it picks a random Asset from the descendents of the Asset whose URL is supplied as the
|
||||
argument.
|
||||
|,
|
||||
lastUpdated => 1112315914,
|
||||
},
|
||||
|,
|
||||
lastUpdated => 1135101114,
|
||||
},
|
||||
|
||||
'childless' => {
|
||||
message => q|Asset has no children.|,
|
||||
lastUpdated => 1135101140,
|
||||
},
|
||||
|
||||
'invalid url' => {
|
||||
message => q|Invalid asset URL.|,
|
||||
lastUpdated => 1135101140,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue