add: example images to templates
This commit is contained in:
parent
fc95fa8f86
commit
23d80cfa5c
6 changed files with 41 additions and 0 deletions
BIN
docs/upgrades/packages-7.9.4/style_01.wgpkg
Normal file
BIN
docs/upgrades/packages-7.9.4/style_01.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.9.4/style_02.wgpkg
Normal file
BIN
docs/upgrades/packages-7.9.4/style_02.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.9.4/style_03.wgpkg
Normal file
BIN
docs/upgrades/packages-7.9.4/style_03.wgpkg
Normal file
Binary file not shown.
|
|
@ -39,6 +39,7 @@ dropVisitorAddressBooks($session);
|
|||
alterCartTable($session);
|
||||
alterAddressBookTable($session);
|
||||
addWizardHandler( $session );
|
||||
addTemplateExampleImage( $session );
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -52,6 +53,19 @@ finish($session); # this line required
|
|||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add example images to templates
|
||||
sub addTemplateExampleImage {
|
||||
my $session = shift;
|
||||
print "\tAdding example image field to template... " unless $quiet;
|
||||
|
||||
$session->db->write( q{
|
||||
ALTER TABLE template ADD storageIdExample CHAR(22)
|
||||
} );
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
sub addWizardHandler {
|
||||
|
|
|
|||
|
|
@ -109,6 +109,9 @@ sub definition {
|
|||
fieldType => 'yesNo',
|
||||
defaultValue => 0,
|
||||
},
|
||||
storageIdExample => {
|
||||
fieldType => 'image',
|
||||
},
|
||||
},
|
||||
};
|
||||
return $class->SUPER::definition($session,$definition);
|
||||
|
|
@ -190,6 +193,10 @@ sub duplicate {
|
|||
my $newTemplate = $self->SUPER::duplicate;
|
||||
$newTemplate->update({isDefault => 0});
|
||||
$newTemplate->addAttachments($self->getAttachments);
|
||||
if ( my $storageId = $self->get('storageIdExample') ) {
|
||||
my $newStorage = WebGUI::Storage->get( $self->session, $storageId )->copy;
|
||||
$newTemplate->update({ storageIdExample => $newStorage->getId });
|
||||
}
|
||||
return $newTemplate;
|
||||
}
|
||||
|
||||
|
|
@ -205,6 +212,9 @@ sub exportAssetData {
|
|||
my ( $self ) = @_;
|
||||
my $data = $self->SUPER::exportAssetData;
|
||||
$data->{template_attachments} = $self->getAttachments;
|
||||
if ( $self->get('storageIdExample') ) {
|
||||
push @{$data->{storage}}, $self->get('storageIdExample');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
@ -387,6 +397,13 @@ sub getEditForm {
|
|||
$label = $i18n->get('attachment add field label');
|
||||
$properties->raw("<tr><td>$label</td><td>$table</td></tr>");
|
||||
|
||||
$properties->image(
|
||||
name => 'storageIdExample',
|
||||
value => $self->getValue('storageIdExample'),
|
||||
label => $i18n->get('field storageIdExample'),
|
||||
hoverHelp => $i18n->get('field storageIdExample description'),
|
||||
);
|
||||
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -390,6 +390,16 @@ Any scratch variables will be available in the template with this syntax:<br/>
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'field storageIdExample' => {
|
||||
message => 'Example Image',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'field storageIdExample description' => {
|
||||
message => 'An example image to show what the template looks like before the user selects it',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue