initial import of Matrix v2 files into Matrix branch

This commit is contained in:
Yung Han Khoe 2008-10-20 16:17:27 +00:00
parent e37f2996cb
commit 22f5565351
10 changed files with 1860 additions and 1487 deletions

View file

@ -0,0 +1,420 @@
package WebGUI::Asset::MatrixListing;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use Tie::IxHash;
use base 'WebGUI::Asset';
use WebGUI::Utility;
=head1 NAME
Package WebGUI::Asset::MatrixListing
=head1 DESCRIPTION
Describe your New Asset's functionality and features here.
=head1 SYNOPSIS
use WebGUI::Asset::MatrixListing;
=head1 METHODS
These methods are available from this class:
=cut
#-------------------------------------------------------------------
=head2 addRevision
This method exists for demonstration purposes only. The superclass
handles revisions to MatrixListing Assets.
=cut
sub addRevision {
my $self = shift;
my $newSelf = $self->SUPER::addRevision(@_);
return $newSelf;
}
#-------------------------------------------------------------------
=head2 definition ( session, definition )
defines asset properties for MatrixListing instances.
=head3 session
=head3 definition
A hash reference passed in from a subclass definition.
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my %properties;
tie %properties, 'Tie::IxHash';
my $i18n = WebGUI::International->new($session, "Asset_MatrixListing");
%properties = (
templateId => {
tab =>"display",
fieldType =>"template",
defaultValue =>'MatrixListingTmpl00001',
noFormPost =>0,
namespace =>"MatrixListing",
hoverHelp =>$i18n->get('template description'),
label =>$i18n->get('template label')
},
screenshots => {
tab =>"properties",
fieldType =>"image",
defaultValue =>undef,
label =>$i18n->get("screenshots label"),
hoverHelp =>$i18n->get("screenshots description")
},
description => {
tab =>"properties",
fieldType =>"HTMLArea",
defaultValue =>undef,
label =>$i18n->get("description label"),
hoverHelp =>$i18n->get("description description")
},
version => {
tab =>"properties",
fieldType =>"text",
defaultValue =>undef,
label =>$i18n->get("version label"),
hoverHelp =>$i18n->get("version description")
},
views => {
defaultValue =>0,
autoGenerate =>0,
noFormPost =>1,
},
compares => {
defaultValue =>0,
autoGenerate =>0,
noFormPost =>1,
},
clicks => {
defaultValue =>0,
autoGenerate =>0,
noFormPost =>1,
},
viewsLastIp => {
defaultValue =>undef,
autoGenerate =>0,
noFormPost =>1,
},
comparesLastIp => {
defaultValue =>undef,
autoGenerate =>0,
noFormPost =>1,
},
clicksLastIp => {
defaultValue =>undef,
autoGenerate =>0,
noFormPost =>1,
},
maintainer => {
tab =>"properties",
fieldType =>"user",
defaultValue =>$session->user->userId,
label =>$i18n->get("maintainer label"),
hoverHelp =>$i18n->get("maintainer description")
},
manufacturerName => {
tab =>"properties",
fieldType =>"text",
defaultValue =>undef,
label =>$i18n->get("manufacturerName label"),
hoverHelp =>$i18n->get("manufacturerName description")
},
manufacturerURL => {
tab =>"properties",
fieldType =>"url",
defaultValue =>undef,
label =>$i18n->get("manufacturerURL label"),
hoverHelp =>$i18n->get("manufacturerURL description")
},
productURL => {
tab =>"properties",
fieldType =>"url",
defaultValue =>undef,
label =>$i18n->get("productURL label"),
hoverHelp =>$i18n->get("productURL description")
},
lastUpdated => {
defaultValue =>time(),
autoGenerate =>0,
noFormPost =>1,
},
);
push(@{$definition}, {
assetName=>$i18n->get('assetName'),
icon=>'MatrixListing.gif',
autoGenerateForms=>1,
tableName=>'MatrixListing',
className=>'WebGUI::Asset::MatrixListing',
properties=>\%properties
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
=head2 duplicate
This method exists for demonstration purposes only. The superclass
handles duplicating MatrixListing Assets. This method will be called
whenever a copy action is executed
=cut
sub duplicate {
my $self = shift;
my $newAsset = $self->SUPER::duplicate(@_);
return $newAsset;
}
#-------------------------------------------------------------------
=head2 getAutoCommitWorkflowId
Gets the WebGUI::VersionTag workflow to use to automatically commit MatrixListings.
By specifying this method, you activate this feature.
=cut
sub getAutoCommitWorkflowId {
my $self = shift;
return $self->getParent->get("submissionApprovalWorkflowId");
}
#-------------------------------------------------------------------
=head2 indexContent ( )
Making private. See WebGUI::Asset::indexContent() for additonal details.
=cut
sub indexContent {
my $self = shift;
my $indexer = $self->SUPER::indexContent;
$indexer->setIsPublic(0);
}
#-------------------------------------------------------------------
=head2 prepareView ( )
See WebGUI::Asset::prepareView() for details.
=cut
sub prepareView {
my $self = shift;
$self->SUPER::prepareView();
my $template = WebGUI::Asset::Template->new($self->session, $self->get("templateId"));
$template->prepare;
$self->{_viewTemplate} = $template;
}
#-------------------------------------------------------------------
=head2 processPropertiesFromFormPost ( )
Used to process properties from the form posted. Do custom things with
noFormPost fields here, or do whatever you want. This method is called
when /yourAssetUrl?func=editSave is requested/posted.
=cut
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost;
$self->requestAutoCommit;
}
#-------------------------------------------------------------------
=head2 purge ( )
This method is called when data is purged by the system.
removes collateral data associated with a MatrixListing when the system
purges it's data.
=cut
sub purge {
my $self = shift;
return $self->SUPER::purge;
}
#-------------------------------------------------------------------
=head2 purgeRevision ( )
This method is called when data is purged by the system.
=cut
sub purgeRevision {
my $self = shift;
return $self->SUPER::purgeRevision;
}
#-------------------------------------------------------------------
=head2 view ( )
method called by the container www_view method.
=cut
sub view {
my $self = shift;
my $var = $self->get; # $var is a hash reference.
$var->{controls} = $self->getToolbar;
$var->{fileUrl} = $self->getFileUrl;
$var->{fileIcon} = $self->getFileIconUrl;
return $self->processTemplate($var,undef, $self->{_viewTemplate});
}
#-------------------------------------------------------------------
=head2 www_edit ( )
Web facing method which is the default edit page
=cut
sub www_edit {
my $self = shift;
return $self->session->privilege->noAccess() unless $self->getParent->canAddMatrixListing();
my $i18n = WebGUI::International->new($self->session, "Asset_MatrixListing");
return $self->session->privilege->insufficient() unless $self->canEdit;
return $self->session->privilege->locked() unless $self->canEditIfLocked;
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get('edit matrix listing title'));
}
#-------------------------------------------------------------------
=head2 www_view ( )
Web facing method which is the default view page. This method does a
302 redirect to the "showPage" file in the storage location.
=cut
sub www_view {
my $self = shift;
return $self->session->privilege->noAccess() unless $self->canView;
if ($self->session->var->isAdminOn) {
return $self->getContainer->www_view;
}
$self->session->http->setRedirect($self->getFileUrl($self->getValue("showPage")));
return undef;
}
#-------------------------------------------------------------------
# Everything below here is to make it easier to install your custom
# asset, but has nothing to do with assets in general
#-------------------------------------------------------------------
# cd /data/WebGUI/lib
# perl -MWebGUI::Asset::MatrixListing -e install www.example.com.conf [ /path/to/WebGUI ]
# - or -
# perl -MWebGUI::Asset::MatrixListing -e uninstall www.example.com.conf [ /path/to/WebGUI ]
#-------------------------------------------------------------------
use base 'Exporter';
our @EXPORT = qw(install uninstall);
use WebGUI::Session;
#-------------------------------------------------------------------
sub install {
my $config = $ARGV[0];
my $home = $ARGV[1] || "/data/WebGUI";
die "usage: perl -MWebGUI::Asset::MatrixListing -e install www.example.com.conf\n" unless ($home && $config);
print "Installing asset.\n";
my $session = WebGUI::Session->open($home, $config);
$session->config->addToArray("assets","WebGUI::Asset::MatrixListing");
$session->db->write("create table MatrixListing (
assetId varchar(22) binary not null,
revisionDate bigint not null,
title varchar(255),
screenshots varchar(22),
description text,
version varchar(255),
views int(11),
compares int(11),
clicks int(11),
viewsLastIp varchar(255),
comparesLastIp varchar(255),
clicksLastIp varchar(255),
lastUpdated int(11),
maintainer varchar(22),
manufacturerName varchar(255),
manufacturerURL varchar(255),
productURL varchar(255),
primary key (assetId, revisionDate)
)");
$session->var->end;
$session->close;
print "Done. Please restart Apache.\n";
}
#-------------------------------------------------------------------
sub uninstall {
my $config = $ARGV[0];
my $home = $ARGV[1] || "/data/WebGUI";
die "usage: perl -MWebGUI::Asset::MatrixListing -e uninstall www.example.com.conf\n" unless ($home && $config);
print "Uninstalling asset.\n";
my $session = WebGUI::Session->open($home, $config);
$session->config->deleteFromArray("assets","WebGUI::Asset::MatrixListing");
my $rs = $session->db->read("select assetId from asset where className='WebGUI::Asset::MatrixListing'");
while (my ($id) = $rs->array) {
my $asset = WebGUI::Asset->new($session, $id, "WebGUI::Asset::MatrixListing");
$asset->purge if defined $asset;
}
$session->db->write("drop table MatrixListing");
$session->var->end;
$session->close;
print "Done. Please restart Apache.\n";
}
1;
#vim:ft=perl

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,156 @@
package WebGUI::Form::MatrixCompare;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::SelectBox';
use Tie::IxHash;
use WebGUI::International;
use WebGUI::Pluggable;
use WebGUI::Utility;
=head1 NAME
Package WebGUI::Form::MatrixCompare
=head1 DESCRIPTION
Creates a form control that will allow you to select a field type that can be used by the Matrix wobject.
It's meant to be used in conjunction with the DynamicField form control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 areOptionsSettable ( )
Returns 0.
=cut
sub areOptionsSettable {
return 0;
}
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 types
An array reference containing the form control types to be selectable. Defaults to all available dynamic types.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
label=>{
defaultValue=>$i18n->get("matrix compare","WebGUI")
},
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
=head2 getName ( session )
Returns the human readable name of this control.
=cut
sub getName {
my ($self, $session) = @_;
return WebGUI::International->new($session, 'WebGUI')->get('matrix compare');
}
#-------------------------------------------------------------------
=head2 getValue ( )
Returns either what's posted or if nothing comes back it returns "text".
=cut
sub getValue {
my $self = shift;
my $compareValue = $self->SUPER::getValue(@_);
$compareValue =~ s/[^\w]//g;
return $compareValue || 0;
}
#-------------------------------------------------------------------
=head2 isDynamicCompatible ( )
Returns 0.
=cut
sub isDynamicCompatible {
return 0;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a fieldType selector.
=cut
sub toHtml {
my $self = shift;
my $i18n = WebGUI::International->new($session,'Form_MatrixCompare');
my %options;
tie %options, "Tie::IxHash";
%options = (
0 => $i18n->get('no'),
1 => $i18n->get('limited'),
2 => $i18n->get('costs extra'),
3 => $i18n->get('free add on'),
4 => $i18n->get('yes'),
);
$self->set('options', \%options);
$self->set('defaultValue',0);
return $self->SUPER::toHtml();
}
1;

View file

@ -0,0 +1,153 @@
package WebGUI::Form::MatrixFieldType;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::SelectBox';
use Tie::IxHash;
use WebGUI::International;
use WebGUI::Pluggable;
use WebGUI::Utility;
=head1 NAME
Package WebGUI::Form::MatrixFieldType
=head1 DESCRIPTION
Creates a form control that will allow you to select a field type that can be used by the Matrix wobject.
It's meant to be used in conjunction with the DynamicField form control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 areOptionsSettable ( )
Returns 0.
=cut
sub areOptionsSettable {
return 0;
}
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 types
An array reference containing the form control types to be selectable. Defaults to all available dynamic types.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
label=>{
defaultValue=>$i18n->get("matrix fieldtype","WebGUI")
},
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
=head2 getName ( session )
Returns the human readable name of this control.
=cut
sub getName {
my ($self, $session) = @_;
return WebGUI::International->new($session, 'WebGUI')->get('matrix fieldtype');
}
#-------------------------------------------------------------------
=head2 getValue ( )
Returns either what's posted or if nothing comes back it returns "text".
=cut
sub getValue {
my $self = shift;
my $fieldType = $self->SUPER::getValue(@_);
$fieldType =~ s/[^\w]//g;
return $fieldType || "MatrixCompare";
}
#-------------------------------------------------------------------
=head2 isDynamicCompatible ( )
Returns 0.
=cut
sub isDynamicCompatible {
return 0;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a fieldType selector.
=cut
sub toHtml {
my $self = shift;
my %options;
tie %options, "Tie::IxHash";
%options = (
MatrixCompare => WebGUI::Pluggable::instanciate('WebGUI::Form::MatrixCompare', 'getName',[$self->session]),
SelectBox => WebGUI::Pluggable::instanciate('WebGUI::Form::SelectBox', 'getName',[$self->session]),
Combo => WebGUI::Pluggable::instanciate('WebGUI::Form::Combo', 'getName',[$self->session]),
);
$self->set('options', \%options);
$self->set('defaultValue','MatrixCompare');
return $self->SUPER::toHtml();
}
1;

View file

@ -4,30 +4,18 @@ use strict;
our $I18N = {
'delete field confirm' => {
message => q|Are you certain you wish to delete this field and all the data linked to it?|,
lastUpdated => 0,
lastUpdated => 1230,
context => q|displayed in field manager before delete|
},
'screenshot' => {
message => q|Screenshot/Photo|,
lastUpdated => 0,
context => q|edit listing property|
},
'screenshot help' => {
message => q|Upload a picture of the product, or a screen shot if it's a software package.|,
lastUpdated => 0,
context => q|edit listing property help|
},
'visitor cache timeout' => {
message => q|Visitor Cache Timeout|,
lastUpdated => 0
lastUpdated => 1230
},
'visitor cache timeout help' => {
message => q|Since all visitors will see this asset the same way, we can cache it to increase performance. How long should we cache it?|,
lastUpdated => 0
lastUpdated => 1230
},
'isTooMany' => {
@ -55,11 +43,6 @@ our $I18N = {
lastUpdated => 1149783768,
},
'version' => {
message => q|The version number or model number of the product.|,
lastUpdated => 1149783768,
},
'details url' => {
message => q|The URL to the details page for this listing.|,
lastUpdated => 1149783768,
@ -210,11 +193,6 @@ our $I18N = {
lastUpdated => 1149784175,
},
'manufacturerName' => {
message => q|The name of the company that manufactures the product or provides the service represented in this listing.|,
lastUpdated => 1167186054,
},
'manufacturerUrl' => {
message => q|The manufacturer's URL.|,
lastUpdated => 1149784175,
@ -225,11 +203,6 @@ our $I18N = {
lastUpdated => 1149784175,
},
'versionNumber' => {
message => q|The version number or model number of this product.|,
lastUpdated => 1149784175,
},
'views' => {
message => q|The total number of views this listing has received.|,
lastUpdated => 1149784175,
@ -281,7 +254,7 @@ our $I18N = {
},
'detail template help title' => {
lastUpdated => 0,
lastUpdated =>
message => q|Matrix Listing Detail Template Variables|
},
@ -501,7 +474,7 @@ our $I18N = {
},
'ratings detail template help title' => {
lastUpdated => 0,
lastUpdated => 1230,
message => q|Matrix Ratings Detail Template Variables|
},
@ -582,23 +555,68 @@ our $I18N = {
'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 => 1136503559,
},
lastUpdated => 0,
},
'categories default value' => {
message => q|Features\nBenefits|,
lastUpdated => 0,
},
'submission approval workflow description' => {
message => q|Select the workflow that is used to approve submissions.|,
lastUpdated => 0,
},
'ratings duration description' => {
message => q|Select the interval after which old ratings are cleaned out.|,
lastUpdated => 0,
},
'default sort description' => {
message => q|Select the default sort order for the listings in the compare box.|,
lastUpdated => 0,
},
'compare color no description' => {
message => q|Select the color for compare result 'No' in the compare display.|,
lastUpdated => 0,
},
'compare color limited description' => {
message => q|Select the color for compare result 'Limited' in the compare display.|,
lastUpdated => 0,
},
'compare color costs extra description' => {
message => q|Select the color for compare result 'Costs Extra' in the compare display.|,
lastUpdated => 0,
},
'compare color free add on description' => {
message => q|Select the color for compare result 'Free Add On' in the compare display.|,
lastUpdated => 0,
},
'compare color yes description' => {
message => q|Select the color for compare result 'Yes' in the compare display.|,
lastUpdated => 0,
},
'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 description' => {
message => q|Specifies how many comparisons are allowed in searches and comparisons.|,
lastUpdated => 0,
},
'max comparisons privileged description' => {
message => q|Specifies how many comparisons are allowed in searches and comparisons for users in the privileged group.|,
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 => 0,
},
'rating timeout description' => {
message => q|Set a timeout so that users are prevented from rating a given listing too often.|,
@ -625,43 +643,103 @@ our $I18N = {
lastUpdated => 1135271460,
},
'main template description' => {
'template description' => {
message => q|Select a template to be used to display the default view of the Matrix.|,
lastUpdated => 1135271460,
lastUpdated => 0,
},
'detail template description' => {
message => q|Select a template to be used to display the detailed information about a listing.|,
lastUpdated => 1135271460,
lastUpdated => 0,
},
'rating detail template description' => {
message => q|Select a template to be used to display the detailed ratings information.|,
lastUpdated => 1135271460,
lastUpdated => 0,
},
'search template description' => {
message => q|Select a template to be used to display the search engine interface.|,
lastUpdated => 1135271460,
lastUpdated => 0,
},
'compare template description' => {
message => q|Select a template to be used to show the listing comparison data.|,
lastUpdated => 1135271460,
lastUpdated => 0,
},
'categories' => {
'categories label' => {
message => q|Categories|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'max comparisons' => {
'submission approval workflow label' => {
message => q|Submission Approval Workflow|,
lastUpdated => 0,
},
'ratings duration label' => {
message => q|Ratings Duration|,
lastUpdated => 0,
},
'default sort label' => {
message => q|Default Sort|,
lastUpdated => 0,
},
'sort by score label' => {
message => q|Score|,
lastUpdated => 0,
},
'sort alpha numeric label' => {
message => q|Alpha Numeric|,
lastUpdated => 0,
},
'sort by asset rank label' => {
message => q|Asset Rank|,
lastUpdated => 0,
},
'sort by last updated label' => {
message => q|Most Recent Update|,
lastUpdated => 0,
},
'compare color no label' => {
message => q|Compare Color: No|,
lastUpdated => 0,
},
'compare color limited label' => {
message => q|Compare Color: Limited|,
lastUpdated => 0,
},
'compare color costs extra label' => {
message => q|Compare Color: Costs Extra|,
lastUpdated => 0,
},
'compare color free add on label' => {
message => q|Compare Color: Free Add On|,
lastUpdated => 0,
},
'compare color yes label' => {
message => q|Compare Color: Yes|,
lastUpdated => 0,
},
'max comparisons label' => {
message => q|Maximum Comparisons|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'max comparisons privileged' => {
'max comparisons privileged label' => {
message => q|Maximum Comparisons (For Privileged Users)|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'rating timeout' => {
@ -689,29 +767,29 @@ our $I18N = {
lastUpdated => 1133758944,
},
'main template' => {
message => q|Main Template|,
lastUpdated => 1133758944,
'template label' => {
message => q|Matrix Template|,
lastUpdated => 0,
},
'detail template' => {
'detail template label' => {
message => q|Detail Template|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'rating detail template' => {
'rating detail template label' => {
message => q|Rating Detail Template|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'search template' => {
'search template label' => {
message => q|Search Template|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'compare template' => {
'compare template label' => {
message => q|Compare Template|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'product name' => {
@ -719,59 +797,34 @@ our $I18N = {
lastUpdated => 1133758944,
},
'version number' => {
message => q|Version/Model Number|,
lastUpdated => 1133758944,
'attribute name label' => {
message => q|Name|,
lastUpdated => 0,
},
'product url' => {
message => q|Product URL|,
lastUpdated => 1135279964,
},
'manufacturer name' => {
message => q|Manufacturer Name|,
lastUpdated => 1133758944,
},
'manufacturer url' => {
message => q|Manufacturer URL|,
lastUpdated => 1133758944,
},
'description' => {
message => q|Description|,
lastUpdated => 1133758944,
},
'listing maintainer' => {
message => q|Listing Maintainer|,
lastUpdated => 1133758944,
},
'field name' => {
message => q|Field Name|,
lastUpdated => 1136499280,
},
'field label' => {
message => q|Field Label|,
lastUpdated => 1136499282,
},
'field type' => {
# 'field label' => {
# message => q|Field Label|,
# lastUpdated => 1136499282,
# },
'fieldType label' => {
message => q|Field Type|,
lastUpdated => 1136499283,
lastUpdated => 0,
},
'default value' => {
'attribute defaultValue label' => {
message => q|Default Value|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'category' => {
'attribute options label' => {
message => q|Options|,
lastUpdated => 0,
},
'category label' => {
message => q|Category|,
lastUpdated => 1133758944,
lastUpdated => 0,
},
'your email' => {
@ -829,9 +882,9 @@ our $I18N = {
message => q|<h1>Edit Listing</h1>|
},
'edit field' => {
lastUpdated => 1135279558,
message => q|<h1>Edit Field</h1>|
'edit attribute title' => {
lastUpdated => 0,
message => q|Edit/Add Attribute|
},
'good bad' => {
@ -869,12 +922,20 @@ our $I18N = {
<p><a href="%s">No, I made a mistake.</a></p>|,
},
'list fields' => {
lastUpdated => 1135289632,
message => q|<h1>Field List</h1>
<a href="%s">Add new field.</a>
<p />|,
},
'list attributes title' => {
lastUpdated => 0,
message => q|Attribute List|,
},
'delete attribute confirm message' => {
message => q|Are you certain you wish to delete this attribute and all the data linked to it?|,
lastUpdated => 0,
},
'add attribute label' => {
lastUpdated => 0,
message => q|Add Attribute|,
},
'yes' => {
lastUpdated => 1135279558,
@ -906,38 +967,6 @@ our $I18N = {
message => q|Enter the name of the product. If there are entries for the product with different revisions, it would be best to make sure the names are the same.|
},
'version number description' => {
lastUpdated => 1135279558,
message => q|Enter the release or version number for the product.|
},
'product url description' => {
lastUpdated => 1135279558,
message => q|If the product has its own website, enter the complete URL for it here.|
},
'manufacturer name description' => {
lastUpdated => 1135279558,
message => q|Enter the manufacturer of the product.|
},
'manufacturer url description' => {
lastUpdated => 1135279558,
message => q|If the manufacturer has a website, enter the complete URL for it here.|
},
'description description' => {
lastUpdated => 1135279558,
message => q|Please give a general description of the product. Specific details can be rated in the form fields below.|
},
'listing maintainer description' => {
lastUpdated => 1136488950,
message => q|If left blank, this will be the name of the user who created this product listing. The
listing maintainer is allowed to edit this listing, even if they are not members of the group
to add or edit listings.|
},
'matrix specific fields description' => {
lastUpdated => 1135279558,
message => q|Each matrix is configured to compare the features and performance of various products. These features and performance criteria are displayed for you to rate on an item by item basis.|
@ -948,55 +977,46 @@ our $I18N = {
message => q|Matrix Specific Fields|
},
'field name description' => {
lastUpdated => 1135279558,
message => q|The name of the field that you are creating. It is case sensitive and must be unique.|
'attribute name description' => {
lastUpdated => 0,
message => q|The name of the attribute that you are creating. It is case sensitive and must be unique.|
},
'field label description' => {
lastUpdated => 1135279558,
message => q|The name of the field that you are creating. It is case sensitive and must be unique.|
# 'field label description' => {
# lastUpdated => 1135279558,
# message => q|The name of the field that you are creating. It is case sensitive and must be unique.|
# },
'fieldType description' => {
lastUpdated => 0,
message => q|<p>The field type of attribute you are creating. Please select the field type from the options in the drop-down list.</p>|
},
'field type description' => {
lastUpdated => 1167185918,
message => q|<p>The type of field you are creating. Please select the type from the following options in the drop-down list.</p>
<div>
<dl>
<dt>Good Bad</dt>
<dd>Defines availability of a feature, has it, doesn't have it, limited functionality, free add on, etc.</dd>
<dt>Text</dt>
<dd>A single line of text, like a short description or title.</dd>
<dt>TextArea</dt>
<dd>Multiple lines of text.</dd>
<dt>URL</dt>
<dd>A URL.</dd>
<dt>Combo</dt>
<dd>A combination Text box and drop down list.</dd>
</dl></div>|
'attribute description label' => {
lastUpdated => 0,
message => q|Description|
},
'field description' => {
lastUpdated => 1135279558,
message => q|Field Description|
'attribute description description' => {
lastUpdated => 0,
message => q|Please give a general description of the attribute.|
},
'field description description' => {
lastUpdated => 1135279558,
message => q|Please give a general description of the field.|
'attribute defaultValue description' => {
lastUpdated => 0,
message => q|<p>Enter in a default value for the attribute that will be used if the fieldType is
selectBox.</p>|
},
'default value description' => {
translatorsNote => q|Please do not translate the GoodBad field values, as described below|,
lastUpdated => 1135279558,
message => q|<p>Enter in a default value for the field that will be used if the user leaves the field blank.</p>
<p>For the GoodBad field, the possible values are "No", "Yes", "Free Add On", "Costs Extra", "Limited". While the displayed labels are internationalized, these values are not.</p>
<p>For the Combo field, you may only enter in 1 value, but the user will be allowed to select any value entered in by other users. In other words, the drop-down list will contain all values entered in by users who enter unique data into this field.</p>|
'attribute options description' => {
lastUpdated => 0,
message => q|<p>Enter in options (one per line) for the attribute that will be used if the fieldType is
selectBox.</p>|
},
'category description' => {
lastUpdated => 1136503500,
message => q|Select the category which this field falls into.|
lastUpdated => 0,
message => q|Select the category which this attribute falls into.|
},
};

View file

@ -0,0 +1,103 @@
package WebGUI::i18n::English::Asset_MatrixListing;
use strict;
our $I18N = {
'assetName' => {
message => q|Matrix Listing|,
lastUpdated => 0,
},
'edit matrix listing title' => {
message => q|Edit/Add Listing|,
lastUpdated => 0,
},
'template description' => {
message => q|Select a template to be used to display the default view of the Matrix.|,
lastUpdated => 0,
},
'template label' => {
message => q|Matrix Listing Template|,
lastUpdated => 0,
},
'screenshots description' => {
message => q|Upload a picture of the product, or a screen shot if it's a software package.|,
lastUpdated => 0,
},
'screenshots label' => {
message => q|Screenshots/Photos|,
lastUpdated => 0,
},
'description description' => {
message => q|Please give a general description of the product. Specific details can be rated in the form
fields below.|,
lastUpdated => 0,
},
'description label' => {
message => q|Description|,
lastUpdated => 0,
},
'version description' => {
message => q|Enter the version/edition/model number for the product.|,
lastUpdated => 0,
},
'version label' => {
message => q|Version/Model|,
lastUpdated => 0,
},
'maintainer description' => {
message => q|If left blank, this will be the name of the user who created this product listing. The
listing maintainer is allowed to edit this listing, even if they are not members of the group
to add or edit listings.|,
lastUpdated => 0,
},
'maintainer label' => {
message => q|Maintainer|,
lastUpdated => 0,
},
'manufacturerName description' => {
message => q|The name of the company that manufactures the product or provides the service represented in
this listing.|,
lastUpdated => 0,
},
'manufacturerName label' => {
message => q|Manufacturer Name|,
lastUpdated => 0,
},
'manufacturerURL description' => {
message => q|If the manufacturer has a website, enter the complete URL for it here.|,
lastUpdated => 0,
},
'manufacturerURL label' => {
message => q|Manufacturer URL|,
lastUpdated => 0,
},
'productURL description' => {
message => q|If the product has its own website, enter the complete URL for it here.|,
lastUpdated => 0,
},
'productURL label' => {
message => q|Product URL|,
lastUpdated => 0,
},
};
1;

View file

@ -0,0 +1,32 @@
package WebGUI::i18n::English::Form_MatrixCompare;
use strict;
our $I18N = {
'no' => {
message => q|No|,
lastUpdated => 0,
},
'limited' => {
message => q|Limited|,
lastUpdated => 0,
},
'costs extra' => {
message => q|Costs Extra|,
lastUpdated => 0,
},
'free add on' => {
message => q|Free Add On|,
lastUpdated => 0,
},
'yes' => {
message => q|Yes|,
lastUpdated => 0,
},
};
1;

View file

@ -2880,6 +2880,18 @@ or are under your current version tag.</p>
context => q|Field type name|
},
'matrix fieldtype' => {
message => q|Matrix Field Type|,
lastUpdated =>0,
context => q|Field type name|
},
'matrix compare' => {
message => q|Matrix Compare|,
lastUpdated =>0,
context => q|Field type name|
},
'hidden list' => {
message => q|Hidden List|,
lastUpdated =>0,

63
t/Asset/MatrixListing.t Normal file
View file

@ -0,0 +1,63 @@
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use FindBin;
use strict;
use lib "$FindBin::Bin/../lib";
##The goal of this test is to test the creation of a MatrixListing Asset.
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 2; # increment this value for each test you create
use WebGUI::Asset::Wobject::Matrix;
use WebGUI::Asset::MatrixListing;
my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my ($matrix, $matrixListing);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Matrix Listing Test"});
$matrix = $node->addChild({className=>'WebGUI::Asset::Wobject::Matrix'});
$versionTag->commit;
$matrixListing = $matrix->addChild({className=>'WebGUI::Asset::MatrixListing'});
# Wikis create and autocommit a version tag when a child is added. Lets get the name so we can roll it back.
my $secondVersionTag = WebGUI::VersionTag->new($session,$matrixListing->get("tagId"));
# Test for sane object types
isa_ok($matrix, 'WebGUI::Asset::Wobject::Matrix');
isa_ok($matrixListing, 'WebGUI::Asset::MatrixListing');
# Try to add content under a MatrixListing asset
#my $article = $matrixListing->addChild({className=>'WebGUI::Asset::Wobject::Article'});
#is($article, undef, "Can't add an Article wobject as a child to a Matrix Listing.");
# See if the duplicate method works
#my $wikiPageCopy = $wikipage->duplicate();
#isa_ok($wikiPageCopy, 'WebGUI::Asset::WikiPage');
#my $thirdVersionTag = WebGUI::VersionTag->new($session,$wikiPageCopy->get("tagId"));
#TODO: {
# local $TODO = "Tests to make later";
# ok(0, 'Lots and lots to do');
#}
END {
# Clean up after thy self
$versionTag->rollback();
$secondVersionTag->rollback();
#$thirdVersionTag->rollback();
}

98
t/Asset/Wobject/Matrix.t Normal file
View file

@ -0,0 +1,98 @@
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use FindBin;
use strict;
use File::Spec;
use lib "$FindBin::Bin/../../lib";
##The goal of this test is to test the creation of UserList Wobjects.
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 10; # increment this value for each test you create
use Test::Deep;
use WebGUI::Asset::Wobject::Matrix;
my $session = WebGUI::Test->session;
# Do our work in the import node
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Matrix Test"});
my $matrix = $node->addChild({className=>'WebGUI::Asset::Wobject::Matrix'});
# Test for a sane object type
isa_ok($matrix, 'WebGUI::Asset::Wobject::Matrix');
# Test to see if we can set new values
my $newMatrixSettings = {
maxComparisons => 20,
defaultSort => 'assetRank',
compareColorNo => '#aaffaa',
submissionApprovalWorkflowId => 'pbworkflow000000000005',
categories => "category1\ncategory2",
};
$matrix->update($newMatrixSettings);
foreach my $newSetting (keys %{$newMatrixSettings}) {
unless ($newSetting eq 'categories'){
is ($matrix->get($newSetting), $newMatrixSettings->{$newSetting}, "updated $newSetting is ".$newMatrixSettings->{$newSetting});
}
}
cmp_deeply (
$matrix->getCategories,
{
category1=>'category1',
category2=>'category2'
},
'getCategories method returned correct hashref'
);
# add a new attribute
$session->user({userId => 3});
my $attributeProperties = {
name =>'test attribute',
description =>'description of the test attribute',
category =>'category1',
};
my $newAttributeId = $matrix->editAttributeSave($attributeProperties);
my $newAttribute = $matrix->getAttribute($newAttributeId);
my $isValidId = $session->id->valid($newAttributeId);
is($isValidId,1,"editAttributeSave returnes a valid guid");
is($newAttribute->{name},'test attribute',"Adding a new attribute, attribute name was set correctly");
is($newAttribute->{fieldType},'MatrixCompare',"Adding a new attribute, undefined fieldType was set correctly to
default value");
# delete new attribute
$matrix->deleteAttribute($newAttributeId);
my $newAttribute = $matrix->getAttribute($newAttributeId);
is($newAttribute->{attributeId},undef,"The new attribute was successfully deleted.");
# TODO: test deleting of listing data for attribute
END {
# Clean up after thy self
$versionTag->rollback();
}