lots of changes

This commit is contained in:
Frank Dillon 2008-11-12 23:03:42 +00:00
parent 93df39d6f6
commit 615e0e3746
28 changed files with 2883 additions and 212 deletions

View file

@ -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,43 @@ 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.
=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 $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
#Handle storageId case
if($isStorageId && $id) {
my $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');
}