GalleryFile now sets Album thumbnail if Album doesnt have one
This commit is contained in:
parent
d28c2dc854
commit
d2faf8cd23
3 changed files with 9 additions and 127 deletions
|
|
@ -12,6 +12,8 @@
|
||||||
- add: More vars to GalleryAlbum and GalleryFile
|
- add: More vars to GalleryAlbum and GalleryFile
|
||||||
- fix: thumbnails.js now more easily stylable in anticipation of new Gallery
|
- fix: thumbnails.js now more easily stylable in anticipation of new Gallery
|
||||||
templates
|
templates
|
||||||
|
- add: GalleryFile now sets GalleryAlbum thumbnail if the Album doesn't yet
|
||||||
|
have one and a File is saved.
|
||||||
|
|
||||||
7.5.10
|
7.5.10
|
||||||
- fix: Syntax error in GetCsMail
|
- fix: Syntax error in GetCsMail
|
||||||
|
|
|
||||||
|
|
@ -577,6 +577,13 @@ sub processPropertiesFromFormPost {
|
||||||
|
|
||||||
### Passes all checks
|
### Passes all checks
|
||||||
|
|
||||||
|
# If the album doesn't yet have a thumbnail, make this File the thumbnail
|
||||||
|
if ( !$self->getParent->get('assetIdThumbnail') ) {
|
||||||
|
$self->getParent->update( {
|
||||||
|
assetIdThumbnail => $self->getId,
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
$self->requestAutoCommit;
|
$self->requestAutoCommit;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# Please read the legal notices (docs/legal.txt) and the license
|
|
||||||
# (docs/license.txt) that came with this distribution before using
|
|
||||||
# this software.
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
# http://www.plainblack.com info@plainblack.com
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
# The goal of this test is to test the editSave,
|
|
||||||
# processPropertiesFromFormPost, and applyConstraints methods.
|
|
||||||
|
|
||||||
use FindBin;
|
|
||||||
use strict;
|
|
||||||
use lib "$FindBin::Bin/../../../../lib";
|
|
||||||
|
|
||||||
use Scalar::Util qw( blessed );
|
|
||||||
use WebGUI::Test;
|
|
||||||
use WebGUI::Session;
|
|
||||||
use Test::More;
|
|
||||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Init
|
|
||||||
my $session = WebGUI::Test->session;
|
|
||||||
my $node = WebGUI::Asset->getImportNode($session);
|
|
||||||
|
|
||||||
my @versionTags = ();
|
|
||||||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
|
||||||
$versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"});
|
|
||||||
|
|
||||||
$session->user( { userId => 3 } ); # Admins can do everything
|
|
||||||
|
|
||||||
# Create a user for testing purposes
|
|
||||||
my $user = WebGUI::User->new( $session, "new" );
|
|
||||||
$user->username( 'dufresne' );
|
|
||||||
$user->addToGroups( ['3'] );
|
|
||||||
my $identifier = 'ritahayworth';
|
|
||||||
my $auth = WebGUI::Operation::Auth::getInstance( $session, $user->authMethod, $user->userId );
|
|
||||||
$auth->saveParams( $user->userId, $user->authMethod, {
|
|
||||||
'identifier' => Digest::MD5::md5_base64( $identifier ),
|
|
||||||
});
|
|
||||||
|
|
||||||
my $gallery
|
|
||||||
= $node->addChild({
|
|
||||||
className => "WebGUI::Asset::Wobject::Gallery",
|
|
||||||
groupIdAddFile => 3, # Admins
|
|
||||||
});
|
|
||||||
my $album
|
|
||||||
= $gallery->addChild({
|
|
||||||
className => "WebGUI::Asset::Wobject::GalleryAlbum",
|
|
||||||
},
|
|
||||||
undef,
|
|
||||||
undef,
|
|
||||||
{
|
|
||||||
skipAutoCommitWorkflows => 1,
|
|
||||||
});
|
|
||||||
my $photo
|
|
||||||
= $album->addChild({
|
|
||||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
|
||||||
},
|
|
||||||
undef,
|
|
||||||
undef,
|
|
||||||
{
|
|
||||||
skipAutoCommitWorkflows => 1,
|
|
||||||
});
|
|
||||||
|
|
||||||
$versionTags[-1]->commit;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Tests
|
|
||||||
plan skip_all => "Tests not working yet";
|
|
||||||
#plan tests => 1;
|
|
||||||
|
|
||||||
use_ok("Test::WWW::Mechanize");
|
|
||||||
my $mech;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Test permissions
|
|
||||||
$mech = Test::WWW::Mechanize->new;
|
|
||||||
|
|
||||||
# Edit an existing photo
|
|
||||||
$mech->get( $session->url->getSiteURL . $photo->getUrl("func=edit") );
|
|
||||||
$mech->content_contains("permission denied");
|
|
||||||
|
|
||||||
$mech->get( $session->url->getSiteURL . $photo->getUrl("func=editSave") );
|
|
||||||
$mech->content_contains("permission denied");
|
|
||||||
|
|
||||||
# Save a new photo
|
|
||||||
$mech->get( $session->url->getSiteURL . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
|
||||||
$mech->content_contains("permission denied");
|
|
||||||
|
|
||||||
$mech->get( $session->url->getSiteURL . $album->getUrl("func=editSave;assetId=new;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
|
||||||
$mech->content_contains("permission denied");
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Test processPropertiesFromFormPost errors
|
|
||||||
# TODO: This test should use i18n.
|
|
||||||
# TODO: This error / test should occur in File, not Photo
|
|
||||||
$mech = Test::WWW::Mechanize->new;
|
|
||||||
# Login mech object
|
|
||||||
$mech->get( $session->url->getSiteURL . '?op=auth;method=login;username=dufresne;identifier=ritahayworth' );
|
|
||||||
|
|
||||||
$mech->get_ok( $album->getUrl('func=add;class=WebGUI::Asset::File::GalleryFile::Photo') );
|
|
||||||
$mech->submit_form(
|
|
||||||
with_fields => {
|
|
||||||
title => '',
|
|
||||||
newFile_file => '',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Test editSave success result
|
|
||||||
# TODO: This test should use i18n
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Cleanup
|
|
||||||
END {
|
|
||||||
foreach my $versionTag (@versionTags) {
|
|
||||||
$versionTag->rollback;
|
|
||||||
}
|
|
||||||
$user->delete;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue