add new error message to FileUrl macro

This commit is contained in:
Colin Kuskie 2006-07-23 01:35:20 +00:00
parent 10135118d2
commit c1246444e0
3 changed files with 13 additions and 1 deletions

View file

@ -17,6 +17,8 @@
- Fixed typo in template variable project.gantt.rowspan and documentation - Fixed typo in template variable project.gantt.rowspan and documentation
- fix: Events Calendar Double Date (Wouter van Oijen / ProcoliX) - fix: Events Calendar Double Date (Wouter van Oijen / ProcoliX)
- fix: Data Form Text Area Box Non-Existent (Wouter van Oijen / ProcoliX) - fix: Data Form Text Area Box Non-Existent (Wouter van Oijen / ProcoliX)
- Added an error message to the FileUrl macro to help users figure out why it
doesn't work.
7.0.2 7.0.2

View file

@ -50,9 +50,14 @@ sub process {
} }
my $storageId = $asset->get('storageId'); my $storageId = $asset->get('storageId');
if (not defined $storageId) { if (not defined $storageId) {
$session->errorHandler->warn("^FileUrl($url): asset is not a file"); $session->errorHandler->warn("^FileUrl($url): asset does not store files");
return $i18n->get('no storage'); return $i18n->get('no storage');
} }
my $filename = $asset->get('filename');
if (not defined $filename) {
$session->errorHandler->warn("^FileUrl($url): asset does not have a 'filename' property");
return $i18n->get('no filename');
}
my $storage = WebGUI::Storage->get($session,$storageId); my $storage = WebGUI::Storage->get($session,$storageId);
return $storage->getUrl($asset->get("filename")); return $storage->getUrl($asset->get("filename"));
} }

View file

@ -31,6 +31,11 @@ This macro is used to return a filesystem URL to a File or Image Asset identifie
lastUpdated => 1153498370, lastUpdated => 1153498370,
}, },
'no filename' => {
message => q|The Asset you requested does not have a filename property.|,
lastUpdated => 1153618016,
},
}; };
1; 1;