Pluggable Account system added to WebGUI with new Profile, Inbox, Friends, User, and Shop interfaces.
This commit is contained in:
commit
4ff722bd5d
56 changed files with 6954 additions and 1090 deletions
|
|
@ -26,7 +26,7 @@ identified by it's asset URL.
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 process ( url )
|
||||
=head2 process ( url, id, isStorageId, filename )
|
||||
|
||||
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
|
||||
|
|
@ -37,13 +37,54 @@ be returned.
|
|||
|
||||
The URL to the Asset.
|
||||
|
||||
head3 id
|
||||
|
||||
If id is passed in, the macro will attempt to retrive the storageId using the
|
||||
Id of the Asset instead of by the url
|
||||
|
||||
=head3 isStorageId
|
||||
|
||||
If id is passed in and the isStorageId flag is set, the macro will forgo
|
||||
the asset and simply return the url of the first file it finds
|
||||
|
||||
=head3 filename
|
||||
|
||||
If id is passed in and the isStorageId flag is set, you may pass in filename
|
||||
to specify the name of the file you'd like returned.
|
||||
|
||||
head3 isImage
|
||||
|
||||
If id is passed in and the isImage flag is set, the first image will be returned
|
||||
|
||||
=cut
|
||||
|
||||
sub process {
|
||||
my $session = shift;
|
||||
my $url = shift;
|
||||
my $asset = WebGUI::Asset->newByUrl($session,$url);
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
|
||||
my $session = shift;
|
||||
my $url = shift;
|
||||
my $id = shift;
|
||||
my $isStorageId = shift;
|
||||
my $filename = shift;
|
||||
my $isImage = shift;
|
||||
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
|
||||
|
||||
#Handle storageId case
|
||||
if($isStorageId && $id) {
|
||||
my $store = undef;
|
||||
if($isImage) {
|
||||
$store = WebGUI::Storage::Image->get($session,$id);
|
||||
}
|
||||
else {
|
||||
$store = WebGUI::Storage->get($session,$id);
|
||||
}
|
||||
$filename = $store->getFiles->[0] unless ($filename);
|
||||
return "" unless ($filename);
|
||||
return $store->getUrl($filename);
|
||||
}
|
||||
|
||||
my $asset = ($id)
|
||||
? WebGUI::Asset->newByDynamicClass($session,$id)
|
||||
: WebGUI::Asset->newByUrl($session,$url);
|
||||
|
||||
if (not defined $asset) {
|
||||
return $i18n->get('invalid url');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ sub _createURL {
|
|||
my $session = shift;
|
||||
my $text = shift;
|
||||
my $class = shift;
|
||||
my $url = '<a href="'.$session->url->page("op=viewInbox").'"';
|
||||
my $url = '<a href="'.$session->url->page("op=account;module=inbox").'"';
|
||||
$url .= ' class="'.$class.'"' if($class);
|
||||
$url .= '>'.$text.'</a>';
|
||||
return $url;
|
||||
|
|
|
|||
|
|
@ -18,22 +18,39 @@ Package WebGUI::Macro::User
|
|||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for displaying information from the current User's profile.
|
||||
Macro for displaying information from the a User's profile.
|
||||
|
||||
=head2 process( field )
|
||||
=head2 process( field [, userId] )
|
||||
|
||||
process takes a single parameter, the name of a field in the current user's User Profile from
|
||||
the data stored in $session . If the field does not exist, undef is returned.
|
||||
This macro tries to return the profile field passed in for the user
|
||||
passed in. If not user is passed in, the current user in session
|
||||
will be used.
|
||||
|
||||
=head3 field
|
||||
|
||||
field to return
|
||||
|
||||
=head3 userId
|
||||
|
||||
optional userId of the user to return the field for. If this field is
|
||||
empty, the profile field for the default user will be returned
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
return $session->user->profileField(shift);
|
||||
my $session = shift;
|
||||
my $field = shift;
|
||||
my $userId = shift;
|
||||
|
||||
return undef unless ($field);
|
||||
|
||||
my $user = ($userId)
|
||||
? WebGUI::User->new($session,$userId)
|
||||
: $session->user
|
||||
;
|
||||
|
||||
return $user->profileField($field);
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue