Form/File will automatically delete empty storage locations, but assets
expect them to stick around. Add a flag to Form/File.pm to prevent it from deleting them. Make sensitive assets use that flag.
This commit is contained in:
parent
69a07bb672
commit
bd924e8f88
4 changed files with 23 additions and 7 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
- fixed #10664: ThiingyRecord disappeared... sort of
|
- fixed #10664: ThiingyRecord disappeared... sort of
|
||||||
- fixed #10687: i18n Asset_Product::buy_form_options
|
- fixed #10687: i18n Asset_Product::buy_form_options
|
||||||
- fixed #10651: Dashboard Content positions
|
- fixed #10651: Dashboard Content positions
|
||||||
|
- fixed #10695: Adding a new article creates a new version tag
|
||||||
|
|
||||||
7.7.15
|
7.7.15
|
||||||
- fixed #10629: WebGUI::ProfileField create new field bug
|
- fixed #10629: WebGUI::ProfileField create new field bug
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,8 @@ sub definition {
|
||||||
defaultValue=>undef,
|
defaultValue=>undef,
|
||||||
maxAttachments=>1,
|
maxAttachments=>1,
|
||||||
label=>$i18n->get(7),
|
label=>$i18n->get(7),
|
||||||
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=image1;filename=")
|
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=image1;filename="),
|
||||||
|
persist => 1,
|
||||||
},
|
},
|
||||||
image2=>{
|
image2=>{
|
||||||
tab => "properties",
|
tab => "properties",
|
||||||
|
|
@ -102,7 +103,8 @@ sub definition {
|
||||||
maxAttachments=>1,
|
maxAttachments=>1,
|
||||||
label=>$i18n->get(8),
|
label=>$i18n->get(8),
|
||||||
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=image2;filename="),
|
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=image2;filename="),
|
||||||
defaultValue=>undef
|
defaultValue=>undef,
|
||||||
|
persist => 1,
|
||||||
},
|
},
|
||||||
image3=>{
|
image3=>{
|
||||||
tab => "properties",
|
tab => "properties",
|
||||||
|
|
@ -110,7 +112,8 @@ sub definition {
|
||||||
maxAttachments=>1,
|
maxAttachments=>1,
|
||||||
label=>$i18n->get(9),
|
label=>$i18n->get(9),
|
||||||
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=image3;filename="),
|
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=image3;filename="),
|
||||||
defaultValue=>undef
|
defaultValue=>undef,
|
||||||
|
persist => 1,
|
||||||
},
|
},
|
||||||
brochure=>{
|
brochure=>{
|
||||||
tab => "properties",
|
tab => "properties",
|
||||||
|
|
@ -118,7 +121,8 @@ sub definition {
|
||||||
maxAttachments=>1,
|
maxAttachments=>1,
|
||||||
label=>$i18n->get(13),
|
label=>$i18n->get(13),
|
||||||
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=brochure;filename="),
|
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=brochure;filename="),
|
||||||
defaultValue=>undef
|
defaultValue=>undef,
|
||||||
|
persist => 1,
|
||||||
},
|
},
|
||||||
manual=>{
|
manual=>{
|
||||||
tab => "properties",
|
tab => "properties",
|
||||||
|
|
@ -126,7 +130,8 @@ sub definition {
|
||||||
maxAttachments=>1,
|
maxAttachments=>1,
|
||||||
label=>$i18n->get(14),
|
label=>$i18n->get(14),
|
||||||
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=manual;filename="),
|
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=manual;filename="),
|
||||||
defaultValue=>undef
|
defaultValue=>undef,
|
||||||
|
persist => 1,
|
||||||
},
|
},
|
||||||
isShippingRequired => {
|
isShippingRequired => {
|
||||||
tab => "shop",
|
tab => "shop",
|
||||||
|
|
@ -141,7 +146,8 @@ sub definition {
|
||||||
maxAttachments=>1,
|
maxAttachments=>1,
|
||||||
label=>$i18n->get(15),
|
label=>$i18n->get(15),
|
||||||
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=warranty;filename="),
|
deleteFileUrl=>$session->url->page("func=deleteFileConfirm;file=warranty;filename="),
|
||||||
defaultValue=>undef
|
defaultValue=>undef,
|
||||||
|
persist => 1,
|
||||||
},
|
},
|
||||||
variantsJSON => {
|
variantsJSON => {
|
||||||
##Collateral data is stored as JSON in here
|
##Collateral data is stored as JSON in here
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,7 @@ sub definition {
|
||||||
fieldType=>"image",
|
fieldType=>"image",
|
||||||
deleteFileUrl=>$session->url->page("func=deleteFile;filename="),
|
deleteFileUrl=>$session->url->page("func=deleteFile;filename="),
|
||||||
maxAttachments=>2,
|
maxAttachments=>2,
|
||||||
|
persist => 1,
|
||||||
defaultValue=>undef,
|
defaultValue=>undef,
|
||||||
label=>$i18n->get("attachments"),
|
label=>$i18n->get("attachments"),
|
||||||
hoverHelp=>$i18n->get("attachments help")
|
hoverHelp=>$i18n->get("attachments help")
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,11 @@ A url that will get a filename appended to it and then links to delete the files
|
||||||
|
|
||||||
Though not all browsers support it, this will attempt to set the size (or width) of the browse for file field.
|
Though not all browsers support it, this will attempt to set the size (or width) of the browse for file field.
|
||||||
|
|
||||||
|
=head4 persist
|
||||||
|
|
||||||
|
The default behavior of File is to delete empty storage location. However, this causes problems with Assets, which
|
||||||
|
expect them to stick around. Setting persist => 1 will prevent the deletion.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub definition {
|
sub definition {
|
||||||
|
|
@ -83,6 +88,9 @@ sub definition {
|
||||||
},
|
},
|
||||||
size=>{
|
size=>{
|
||||||
defaultValue=>40
|
defaultValue=>40
|
||||||
|
},
|
||||||
|
persist=>{
|
||||||
|
defaultValue=>0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return $class->SUPER::definition($session, $definition);
|
return $class->SUPER::definition($session, $definition);
|
||||||
|
|
@ -195,7 +203,7 @@ sub getValue {
|
||||||
}
|
}
|
||||||
$storage->addFileFromFormPost($self->get("name")."_file",1000);
|
$storage->addFileFromFormPost($self->get("name")."_file",1000);
|
||||||
my @files = @{ $storage->getFiles };
|
my @files = @{ $storage->getFiles };
|
||||||
if (scalar(@files) < 1) {
|
if (scalar(@files) < 1 && !$self->get('persist')) {
|
||||||
$storage->delete;
|
$storage->delete;
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue