Add another error message to FileUrl so that it's clear that there

are no files, rather than the wrong URL.
Update Page macro docs to show it works on _any_ asset, not just Pages.
This commit is contained in:
Colin Kuskie 2006-07-21 16:10:11 +00:00
parent 1fe73fa764
commit 2b03fdc73d
3 changed files with 9 additions and 5 deletions

View file

@ -43,16 +43,15 @@ sub process {
my $session = shift;
my $url = shift;
my $asset = WebGUI::Asset->newByUrl($session,$url);
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
if (not defined $asset) {
$session->errorHandler->warn("^FileUrl($url): asset not found");
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
return $i18n->get('invalid url');
}
my $storageId = $asset->get('storageId');
if (not defined $storageId) {
$session->errorHandler->warn("^FileUrl($url): asset is not a file");
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
return $i18n->get('invalid url');
return $i18n->get('no storage');
}
my $storage = WebGUI::Storage->get($session,$storageId);
return $storage->getUrl($asset->get("filename"));