Added WebGUI::Asset::File::GalleryFile
Changed Photo to subclass WebGUI::Asset::File::GalleryFile
This commit is contained in:
parent
9695b704c5
commit
3842ebf6fa
23 changed files with 360 additions and 115 deletions
|
|
@ -5,6 +5,9 @@
|
|||
- Added ability to edit comments. Entirely changed how comments work in prep
|
||||
for turning it into a mixin.
|
||||
- fixed: Child assets not indicated by plus sign in uncommited tags
|
||||
- Added WebGUI::Asset::File::GalleryFile as a subclass for all files to be
|
||||
used inside the Gallery.
|
||||
- Changed WebGUI::Asset::File::Image::Photo to subclass GalleryFile
|
||||
|
||||
7.5.4
|
||||
- fixed: unable to remove calendar feeds in IE6
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -25,6 +25,7 @@ my $session = start(); # this line required
|
|||
# upgrade functions go here
|
||||
addGalleryEditCommentTemplate( $session );
|
||||
addGalleryRichEditAlbum( $session );
|
||||
migrateToGalleryFile( $session );
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -58,6 +59,29 @@ sub addGalleryRichEditAlbum {
|
|||
$session->db->write( q{
|
||||
ALTER TABLE Gallery ADD COLUMN richEditIdAlbum VARCHAR(22) BINARY
|
||||
} );
|
||||
$session->db->write( q{
|
||||
ALTER TABLE Gallery ADD COLUMN richEditIdFile VARCHAR(22) BINARY
|
||||
} );
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Move File::Image::Photos to File::GalleryFile::Photos
|
||||
sub migrateToGalleryFile {
|
||||
my $session = shift;
|
||||
print "\tMigrating Image::Photos to GalleryFile::Photos (this may take time)..." unless $quiet;
|
||||
|
||||
# Change WebGUI::Asset::File::Image::Photo to WebGUI::Asset::File::GalleryFile::Photo
|
||||
$session->db->write( q{
|
||||
UPDATE asset SET className='WebGUI::Asset::File::GalleryFile::Photo' WHERE
|
||||
className='WebGUI::Asset::File::Image::Photo'
|
||||
});
|
||||
|
||||
# Delete Photos from ImageAsset table
|
||||
$session->db->write(
|
||||
"DELETE FROM ImageAsset WHERE assetId IN ( SELECT assetId FROM Photo )"
|
||||
);
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
|
|
|||
142
lib/WebGUI/Asset/File/GalleryFile.pm
Normal file
142
lib/WebGUI/Asset/File/GalleryFile.pm
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
package WebGUI::Asset::File::GalleryFile;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Asset::File';
|
||||
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
WebGUI::Asset::File::GalleryFile - Superclass to create files for the Gallery
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class
|
||||
|
||||
=cut
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getThumbnailUrl ( )
|
||||
|
||||
Gets the URL to the thumbnail for this GalleryFile. This should probably be
|
||||
overridded by your child class.
|
||||
|
||||
=cut
|
||||
|
||||
sub getThumbnailUrl {
|
||||
my $self = shift;
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getTemplateVars ( )
|
||||
|
||||
Gets the template vars for this GalleryFile. You should probably extend this
|
||||
method.
|
||||
|
||||
=cut
|
||||
|
||||
sub getTemplateVars {
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
||||
$var->{ fileUrl } = $self->getFileUrl;
|
||||
$var->{ thumbnailUrl } = $self->getThumbnailUrl;
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 processStyle ( html )
|
||||
|
||||
Returns the HTML from the Gallery's style.
|
||||
|
||||
=cut
|
||||
|
||||
sub processStyle {
|
||||
my $self = shift;
|
||||
return $self->getGallery->processStyle( @_ );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_demote
|
||||
|
||||
Override the default demote page to send the user back to the GalleryAlbum
|
||||
edit screen.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_demote {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
$self->demote;
|
||||
|
||||
return $self->session->asset( $self->getParent )->www_edit;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_promote
|
||||
|
||||
Override the default promote page to send the user back to the GalleryAlbum
|
||||
edit screen.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_promote {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
$self->promote;
|
||||
|
||||
return $self->session->asset( $self->getParent )->www_edit;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_view ( )
|
||||
|
||||
Show the default view, with content chunking.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_view {
|
||||
my $self = shift;
|
||||
$self->session->http->setLastModified($self->getContentLastModified);
|
||||
$self->session->http->sendHeader;
|
||||
$self->prepareView;
|
||||
my $style = $self->processStyle("~~~");
|
||||
my ($head, $foot) = split("~~~",$style);
|
||||
$self->session->output->print($head, 1);
|
||||
$self->session->output->print($self->view);
|
||||
$self->session->output->print($foot, 1);
|
||||
return "chunked";
|
||||
}
|
||||
|
||||
1; # Who knew the truth would be so obvious?
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::Asset::File::Image::Photo;
|
||||
package WebGUI::Asset::File::GalleryFile::Photo;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ package WebGUI::Asset::File::Image::Photo;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Asset::File::Image';
|
||||
use base 'WebGUI::Asset::File::GalleryFile';
|
||||
|
||||
use Carp qw( carp croak );
|
||||
use Image::ExifTool qw( :Public );
|
||||
|
|
@ -26,18 +26,19 @@ use Tie::IxHash;
|
|||
use WebGUI::DateTime;
|
||||
use WebGUI::Friends;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Storage::Image;
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
WebGUI::Asset::File::Image::Photo
|
||||
WebGUI::Asset::File::GalleryFile::Photo
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use WebGUI::Asset::File::Image::Photo
|
||||
use WebGUI::Asset::File::GalleryFile::Photo
|
||||
|
||||
=head1 DIAGNOSTICS
|
||||
|
||||
|
|
@ -101,7 +102,7 @@ sub definition {
|
|||
autoGenerateForms => 0,
|
||||
icon => 'photo.gif',
|
||||
tableName => 'Photo',
|
||||
className => 'WebGUI::Asset::File::Image::Photo',
|
||||
className => 'WebGUI::Asset::File::GalleryFile::Photo',
|
||||
i18n => 'Asset_Photo',
|
||||
properties => \%properties,
|
||||
};
|
||||
|
|
@ -196,13 +197,18 @@ sub applyConstraints {
|
|||
my $gallery = $self->getGallery;
|
||||
|
||||
# Update the asset's size and make a thumbnail
|
||||
$self->SUPER::applyConstraints({
|
||||
maxImageSize => $self->getGallery->get("imageViewSize"),
|
||||
thumbnailSize => $self->getGallery->get("imageThumbnailSize"),
|
||||
});
|
||||
|
||||
$self->makeResolutions();
|
||||
$self->updateExifDataFromFile();
|
||||
my $maxImageSize = $self->getGallery->get("imageViewSize")
|
||||
|| $self->session->setting->get("maxImageSize");
|
||||
my $thumbnailSize = $self->getGallery->get("imageThumbnailSize")
|
||||
|| $self->session->setting->get("thumbnailSize");
|
||||
my $parameters = $self->get("parameters");
|
||||
my $storage = $self->getStorageLocation;
|
||||
my $file = $self->get("filename");
|
||||
$storage->adjustMaxImageSize($file);
|
||||
$self->generateThumbnail;
|
||||
$self->setSize;
|
||||
$self->makeResolutions;
|
||||
$self->updateExifDataFromFile;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -311,6 +317,23 @@ sub deleteComment {
|
|||
);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 generateThumbnail ( )
|
||||
|
||||
Generates a thumbnail for this image.
|
||||
|
||||
=cut
|
||||
|
||||
sub generateThumbnail {
|
||||
my $self = shift;
|
||||
$self->getStorageLocation->generateThumbnail(
|
||||
$self->get("filename"),
|
||||
$self->getGallery->get("imageThumbnailSize"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getAutoCommitWorkflowId ( )
|
||||
|
|
@ -453,6 +476,19 @@ sub getResolutions {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getStorageClass ( )
|
||||
|
||||
Get the WebGUI::Storage subclass name for this file. This file uses the
|
||||
Image class.
|
||||
|
||||
=cut
|
||||
|
||||
sub getStorageClass {
|
||||
return 'WebGUI::Storage::Image';
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getTemplateVars ( )
|
||||
|
||||
Get a hash reference of template variables shared by all views of this asset.
|
||||
|
|
@ -462,7 +498,7 @@ Get a hash reference of template variables shared by all views of this asset.
|
|||
sub getTemplateVars {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $var = $self->get;
|
||||
my $var = $self->SUPER::getTemplateVars;
|
||||
my $owner = WebGUI::User->new( $session, $self->get("ownerUserId") );
|
||||
|
||||
# Fix 'undef' vars since HTML::Template does inheritence on them
|
||||
|
|
@ -487,9 +523,6 @@ sub getTemplateVars {
|
|||
= $self->getGallery->getUrl('func=listFilesForUser;userId=' . $self->get("ownerUserId"));
|
||||
$var->{ url_promote } = $self->getUrl('func=promote');
|
||||
|
||||
$var->{ fileUrl } = $self->getFileUrl;
|
||||
$var->{ thumbnailUrl } = $self->getThumbnailUrl;
|
||||
|
||||
### Download resolutions
|
||||
for my $resolution ( $self->getResolutions ) {
|
||||
push @{ $var->{ resolutions_loop } }, {
|
||||
|
|
@ -512,6 +545,21 @@ sub getTemplateVars {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getThumbnailUrl ( )
|
||||
|
||||
Get the URL to the thumbnail for this Photo.
|
||||
|
||||
=cut
|
||||
|
||||
sub getThumbnailUrl {
|
||||
my $self = shift;
|
||||
return $self->getStorageLocation->getThumbnailUrl(
|
||||
$self->get("filename")
|
||||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 i18n ( [ session ] )
|
||||
|
||||
Get a WebGUI::International object for this class.
|
||||
|
|
@ -704,19 +752,6 @@ sub processPropertiesFromFormPost {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 processStyle ( html )
|
||||
|
||||
Returns the HTML from the Gallery's style.
|
||||
|
||||
=cut
|
||||
|
||||
sub processStyle {
|
||||
my $self = shift;
|
||||
return $self->getGallery->processStyle( @_ );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 purge ( )
|
||||
|
||||
Purge the asset. Remove all comments on the photo.
|
||||
|
|
@ -771,6 +806,20 @@ sub setComment {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 setFile ( filename )
|
||||
|
||||
Extend the superclass setFile to automatically generate thumbnails.
|
||||
|
||||
=cut
|
||||
|
||||
sub setFile {
|
||||
my $self = shift;
|
||||
$self->SUPER::setFile(@_);
|
||||
$self->generateThumbnail;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 updateExifDataFromFile ( )
|
||||
|
||||
Gets the EXIF data from the uploaded image and store it in the database.
|
||||
|
|
@ -917,25 +966,6 @@ sub www_deleteConfirm {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_demote
|
||||
|
||||
Override the default demote page to send the user back to the GalleryAlbum
|
||||
edit screen.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_demote {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
$self->demote;
|
||||
|
||||
return $self->session->asset( $self->getParent )->www_edit;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_download
|
||||
|
||||
Download the Photo with the specified resolution. If no resolution specified,
|
||||
|
|
@ -1211,25 +1241,6 @@ sub www_makeShortcutSave {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_promote
|
||||
|
||||
Override the default promote page to send the user back to the GalleryAlbum
|
||||
edit screen.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_promote {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
$self->promote;
|
||||
|
||||
return $self->session->asset( $self->getParent )->www_edit;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_showConfirmation ( )
|
||||
|
||||
Shows the confirmation message after adding / editing a gallery album.
|
||||
|
|
@ -1266,15 +1277,7 @@ sub www_view {
|
|||
# Add to views
|
||||
$self->update({ views => $self->get('views') + 1 });
|
||||
|
||||
$self->session->http->setLastModified($self->getContentLastModified);
|
||||
$self->session->http->sendHeader;
|
||||
$self->prepareView;
|
||||
my $style = $self->processStyle("~~~");
|
||||
my ($head, $foot) = split("~~~",$style);
|
||||
$self->session->output->print($head, 1);
|
||||
$self->session->output->print($self->view);
|
||||
$self->session->output->print($foot, 1);
|
||||
return "chunked";
|
||||
return $self->SUPER::www_view;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -125,6 +125,13 @@ sub definition {
|
|||
label => $i18n->get("richEditIdAlbum label"),
|
||||
hoverHelp => $i18n->get("richEditIdAlbum description"),
|
||||
},
|
||||
richEditIdFile => {
|
||||
tab => "properties",
|
||||
fieldType => "selectRichEditor",
|
||||
defaultValue => "PBrichedit000000000002", # Forum Rich editor
|
||||
label => $i18n->get("richEditIdFile label"),
|
||||
hoverHelp => $i18n->get("richEditIdFile description"),
|
||||
},
|
||||
richEditIdComment => {
|
||||
tab => "properties",
|
||||
fieldType => "selectRichEditor",
|
||||
|
|
@ -323,6 +330,34 @@ sub definition {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 addChild ( properties, [...] )
|
||||
|
||||
Add a child to this asset. See C<WebGUI::AssetLineage> for more info.
|
||||
|
||||
Overridden to ensure that only GalleryAlbums are added to Galleries.
|
||||
|
||||
=cut
|
||||
|
||||
sub addChild {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
my $albumClass = "WebGUI::Asset::Wobject::GalleryAlbum";
|
||||
|
||||
# Load the class
|
||||
WebGUI::Pluggable::load( $properties->{className} );
|
||||
|
||||
if ( !$properties->{className}->isa( $albumClass ) ) {
|
||||
$self->session->errorHandler->security(
|
||||
"add a ".$properties->{className}." to a ".$self->get("className")
|
||||
);
|
||||
return undef;
|
||||
}
|
||||
|
||||
return $self->SUPER::addChild( $properties, @_ );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 appendTemplateVarsSearchForm ( var )
|
||||
|
||||
Appends the template vars for the search form to the hash reference C<var>.
|
||||
|
|
@ -372,9 +407,9 @@ sub appendTemplateVarsSearchForm {
|
|||
|
||||
# Search classes
|
||||
tie my %searchClassOptions, 'Tie::IxHash', (
|
||||
'WebGUI::Asset::File::Image::Photo' => $i18n->get("search class photo"),
|
||||
'WebGUI::Asset::Wobject::GalleryAlbum' => $i18n->get("search class galleryalbum"),
|
||||
'' => $i18n->get("search class any"),
|
||||
'WebGUI::Asset::File::GalleryFile::Photo' => $i18n->get("search class photo"),
|
||||
'WebGUI::Asset::Wobject::GalleryAlbum' => $i18n->get("search class galleryalbum"),
|
||||
'' => $i18n->get("search class any"),
|
||||
);
|
||||
$var->{ searchForm_className }
|
||||
= WebGUI::Form::radioList( $session, {
|
||||
|
|
@ -580,7 +615,7 @@ sub getAssetClassForFile {
|
|||
|
||||
# Checks for Photo assets
|
||||
if ( $filepath =~ /\.(jpe?g|gif|png)$/i ) {
|
||||
return "WebGUI::Asset::File::Image::Photo";
|
||||
return "WebGUI::Asset::File::GalleryFile::Photo";
|
||||
}
|
||||
|
||||
# No class found
|
||||
|
|
@ -931,7 +966,7 @@ sub www_search {
|
|||
|
||||
my $joinClass = [
|
||||
'WebGUI::Asset::Wobject::GalleryAlbum',
|
||||
'WebGUI::Asset::File::Image::Photo',
|
||||
'WebGUI::Asset::File::GalleryFile::Photo',
|
||||
];
|
||||
if ( $form->get("className") ) {
|
||||
$joinClass = [ $form->get('className') ];
|
||||
|
|
|
|||
|
|
@ -146,6 +146,34 @@ sub addArchive {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 addChild ( properties [, ... ] )
|
||||
|
||||
Add a child to this GalleryAlbum. See C<WebGUI::AssetLineage> for more info.
|
||||
|
||||
Override to ensure only appropriate classes get added to GalleryAlbums.
|
||||
|
||||
=cut
|
||||
|
||||
sub addChild {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
my $fileClass = 'WebGUI::Asset::File::GalleryFile';
|
||||
|
||||
# Load the class
|
||||
WebGUI::Pluggable::load( $properties->{className} );
|
||||
|
||||
if ( !$properties->{className}->isa( $fileClass ) ) {
|
||||
$self->session->errorHandler->security(
|
||||
"add a ".$properties->{className}." to a ".$self->get("className")
|
||||
);
|
||||
return undef;
|
||||
}
|
||||
|
||||
return $self->SUPER::addChild( $properties, @_ );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 appendTemplateVarsFileLoop ( vars, assetIds )
|
||||
|
||||
Append template vars for a file loop for the specified assetIds. C<vars> is
|
||||
|
|
@ -381,7 +409,7 @@ sub getTemplateVars {
|
|||
# Friendly URLs
|
||||
$var->{ url } = $self->getUrl;
|
||||
$var->{ url_addArchive } = $self->getUrl('func=addArchive');
|
||||
$var->{ url_addPhoto } = $self->getUrl("func=add;class=WebGUI::Asset::File::Image::Photo");
|
||||
$var->{ url_addPhoto } = $self->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo");
|
||||
$var->{ url_addNoClass } = $self->getUrl("func=add");
|
||||
$var->{ url_delete } = $self->getUrl("func=delete");
|
||||
$var->{ url_edit } = $self->getUrl("func=edit");
|
||||
|
|
|
|||
|
|
@ -87,6 +87,16 @@ our $I18N = {
|
|||
lastUpdated => 0,
|
||||
context => 'Asset property description',
|
||||
},
|
||||
"richEditIdFile label" => {
|
||||
message => "Rich Editor for Files",
|
||||
lastUpdated => 0,
|
||||
context => 'Asset property label',
|
||||
},
|
||||
"richEditIdFile description" => {
|
||||
message => "The Rich Text Editor to use for Files",
|
||||
lastUpdated => 0,
|
||||
context => 'Asset property description',
|
||||
},
|
||||
"richEditIdFileComment label" => {
|
||||
message => "Rich Editor for Comments",
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'help thumbnails body' => {
|
||||
message => 'These variables are available from the slideshow view of the Album',
|
||||
message => 'These variables are available from the thumbnails view of the Album',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -54,13 +54,13 @@ plan tests => 5;
|
|||
#----------------------------------------------------------------------------
|
||||
# Test module compiles okay
|
||||
# plan tests => 1
|
||||
use_ok("WebGUI::Asset::File::Image::Photo");
|
||||
use_ok("WebGUI::Asset::File::GalleryFile::Photo");
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test creating a photo
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -71,12 +71,12 @@ $photo
|
|||
$versionTag->commit;
|
||||
|
||||
is(
|
||||
blessed $photo, "WebGUI::Asset::File::Image::Photo",
|
||||
"Photo is a WebGUI::Asset::File::Image::Photo object",
|
||||
blessed $photo, "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
"Photo is a WebGUI::Asset::File::GalleryFile::Photo object",
|
||||
);
|
||||
|
||||
isa_ok(
|
||||
$photo, "WebGUI::Asset::File::Image",
|
||||
$photo, "WebGUI::Asset::File::GalleryFile",
|
||||
);
|
||||
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ use WebGUI::Session;
|
|||
use Test::More;
|
||||
use Test::Deep;
|
||||
use Scalar::Util qw( blessed );
|
||||
use WebGUI::Asset::File::Image::Photo;
|
||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -43,7 +43,7 @@ my $album
|
|||
}, @addArguments );
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
}, @addArguments );
|
||||
|
||||
$versionTags[-1]->commit;
|
||||
|
|
@ -195,7 +195,7 @@ TODO: {
|
|||
my $html;
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
}, @addArguments );
|
||||
|
||||
# Permissions
|
||||
|
|
@ -19,7 +19,7 @@ use Scalar::Util qw( blessed );
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Test::More;
|
||||
use WebGUI::Asset::File::Image::Photo;
|
||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -47,7 +47,7 @@ my $album
|
|||
});
|
||||
my $photo
|
||||
= $gallery->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -20,7 +20,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Session;
|
||||
use Test::More;
|
||||
use WebGUI::Test::Maker::HTML;
|
||||
use WebGUI::Asset::File::Image::Photo;
|
||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -49,7 +49,7 @@ my $album
|
|||
});
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -91,7 +91,7 @@ $maker->prepare({
|
|||
method => "www_editSave",
|
||||
formParams => {
|
||||
assetId => "new",
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
test_regex => [
|
||||
qr/You must select a file/,
|
||||
|
|
@ -107,7 +107,7 @@ $maker->prepare({
|
|||
method => "www_editSave",
|
||||
formParams => {
|
||||
assetId => "new",
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
test_regex => [
|
||||
qr/awaiting approval and commit/,
|
||||
|
|
@ -41,7 +41,7 @@ my $album
|
|||
);
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef, undef,
|
||||
{ skipAutoCommitWorkflows => 1 },
|
||||
|
|
@ -29,7 +29,7 @@ BEGIN {
|
|||
$graphicsClass = 'Graphics::Magick';
|
||||
}
|
||||
}
|
||||
use WebGUI::Asset::File::Image::Photo;
|
||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -63,7 +63,7 @@ plan tests => 13;
|
|||
# makeResolutions gets default resolutions from a parent Photo Gallery asset
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -110,7 +110,7 @@ $album
|
|||
});
|
||||
$photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -148,7 +148,7 @@ TODO: {
|
|||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
||||
$photo
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -185,7 +185,7 @@ TODO: {
|
|||
push @versionTags, WebGUI::VersionTag->getWorking($session);
|
||||
$photo
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -20,7 +20,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Session;
|
||||
use Test::More;
|
||||
use WebGUI::Test::Maker::HTML;
|
||||
use WebGUI::Asset::File::Image::Photo;
|
||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -35,7 +35,7 @@ my $otherParent
|
|||
});
|
||||
my $photo
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
userDefined1 => "ORIGINAL",
|
||||
},
|
||||
undef,
|
||||
|
|
@ -63,7 +63,7 @@ my $album
|
|||
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
friendsOnly => 0,
|
||||
},
|
||||
undef,
|
||||
|
|
@ -19,7 +19,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Session;
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use WebGUI::Asset::File::Image::Photo;
|
||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -43,7 +43,7 @@ my $album
|
|||
});
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -19,7 +19,7 @@ use WebGUI::Test;
|
|||
use WebGUI::Session;
|
||||
use Test::More;
|
||||
use WebGUI::Test::Maker::HTML;
|
||||
use WebGUI::Asset::File::Image::Photo;
|
||||
use WebGUI::Asset::File::GalleryFile::Photo;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -43,7 +43,7 @@ my $album
|
|||
});
|
||||
my $photo
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
@ -51,7 +51,7 @@ my @photos;
|
|||
for my $i ( 0 .. 5 ) {
|
||||
$photos[ $i ]
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
filename => "$i.jpg",
|
||||
},
|
||||
undef,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ my @photos;
|
|||
for my $i ( 0 .. 5 ) {
|
||||
$photos[ $i ]
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
filename => "$i.jpg",
|
||||
},
|
||||
undef,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ my @photos;
|
|||
for my $i ( 0 .. 5 ) {
|
||||
$photos[ $i ]
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
filename => "$i.jpg",
|
||||
},
|
||||
undef,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ my @photos;
|
|||
for my $i ( 0 .. 5 ) {
|
||||
$photos[ $i ]
|
||||
= $album->addChild({
|
||||
className => "WebGUI::Asset::File::Image::Photo",
|
||||
className => "WebGUI::Asset::File::GalleryFile::Photo",
|
||||
filename => "$i.jpg",
|
||||
},
|
||||
undef,
|
||||
|
|
@ -87,7 +87,7 @@ cmp_deeply( $album->getTemplateVars, superhashof( { %{$album->get}, url => $albu
|
|||
my $expected = {
|
||||
"url_addPhoto"
|
||||
=> all(
|
||||
re( qr/class=WebGUI::Asset::File::Image::Photo/ ),
|
||||
re( qr/class=WebGUI::Asset::File::GalleryFile::Photo/ ),
|
||||
re( qr/func=add/ ),
|
||||
re( $album->getUrl ),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue