Hover help for Matrix. Internationalized all labels and text as well.

Internationalized entries for Commerce settings that were missed before.
Added some POD.
This commit is contained in:
Colin Kuskie 2005-12-22 23:18:55 +00:00
parent 9bc967a042
commit 3a6284d0f4
6 changed files with 339 additions and 75 deletions

View file

@ -28,6 +28,7 @@ sub definition {
icon=>'matrix.gif',
tableName=>'Matrix',
className=>'WebGUI::Asset::Wobject::Matrix',
assetName=>WebGUI::International::get('assetName',"Asset_Matrix"),
properties=>{
categories=>{
defaultValue=>"Features\nBenefits",
@ -165,23 +166,6 @@ sub incrementCounter {
}
}
#-------------------------------------------------------------------
sub getName {
return "Matrix";
}
#-------------------------------------------------------------------
sub purge {
my $self = shift;
WebGUI::SQL->write("delete from Matrix_listing where assetId=".quote($self->getId));
WebGUI::SQL->write("delete from Matrix_listingData where assetId=".quote($self->getId));
WebGUI::SQL->write("delete from Matrix_field where assetId=".quote($self->getId));
WebGUI::SQL->write("delete from Matrix_rating where assetId=".quote($self->getId));
WebGUI::SQL->write("delete from Matrix_ratingSummary where assetId=".quote($self->getId));
$self->SUPER::purge;
}
#-------------------------------------------------------------------
sub setRatings {
my $self = shift;
@ -320,12 +304,9 @@ sub www_copy {
#-------------------------------------------------------------------
sub www_deleteListing {
my $self = shift;
my $output = '<h1>Confirm Delete</h1>
Are you absolutely sure you wish to delete this listing? This operation cannot be undone.
<p>
<a href="'.$self->getUrl("func=deleteListingConfirm&listingId=".$session{form}{listingId}).'">Yes!</a>
<p>
<a href="'.$self->formatURL("viewDetail",$session{form}{listingId}).'">No, I made a mistake.</a> ';
my $output = sprintf WebGUI::International::get('delete listing confirmation','Asset_Matrix'),
$self->getUrl("func=deleteListingConfirm&listingId=".$session{form}{listingId}),
$self->formatURL("viewDetail",$session{form}{listingId});
return $self->processStyle($output);
}
@ -351,72 +332,85 @@ sub getEditForm {
$tabform->getTab("properties")->textarea(
-name=>"categories",
-label=>WebGUI::International::get('categories', 'Asset_Matrix'),
-hoverHelp=>WebGUI::International::get('categories description', 'Asset_Matrix'),
-value=>$self->getValue("categories"),
-subtext=>"<br />Enter one per line in the order you want them to appear. Be sure to watch leading and trailing whitespace."
-subtext=>WebGUI::International::get('categories subtext', 'Asset_Matrix'),
);
$tabform->getTab("properties")->integer(
-name=>"maxComparisons",
-label=>WebGUI::International::get("max comparisons","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("max comparisons description","Asset_Matrix"),
-value=>$self->getValue("maxComparisons")
);
$tabform->getTab("properties")->integer(
-name=>"maxComparisonsPrivileged",
-label=>WebGUI::International::get("max comparisons privileged","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("max comparisons privileged description","Asset_Matrix"),
-value=>$self->getValue("maxComparisonsPrivileged")
);
$tabform->getTab("properties")->interval(
-name=>"ratingTimeout",
-label=>WebGUI::International::get("rating timeout","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("rating timeout description","Asset_Matrix"),
-value=>$self->getValue("ratingTimeout")
);
$tabform->getTab("properties")->interval(
-name=>"ratingTimeoutPrivileged",
-label=>WebGUI::International::get("rating timeout privileged","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("rating timeout privileged description","Asset_Matrix"),
-value=>$self->getValue("ratingTimeoutPrivileged")
);
$tabform->getTab("security")->group(
-name=>"groupToAdd",
-label=>WebGUI::International::get("group to add","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("group to add description","Asset_Matrix"),
-value=>[$self->getValue("groupToAdd")]
);
$tabform->getTab("security")->group(
-name=>"privilegedGroup",
-label=>WebGUI::International::get("privileged group","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("privileged group description","Asset_Matrix"),
-value=>[$self->getValue("privilegedGroup")]
);
$tabform->getTab("security")->group(
-name=>"groupToRate",
-label=>WebGUI::International::get("rating group","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("rating group description","Asset_Matrix"),
-value=>[$self->getValue("groupToRate")]
);
$tabform->getTab("display")->template(
-name=>"templateId",
-value=>$self->getValue("templateId"),
-label=>WebGUI::International::get("main template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("main template description","Asset_Matrix"),
-namespace=>"Matrix"
);
$tabform->getTab("display")->template(
-name=>"detailTemplateId",
-value=>$self->getValue("detailTemplateId"),
-label=>WebGUI::International::get("detail template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("detail template description","Asset_Matrix"),
-namespace=>"Matrix/Detail"
);
$tabform->getTab("display")->template(
-name=>"ratingDetailTemplateId",
-value=>$self->getValue("ratingDetailTemplateId"),
-label=>WebGUI::International::get("rating detail template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("rating detail template description","Asset_Matrix"),
-namespace=>"Matrix/RatingDetail"
);
$tabform->getTab("display")->template(
-name=>"searchTemplateId",
-value=>$self->getValue("searchTemplateId"),
-label=>WebGUI::International::get("search template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("search template description","Asset_Matrix"),
-namespace=>"Matrix/Search"
);
$tabform->getTab("display")->template(
-name=>"compareTemplateId",
-value=>$self->getValue("compareTemplateId"),
-label=>WebGUI::International::get("compare template","Asset_Matrix"),
-hoverHelp=>WebGUI::International::get("compare template description","Asset_Matrix"),
-namespace=>"Matrix/Compare"
);
return $tabform;
@ -426,7 +420,8 @@ sub getEditForm {
sub www_edit {
my $self = shift;
return WebGUI::Privilege::insufficient() unless $self->canEdit;
return $self->getAdminConsole->render($self->getEditForm->print,"Edit Matrix");
return $self->getAdminConsole->render($self->getEditForm->print,
WebGUI::International::get("edit matrix",'Asset_Matrix'));
}
@ -435,7 +430,7 @@ sub www_edit {
sub www_editListing {
my $self = shift;
my $listing= WebGUI::SQL->getRow("Matrix_listing","listingId",$session{form}{listingId});
return "You don't have the rights to edit this listing." unless (($session{form}{listingId} eq "new" && WebGUI::Grouping::isInGroup($self->get("groupToAdd"))) || $session{user}{userId} eq $listing->{maintainerId} || $self->canEdit);
return WebGUI::International('no edit rights','Asset_Matrix') unless (($session{form}{listingId} eq "new" && WebGUI::Grouping::isInGroup($self->get("groupToAdd"))) || $session{user}{userId} eq $listing->{maintainerId} || $self->canEdit);
my $f = WebGUI::HTMLForm->new(-action=>$self->getUrl);
$f->hidden(
-name=>"func",
@ -459,7 +454,7 @@ sub www_editListing {
$f->url(
-name=>"productUrl",
-value=>$listing->{productUrl},
-label=>"Product URL"
-label=>WebGUI::International::get('product url','Asset_Matrix'),
);
$f->text(
-name=>"manufacturerName",
@ -484,7 +479,13 @@ sub www_editListing {
-options=>WebGUI::SQL->buildHashRef("select userId,username from users order by username")
);
}
my %goodBad = ("No"=>"No", "Yes"=>"Yes", "Free Add On"=>"Free Add On","Costs Extra"=>"Costs Extra", "Limited"=>"Limited");
my %goodBad = (
"No" => WebGUI::International::get("no",'Asset_Matrix'),
"Yes" => WebGUI::International::get("yes",'Asset_Matrix'),
"Free Add On" => WebGUI::International::get("free",'Asset_Matrix'),
"Costs Extra" => WebGUI::International::get("extra",'Asset_Matrix'),
"Limited" => WebGUI::International::get("limited",'Asset_Matrix'),
);
foreach my $category ($self->getCategories()) {
$f->raw('<tr><td colspan="2"><b>'.$category.'</b></td></tr>');
my $a;
@ -545,7 +546,7 @@ sub www_editListing {
$a->finish;
}
$f->submit;
return $self->processStyle("<h1>Edit Listing</h1>".$f->print);
return $self->processStyle(WebGUI::International::get('edit listing','Asset_Matrix').$f->print);
}
@ -553,7 +554,7 @@ sub www_editListing {
sub www_editListingSave {
my $self = shift;
my $listing = WebGUI::SQL->getRow("Matrix_listing","listingId",$session{form}{listingId});
return "You don't have the rights to edit this listing." unless (($session{form}{listingId} eq "new" && WebGUI::Grouping::isInGroup($self->get("groupToAdd"))) || $session{user}{userId} eq $listing->{maintainerId} || $self->canEdit);
return WebGUI::International('no edit rights','Asset_Matrix') unless (($session{form}{listingId} eq "new" && WebGUI::Grouping::isInGroup($self->get("groupToAdd"))) || $session{user}{userId} eq $listing->{maintainerId} || $self->canEdit);
my %data = (
listingId => $session{form}{listingId},
lastUpdated => WebGUI::DateTime::time(),
@ -657,11 +658,11 @@ sub www_editField {
-value=>[$field->{fieldType}],
-label=>WebGUI::International::get('type','Asset_Matrix'),
-options=>{
goodBad=>"Good Bad",
text=>"Text",
url=>"URL",
textarea=>"Text Area",
combo=>"Combo"
'goodBad' => WebGUI::International::get('good bad','Asset_Matrix'),
'text' => WebGUI::International::get('text','Asset_Matrix'),
'url' => WebGUI::International::get('url','Asset_Matrix'),
'textarea' => WebGUI::International::get('text area','Asset_Matrix'),
'combo' => WebGUI::International::get('combo','Asset_Matrix'),
}
);
$f->textarea(
@ -685,7 +686,7 @@ sub www_editField {
-options=>\%cats
);
$f->submit;
return $self->processStyle("<h1>Edit Field</h1>".$f->print);
return $self->processStyle(WebGUI::International::get('edit field','Asset_Matrix').$f->print);
}
@ -710,9 +711,8 @@ sub www_editFieldSave {
sub www_listFields {
my $self = shift;
return WebGUI::Privilege::insufficient() unless($self->canEdit);
my $output = '<h1>Field List</h1>
<a href="'.$self->getUrl("func=editField&amp;fieldId=new").'">Add new field.</a>
<p />';
my $output = sprintf WebGUI::International::get('list fields','Asset_Matrix'),
$self->getUrl("func=editField&amp;fieldId=new");
my $sth = WebGUI::SQL->read("select fieldId, label from Matrix_field where assetId=".quote($self->getId)." order by label");
while (my ($id, $label) = $sth->array) {
$output .= '<a href="'.$self->getUrl("func=editField&amp;fieldId=".$id).'">'.$label.'</a><br />';

View file

@ -4,6 +4,73 @@ our $HELP = {
'matrix add/edit' => {
title => 'add/edit help title',
body => 'add/edit help body',
fields => [
{
title => 'categories',
description => 'categories description',
namespace => 'Asset_Matrix',
},
{
title => 'max comparisons',
description => 'max comparisons description',
namespace => 'Asset_Matrix',
},
{
title => 'max comparisons privileged',
description => 'max comparisons privileged description',
namespace => 'Asset_Matrix',
},
{
title => 'detail template',
description => 'detail template description',
namespace => 'Asset_Matrix',
},
{
title => 'rating timeout',
description => 'rating timeout description',
namespace => 'Asset_Matrix',
},
{
title => 'rating timeout privileged',
description => 'rating timeout privileged description',
namespace => 'Asset_Matrix',
},
{
title => 'group to add',
description => 'group to add description',
namespace => 'Asset_Matrix',
},
{
title => 'privileged group',
description => 'privileged group description',
namespace => 'Asset_Matrix',
},
{
title => 'rating group',
description => 'rating group description',
namespace => 'Asset_Matrix',
},
{
title => 'main template',
description => 'main template description',
namespace => 'Asset_Matrix',
},
{
title => 'rating detail template',
description => 'rating detail template description',
namespace => 'Asset_Matrix',
},
{
title => 'search template',
description => 'search template description',
namespace => 'Asset_Matrix',
},
{
title => 'compare template',
description => 'compare template description',
namespace => 'Asset_Matrix',
},
],
related => [
{
tag => 'search template',

View file

@ -357,7 +357,7 @@ sub www_deleteCartItem {
#-------------------------------------------------------------------
sub www_editCommerceSettings {
my (%tabs, $tabform, $jscript, $currentPlugin, $ac, $jscript, $i18n,
my (%tabs, $tabform, $currentPlugin, $ac, $jscript, $i18n,
$paymentPlugin, @paymentPlugins, %paymentPlugins, @failedPaymentPlugins, $plugin,
$shippingPlugin, @shippingPlugins, %shippingPlugins, @failedShippingPlugins);
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
@ -561,16 +561,16 @@ sub www_listTransactions {
my $i18n = WebGUI::International->new('TransactionLog');
my $transactionOptions = {
'' => 'Any',
'Pending' => 'Pending',
'Completed' => 'Completed',
'' => $i18n->get('any'),
'Pending' => $i18n->get('pending'),
'Completed' => $i18n->get('completed'),
};
my $shippingOptions = {
'' => 'Any',
'Shipped' => 'Shipped',
'NotShipped' => 'Not yet shipped',
'Delivered' => 'Delivered',
'' => $i18n->get('any'),
'Shipped' => $i18n->get('shipped'),
'NotShipped' => $i18n->get('not shipped'),
'Delivered' => $i18n->get('delivered'),
};
my $initStart = WebGUI::FormProcessor::date('initStart');

View file

@ -10,7 +10,28 @@ use WebGUI::Form;
use WebGUI::Privilege;
use WebGUI::Grouping;
=head1 NAME
Package WebGUI::Operation::TransactionLog
=head1 DESCRIPTION
Operations for dealing with transactions from the WebGUI Commerce System.
=cut
#-------------------------------------------------------------------
=head2 www_viewPurchaseHistory ( errorMessage )
Templated output of all Commerce transactions by this user. Allows the user to cancel any recurring
transactions.
=head3 errorMessage
This error message will be added to the template variables.
=cut
sub www_viewPurchaseHistory {
my (@history, @historyLoop, %var, %properties);
@ -35,6 +56,15 @@ sub www_viewPurchaseHistory {
}
#-------------------------------------------------------------------
=head2 www_cancelRecurringTransaction ( )
Cancels a transaction if it is recurring. If not, an error message is returned.
The transaction to cancel is passed in via a form field entry in the session variable,
$session{form}{tid}.
=cut
sub www_cancelRecurringTransaction {
my ($transaction, $error, $message);
@ -52,6 +82,14 @@ sub www_cancelRecurringTransaction {
}
#-------------------------------------------------------------------
=head2 www_deleteTransaction ( )
Deletes a transaction, as specified by $session{form}{tid}.
Afterward, it calls www_listTransactions
=cut
sub www_deleteTransaction {
my $transactionId;

View file

@ -669,37 +669,80 @@ our $I18N = {
},
'add/edit help body' => {
lastUpdated => 0,
lastUpdated => 1135271513,
message => q|<p>The Matrix allows you to set up a really powerful comparison system for any manner of item or service.</p>
<p>
<b>Categories</b><br />
Specify one category per line here to define the categories for this matrix. Categories are used to subdivide fields and also represent the things users can rate each listing on.
</p>
<p>
<b>Detail Template</b><br />
Select a template to be used to display the detailed information about a listing.
</p>
<p>
<b>Rating Detail Template</b><br />
Select a template to be used to display the detailed ratings information.
</p>
<p>
<b>Search Template</b><br />
Select a template to be used to display the search engine interface.
</p>
<p>
<b>Compare Template</b><br />
Select a template to be used to show the listing comparison data.
</p>|
|
},
'categories description' => {
message => q|Specify one category per line here to define the categories for this matrix. Categories are used to subdivide fields and also represent the things users can rate each listing on.|,
lastUpdated => 1135271460,
},
'categories subtext' => {
message => q|<br />Enter one per line in the order you want them to appear. Be sure to watch leading and trailing whitespace.|,
lastUpdated => 1135271460,
},
'max comparisons description' => {
message => q|Specifies how many comparisons are allowed in searches and comparisons.|,
lastUpdated => 1135271460,
},
'max comparisons privileged description' => {
message => q|Specifies how many comparisons are allowed in searches and comparisons for users in the privileged group.|,
lastUpdated => 1135271460,
},
'rating timeout description' => {
message => q|Set a timeout so that users are prevented from rating a given listing too often.|,
lastUpdated => 1135271460,
},
'rating timeout privileged description' => {
message => q|Privileged users may have a different rating timeout than general users who are allowed to rate.|,
lastUpdated => 1135271460,
},
'group to add description' => {
message => q|This group will be allowed to add or edit listings|,
lastUpdated => 1135271460,
},
'privileged group description' => {
message => q|This group will have special privileges with respect to the maximum number of comparisons allowed and frequency of rating|,
lastUpdated => 1135271460,
},
'rating group description' => {
message => q|This group will be allowed to rate listings in the Matrix.|,
lastUpdated => 1135271460,
},
'main template description' => {
message => q|Select a template to be used to display the default view of the Matrix.|,
lastUpdated => 1135271460,
},
'detail template description' => {
message => q|Select a template to be used to display the detailed information about a listing.|,
lastUpdated => 1135271460,
},
'rating detail template description' => {
message => q|Select a template to be used to display the detailed ratings information.|,
lastUpdated => 1135271460,
},
'search template description' => {
message => q|Select a template to be used to display the search engine interface.|,
lastUpdated => 1135271460,
},
'compare template description' => {
message => q|Select a template to be used to show the listing comparison data.|,
lastUpdated => 1135271460,
},
'categories' => {
message => q|Categories|,
lastUpdated => 1133758944,
@ -775,6 +818,11 @@ our $I18N = {
lastUpdated => 1133758944,
},
'product url' => {
message => q|Product URL|,
lastUpdated => 1135279964,
},
'manufacturer name' => {
message => q|Manufacturer Name|,
lastUpdated => 1133758944,
@ -855,11 +903,98 @@ our $I18N = {
lastUpdated => 1133758944,
},
'no edit rights' => {
message => q|You don't have the rights to edit this listing.|,
lastUpdated => 1133758944,
},
'assetName' => {
lastUpdated => 1134256651,
message => q|Matrix|
},
'edit matrix' => {
lastUpdated => 1135279558,
message => q|Edit Matrix|
},
'edit listing' => {
lastUpdated => 1135279558,
message => q|<h1>Edit Listing</h1>|
},
'edit field' => {
lastUpdated => 1135279558,
message => q|<h1>Edit Field</h1>|
},
'good bad' => {
lastUpdated => 1135279558,
message => q|Good Bad|
},
'text' => {
lastUpdated => 1135279558,
message => q|Text|
},
'url' => {
lastUpdated => 1135279558,
message => q|URL|
},
'text area' => {
lastUpdated => 1135279558,
message => q|Text Area|,
},
'combo' => {
lastUpdated => 1135279558,
message => q|Combo|,
},
'delete listing confirmation' => {
lastUpdated => 1135289632,
message => q|<h1>Confirm Delete</h1>
Are you absolutely sure you wish to delete this listing? This operation cannot be undone.
<p>
<a href="%s">Yes!</a>
<p>
<a href="%s">No, I made a mistake.</a>|,
},
'list fields' => {
lastUpdated => 1135289632,
message => q|<h1>Field List</h1>
<a href="%s">Add new field.</a>
<p />|,
},
'yes' => {
lastUpdated => 1135279558,
message => q|Yes|
},
'no' => {
lastUpdated => 1135279558,
message => q|No|
},
'free' => {
lastUpdated => 1135279558,
message => q|Free Add On|
},
'extra' => {
lastUpdated => 1135279558,
message => q|Costs Extra|
},
'limited' => {
lastUpdated => 1135279558,
message => q|Limited|
},
};
1;

View file

@ -132,6 +132,30 @@ A loop containing the transactions in the transaction history. Within this loop
lastUpdated => 1128920040,
context => q|An error message that's shown when an attempt is made to cancel a non recurring transaction.|
},
'pending' => {
message => q|Pending|,
lastUpdated => 1135291532,
},
'completed' => {
message => q|Completed|,
lastUpdated => 1135291540,
},
'shipped' => {
message => q|Shipped|,
lastUpdated => 1135291545,
},
'not shipped' => {
message => q|Not Shipped|,
lastUpdated => 1135291589,
},
'any' => {
message => q|Any|,
lastUpdated => 1135291967,
},
'delivered' => {
message => q|Delivered|,
lastUpdated => 1135291969,
},
};