Update docs for GroupAdd.
Internationalize error message for File Url Add POD to 3 macros.
This commit is contained in:
parent
f007395c50
commit
8aafc5a3ad
5 changed files with 86 additions and 6 deletions
|
|
@ -14,6 +14,30 @@ use strict;
|
|||
use WebGUI::Asset;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::FileUrl
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for displaying returning the file system URL to a File, Image or Snippet Asset,
|
||||
identified by it's asset URL.
|
||||
|
||||
=head2 process ( url )
|
||||
|
||||
returns the file system URL if url is the URL for an Asset in the
|
||||
system that has storageId and filename properties. If no Asset
|
||||
with that URL exists, then an internationalized error message will
|
||||
be returned.
|
||||
|
||||
=head3 url
|
||||
|
||||
The URL to the Asset.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
|
|
@ -23,7 +47,7 @@ sub process {
|
|||
my $storage = WebGUI::Storage->get($asset->get("storageId"));
|
||||
return $storage->getUrl($asset->get("filename"));
|
||||
} else {
|
||||
return "Invalid Asset URL";
|
||||
return WebGUI::International::get('invalid url', 'Macro_FileUrl');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,24 @@ package WebGUI::Macro::FormParam;
|
|||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::FormParam
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for pulling the value of any form field by specifying the name of the form field. This
|
||||
macro is mainly used for making SQL Reports with dynamic queries.
|
||||
|
||||
=head2 process ( fieldName )
|
||||
|
||||
=head3 fieldName
|
||||
|
||||
The name of the field to pull from the session variable.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
return $session{req}->param(shift) if ($session{req});
|
||||
|
|
|
|||
|
|
@ -17,6 +17,33 @@ use WebGUI::Session;
|
|||
use WebGUI::Asset::Template;
|
||||
use WebGUI::URL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::GroupAdd
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro that allows users to add themselves to a group.
|
||||
|
||||
=head2 process ( groupId, text, [ template ] )
|
||||
|
||||
=head3 groupId
|
||||
|
||||
The ID of a group. The group must exist and be set up for auto adds for the link
|
||||
to be shown.
|
||||
|
||||
=head3 text
|
||||
|
||||
The text that will be displayed to the user in the link for adding themselves
|
||||
to the group.
|
||||
|
||||
=head3 template
|
||||
|
||||
An optional template for formatting the text and link.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = @_;
|
||||
|
|
@ -27,9 +54,9 @@ sub process {
|
|||
return "" if ($g->groupId eq "");
|
||||
return "" unless ($g->autoAdd);
|
||||
return "" if (WebGUI::Grouping::isInGroup($g->groupId));
|
||||
my %var = ();
|
||||
$var{'group.url'} = WebGUI::URL::page("op=autoAddToGroup;groupId=".$g->groupId);
|
||||
$var{'group.text'} = $param[1];
|
||||
my %var = ();
|
||||
$var{'group.url'} = WebGUI::URL::page("op=autoAddToGroup;groupId=".$g->groupId);
|
||||
$var{'group.text'} = $param[1];
|
||||
if ($param[2]) {
|
||||
return WebGUI::Asset::Template->newByUrl($param[2])->process(\%var);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,11 @@ This macro is used to return a filesystem URL to an File, Image or Snippet Asset
|
|||
lastUpdated => 1112315914,
|
||||
},
|
||||
|
||||
'invalid url' => {
|
||||
message => q|Invalid Asset URL|,
|
||||
lastUpdated => 1134855446,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -25,11 +25,17 @@ The URL with the action to add the user to the group.
|
|||
The supplied text string for the user to click on.
|
||||
|
||||
<p>
|
||||
<b>NOTE:</b> If the user is not logged in, or or already belongs to the group, or the group is not set to allow auto adds, then no link will be displayed.
|
||||
<b>NOTE:</b> All these conditions must be met for the link to be displayed:
|
||||
<ul>
|
||||
<li>User must be logged in.</li>
|
||||
<li>User must not already belong to the group.</li>
|
||||
<li>The group must exist.</li>
|
||||
<li>The group must be set up to allow auto adds.</li>
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
|,
|
||||
lastUpdated => 1112466919,
|
||||
lastUpdated => 1134856680,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue