POD added to last set of Macros.
Internationalized an error message in Product. Fixed typos in docs in Macro_Product.pm
This commit is contained in:
parent
4adafce696
commit
6ded5832ca
11 changed files with 215 additions and 3 deletions
|
|
@ -7,12 +7,33 @@ use WebGUI::Asset::Template;
|
||||||
use WebGUI::SQL;
|
use WebGUI::SQL;
|
||||||
use WebGUI::International;
|
use WebGUI::International;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::Product
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
This macro looks up a Product in the Product Manager
|
||||||
|
|
||||||
|
=head2 process ( ID/SKU [,templateId] )
|
||||||
|
|
||||||
|
=head3 productId or SKU
|
||||||
|
|
||||||
|
The productId or SKU of the project to look up.
|
||||||
|
|
||||||
|
=head3 templateId
|
||||||
|
|
||||||
|
An alternate template to use for formatting the link, referenced by templateId. If this
|
||||||
|
is left blank, a default template from the Macro/Product namespace will be used.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub process {
|
sub process {
|
||||||
my (@param, $productId, $variantId, $product, $variant, $output, $templateId, @variantLoop, %var);
|
my (@param, $productId, $variantId, $product, $variant, $output, $templateId, @variantLoop, %var);
|
||||||
|
|
||||||
@param = @_;
|
@param = @_;
|
||||||
|
|
||||||
return 'No SKU or productId passed' unless ($_[0]);
|
return WebGUI::International::get('no sku or id') unless ($_[0]);
|
||||||
|
|
||||||
($productId, $variantId) = WebGUI::SQL->quickArray("select productId, variantId from productVariants where sku=".quote($_[0]));
|
($productId, $variantId) = WebGUI::SQL->quickArray("select productId, variantId from productVariants where sku=".quote($_[0]));
|
||||||
($productId) = WebGUI::SQL->quickArray("select productId from products where sku=".quote($_[0])) unless ($productId);
|
($productId) = WebGUI::SQL->quickArray("select productId from products where sku=".quote($_[0])) unless ($productId);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,29 @@ use WebGUI::Session;
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::Spacer
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro for outputting a spacer graphic.
|
||||||
|
|
||||||
|
=head2 process ( [width, height] )
|
||||||
|
|
||||||
|
process takes returns an IMG tag pointing to the spacer gif in the WebGUI
|
||||||
|
extras directory.
|
||||||
|
|
||||||
|
=head3 width
|
||||||
|
|
||||||
|
Set the width of the spacer.
|
||||||
|
|
||||||
|
=head3 height
|
||||||
|
|
||||||
|
Set the height of the spacer.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub process {
|
sub process {
|
||||||
my ($output, @param, $width, $height);
|
my ($output, @param, $width, $height);
|
||||||
@param = @_;
|
@param = @_;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,25 @@ package WebGUI::Macro::Splat_random;
|
||||||
use strict;
|
use strict;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::Splat_random
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro for returning a bounded, integer random number.
|
||||||
|
|
||||||
|
=head2 process ( max )
|
||||||
|
|
||||||
|
Random numbers are rounded, not truncated.
|
||||||
|
|
||||||
|
=head3 max
|
||||||
|
|
||||||
|
The maximum random number. If omitted, 1_000_000_000 is
|
||||||
|
used as a default.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub process {
|
sub process {
|
||||||
my ($temp, @param);
|
my ($temp, @param);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,24 @@ use strict;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Style;
|
use WebGUI::Style;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::StyleSheet
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro for dynamically adding references to CSS documents to use in this page.
|
||||||
|
|
||||||
|
=head2 process ( url )
|
||||||
|
|
||||||
|
process is a wrapper around WebGUI::Style::setLink().
|
||||||
|
|
||||||
|
=head3 url
|
||||||
|
|
||||||
|
The URL to the CSS document.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub process {
|
sub process {
|
||||||
WebGUI::Style::setLink(shift,{
|
WebGUI::Style::setLink(shift,{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,30 @@ use WebGUI::Asset::Template;
|
||||||
use WebGUI::SQL;
|
use WebGUI::SQL;
|
||||||
use WebGUI::URL;
|
use WebGUI::URL;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::SubscriptionItem;
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro for displaying information about subscription items.
|
||||||
|
|
||||||
|
=head2 process ( subscriptionId [,templateId ] )
|
||||||
|
|
||||||
|
process takes two optional parameters for customizing the content and layout
|
||||||
|
of the account link.
|
||||||
|
|
||||||
|
=head3 subscriptionId
|
||||||
|
|
||||||
|
The text of the link. If no text is displayed an internationalized default will be used.
|
||||||
|
|
||||||
|
=head3 templateId
|
||||||
|
|
||||||
|
A templateId to use for formatting the link. If this is empty, a default template will
|
||||||
|
be used from the Macro/SubscriptionItem namespace.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub process {
|
sub process {
|
||||||
my ($subscriptionId, $templateId, %var);
|
my ($subscriptionId, $templateId, %var);
|
||||||
($subscriptionId, $templateId) = @_;
|
($subscriptionId, $templateId) = @_;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,25 @@ package WebGUI::Macro::SubscriptionItemPurchaseUrl;
|
||||||
use strict;
|
use strict;
|
||||||
use WebGUI::URL;
|
use WebGUI::URL;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::SubscriptionItemPurchaseUrl
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro that returns a URL to purchase a subscription item.
|
||||||
|
|
||||||
|
=head2 process ( subscriptionId )
|
||||||
|
|
||||||
|
process returns a URL that is the current page with an operation appended
|
||||||
|
to purchase the requested subscription item.
|
||||||
|
|
||||||
|
=head3 subscriptionId
|
||||||
|
|
||||||
|
The ID of the subscription item to purchase.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub process {
|
sub process {
|
||||||
return WebGUI::URL::page('op=purchaseSubscription;sid='.shift);
|
return WebGUI::URL::page('op=purchaseSubscription;sid='.shift);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,23 @@ use strict;
|
||||||
use WebGUI::Asset::File::Image;
|
use WebGUI::Asset::File::Image;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::Thumbnail
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro for returning a thumbnail to an Image Asset.
|
||||||
|
|
||||||
|
=head2 process ( url )
|
||||||
|
|
||||||
|
=head3 url
|
||||||
|
|
||||||
|
A URL to the Image Asset whose thumbnail you want to display. If no
|
||||||
|
Image Asset can be found with that URL, then undef will be returned.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub process {
|
sub process {
|
||||||
my $url = shift;
|
my $url = shift;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,25 @@ use strict;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::URL;
|
use WebGUI::URL;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::URLEncode
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro for URL encoding text.
|
||||||
|
|
||||||
|
=head2 process ( text )
|
||||||
|
|
||||||
|
process is really a wrapper around WebGUI::URL::escape;
|
||||||
|
of the account link.
|
||||||
|
|
||||||
|
=head3 text
|
||||||
|
|
||||||
|
The text to URL encode.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub process {
|
sub process {
|
||||||
return WebGUI::URL::escape(shift);
|
return WebGUI::URL::escape(shift);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,38 @@ use WebGUI::Asset::Template;
|
||||||
use WebGUI::URL;
|
use WebGUI::URL;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::r_printable
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro for displaying a link to the user to change the page's style template
|
||||||
|
to one more suitable for printing.
|
||||||
|
|
||||||
|
=head2 process ( [text,styleId,template] )
|
||||||
|
|
||||||
|
process takes two optional parameters for customizing the content and layout
|
||||||
|
of the account link.
|
||||||
|
|
||||||
|
=head3 text
|
||||||
|
|
||||||
|
The text of the link. If no text is displayed an internationalized
|
||||||
|
default will be used. If the text equals 'linkonly', then only the
|
||||||
|
URL for the link will be returned instead of the templated output.
|
||||||
|
|
||||||
|
=head3 styleId
|
||||||
|
|
||||||
|
The default style to make the page printable is "Make Page Printable". The
|
||||||
|
styleId argument can be used to override this default.
|
||||||
|
|
||||||
|
=head3 template
|
||||||
|
|
||||||
|
The URL to a template to use for formatting the link. If omitted, a default
|
||||||
|
is used.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub process {
|
sub process {
|
||||||
my ($temp, @param, $styleId);
|
my ($temp, @param, $styleId);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,21 @@ package WebGUI::Macro::u_companyUrl;
|
||||||
use strict;
|
use strict;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Macro::u_companyUrl
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Macro for displaying the Company URL entered into the WebGUI site settings
|
||||||
|
|
||||||
|
=head2 process ( )
|
||||||
|
|
||||||
|
returns the companyURL from the session variable.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub process {
|
sub process {
|
||||||
return $session{setting}{companyURL};
|
return $session{setting}{companyURL};
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ our $I18N = {
|
||||||
lastUpdated => 1128918830,
|
lastUpdated => 1128918830,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'no sku or id' => {
|
||||||
|
message => q|No SKU or productId passed|,
|
||||||
|
lastUpdated => 1135117939,
|
||||||
|
},
|
||||||
|
|
||||||
'cannot find product' => {
|
'cannot find product' => {
|
||||||
message => q|Cannot find product|,
|
message => q|Cannot find product|,
|
||||||
lastUpdated => 1128976376,
|
lastUpdated => 1128976376,
|
||||||
|
|
@ -32,10 +37,10 @@ our $I18N = {
|
||||||
<p>
|
<p>
|
||||||
<b>^Product(<i>SKU or productId</i>, [<i>templateId</i>]);</b><br>
|
<b>^Product(<i>SKU or productId</i>, [<i>templateId</i>]);</b><br>
|
||||||
This macro looks up a Product in the Product Manager by SKU or productId and
|
This macro looks up a Product in the Product Manager by SKU or productId and
|
||||||
allows information about i to be displayed. If the SKU or productId cannot
|
allows information about it to be displayed. If the SKU or productId cannot
|
||||||
be found, the message ^International("cannot find product","Macro_Product"); will
|
be found, the message ^International("cannot find product","Macro_Product"); will
|
||||||
be displayed.</p>
|
be displayed.</p>
|
||||||
<p>The macro may take one optional argument, an alternate template in the Macro/Product namespace for formatting information about the Product. The following variables are available in the template:</p>
|
<p>The macro takes one optional argument, an alternate template in the Macro/Product namespace for formatting information about the Product. The following variables are available in the template:</p>
|
||||||
|
|
||||||
<p><b>variants.message</b><br />
|
<p><b>variants.message</b><br />
|
||||||
The internationalized text "^International("available product configurations","Macro_Product");"
|
The internationalized text "^International("available product configurations","Macro_Product");"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue