diff --git a/docs/upgrades/packages-7.6.6/default-matrix-edit-listing-template.wgpkg b/docs/upgrades/packages-7.6.6/default-matrix-edit-listing-template.wgpkg new file mode 100644 index 000000000..69f960986 Binary files /dev/null and b/docs/upgrades/packages-7.6.6/default-matrix-edit-listing-template.wgpkg differ diff --git a/docs/upgrades/packages-7.6.5/matrix-default-compare-template.wgpkg b/docs/upgrades/packages-7.6.6/matrix-default-compare-template.wgpkg similarity index 100% rename from docs/upgrades/packages-7.6.5/matrix-default-compare-template.wgpkg rename to docs/upgrades/packages-7.6.6/matrix-default-compare-template.wgpkg diff --git a/docs/upgrades/packages-7.6.5/matrix-default-view-template.wgpkg b/docs/upgrades/packages-7.6.6/matrix-default-view-template.wgpkg similarity index 100% rename from docs/upgrades/packages-7.6.5/matrix-default-view-template.wgpkg rename to docs/upgrades/packages-7.6.6/matrix-default-view-template.wgpkg diff --git a/docs/upgrades/upgrade_7.6.5-7.6.6.pl b/docs/upgrades/upgrade_7.6.5-7.6.6.pl index 1ca1b4684..4075a8003 100644 --- a/docs/upgrades/upgrade_7.6.5-7.6.6.pl +++ b/docs/upgrades/upgrade_7.6.5-7.6.6.pl @@ -29,6 +29,7 @@ my $quiet; # this line required my $session = start(); # this line required # upgrade functions go here +addMatrixEditListingTemplate( $session ); lengthenThingyDefaultValues($session); finish($session); # this line required @@ -43,6 +44,13 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +# Add editListingTemplate property to Matrix +sub addMatrixEditListingTemplate { + my $session = shift; + print "Add editListingTemplate property to Matrix\t... " unless $quiet; + $session->db->write("alter table Matrix add editListingTemplateId char(22)"); + print "DONE!\n" unless $quiet; +} #---------------------------------------------------------------------------- # Describe what our function does @@ -54,6 +62,7 @@ sub lengthenThingyDefaultValues { print "DONE!\n" unless $quiet; } + # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/MatrixListing.pm b/lib/WebGUI/Asset/MatrixListing.pm index c1bcd579c..82e6d2ef3 100644 --- a/lib/WebGUI/Asset/MatrixListing.pm +++ b/lib/WebGUI/Asset/MatrixListing.pm @@ -226,11 +226,78 @@ sub getEditForm { my $session = $self->session; my $db = $session->db; my $matrixId = $self->getParent->getId; - my $tabform = $self->next::method(); my $i18n = WebGUI::International->new($session, 'Asset_MatrixListing'); + my $func = $session->form->process("func"); + + my $form = WebGUI::HTMLForm->new($session); + + if ($func eq "add" || ( $func eq "editSave" && $session->form->process("assetId") eq "new")) { + $form->hidden( + -name =>'assetId', + -value =>'new', + ); + $form->hidden( + -name =>'class', + -value =>'WebGUI::Asset::MatrixListing', + ); + } + $form->hidden( + -name =>'func', + -value =>'editSave', + ); + $form->text( + -name =>'title', + -defaultValue =>'Untitled', + -label =>$i18n->get("product name label"), + -hoverHelp =>$i18n->get('product name description'), + -value =>$self->getValue('title'), + ); + $form->image( + -name =>'screenshots', + -defaultValue =>undef, + -maxAttachments =>20, + -label =>$i18n->get("screenshots label"), + -hoverHelp =>$i18n->get("screenshots description"),, + -value =>$self->getValue('screenshots'), + ); + $form->HTMLArea( + -name =>'description', + -defaultValue =>undef, + -label =>$i18n->get("description label"), + -hoverHelp =>$i18n->get("description description"), + -value =>$self->getValue('description'), + ); + $form->text( + -name =>'version', + -defaultValue =>undef, + -label =>$i18n->get("version label"), + -hoverHelp =>$i18n->get("version description"), + -value =>$self->getValue('version'), + ); + $form->text( + -name =>'manufacturerName', + -defaultValue =>undef, + -label =>$i18n->get("manufacturerName label"), + -hoverHelp =>$i18n->get("manufacturerName description"), + -value =>$self->getValue('manufacturerName'), + ); + $form->url( + -name =>'manufacturerURL', + -defaultValue =>undef, + -label =>$i18n->get("manufacturerURL label"), + -hoverHelp =>$i18n->get("manufacturerURL description"), + -value =>$self->getValue('manufacturerURL'), + ); + $form->url( + -name =>'productURL', + -defaultValue =>undef, + -label =>$i18n->get("productURL label"), + -hoverHelp =>$i18n->get("productURL description"), + -value =>$self->getValue('productURL'), + ); foreach my $category (keys %{$self->getParent->getCategories}) { - $tabform->getTab('properties')->raw(''.$category.''); + $form->raw(''.$category.''); my $attributes; if ($session->form->process('func') eq 'add'){ $attributes = $db->read("select * from Matrix_attribute where category = ? and assetId = ?", @@ -246,10 +313,13 @@ sub getEditForm { $attribute->{label} = $attribute->{name}; $attribute->{subtext} = $attribute->{description}; $attribute->{name} = 'attribute_'.$attribute->{attributeId}; - $tabform->getTab("properties")->dynamicField(%{$attribute}); + $form->dynamicField(%{$attribute}); } } - return $tabform; + + $form->submit(); + + return $form; } #------------------------------------------------------------------- @@ -777,7 +847,12 @@ sub www_edit { 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')); + + my $var = $self->get; + my $matrix = $self->getParent; + $var->{form} = $self->getEditForm->print; + + return $matrix->processStyle($self->processTemplate($var,$matrix->get("editListingTemplateId"))); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index 1b41ff35f..989e0a2c5 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -86,6 +86,14 @@ sub definition { hoverHelp =>$i18n->get('compare template description'), label =>$i18n->get('compare template label'), }, + editListingTemplateId=>{ + defaultValue =>"matrixtmpl000000000004", + fieldType =>"template", + tab =>"display", + namespace =>"Matrix/EditListing", + hoverHelp =>$i18n->get('edit listing template description'), + label =>$i18n->get('edit listing template label'), + }, defaultSort=>{ fieldType =>"selectBox", tab =>"display", diff --git a/lib/WebGUI/i18n/English/Asset_Matrix.pm b/lib/WebGUI/i18n/English/Asset_Matrix.pm index 5267f0c33..d21fc620e 100644 --- a/lib/WebGUI/i18n/English/Asset_Matrix.pm +++ b/lib/WebGUI/i18n/English/Asset_Matrix.pm @@ -619,6 +619,11 @@ listing,|, message => q|Select a template to be used to show the listing comparison data.|, lastUpdated => 0, }, + + 'edit listing template description' => { + message => q|Select a template to be used to show the listing edit screen.|, + lastUpdated => 0, + }, 'categories label' => { message => q|Categories|, @@ -745,6 +750,11 @@ listing,|, lastUpdated => 0, }, + 'edit listing template label' => { + message => q|Edit Listing Template|, + lastUpdated => 0, + }, + 'product name' => { message => q|Product Name|, lastUpdated => 1133758944, diff --git a/lib/WebGUI/i18n/English/Asset_MatrixListing.pm b/lib/WebGUI/i18n/English/Asset_MatrixListing.pm index 51af42326..25bd3ca14 100644 --- a/lib/WebGUI/i18n/English/Asset_MatrixListing.pm +++ b/lib/WebGUI/i18n/English/Asset_MatrixListing.pm @@ -113,6 +113,17 @@ this listing.|, lastUpdated => 0, }, + 'product name label' => { + message => q|Product Name|, + lastUpdated => 0, + }, + + 'product name description' => { + 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.|, + lastUpdated => 0, + }, + 'productURL description' => { message => q|If the product has its own website, enter the complete URL for it here.|, lastUpdated => 0,