Merge in HEAD, up to 9866.
This commit is contained in:
parent
c7a66861a6
commit
2bd7a60a01
107 changed files with 6258 additions and 2436 deletions
|
|
@ -391,12 +391,13 @@ sub _cacheFieldConfig {
|
|||
my $fieldData;
|
||||
if ($jsonData && eval { $jsonData = JSON::from_json($jsonData) ; 1 }) {
|
||||
# jsonData is an array in the order the fields should be
|
||||
$self->{_fieldConfig} = {
|
||||
map { $_->{name}, $_ } @{ $jsonData }
|
||||
};
|
||||
$self->{_fieldOrder} = [
|
||||
map { $_->{name} } @{ $jsonData }
|
||||
];
|
||||
$self->{_fieldConfig} = {};
|
||||
$self->{_fieldOrder} = [];
|
||||
FIELD: foreach my $field (@{ $jsonData } ) {
|
||||
next FIELD unless ref $field eq 'HASH';
|
||||
$self->{_fieldConfig}->{$field->{name}} = $field;
|
||||
push @{ $self->{_fieldOrder} }, $field->{name};
|
||||
}
|
||||
}
|
||||
else {
|
||||
$self->{_fieldConfig} = {};
|
||||
|
|
|
|||
|
|
@ -30,10 +30,46 @@ Returns true if able to add MatrixListings.
|
|||
|
||||
sub canAddMatrixListing {
|
||||
my $self = shift;
|
||||
my $user = $self->session->user;
|
||||
|
||||
return 0 if $self->session->user->isVisitor;
|
||||
# Users in the groupToAdd group can add listings
|
||||
if ( $user->isInGroup( $self->get("groupToAdd") ) ) {
|
||||
return 1;
|
||||
}
|
||||
# Users who can edit matrix can add listings
|
||||
else {
|
||||
return $self->canEdit;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canEdit ( [userId] )
|
||||
|
||||
Returns true if the user can edit this Matrix.
|
||||
|
||||
Also checks if a user is adding a Matrix Listing and allows them to if they are
|
||||
part of the C<groupToAdd> group.
|
||||
|
||||
=cut
|
||||
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
|
||||
my $form = $self->session->form;
|
||||
if ( $form->get('func') eq "editSave" && $form->get('assetId') eq "new" && $form->get( 'class' )->isa(
|
||||
'WebGUI::Asset::MatrixListing' ) ) {
|
||||
return $self->canAddMatrixListing();
|
||||
}
|
||||
else {
|
||||
if ($userId eq $self->get("ownerUserId")) {
|
||||
return 1;
|
||||
}
|
||||
my $user = WebGUI::User->new($self->session, $userId);
|
||||
return $user->isInGroup($self->get("groupIdEdit"));
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -94,6 +130,22 @@ sub definition {
|
|||
hoverHelp =>$i18n->get('edit listing template description'),
|
||||
label =>$i18n->get('edit listing template label'),
|
||||
},
|
||||
screenshotsTemplateId=>{
|
||||
defaultValue =>"matrixtmpl000000000006",
|
||||
fieldType =>"template",
|
||||
tab =>"display",
|
||||
namespace =>"Matrix/Screenshots",
|
||||
hoverHelp =>$i18n->get('screenshots template description'),
|
||||
label =>$i18n->get('screenshots template label'),
|
||||
},
|
||||
screenshotsConfigTemplateId=>{
|
||||
defaultValue =>"matrixtmpl000000000007",
|
||||
fieldType =>"template",
|
||||
tab =>"display",
|
||||
namespace =>"Matrix/ScreenshotsConfig",
|
||||
hoverHelp =>$i18n->get('screenshots config template description'),
|
||||
label =>$i18n->get('screenshots config template label'),
|
||||
},
|
||||
defaultSort=>{
|
||||
fieldType =>"selectBox",
|
||||
tab =>"display",
|
||||
|
|
@ -164,6 +216,13 @@ sub definition {
|
|||
hoverHelp =>$i18n->get('max comparisons privileged description'),
|
||||
label =>$i18n->get('max comparisons privileged label'),
|
||||
},
|
||||
groupToAdd=>{
|
||||
fieldType =>"group",
|
||||
tab =>"security",
|
||||
defaultValue =>2,
|
||||
hoverHelp =>$i18n->get('group to add description'),
|
||||
label =>$i18n->get('group to add label'),
|
||||
},
|
||||
submissionApprovalWorkflowId=>{
|
||||
fieldType =>"workflow",
|
||||
tab =>"security",
|
||||
|
|
@ -543,7 +602,8 @@ sub view {
|
|||
}) };
|
||||
foreach my $pendingListing (@pendingListings){
|
||||
push (@{ $var->{pending_loop} }, {
|
||||
url => $pendingListing->getUrl,
|
||||
url => $pendingListing->getUrl
|
||||
."?func=view;revision=".$pendingListing->get('revisionDate'),
|
||||
name => $pendingListing->get('title'),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,7 +210,11 @@ sub importProducts {
|
|||
}
|
||||
|
||||
if ($productRow{title} ne $product->getTitle) {
|
||||
$product->update({ title => $product->fixTitle($productRow{title}) });
|
||||
my $newTitle = $product->fixTitle($productRow{title});
|
||||
$product->update({
|
||||
title => $newTitle,
|
||||
menuTitle => $newTitle,
|
||||
});
|
||||
}
|
||||
|
||||
my $collaterals = $product->getAllCollateral('variantsJSON');
|
||||
|
|
@ -230,10 +234,12 @@ sub importProducts {
|
|||
##Insert a new product;
|
||||
$session->log->warn("Making a new product: $productRow{sku}\n");
|
||||
my $newProduct = $node->addChild({className => 'WebGUI::Asset::Sku::Product'});
|
||||
my $newTitle = $newProduct->fixTitle($productRow{title});
|
||||
$newProduct->update({
|
||||
title => $newProduct->fixTitle($productRow{title}),
|
||||
url => $newProduct->fixUrl($productRow{title}),
|
||||
sku => $productRow{mastersku},
|
||||
title => $newTitle,
|
||||
menuTitle => $newTitle,
|
||||
url => $newProduct->fixUrl($productRow{title}),
|
||||
sku => $productRow{mastersku},
|
||||
});
|
||||
$newProduct->setCollateral('variantsJSON', 'variantId', 'new', \%productCollateral);
|
||||
$newProduct->commit;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue