From 2b03fdc73d6cd3d4e46a1ecf84eb691f1bd34b04 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 21 Jul 2006 16:10:11 +0000 Subject: [PATCH] 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. --- lib/WebGUI/Macro/FileUrl.pm | 5 ++--- lib/WebGUI/i18n/English/Macro_FileUrl.pm | 5 +++++ lib/WebGUI/i18n/English/Macro_Page.pm | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/Macro/FileUrl.pm b/lib/WebGUI/Macro/FileUrl.pm index c8b939f4a..1890c0648 100644 --- a/lib/WebGUI/Macro/FileUrl.pm +++ b/lib/WebGUI/Macro/FileUrl.pm @@ -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")); diff --git a/lib/WebGUI/i18n/English/Macro_FileUrl.pm b/lib/WebGUI/i18n/English/Macro_FileUrl.pm index 7cef4afdc..43ff9b952 100644 --- a/lib/WebGUI/i18n/English/Macro_FileUrl.pm +++ b/lib/WebGUI/i18n/English/Macro_FileUrl.pm @@ -26,6 +26,11 @@ This macro is used to return a filesystem URL to a File or Image Asset identifie lastUpdated => 1134855446, }, + 'no storage' => { + message => q|The Asset you requested does not store files.|, + lastUpdated => 1153498370, + }, + }; 1; diff --git a/lib/WebGUI/i18n/English/Macro_Page.pm b/lib/WebGUI/i18n/English/Macro_Page.pm index 8bbc7eb3b..bd36df60d 100644 --- a/lib/WebGUI/i18n/English/Macro_Page.pm +++ b/lib/WebGUI/i18n/English/Macro_Page.pm @@ -19,9 +19,9 @@ our $I18N = { This can be used to retrieve information about the current asset. For instance it could be used to get the page URL like this ^Page("urlizedTitle"); or to get the menu title like this ^Page("menuTitle");. If the macro is called outside the context of an asset, or if the property doesn't exist, then it returns nothing.

- +

Properties available for retrieval depend on the type of asset that is being queried.

|, - lastUpdated => 1153177069, + lastUpdated => 1153339253, }, };