diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt
index 14630eaa6..73c38aa64 100644
--- a/docs/changelog/6.x.x.txt
+++ b/docs/changelog/6.x.x.txt
@@ -35,6 +35,8 @@
everything should cache in the same way.
- Converted WebGUI to use a new object oriented session system. More details
in migation.txt.
+ - Added a screenshot feature to the matrix.
+ - Added an option to delete Matrix fields.
- Added an API for retrieving email from POP3 servers.
- The rebuildLineage.pl script now finds and fixes orphans, and tries to
locate circular relationships as well.
diff --git a/docs/upgrades/upgrade_6.8.8-6.99.0.pl b/docs/upgrades/upgrade_6.8.8-6.99.0.pl
index 415280b41..603e93bfa 100644
--- a/docs/upgrades/upgrade_6.8.8-6.99.0.pl
+++ b/docs/upgrades/upgrade_6.8.8-6.99.0.pl
@@ -44,9 +44,17 @@ addDatabaseCache();
updateHelpTemplate();
fixImportNodePrivileges();
addAdManager();
+updateMatrix();
finish($session); # this line required
+#-------------------------------------------------
+sub updateMatrix {
+ print "\tAdding new features to the matrix.\n";
+ $session->db->write("alter table Matrix_listing add column storageId varchar(22) binary");
+ $session->db->write("alter table Matrix_listing add column filename varchar(255)");
+}
+
#-------------------------------------------------
sub changeCache {
print "\tChanging page cache system.\n";
diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm
index bb8eefe90..92647b3f5 100644
--- a/lib/WebGUI/Asset/Wobject/Matrix.pm
+++ b/lib/WebGUI/Asset/Wobject/Matrix.pm
@@ -7,6 +7,7 @@ use WebGUI::HTMLForm;
use WebGUI::Cache;
use WebGUI::Mail::Send;
use WebGUI::SQL;
+use WebGUI::Storage::Image;
use WebGUI::User;
use WebGUI::Utility;
use WebGUI::Inbox;
@@ -361,6 +362,15 @@ sub www_copy {
return $i18n->get('no copy');
}
+#-------------------------------------------------------------------
+sub www_deleteField {
+ my $self = shift;
+ my $id = $self->session->form->param("fieldId");
+ $self->session->db->write("delete from Matrix_field where fieldId=?",[$id]);
+ $self->session->db->write("delete from Matrix_listingData where fieldId=?",[$id]);
+ $self->www_listFields();
+}
+
#-------------------------------------------------------------------
sub www_deleteListing {
my $self = shift;
@@ -540,6 +550,15 @@ sub www_editListing {
-label=>$i18n->get('product url'),
-hoverHelp=>$i18n->get('product url description'),
);
+ $f->image(
+ name=>"screenshot",
+ label=>$i18n->get("screenshot"),
+ hoverHelp=>$i18n->get("screenshot help")
+ );
+ if ($listing->{filename} && $listing->{storageId}) {
+ my $storage = WebGUI::Storage::Image->get($self->session, $listing->{storageId});
+ $f->readOnly(value=>'');
+ }
$f->text(
-name=>"manufacturerName",
-value=>$listing->{manufacturerName},
@@ -652,6 +671,18 @@ sub www_editListingSave {
description => $self->session->form->process("description"),
versionNumber=>$self->session->form->process("versionNumber")
);
+ my $storage = undef;
+ if ($listing->{storageId} ne "") {
+ $storage = WebGUI::Storage::Image->get($self->session, $listing->{storageId});
+ } else {
+ $storage = WebGUI::Storage::Image->create($self->session);
+ $data{storageId} = $storage->getId;
+ }
+ my $screenshot = $storage->addFileFromFormPost("screenshot");
+ if (defined $screenshot) {
+ $data{filename} = $screenshot;
+ $storage->generateThumbnail($screenshot);
+ }
my $isNew = 0;
if ($self->session->form->process("listingId") eq "new") {
$data{maintainerId} = $self->session->user->userId if ($self->session->form->process("listingId") eq "new");
@@ -814,7 +845,9 @@ sub www_listFields {
$self->getUrl("func=editField;fieldId=new");
my $sth = $self->session->db->read("select fieldId, label from Matrix_field where assetId=".$self->session->db->quote($self->getId)." order by label");
while (my ($id, $label) = $sth->array) {
- $output .= ''.$label.'
';
+ $output .= $self->session->icon->delete("func=deleteField;fieldId=".$id, $self->get("url"), $i18n->get("delete field confirm"))
+ .$self->session->icon->edit("func=editField;fieldId=".$id)
+ .' '.$label."
\n";
}
$sth->finish;
return $self->processStyle($output);
@@ -1051,6 +1084,11 @@ sub www_viewDetail {
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$listingId);
my $forum = WebGUI::Asset::Wobject::Collaboration->new($self->session, $listing->{forumId});
+ if ($listing->{storageId} && $listing->{filename}) {
+ my $storage = WebGUI::Storage::Image->get($self->session, $listing->{storageId});
+ $var{screenshot} = $storage->getUrl($listing->{filename});
+ $var{thumbnail} = $storage->getThumbnailUrl($listing->{filename});
+ }
$var{"discussion"} = $forum->view;
$var{'isLoggedIn'} = ($self->session->user->userId ne "1");
if ($self->session->form->process("do") eq "sendEmail") {
diff --git a/lib/WebGUI/i18n/English/Asset_Matrix.pm b/lib/WebGUI/i18n/English/Asset_Matrix.pm
index b548b8db7..4c1a8dfd0 100644
--- a/lib/WebGUI/i18n/English/Asset_Matrix.pm
+++ b/lib/WebGUI/i18n/English/Asset_Matrix.pm
@@ -1,6 +1,24 @@
package WebGUI::i18n::English::Asset_Matrix;
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,
+ 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
@@ -125,14 +143,24 @@ our $I18N = {
},
'detail template help body' => {
- lastUpdated => 0,
+ lastUpdated => 1144969331,
message => q|
The following variables are available in the listing detail template.
discussion
The forum attached to this listing.
+ screenshot
+ The URL to the uploaded photo or screenshot.
+
+ thumbnail
+ The URL to the thumbnail of the uploaded photo or screenshot
+
email.form