Internationalize error messages in SQL.pm
Add POD to 5 macros
This commit is contained in:
parent
d430f570f4
commit
4adafce696
6 changed files with 86 additions and 3 deletions
|
|
@ -24,7 +24,7 @@ Macro for returning the title of the current Asset.
|
|||
=head2 process ( )
|
||||
|
||||
Returns the title of the current Asset. If a WebGUI operation or function
|
||||
is active, then the title is returned as a link to the Asset. If there's
|
||||
is active, then the title is returned as a link to the Asset. If there is
|
||||
no asset cached in the session variable, nothing is returned.
|
||||
|
||||
=cut
|
||||
|
|
|
|||
|
|
@ -14,6 +14,24 @@ use strict;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::Style;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::RawHeadTags
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for adding
|
||||
|
||||
=head2 process ( tags )
|
||||
|
||||
process is a wrapper for WebGUI::Style::setRawHeadTags();
|
||||
|
||||
=head3 text
|
||||
|
||||
Text that will be added to the HEAD tags for this page.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
WebGUI::Style::setRawHeadTags(shift);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,22 @@ use strict;
|
|||
use WebGUI::Asset;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::RootTitle
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for returning the title of the root for this page.
|
||||
|
||||
=head2 process ( )
|
||||
|
||||
If an asset exists in the session variable cache and and it's
|
||||
topmost parent (root) can be found the title for that asset
|
||||
is returned. Otherwise a space is returned.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
if (exists $session{asset}) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,30 @@ use strict;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::SQL
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for executing SQL select-type statements and returning formatted output.
|
||||
|
||||
=head2 process ( SQL, format )
|
||||
|
||||
=head3 SQL
|
||||
|
||||
The SQL statement to execute. If the statement is not something that
|
||||
returns data (select, show, describe), an error message is returned. If
|
||||
there is an error executing the SQL, an error message will be returned.
|
||||
|
||||
=head3 format
|
||||
|
||||
Describes how to format the results of the SQL statement. For each
|
||||
term in in a select-type statement, a numeric macro (^0, ^1, etc.)can
|
||||
be used to position its output in the format.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my ($output, @data, $rownum, $temp);
|
||||
|
|
@ -22,7 +46,7 @@ sub process {
|
|||
if ($statement =~ /^\s*select/i || $statement =~ /^\s*show/i || $statement =~ /^\s*describe/i) {
|
||||
my $sth = WebGUI::SQL->unconditionalRead($statement,WebGUI::SQL->getSlave);
|
||||
unless ($sth->errorCode < 1) {
|
||||
return '<p><b>SQL Macro Failed:</b> '.$sth->errorMessage.'<p>';
|
||||
return sprintf WebGUI::International::get('sql error','Macro_SQL'), $sth->errorMessage;
|
||||
} else {
|
||||
while (@data = $sth->array) {
|
||||
$temp = $format;
|
||||
|
|
@ -35,7 +59,7 @@ sub process {
|
|||
return $output;
|
||||
}
|
||||
} else {
|
||||
return "Cannot execute this type of query.";
|
||||
return WebGUI::International::get('illegal query','Macro_SQL');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,20 @@ use strict;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::URL;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::Slash_gatewayUrl
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for returning the gateway URL (defined in the WebGUI config file) to the site.
|
||||
|
||||
=head2 process ( )
|
||||
|
||||
process is really a wrapper around WebGUI::URL::gateway();
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
return WebGUI::URL::gateway();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,17 @@ A one line SQL report. Sometimes you just need to pull something back from the d
|
|||
|,
|
||||
lastUpdated => 1112466919,
|
||||
},
|
||||
|
||||
'illegal query' => {
|
||||
message => q|Cannot execute this type of query.|,
|
||||
lastUpdated => 1135105884,
|
||||
},
|
||||
|
||||
'sql error' => {
|
||||
message => q|<p><b>SQL Macro Failed:</b>%s<p>|,
|
||||
lastUpdated => 1135105919,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue