From 8aafc5a3ad5e467b2a5101661a7974b71b4107fa Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sat, 17 Dec 2005 21:54:34 +0000 Subject: [PATCH] Update docs for GroupAdd. Internationalize error message for File Url Add POD to 3 macros. --- lib/WebGUI/Macro/FileUrl.pm | 26 +++++++++++++++++- lib/WebGUI/Macro/FormParam.pm | 18 +++++++++++++ lib/WebGUI/Macro/GroupAdd.pm | 33 ++++++++++++++++++++--- lib/WebGUI/i18n/English/Macro_FileUrl.pm | 5 ++++ lib/WebGUI/i18n/English/Macro_GroupAdd.pm | 10 +++++-- 5 files changed, 86 insertions(+), 6 deletions(-) diff --git a/lib/WebGUI/Macro/FileUrl.pm b/lib/WebGUI/Macro/FileUrl.pm index ac91c1ba0..087f20d25 100644 --- a/lib/WebGUI/Macro/FileUrl.pm +++ b/lib/WebGUI/Macro/FileUrl.pm @@ -14,6 +14,30 @@ use strict; use WebGUI::Asset; use WebGUI::Session; use WebGUI::Storage; +use WebGUI::International; + +=head1 NAME + +Package WebGUI::Macro::FileUrl + +=head1 DESCRIPTION + +Macro for displaying returning the file system URL to a File, Image or Snippet Asset, +identified by it's asset URL. + +=head2 process ( url ) + +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 +with that URL exists, then an internationalized error message will +be returned. + +=head3 url + +The URL to the Asset. + +=cut + #------------------------------------------------------------------- sub process { @@ -23,7 +47,7 @@ sub process { my $storage = WebGUI::Storage->get($asset->get("storageId")); return $storage->getUrl($asset->get("filename")); } else { - return "Invalid Asset URL"; + return WebGUI::International::get('invalid url', 'Macro_FileUrl'); } } diff --git a/lib/WebGUI/Macro/FormParam.pm b/lib/WebGUI/Macro/FormParam.pm index 0177fd60e..76e491fb2 100644 --- a/lib/WebGUI/Macro/FormParam.pm +++ b/lib/WebGUI/Macro/FormParam.pm @@ -13,6 +13,24 @@ package WebGUI::Macro::FormParam; use strict; use WebGUI::Session; +=head1 NAME + +Package WebGUI::Macro::FormParam + +=head1 DESCRIPTION + +Macro for pulling the value of any form field by specifying the name of the form field. This +macro is mainly used for making SQL Reports with dynamic queries. + +=head2 process ( fieldName ) + +=head3 fieldName + +The name of the field to pull from the session variable. + +=cut + + #------------------------------------------------------------------- sub process { return $session{req}->param(shift) if ($session{req}); diff --git a/lib/WebGUI/Macro/GroupAdd.pm b/lib/WebGUI/Macro/GroupAdd.pm index ddef79d36..d72e58ff4 100644 --- a/lib/WebGUI/Macro/GroupAdd.pm +++ b/lib/WebGUI/Macro/GroupAdd.pm @@ -17,6 +17,33 @@ use WebGUI::Session; use WebGUI::Asset::Template; use WebGUI::URL; +=head1 NAME + +Package WebGUI::Macro::GroupAdd + +=head1 DESCRIPTION + +Macro that allows users to add themselves to a group. + +=head2 process ( groupId, text, [ template ] ) + +=head3 groupId + +The ID of a group. The group must exist and be set up for auto adds for the link +to be shown. + +=head3 text + +The text that will be displayed to the user in the link for adding themselves +to the group. + +=head3 template + +An optional template for formatting the text and link. + +=cut + + #------------------------------------------------------------------- sub process { my @param = @_; @@ -27,9 +54,9 @@ sub process { return "" if ($g->groupId eq ""); return "" unless ($g->autoAdd); return "" if (WebGUI::Grouping::isInGroup($g->groupId)); - my %var = (); - $var{'group.url'} = WebGUI::URL::page("op=autoAddToGroup;groupId=".$g->groupId); - $var{'group.text'} = $param[1]; + my %var = (); + $var{'group.url'} = WebGUI::URL::page("op=autoAddToGroup;groupId=".$g->groupId); + $var{'group.text'} = $param[1]; if ($param[2]) { return WebGUI::Asset::Template->newByUrl($param[2])->process(\%var); } else { diff --git a/lib/WebGUI/i18n/English/Macro_FileUrl.pm b/lib/WebGUI/i18n/English/Macro_FileUrl.pm index 8c789cc4b..764b37dd1 100644 --- a/lib/WebGUI/i18n/English/Macro_FileUrl.pm +++ b/lib/WebGUI/i18n/English/Macro_FileUrl.pm @@ -21,6 +21,11 @@ This macro is used to return a filesystem URL to an File, Image or Snippet Asset lastUpdated => 1112315914, }, + 'invalid url' => { + message => q|Invalid Asset URL|, + lastUpdated => 1134855446, + }, + }; 1; diff --git a/lib/WebGUI/i18n/English/Macro_GroupAdd.pm b/lib/WebGUI/i18n/English/Macro_GroupAdd.pm index 27b9d2120..8a7d5ef4c 100644 --- a/lib/WebGUI/i18n/English/Macro_GroupAdd.pm +++ b/lib/WebGUI/i18n/English/Macro_GroupAdd.pm @@ -25,11 +25,17 @@ The URL with the action to add the user to the group. The supplied text string for the user to click on.

-NOTE: If the user is not logged in, or or already belongs to the group, or the group is not set to allow auto adds, then no link will be displayed. +NOTE: All these conditions must be met for the link to be displayed: +

|, - lastUpdated => 1112466919, + lastUpdated => 1134856680, }, };