added image upload and field delete to matrix
This commit is contained in:
parent
b0356f06a0
commit
759ec7bcf0
4 changed files with 78 additions and 2 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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=>'<img src="'.$storage->getThumbnailUrl($listing->{filename}).'" alt="'.$listing->{filename}.'" />');
|
||||
}
|
||||
$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 .= '<a href="'.$self->getUrl("func=editField;fieldId=".$id).'">'.$label.'</a><br />';
|
||||
$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."<br />\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") {
|
||||
|
|
|
|||
|
|
@ -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|<p>The following variables are available in the listing detail template.</p>
|
||||
|
||||
<p>
|
||||
<b>discussion</b><br />
|
||||
The forum attached to this listing.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>screenshot</b><br />
|
||||
The URL to the uploaded photo or screenshot.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>thumbnail</b><br />
|
||||
The URL to the thumbnail of the uploaded photo or screenshot
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>email.form</b><br />
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue