fix: FileUrl doesn't handle Snippets

This commit is contained in:
Wouter van Oijen 2006-07-21 13:04:17 +00:00
parent ae61abe80d
commit d37cd047e3
3 changed files with 13 additions and 6 deletions

View file

@ -9,6 +9,7 @@
- fix: Indent Navigation broken (Wouter van Oijen / ProcoliX)
- fix: HttpProxy not working (with fix) (Eric Kennedy)
- fix: Copyright on Default Template (Wouter van Oijen / ProcoliX)
- fix: FileUrl macro doesn't handle snippets (Wouter van Oijen / ProcoliX)
7.0.2

View file

@ -43,13 +43,19 @@ sub process {
my $session = shift;
my $url = shift;
my $asset = WebGUI::Asset->newByUrl($session,$url);
if (defined $asset) {
my $storage = WebGUI::Storage->get($session,$asset->get("storageId"));
return $storage->getUrl($asset->get("filename"));
} else {
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');
}
my $storage = WebGUI::Storage->get($session,$storageId);
return $storage->getUrl($asset->get("filename"));
}

View file

@ -16,9 +16,9 @@ our $I18N = {
message => q|
<p><b>&#94;FileUrl</b>();<br />
<b>&#94;FileUrl</b>(<i>Asset URL</i>);<br />
This macro is used to return a filesystem URL to an File, Image or Snippet Asset identified by its Asset URL.</p>
This macro is used to return a filesystem URL to a File or Image Asset identified by its Asset URL.</p>
|,
lastUpdated => 1146679314,
lastUpdated => 1153476000,
},
'invalid url' => {