Finished? Ready for merge at least.
This commit is contained in:
parent
5d1faff793
commit
82e9bf8448
45 changed files with 5112 additions and 513 deletions
|
|
@ -14,6 +14,8 @@ package WebGUI::Asset;
|
|||
|
||||
=cut
|
||||
|
||||
use Carp qw( croak confess );
|
||||
|
||||
use WebGUI::AssetBranch;
|
||||
use WebGUI::AssetClipboard;
|
||||
use WebGUI::AssetExportHtml;
|
||||
|
|
@ -1336,12 +1338,12 @@ Loads an asset module if it's not already in memory. This is a class method. Ret
|
|||
|
||||
sub loadModule {
|
||||
my ($class, $session, $className) = @_;
|
||||
(my $module = $className . '.pm') =~ s{::|'}{/}g;
|
||||
(my $module = $className . '.pm') =~ s{::|'}{/}g;
|
||||
if (eval { require $module; 1 }) {
|
||||
return $className;
|
||||
}
|
||||
$session->errorHandler->error("Couldn't compile asset package: ".$className.". Root cause: ".$@);
|
||||
return;
|
||||
$session->errorHandler->error("Couldn't compile asset package: ".$className.". Root cause: ".$@);
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1752,6 +1754,7 @@ A specific revision date for the asset to retrieve. If not specified, the most r
|
|||
sub newByDynamicClass {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
confess "newByDynamicClass requires WebGUI::Session" unless $session;
|
||||
my $assetId = shift;
|
||||
my $revisionDate = shift;
|
||||
return undef unless defined $assetId;
|
||||
|
|
@ -1895,6 +1898,7 @@ sub processPropertiesFromFormPost {
|
|||
$self->session->db->beginTransaction;
|
||||
$self->update(\%data);
|
||||
$self->session->db->commit;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2082,6 +2086,9 @@ Updates the properties of an existing revision. If you want to create a new revi
|
|||
|
||||
Hash reference of properties and values to set.
|
||||
|
||||
NOTE: C<keywords> is a special property that uses the WebGUI::Keyword API
|
||||
to set the keywords for this asset.
|
||||
|
||||
=cut
|
||||
|
||||
sub update {
|
||||
|
|
|
|||
|
|
@ -55,17 +55,17 @@ Override the default method in order to deal with attachments.
|
|||
=cut
|
||||
|
||||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
|
||||
if ($self->get("storageId") ne "") {
|
||||
my $newStorage = $self->getStorageClass->get($self->session,$self->get("storageId"))->copy;
|
||||
$properties->{storageId} = $newStorage->getId;
|
||||
}
|
||||
|
||||
my $newSelf = $self->SUPER::addRevision($properties);
|
||||
|
||||
return $newSelf;
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
|
||||
if ($self->get("storageId") ne "") {
|
||||
my $newStorage = $self->getStorageClass->get($self->session,$self->get("storageId"))->copy;
|
||||
$properties->{storageId} = $newStorage->getId;
|
||||
}
|
||||
|
||||
my $newSelf = $self->SUPER::addRevision($properties, @_);
|
||||
|
||||
return $newSelf;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -173,23 +173,50 @@ Returns the TabForm object that will be used in generating the edit page for thi
|
|||
=cut
|
||||
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
my $i18n = WebGUI::International->new($self->session, 'Asset_File');
|
||||
if ($self->get("filename") ne "") {
|
||||
$tabform->getTab("properties")->readOnly(
|
||||
-label=>$i18n->get('current file'),
|
||||
-hoverHelp=>$i18n->get('current file description', 'Asset_File'),
|
||||
-value=>'<p style="display:inline;vertical-align:middle;"><a href="'.$self->getFileUrl.'"><img src="'.$self->getFileIconUrl.'" alt="'.$self->get("filename").'" style="border-style:none;vertical-align:middle;" /> '.$self->get("filename").'</a></p>'
|
||||
);
|
||||
my $self = shift;
|
||||
my $tabform = $self->SUPER::getEditForm();
|
||||
my $i18n = WebGUI::International->new($self->session, 'Asset_File');
|
||||
|
||||
}
|
||||
$tabform->getTab("properties")->file(
|
||||
-name => 'newFile',
|
||||
-label => $i18n->get('new file'),
|
||||
-hoverHelp => $i18n->get('new file description'),
|
||||
);
|
||||
return $tabform;
|
||||
$tabform->getTab("properties")->raw(
|
||||
'<tr><td>'.$i18n->get('new file').'<td colspan="2">'
|
||||
. $self->getEditFormUploadControl
|
||||
. '</td></tr>'
|
||||
);
|
||||
|
||||
return $tabform;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getEditFormUploadControl
|
||||
|
||||
Returns the HTML to render the upload box and link to delete the existing
|
||||
file, if necessary.
|
||||
|
||||
=cut
|
||||
|
||||
sub getEditFormUploadControl {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_File');
|
||||
my $html = '';
|
||||
|
||||
if ($self->get("filename") ne "") {
|
||||
$html .= WebGUI::Form::readOnly( $session, {
|
||||
label => $i18n->get('current file'),
|
||||
hoverHelp => $i18n->get('current file description', 'Asset_File'),
|
||||
value => '<p style="display:inline;vertical-align:middle;"><a href="'.$self->getFileUrl.'"><img src="'.$self->getFileIconUrl.'" alt="'.$self->get("filename").'" style="border-style:none;vertical-align:middle;" /> '.$self->get("filename").'</a></p>'
|
||||
});
|
||||
}
|
||||
|
||||
# Control to upload a new file
|
||||
$html .= WebGUI::Form::file( $session, {
|
||||
name => 'newFile',
|
||||
label => $i18n->get('new file'),
|
||||
hoverHelp => $i18n->get('new file description'),
|
||||
});
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -200,10 +227,10 @@ sub getFileUrl {
|
|||
return $self->getStorageLocation->getUrl($self->get("filename"));
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getFileIconUrl {
|
||||
my $self = shift;
|
||||
return unless $self->get("filename"); ## Why do I have to do this when creating new Files?
|
||||
return $self->getStorageLocation->getFileIconUrl($self->get("filename"));
|
||||
}
|
||||
|
||||
|
|
@ -246,6 +273,7 @@ sub getStorageFromPost {
|
|||
my $self = shift;
|
||||
my $storageId = shift;
|
||||
my $fileStorageId = WebGUI::Form::File->new($self->session, {name => 'newFile', value=>$storageId })->getValueFromPost;
|
||||
$self->session->errorHandler->info( "File Storage Id: $fileStorageId" );
|
||||
return $self->getStorageClass->get($self->session, $fileStorageId);
|
||||
}
|
||||
|
||||
|
|
@ -295,45 +323,21 @@ sub prepareView {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
my $errors = $self->SUPER::processPropertiesFromFormPost;
|
||||
return $errors if $errors;
|
||||
|
||||
#Get the storage location out of memory. If you call getStorageLocation you risk creating another one.
|
||||
# How can this EVER be true?
|
||||
my $storageLocation = $self->{_storageLocation};
|
||||
$session->errorHandler->error("Storage Location set magically") if defined $storageLocation;
|
||||
my $storageId = undef;
|
||||
$storageId = $storageLocation->getId if(defined $storageLocation);
|
||||
|
||||
#Now remove the storage location to prevent wierd caching stuff.
|
||||
delete $self->{_storageLocation};
|
||||
|
||||
#Clear the storage location if a file was uploaded.
|
||||
if($session->form->get("newFile_file") ne "") {
|
||||
$storageLocation->clear();
|
||||
my $errors = $self->SUPER::processPropertiesFromFormPost;
|
||||
return $errors if $errors;
|
||||
|
||||
if (my $storageId = $session->form->get('newFile','File')) {
|
||||
$session->errorHandler->info("Got a new file for asset " . $self->getId);
|
||||
my $storage = $self->getStorageClass->get( $session, $storageId);
|
||||
my $filePath = $storage->getPath( $storage->getFiles->[0] );
|
||||
$self->setFile( $filePath );
|
||||
$storage->delete;
|
||||
}
|
||||
|
||||
# Pass in the storage Id to prevent another one from being created.
|
||||
my $storage = $self->getStorageFromPost($storageId);
|
||||
if (defined $storage) {
|
||||
my $filename = $storage->getFiles()->[0];
|
||||
|
||||
if (defined $filename) {
|
||||
my %data;
|
||||
$data{filename} = $filename;
|
||||
$data{storageId} = $storage->getId;
|
||||
$data{title} = $filename unless ($session->form->process("title"));
|
||||
$data{menuTitle} = $filename unless ($session->form->process("menuTitle"));
|
||||
$data{url} = $self->getParent->get('url').'/'.$filename unless ($session->form->process("url"));
|
||||
$self->setStorageLocation($storage);
|
||||
$self->update(\%data);
|
||||
}
|
||||
}
|
||||
|
||||
$self->applyConstraints;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -421,18 +425,18 @@ sub setSize {
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
sub setStorageLocation {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $storage = shift;
|
||||
if (defined $storage) {
|
||||
if (defined $storage) {
|
||||
$self->{_storageLocation} = $storage;
|
||||
}
|
||||
elsif ($self->get("storageId") eq "") {
|
||||
$self->{_storageLocation} = $self->getStorageClass->create($self->session);
|
||||
$self->update({storageId=>$self->{_storageLocation}->getId});
|
||||
}
|
||||
}
|
||||
elsif ($self->get("storageId") eq "") {
|
||||
$self->{_storageLocation} = $self->getStorageClass->create($self->session);
|
||||
$self->update({storageId=>$self->{_storageLocation}->getId});
|
||||
}
|
||||
else {
|
||||
$self->{_storageLocation} = $self->getStorageClass->get($self->session,$self->get("storageId"));
|
||||
}
|
||||
$self->{_storageLocation} = $self->getStorageClass->get($self->session,$self->get("storageId"));
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -475,9 +479,11 @@ sub updatePropertiesFromStorage {
|
|||
my $self = shift;
|
||||
my $storage = $self->getStorageLocation;
|
||||
my $filename = $storage->getFiles->[0];
|
||||
$self->session->errorHandler->info("Updating file asset filename to $filename");
|
||||
$self->update({
|
||||
filename => $filename,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -22,19 +22,7 @@ use Image::ExifTool qw( :Public );
|
|||
use JSON;
|
||||
use Tie::IxHash;
|
||||
|
||||
our $magick;
|
||||
BEGIN {
|
||||
if (eval { require Graphics::Magick; 1 }) {
|
||||
$magick = 'Graphics::Magick';
|
||||
}
|
||||
elsif (eval { require Image::Magick; 1 }) {
|
||||
$magick = 'Image::Magick';
|
||||
}
|
||||
else {
|
||||
croak "You must have either Graphics::Magick or Image::Magick installed to run WebGUI.\n";
|
||||
}
|
||||
}
|
||||
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Friends;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
|
@ -50,7 +38,6 @@ WebGUI::Asset::File::Image::Photo
|
|||
|
||||
use WebGUI::Asset::File::Image::Photo
|
||||
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
|
@ -72,15 +59,18 @@ sub definition {
|
|||
my $i18n = __PACKAGE__->i18n($session);
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
exifData => {
|
||||
defaultValue => undef,
|
||||
},
|
||||
friendsOnly => {
|
||||
defaultValue => 0,
|
||||
},
|
||||
location => {
|
||||
defaultValue => undef,
|
||||
},
|
||||
rating => {
|
||||
defaultValue => 0,
|
||||
},
|
||||
storageIdPhoto => {
|
||||
defaultValue => undef,
|
||||
},
|
||||
);
|
||||
|
||||
# UserDefined Fields
|
||||
|
|
@ -91,12 +81,13 @@ sub definition {
|
|||
}
|
||||
|
||||
push @{$definition}, {
|
||||
assetName => $i18n->get('assetName'),
|
||||
icon => 'Image.gif',
|
||||
tableName => 'Photo',
|
||||
className => 'WebGUI::Asset::File::Image::Photo',
|
||||
i18n => 'Asset_Photo',
|
||||
properties => \%properties,
|
||||
assetName => $i18n->get('assetName'),
|
||||
autoGenerateForms => 0,
|
||||
icon => 'Image.gif',
|
||||
tableName => 'Photo',
|
||||
className => 'WebGUI::Asset::File::Image::Photo',
|
||||
i18n => 'Asset_Photo',
|
||||
properties => \%properties,
|
||||
};
|
||||
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
|
|
@ -114,14 +105,27 @@ reference. Returns the hash reference for convenience.
|
|||
sub appendTemplateVarsForCommentForm {
|
||||
my $self = shift;
|
||||
my $var = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
$var->{commentForm_start}
|
||||
= WebGUI::Form::formHeader( $session );
|
||||
$var->{ commentForm_start }
|
||||
= WebGUI::Form::formHeader( $session )
|
||||
. WebGUI::Form::hidden( $session, { name => "func", value => "addCommentSave" } )
|
||||
;
|
||||
$var->{commentForm_end}
|
||||
$var->{ commentForm_end }
|
||||
= WebGUI::Form::formFooter( $session );
|
||||
|
||||
$var->{ commentForm_bodyText }
|
||||
= WebGUI::Form::HTMLArea( $session, {
|
||||
name => "bodyText",
|
||||
richEditId => $self->getGallery->get("richEditIdComment"),
|
||||
});
|
||||
|
||||
$var->{ commentForm_submit }
|
||||
= WebGUI::Form::submit( $session, {
|
||||
name => "submit",
|
||||
value => "Save Comment",
|
||||
});
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
|
|
@ -143,14 +147,14 @@ sub applyConstraints {
|
|||
my $self = shift;
|
||||
my $gallery = $self->getGallery;
|
||||
|
||||
$self->makeResolutions();
|
||||
$self->updateExifDataFromFile();
|
||||
|
||||
# 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();
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -247,6 +251,19 @@ sub deleteComment {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getAutoCommitWorkflowId ( )
|
||||
|
||||
Returns the workflowId of the Gallery's approval workflow.
|
||||
|
||||
=cut
|
||||
|
||||
sub getAutoCommitWorkflowId {
|
||||
my $self = shift;
|
||||
return $self->getGallery->get("workflowIdCommit");
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getComment ( commentId )
|
||||
|
||||
Get a comment from this asset. C<id> is the ID of the comment to get. Returns
|
||||
|
|
@ -292,6 +309,7 @@ Get a WebGUI::Paginator for the comments for this Photo.
|
|||
|
||||
sub getCommentPaginator {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
my $p = WebGUI::Paginator->new($session, $self->getUrl);
|
||||
$p->setDataByQuery(
|
||||
|
|
@ -366,10 +384,37 @@ 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 $owner = WebGUI::User->new( $session, $self->get("ownerUserId") );
|
||||
|
||||
$var->{ canComment } = $self->canComment;
|
||||
$var->{ canEdit } = $self->canEdit;
|
||||
$var->{ numberOfComments } = scalar @{ $self->getCommentIds };
|
||||
$var->{ ownerUsername } = $owner->username;
|
||||
$var->{ url } = $self->getUrl;
|
||||
$var->{ url_delete } = $self->getUrl('func=delete');
|
||||
$var->{ url_demote } = $self->getUrl('func=demote');
|
||||
$var->{ url_edit } = $self->getUrl('func=edit');
|
||||
$var->{ url_gallery } = $self->getGallery->getUrl;
|
||||
$var->{ url_makeShortcut } = $self->getUrl('func=makeShortcut');
|
||||
$var->{ url_listFilesForOwner }
|
||||
= $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 } }, {
|
||||
url_download => $self->getStorageLocation->getPathFrag($resolution)
|
||||
};
|
||||
}
|
||||
|
||||
### Format exif vars
|
||||
my $exif = jsonToObj( delete $var->{exifData} );
|
||||
$exif = ImageInfo( $self->getStorageLocation->getPath( $self->get("filename") ) );
|
||||
for my $tag ( keys %$exif ) {
|
||||
# Hash of exif_tag => value
|
||||
$var->{ "exif_" . $tag } = $exif->{$tag};
|
||||
|
|
@ -428,6 +473,7 @@ contained in.
|
|||
sub makeResolutions {
|
||||
my $self = shift;
|
||||
my $resolutions = shift;
|
||||
my $error;
|
||||
|
||||
croak "Photo->makeResolutions: resolutions must be an array reference"
|
||||
if $resolutions && ref $resolutions ne "ARRAY";
|
||||
|
|
@ -435,15 +481,14 @@ sub makeResolutions {
|
|||
# Get default if necessary
|
||||
$resolutions ||= $self->getGallery->getImageResolutions;
|
||||
|
||||
my $storage = $self->getStorageLocation;
|
||||
my $photo = $magick->new;
|
||||
$photo->Read( $storage->get( $self->get("filename") ) );
|
||||
my $storage = $self->getStorageLocation;
|
||||
$self->session->errorHandler->info(" Making resolutions for '" . $self->get("filename") . q{'});
|
||||
|
||||
for my $res ( @$resolutions ) {
|
||||
# carp if resolution is bad
|
||||
my $newPhoto = $photo->Clone;
|
||||
$newPhoto->Resize( geometry => $res );
|
||||
$newPhoto->Write( $storage->getFilePath( "$res.jpg" ) );
|
||||
my $newFilename = $res . ".jpg";
|
||||
$storage->copyFile( $self->get("filename"), $newFilename );
|
||||
$storage->resize( $newFilename, $res );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -512,8 +557,12 @@ sub prepareView {
|
|||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
my $errors = $self->SUPER::processPropertiesFromFormPost || [];
|
||||
|
||||
# Return if errors
|
||||
return $errors if @$errors;
|
||||
|
||||
|
||||
# Passes all checks
|
||||
$self->requestAutoCommit;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -566,7 +615,9 @@ sub updateExifDataFromFile {
|
|||
my $self = shift;
|
||||
my $storage = $self->getStorageLocation;
|
||||
|
||||
my $info = ImageInfo( $storage->getFilePath( $self->get('filename') ) );
|
||||
return;
|
||||
my $info = ImageInfo( $storage->getPath( $self->get('filename') ) );
|
||||
use Data::Dumper; $self->session->errorHandler->info( Dumper $info );
|
||||
$self->update({
|
||||
exifData => objToJson( $info ),
|
||||
});
|
||||
|
|
@ -584,16 +635,19 @@ sub view {
|
|||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $var = $self->getTemplateVars;
|
||||
$var->{ controls } = $self->getToolbar;
|
||||
$var->{ fileUrl } = $self->getFileUrl;
|
||||
$var->{ fileIcon } = $self->getFileIconUrl;
|
||||
|
||||
$self->appendTemplateVarsForCommentForm( $var );
|
||||
|
||||
my $p = $self->getCommentPaginator;
|
||||
$var->{ commentLoop } = $p->getPageData;
|
||||
$var->{ commentLoop_urlNext } = [$p->getNextPageLink]->[0];
|
||||
$var->{ commentLoop_urlPrev } = [$p->getPrevPageLink]->[0];
|
||||
for my $comment ( @{ $p->getPageData } ) {
|
||||
my $user = WebGUI::User->new( $session, $comment->{userId} );
|
||||
$comment->{ username } = $user->username;
|
||||
|
||||
my $dt = WebGUI::DateTime->new( $session, $comment->{ creationDate } );
|
||||
$comment->{ creationDate } = $dt->toUserTimeZone;
|
||||
|
||||
push @{ $var->{commentLoop} }, $comment;
|
||||
}
|
||||
$var->{ commentLoop_pageBar } = $p->getBarAdvanced;
|
||||
|
||||
return $self->processTemplate($var, undef, $self->{_viewTemplate});
|
||||
|
|
@ -609,14 +663,15 @@ Save a new comment to the Photo.
|
|||
|
||||
sub www_addCommentSave {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canComment;
|
||||
return $session->privilege->insufficient unless $self->canComment;
|
||||
|
||||
my $form = $self->session;
|
||||
my $form = $self->session->form;
|
||||
|
||||
my $properties = {
|
||||
assetId => $self->getId,
|
||||
creationDate => time,
|
||||
creationDate => WebGUI::DateTime->new( $session, time )->toDatabase,
|
||||
userId => $session->user->userId,
|
||||
visitorIp => ( $session->user->userId eq "1" ? $session->env("REMOTE_ADDR") : undef ),
|
||||
bodyText => $form->get("bodyText"),
|
||||
|
|
@ -638,14 +693,17 @@ this Photo exists in.
|
|||
|
||||
sub www_delete {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $var = $self->getTemplateVar;
|
||||
my $var = $self->getTemplateVars;
|
||||
$var->{ url_yes } = $self->getUrl("func=deleteConfirm");
|
||||
|
||||
# TODO Get albums with shortcuts to this asset
|
||||
|
||||
return $self->processStyle(
|
||||
$self->processTemplate( $var, $self->getGallery->get("templateIdDeletePhoto") )
|
||||
$self->processTemplate( $var, $self->getGallery->get("templateIdDeleteFile") )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -663,7 +721,7 @@ sub www_deleteConfirm {
|
|||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $i18n = $self->i18n( $self->session );
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
|
||||
$self->purge;
|
||||
|
||||
|
|
@ -674,6 +732,25 @@ 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,
|
||||
|
|
@ -719,10 +796,36 @@ sub www_edit {
|
|||
return $self->session->privilege->locked unless $self->canEditIfLocked;
|
||||
|
||||
# Prepare the template variables
|
||||
my $var = $self->getTemplateVars;
|
||||
my $var = {
|
||||
url_addArchive => $self->getParent->getUrl('func=addArchive'),
|
||||
};
|
||||
|
||||
$var->{ form_header } = WebGUI::Form::formHeader( $session );
|
||||
$var->{ form_footer } = WebGUI::Form::formFooter( $session );
|
||||
# Generate the form
|
||||
if ($form->get("func") eq "add") {
|
||||
$var->{ form_start }
|
||||
= WebGUI::Form::formHeader( $session, {
|
||||
action => $self->getParent->getUrl('func=editSave;assetId=new;class='.__PACKAGE__),
|
||||
});
|
||||
}
|
||||
else {
|
||||
$var->{ form_start }
|
||||
= WebGUI::Form::formHeader( $session, {
|
||||
action => $self->getUrl('func=editSave'),
|
||||
});
|
||||
}
|
||||
$var->{ form_start }
|
||||
.= WebGUI::Form::hidden( $session, {
|
||||
name => "proceed",
|
||||
value => "showConfirmation",
|
||||
});
|
||||
|
||||
$var->{ form_end } = WebGUI::Form::formFooter( $session );
|
||||
|
||||
$var->{ form_submit }
|
||||
= WebGUI::Form::submit( $session, {
|
||||
name => "submit",
|
||||
value => "Save",
|
||||
});
|
||||
|
||||
$var->{ form_title }
|
||||
= WebGUI::Form::Text( $session, {
|
||||
|
|
@ -737,12 +840,7 @@ sub www_edit {
|
|||
richEditId => $self->getGallery->get("assetIdRichEditFile"),
|
||||
});
|
||||
|
||||
$var->{ form_storageIdPhoto }
|
||||
= WebGUI::Form::Image( $session, {
|
||||
name => "storageIdPhoto",
|
||||
value => ( $form->get("storageIdPhoto") || $self->get("storageIdPhoto") ),
|
||||
maxAttachments => 1,
|
||||
});
|
||||
$var->{ form_photo } = $self->getEditFormUploadControl;
|
||||
|
||||
$var->{ form_keywords }
|
||||
= WebGUI::Form::Text( $session, {
|
||||
|
|
@ -771,6 +869,23 @@ sub www_edit {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_editSave ( )
|
||||
|
||||
Save the edit form. Overridden to display a confirm message to the user.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editSave {
|
||||
my $self = shift;
|
||||
$self->SUPER::www_editSave;
|
||||
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
|
||||
sprintf $i18n->get("save message"), $self->getUrl,
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_makeShortcut ( )
|
||||
|
||||
Display the form to make a shortcut.
|
||||
|
|
@ -781,24 +896,27 @@ This page is only available to those who can edit this Photo.
|
|||
|
||||
sub www_makeShortcut {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
# Create the form to make a shortcut
|
||||
my $var = $self->getTemplateVars;
|
||||
|
||||
$var->{ form_header }
|
||||
$var->{ form_start }
|
||||
= WebGUI::Form::formHeader( $session )
|
||||
. WebGUI::Form::hidden( $session, { name => "func", value => "makeShortcutSave" });
|
||||
$var->{ form_footer }
|
||||
$var->{ form_end }
|
||||
= WebGUI::Form::formFooter( $session );
|
||||
|
||||
# Albums under this Gallery
|
||||
my $albums = $self->getGallery->getAlbumIds;
|
||||
my %albumOptions;
|
||||
for my $assetId ( @$albums ) {
|
||||
$albumOptions{ $assetId }
|
||||
= WebGUI::Asset->newByDynamicClass($session, $assetId)->get("title");
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($session, $assetId);
|
||||
if ($asset->canAddFile) {
|
||||
$albumOptions{ $assetId } = $asset->get("title");
|
||||
}
|
||||
}
|
||||
$var->{ form_parentId }
|
||||
= WebGUI::Form::selectBox( $session, {
|
||||
|
|
@ -827,7 +945,8 @@ sub www_makeShortcutSave {
|
|||
my $form = $self->session->form;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
|
||||
my $parentId = $form->get('parentId');
|
||||
my $shortcut = $self->makeShortcut( $parentId );
|
||||
|
||||
return $shortcut->www_view;
|
||||
|
|
@ -835,6 +954,46 @@ 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.
|
||||
Provides links to view the photo and add more photos.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_showConfirmation {
|
||||
my $self = shift;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
|
||||
return $self->processStyle(
|
||||
sprintf( $i18n->get('save message'),
|
||||
$self->getUrl,
|
||||
$self->getParent->getUrl('func=add;className='.__PACKAGE__),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_view ( )
|
||||
|
||||
Shows the output of L<view> inside of the style provided by the gallery this
|
||||
|
|
@ -857,6 +1016,5 @@ sub www_view {
|
|||
$self->session->output->print($foot, 1);
|
||||
return "chunked";
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -593,6 +593,26 @@ sub getPrefFieldsToImport {
|
|||
return split("\n",$self->getValue("prefFieldsToImport"));
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getTemplateVars
|
||||
|
||||
Gets the template vars for this shortcut.
|
||||
|
||||
=cut
|
||||
|
||||
sub getTemplateVars {
|
||||
my $self = shift;
|
||||
|
||||
my $shortcut = $self->getShortcut;
|
||||
if ( $shortcut->can('getTemplateVars') ) {
|
||||
return $shortcut->getTemplateVars;
|
||||
}
|
||||
else {
|
||||
return $shortcut->get;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub isDashlet {
|
||||
my $self = shift;
|
||||
|
|
|
|||
|
|
@ -24,16 +24,14 @@ use base 'WebGUI::Asset::Wobject';
|
|||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
=head1 DIAGNOSTICS
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( )
|
||||
|
||||
defines wobject properties for New Wobject instances. You absolutely need
|
||||
this method in your new Wobjects. If you choose to "autoGenerateForms", the
|
||||
getEditForm method is unnecessary/redundant/useless.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -51,6 +49,23 @@ sub definition {
|
|||
'1600' => '1600',
|
||||
'2880' => '2880',
|
||||
);
|
||||
|
||||
tie my %viewDefaultOptions, 'Tie::IxHash', (
|
||||
list => $i18n->get("viewDefault option list"),
|
||||
album => $i18n->get("viewDefault option album"),
|
||||
);
|
||||
|
||||
tie my %viewListOrderByOptions, 'Tie::IxHash', (
|
||||
creationDate => $i18n->get("viewListOrderBy option creationDate"),
|
||||
lineage => $i18n->get("viewListOrderBy option lineage"),
|
||||
revisionDate => $i18n->get("viewListOrderBy option revisionDate"),
|
||||
title => $i18n->get("viewListOrderBy option title"),
|
||||
);
|
||||
|
||||
tie my %viewListOrderDirectionOptions, 'Tie::IxHash', (
|
||||
ASC => $i18n->get("viewListOrderDirection option asc"),
|
||||
DESC => $i18n->get("viewListOrderDirection option desc"),
|
||||
);
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
groupIdAddComment => {
|
||||
|
|
@ -77,7 +92,7 @@ sub definition {
|
|||
imageResolutions => {
|
||||
tab => "properties",
|
||||
fieldType => "checkList",
|
||||
defaultValue => ['800', '1024', '1200', '1600', '2880'],
|
||||
defaultValue => join("\n", '800', '1024', '1200', '1600', '2880'),
|
||||
options => \%imageResolutionOptions,
|
||||
label => $i18n->get("imageResolutions label"),
|
||||
hoverHelp => $i18n->get("imageResolutions description"),
|
||||
|
|
@ -85,14 +100,14 @@ sub definition {
|
|||
imageViewSize => {
|
||||
tab => "properties",
|
||||
fieldType => "integer",
|
||||
defaultValue => 0,
|
||||
defaultValue => 700,
|
||||
label => $i18n->get("imageViewSize label"),
|
||||
hoverHelp => $i18n->get("imageViewSize description"),
|
||||
},
|
||||
imageThumbnailSize => {
|
||||
tab => "properties",
|
||||
fieldType => "integer",
|
||||
defaultValue => 0,
|
||||
defaultValue => 300,
|
||||
label => $i18n->get("imageThumbnailSize label"),
|
||||
hoverHelp => $i18n->get("imageThumbnailSize description"),
|
||||
},
|
||||
|
|
@ -106,7 +121,7 @@ sub definition {
|
|||
richEditIdComment => {
|
||||
tab => "properties",
|
||||
fieldType => "selectRichEditor",
|
||||
defaultValue => undef, # Rich Editor for Posts
|
||||
defaultValue => "PBrichedit000000000002", # Forum Rich Editor
|
||||
label => $i18n->get("richEditIdFileComment label"),
|
||||
hoverHelp => $i18n->get("richEditIdFileComment description"),
|
||||
},
|
||||
|
|
@ -134,6 +149,14 @@ sub definition {
|
|||
label => $i18n->get("templateIdDeleteFile label"),
|
||||
hoverHelp => $i18n->get("templateIdDeleteFile description"),
|
||||
},
|
||||
templateIdEditAlbum => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
defaultValue => "",
|
||||
namespace => "GalleryAlbum/Edit",
|
||||
label => $i18n->get("templateIdEditAlbum label"),
|
||||
hoverHelp => $i18n->get("templateIdEditAlbum description"),
|
||||
},
|
||||
templateIdEditFile => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
|
|
@ -158,21 +181,21 @@ sub definition {
|
|||
label => $i18n->get("templateIdListAlbumsRss label"),
|
||||
hoverHelp => $i18n->get("templateIdListAlbumsRss description"),
|
||||
},
|
||||
templateIdListUserFiles => {
|
||||
templateIdListFilesForUser => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
defaultValue => "",
|
||||
namespace => "Gallery/ListUserFiles",
|
||||
label => $i18n->get("templateIdListUserFiles label"),
|
||||
hoverHelp => $i18n->get("templateIdListUserFiles description"),
|
||||
namespace => "Gallery/ListFilesForUser",
|
||||
label => $i18n->get("templateIdListFilesForUser label"),
|
||||
hoverHelp => $i18n->get("templateIdListFilesForUser description"),
|
||||
},
|
||||
templateIdListUserFilesRss => {
|
||||
templateIdListFilesForUserRss => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
defaultValue => "",
|
||||
namespace => "Gallery/ListUserFilesRss",
|
||||
label => $i18n->get("templateIdListUserFilesRss label"),
|
||||
hoverHelp => $i18n->get("templateIdListUserFilesRss description"),
|
||||
namespace => "Gallery/ListFilesForUserRss",
|
||||
label => $i18n->get("templateIdListFilesForUserRss label"),
|
||||
hoverHelp => $i18n->get("templateIdListFilesForUserRss description"),
|
||||
},
|
||||
templateIdMakeShortcut => {
|
||||
tab => "display",
|
||||
|
|
@ -190,21 +213,21 @@ sub definition {
|
|||
label => $i18n->get("templateIdSearch label"),
|
||||
hoverHelp => $i18n->get("templateIdSearch description"),
|
||||
},
|
||||
templateIdSlideshow => {
|
||||
templateIdViewSlideshow => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
defaultValue => "",
|
||||
namespace => "GalleryAlbum/Slideshow",
|
||||
label => $i18n->get("templateIdSlideshow label"),
|
||||
hoverHelp => $i18n->get("templateIdSlideshow description"),
|
||||
namespace => "GalleryAlbum/ViewSlideshow",
|
||||
label => $i18n->get("templateIdViewSlideshow label"),
|
||||
hoverHelp => $i18n->get("templateIdViewSlideshow description"),
|
||||
},
|
||||
templateIdThumbnails => {
|
||||
templateIdViewThumbnails => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
defaultValue => "",
|
||||
namespace => "GalleryAlbum/Thumbnails",
|
||||
label => $i18n->get("templateIdThumbnails label"),
|
||||
hoverHelp => $i18n->get("templateIdThumbnails description"),
|
||||
namespace => "GalleryAlbum/ViewThumbnails",
|
||||
label => $i18n->get("templateIdViewThumbnails label"),
|
||||
hoverHelp => $i18n->get("templateIdViewThumbnails description"),
|
||||
},
|
||||
templateIdViewAlbum => {
|
||||
tab => "display",
|
||||
|
|
@ -230,6 +253,37 @@ sub definition {
|
|||
label => $i18n->get("templateIdViewFile label"),
|
||||
hoverHelp => $i18n->get("templateIdViewFile description"),
|
||||
},
|
||||
viewDefault => {
|
||||
tab => "display",
|
||||
fieldType => "selectBox",
|
||||
defaultValue => "list",
|
||||
options => \%viewDefaultOptions,
|
||||
label => $i18n->get("viewDefault label"),
|
||||
hoverHelp => $i18n->get("viewDefault description"),
|
||||
},
|
||||
viewAlbumAssetId => {
|
||||
tab => "display",
|
||||
fieldType => "asset",
|
||||
class => "WebGUI::Asset::Wobject::GalleryAlbum",
|
||||
label => $i18n->get("viewAlbumAssetId label"),
|
||||
hoverHelp => $i18n->get("viewAlbumAssetId description"),
|
||||
},
|
||||
viewListOrderBy => {
|
||||
tab => "display",
|
||||
fieldType => "selectBox",
|
||||
defaultValue => "lineage", # "Sequence Number"
|
||||
options => \%viewListOrderByOptions,
|
||||
label => $i18n->get("viewListOrderBy label"),
|
||||
hoverHelp => $i18n->get("viewListOrderBy description"),
|
||||
},
|
||||
viewListOrderDirection => {
|
||||
tab => "display",
|
||||
fieldType => "selectBox",
|
||||
defaultValue => "ASC",
|
||||
options => \%viewListOrderDirectionOptions,
|
||||
label => $i18n->get("viewListOrderDirection label"),
|
||||
hoverHelp => $i18n->get("viewListOrderDirection description"),
|
||||
},
|
||||
workflowIdCommit => {
|
||||
tab => "security",
|
||||
fieldType => "workflow",
|
||||
|
|
@ -254,6 +308,91 @@ sub definition {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 appendTemplateVarsSearchForm ( var )
|
||||
|
||||
Appends the template vars for the search form to the hash reference C<var>.
|
||||
Returns the hash reference for convenience.
|
||||
|
||||
=cut
|
||||
|
||||
sub appendTemplateVarsSearchForm {
|
||||
my $self = shift;
|
||||
my $var = shift;
|
||||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_Gallery');
|
||||
|
||||
$var->{ searchForm_start }
|
||||
= WebGUI::Form::formHeader( $session, {
|
||||
action => $self->getUrl('func=search'),
|
||||
method => "GET",
|
||||
});
|
||||
|
||||
$var->{ searchForm_end }
|
||||
= WebGUI::Form::formFooter( $session );
|
||||
|
||||
$var->{ searchForm_basicSearch }
|
||||
= WebGUI::Form::text( $session, {
|
||||
name => "basicSearch",
|
||||
value => $form->get("basicSearch"),
|
||||
});
|
||||
|
||||
$var->{ searchForm_title }
|
||||
= WebGUI::Form::text( $session, {
|
||||
name => "title",
|
||||
value => $form->get("title"),
|
||||
});
|
||||
|
||||
$var->{ searchForm_description }
|
||||
= WebGUI::Form::text( $session, {
|
||||
name => "description",
|
||||
value => $form->get("description"),
|
||||
});
|
||||
|
||||
$var->{ searchForm_keywords }
|
||||
= WebGUI::Form::text( $session, {
|
||||
name => "keywords",
|
||||
value => $form->get("keywords"),
|
||||
});
|
||||
|
||||
# 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"),
|
||||
);
|
||||
$var->{ searchForm_className }
|
||||
= WebGUI::Form::radioList( $session, {
|
||||
name => "className",
|
||||
value => $form->get("className"),
|
||||
options => \%searchClassOptions,
|
||||
});
|
||||
|
||||
# Search creationDate
|
||||
my $oneYearAgo = WebGUI::DateTime->new( $session, time )->add( years => -1 )->epoch;
|
||||
$var->{ searchForm_creationDate_after }
|
||||
= WebGUI::Form::dateTime( $session, {
|
||||
name => "creationDate_after",
|
||||
value => $form->get("creationDate_after","dateTime") || $oneYearAgo,
|
||||
});
|
||||
$var->{ searchForm_creationDate_before }
|
||||
= WebGUI::Form::dateTime( $session, {
|
||||
name => "creationDate_before",
|
||||
value => $form->get("creationDate_before","dateTime"),
|
||||
});
|
||||
|
||||
# Buttons
|
||||
$var->{ searchForm_submit }
|
||||
= WebGUI::Form::submit( $session, {
|
||||
name => "submit",
|
||||
value => $i18n->get("search submit"),
|
||||
});
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canAddFile ( [userId] )
|
||||
|
||||
Returns true if the user can add files to this Gallery. C<userId> is the
|
||||
|
|
@ -356,23 +495,33 @@ Gets an array reference of all the album IDs under this Gallery.
|
|||
sub getAlbumIds {
|
||||
my $self = shift;
|
||||
|
||||
return $self->getLineage(['descendants'], {
|
||||
includeOnlyClasses => ['WebGUI::Asset::Wobject::GalleryAlbum'],
|
||||
});
|
||||
my $assets
|
||||
= $self->getLineage(['descendants'], {
|
||||
includeOnlyClasses => ['WebGUI::Asset::Wobject::GalleryAlbum'],
|
||||
});
|
||||
|
||||
return $assets;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getAlbumPaginator ( )
|
||||
=head2 getAlbumPaginator ( options )
|
||||
|
||||
Gets a WebGUI::Paginator for all the albums in this Gallery.
|
||||
Gets a WebGUI::Paginator for all the albums in this Gallery. C<options> is a
|
||||
hash reference with the following keys.
|
||||
|
||||
perpage => The number of results to show per page. Default: 20
|
||||
|
||||
=cut
|
||||
|
||||
sub getAlbumPaginator {
|
||||
my $self = shift;
|
||||
my $options = shift;
|
||||
|
||||
my $perpage = $options->{ perpage } || 20;
|
||||
|
||||
my $p = WebGUI::Paginator->new( $self->session, $self->getUrl );
|
||||
my $p
|
||||
= WebGUI::Paginator->new( $self->session, $self->getUrl, $perpage );
|
||||
$p->setDataByArrayRef( $self->getAlbumIds );
|
||||
|
||||
return $p;
|
||||
|
|
@ -392,7 +541,7 @@ sub getAssetClassForFile {
|
|||
my $filepath = shift;
|
||||
|
||||
# Checks for Photo assets
|
||||
if ( $filepath =~ /\.(jpe?g|gif|png)/i ) {
|
||||
if ( $filepath =~ /\.(jpe?g|gif|png)$/i ) {
|
||||
return "WebGUI::Asset::File::Image::Photo";
|
||||
}
|
||||
|
||||
|
|
@ -416,9 +565,9 @@ sub getImageResolutions {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getSearchPaginator ( options )
|
||||
=head2 getSearchPaginator ( rules )
|
||||
|
||||
Gets a WebGUI::Paginator for a search. C<options> is a hash reference of
|
||||
Gets a WebGUI::Paginator for a search. C<rules> is a hash reference of
|
||||
options with the following keys:
|
||||
|
||||
keywords => Keywords to search on
|
||||
|
|
@ -431,11 +580,11 @@ sub getSearchPaginator {
|
|||
my $self = shift;
|
||||
my $rules = shift;
|
||||
|
||||
$rules->{ lineage } = $self->get("lineage");
|
||||
$rules->{ lineage } = [ $self->get("lineage") ];
|
||||
|
||||
my $search = WebGUI::Search->new( $self->session );
|
||||
$search->search( $rules );
|
||||
my $paginator = $search->getPaginatorResultSet( $self->getUrl('func=search') );
|
||||
my $paginator = $search->getPaginatorResultSet( $rules->{url} );
|
||||
|
||||
return $paginator;
|
||||
}
|
||||
|
|
@ -451,7 +600,7 @@ classes of files inside of a Gallery.
|
|||
|
||||
=cut
|
||||
|
||||
sub getTemplateEditFile {
|
||||
sub getTemplateIdEditFile {
|
||||
my $self = shift;
|
||||
return $self->get("templateIdEditFile");
|
||||
}
|
||||
|
|
@ -467,37 +616,25 @@ Gets a hash reference of vars common to all templates.
|
|||
sub getTemplateVars {
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
||||
# Add the search form variables
|
||||
$self->appendTemplateVarsSearchForm( $var );
|
||||
|
||||
$var->{ url } = $self->getUrl;
|
||||
$var->{ url_addAlbum } = $self->getUrl('func=add;class=WebGUI::Asset::Wobject::GalleryAlbum');
|
||||
$var->{ url_listAlbums } = $self->getUrl('func=listAlbums');
|
||||
$var->{ url_listAlbumsRss } = $self->getUrl('func=listAlbumsRss');
|
||||
$var->{ url_listFilesForCurrentUser } = $self->getUrl('func=listFilesForUser');
|
||||
$var->{ url_search } = $self->getUrl('func=search');
|
||||
|
||||
$var->{ canEdit } = $self->canEdit;
|
||||
$var->{ canAddFile } = $self->canAddFile;
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getUserFileIds ( [userId] )
|
||||
|
||||
Gets an array reference of assetIds for the files in this Gallery owned by
|
||||
the specified C<userId>. If userId is not defined, will use the current user.
|
||||
|
||||
=cut
|
||||
|
||||
sub getUserFileIds {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
|
||||
my $db = $self->session->db;
|
||||
|
||||
# Note: We use excludeClasses to avoid getting GalleryAlbum assets
|
||||
my $assetIds
|
||||
= $self->getLineage( ['descendants'], {
|
||||
excludeClasses => [ 'WebGUI::Asset::Wobject::GalleryAlbum' ],
|
||||
whereClause => "ownerUserId = " . $db->quote($userId),
|
||||
});
|
||||
|
||||
return $assetIds;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getUserAlbumIds ( [userId] )
|
||||
|
||||
Gets an array reference of assetIds for the GalleryAlbums in this Gallery
|
||||
|
|
@ -523,6 +660,55 @@ sub getUserAlbumIds {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getUserFileIds ( [userId] )
|
||||
|
||||
Gets an array reference of assetIds for the files in this Gallery owned by
|
||||
the specified C<userId>. If userId is not defined, will use the current user.
|
||||
|
||||
=cut
|
||||
|
||||
sub getUserFileIds {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
|
||||
my $db = $self->session->db;
|
||||
|
||||
# Note: We use excludeClasses to avoid getting GalleryAlbum assets
|
||||
my $assetIds
|
||||
= $self->getLineage( ['descendants'], {
|
||||
excludeClasses => [ 'WebGUI::Asset::Wobject::GalleryAlbum' ],
|
||||
whereClause => "ownerUserId = " . $db->quote($userId),
|
||||
});
|
||||
|
||||
return $assetIds;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getUserFilePaginator ( options )
|
||||
|
||||
Gets a WebGUI::Paginator for the files owned by a specific C<userId>.
|
||||
C<options> is a hash reference of options with the following keys:
|
||||
|
||||
userId => The user who owns the asset. Defaults to the current user.
|
||||
url => The URL to give to the paginator
|
||||
|
||||
=cut
|
||||
|
||||
sub getUserFilePaginator {
|
||||
my $self = shift;
|
||||
my $options = shift;
|
||||
my $userId = delete $options->{userId};
|
||||
my $url = delete $options->{url};
|
||||
|
||||
my $p = WebGUI::Paginator->new( $self->session, $url );
|
||||
$p->setDataByArrayRef( $self->getUserFileIds( $userId ) );
|
||||
|
||||
return $p;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 prepareView ( )
|
||||
|
||||
See WebGUI::Asset::prepareView() for details.
|
||||
|
|
@ -532,7 +718,30 @@ See WebGUI::Asset::prepareView() for details.
|
|||
sub prepareView {
|
||||
my $self = shift;
|
||||
$self->SUPER::prepareView();
|
||||
my $template = WebGUI::Asset::Template->new($self->session, $self->get("templateId"));
|
||||
|
||||
if ( $self->get("viewDefault") eq "album" ) {
|
||||
my $asset
|
||||
= WebGUI::Asset->newByDynamicClass( $self->session, $self->get("viewAlbumAssetId") );
|
||||
$asset->prepareView;
|
||||
$self->{_viewAsset} = $asset;
|
||||
}
|
||||
else {
|
||||
$self->prepareViewListAlbums;
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 prepareViewListAlbums ( )
|
||||
|
||||
Prepare the template for listing multiple albums.
|
||||
|
||||
=cut
|
||||
|
||||
sub prepareViewListAlbums {
|
||||
my $self = shift;
|
||||
my $template
|
||||
= WebGUI::Asset::Template->new($self->session, $self->get("templateIdListAlbums"));
|
||||
$template->prepare;
|
||||
$self->{_viewTemplate} = $template;
|
||||
}
|
||||
|
|
@ -541,8 +750,7 @@ sub prepareView {
|
|||
|
||||
=head2 view ( )
|
||||
|
||||
method called by the www_view method. Returns a processed template
|
||||
to be displayed within the page style.
|
||||
Show the default view based on the Gallery settings.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -551,7 +759,41 @@ sub view {
|
|||
my $session = $self->session;
|
||||
my $var = $self->get;
|
||||
|
||||
return $self->processTemplate($var, undef, $self->{_viewTemplate});
|
||||
if ( $self->get("viewDefault") eq "album" ) {
|
||||
return $self->{_viewAsset}->view;
|
||||
}
|
||||
else {
|
||||
return $self->view_listAlbums;
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 view_listAlbums ( )
|
||||
|
||||
Show a paginated list of the albums in this gallery. This method does the
|
||||
actual work.
|
||||
|
||||
=cut
|
||||
|
||||
sub view_listAlbums {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $var = $self->getTemplateVars;
|
||||
my $form = $self->session->form;
|
||||
|
||||
my $p
|
||||
= $self->getAlbumPaginator( {
|
||||
perpage => $form->get('perpage'),
|
||||
} );
|
||||
$p->appendTemplateVars( $var );
|
||||
|
||||
for my $assetId ( @{ $p->getPageData } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
push @{ $var->{albums} }, $asset->getTemplateVars;
|
||||
}
|
||||
|
||||
return $self->processTemplate( $var, undef, $self->{_viewTemplate} );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -565,30 +807,218 @@ Show a paginated list of the albums in this gallery.
|
|||
sub www_listAlbums {
|
||||
my $self = shift;
|
||||
|
||||
# Perform the prepareView ourselves
|
||||
$self->prepareViewListAlbums;
|
||||
|
||||
return $self->processStyle(
|
||||
$self->view_listAlbums
|
||||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_listAlbumsRss ( )
|
||||
|
||||
Show an RSS feed for the albums in this gallery.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_listAlbumsRss {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $var = $self->getTemplateVars;
|
||||
|
||||
for my $assetId ( @{ $self->getAlbumIds } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
my $assetVar = $asset->getTemplateVars;
|
||||
|
||||
# Fix URLs
|
||||
for my $key ( qw( url ) ) {
|
||||
$assetVar->{ $key } = $self->session->url->getSiteURL . $assetVar->{ $key };
|
||||
}
|
||||
|
||||
# Additional vars for RSS
|
||||
$assetVar->{ rssDate }
|
||||
= $session->datetime->epochToMail( $assetVar->{ creationDate } );
|
||||
|
||||
push @{ $var->{albums} }, $assetVar;
|
||||
}
|
||||
|
||||
$self->session->http->setMimeType('text/xml');
|
||||
return $self->processTemplate( $var, $self->get("templateIdListAlbumsRss") );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_search ( )
|
||||
|
||||
Search through the GalleryAlbums and files in this gallery. Show the form to
|
||||
search and display the results if necessary.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_search {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
my $db = $self->session->db;
|
||||
|
||||
my $var = $self->getTemplateVars;
|
||||
# NOTE: Search form is added as part of getTemplateVars()
|
||||
|
||||
# Get search results, if necessary.
|
||||
if ($form->get("submit")) {
|
||||
# Keywords to search on
|
||||
my $keywords = join " ", $form->get('basicSearch'),
|
||||
$form->get('keywords'),
|
||||
$form->get('title'),
|
||||
$form->get('description')
|
||||
;
|
||||
|
||||
# Build a where clause from the advanced options
|
||||
# Lineage search can capture gallery
|
||||
my $where = q{assetIndex.assetId <> '} . $self->getId . q{'};
|
||||
if ( $form->get("title") ) {
|
||||
$where .= q{ AND assetData.title LIKE }
|
||||
. $db->quote( '%' . $form->get("title") . '%' )
|
||||
;
|
||||
}
|
||||
if ( $form->get("description") ) {
|
||||
$where .= q{ AND assetData.synopsis LIKE }
|
||||
. $db->quote( '%' . $form->get("description") . '%' )
|
||||
;
|
||||
}
|
||||
if ( $form->get("className") ) {
|
||||
$where .= q{ AND asset.className IN ('}
|
||||
. $db->quoteAndJoin( [$form->get('className','checkList')] )
|
||||
. q{)}
|
||||
;
|
||||
}
|
||||
|
||||
# Build a URL for the pagination
|
||||
my $url
|
||||
= $self->getUrl(
|
||||
'func=search;submit=1;'
|
||||
. 'basicSearch=' . $form->get('basicSearch') . ';'
|
||||
. 'keywords=' . $form->get('keywords') . ';'
|
||||
. 'title=' . $form->get('title') . ';'
|
||||
. 'description=' . $form->get('description') . ';'
|
||||
. 'className=' . $form->get('className') . ';'
|
||||
. 'creationDate_after=' . $form->get('creationDate_after') . ';'
|
||||
. 'creationDate_before=' . $form->get('creationDate_before') . ';'
|
||||
);
|
||||
|
||||
my $p
|
||||
= $self->getSearchPaginator( {
|
||||
url => $url,
|
||||
keywords => $keywords,
|
||||
where => $where,
|
||||
joinClass => ['WebGUI::Asset::Wobject::GalleryAlbum', 'WebGUI::Asset::File::Image::Photo'],
|
||||
} );
|
||||
|
||||
$var->{ keywords } = $keywords;
|
||||
|
||||
$p->appendTemplateVars( $var );
|
||||
for my $result ( @{ $p->getPageData } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $self->session, $result->{assetId} );
|
||||
push @{ $var->{search_results} }, $asset->getTemplateVars;
|
||||
}
|
||||
}
|
||||
|
||||
return $self->processStyle(
|
||||
$self->processTemplate( $var, $self->get("templateIdSearch") )
|
||||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_userGallery ( )
|
||||
=head2 www_listFilesForUser ( )
|
||||
|
||||
Show all the GalleryAlbums and files owned by a given userId. If no userId is
|
||||
given, will use the current user.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_listFilesForUser {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $var = $self->getTemplateVars;
|
||||
my $userId = $self->session->form->get("userId") || $self->session->user->userId;
|
||||
my $user = WebGUI::User->new( $session, $userId );
|
||||
|
||||
$var->{ url_rss } = $self->getUrl('func=listFilesForUserRss;userId=' . $userId);
|
||||
$var->{ userId } = $userId;
|
||||
$var->{ username } = $user->username;
|
||||
|
||||
# Get all the albums
|
||||
my $albumIds = $self->getUserAlbumIds( $userId );
|
||||
for my $albumId ( @$albumIds ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $albumId );
|
||||
push @{ $var->{user_albums} }, $asset->getTemplateVars;
|
||||
}
|
||||
|
||||
# Get a page of files
|
||||
my $p
|
||||
= $self->getUserFilePaginator({
|
||||
userId => $userId,
|
||||
url => $self->getUrl("func=listFilesForUser")
|
||||
});
|
||||
$p->appendTemplateVars( $var );
|
||||
|
||||
for my $fileId ( @{ $p->getPageData } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $fileId );
|
||||
push @{ $var->{user_files} }, $asset->getTemplateVars;
|
||||
}
|
||||
|
||||
return $self->processStyle(
|
||||
$self->processTemplate( $var, $self->get("templateIdListFilesForUser") )
|
||||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_userGalleryRss ( )
|
||||
=head2 www_listFilesForUserRss ( )
|
||||
|
||||
=cut
|
||||
|
||||
sub www_listFilesForUserRss {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $var = $self->getTemplateVars;
|
||||
my $userId = $self->session->form("userId") || $self->session->user->userId;
|
||||
|
||||
# Fix URLs for template vars
|
||||
for my $key ( qw( url ) ) {
|
||||
$var->{ $key } = $self->session->url->getSiteURL . $var->{ $key };
|
||||
}
|
||||
|
||||
# Get all the albums
|
||||
my $albumIds = $self->getUserAlbumIds( $userId );
|
||||
for my $albumId ( @$albumIds ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $albumId );
|
||||
my $assetVar = $asset->getTemplateVars;
|
||||
|
||||
for my $key ( qw( url ) ) {
|
||||
$assetVar->{ $key } = $self->session->url->getSiteURL . $assetVar->{ $key };
|
||||
}
|
||||
|
||||
push @{ $var->{user_albums} }, $assetVar;
|
||||
}
|
||||
|
||||
# Get all the files
|
||||
my $fileIds = $self->getUserFileIds( $userId );
|
||||
for my $fileId ( @$fileIds ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $fileId );
|
||||
my $assetVar = $asset->getTemplateVars;
|
||||
|
||||
for my $key ( qw( url ) ) {
|
||||
$assetVar->{ $key } = $self->session->url->getSiteURL . $assetVar->{ $key };
|
||||
}
|
||||
|
||||
push @{ $var->{user_files} }, $assetVar;
|
||||
}
|
||||
|
||||
$self->session->http->setMimeType('text/xml');
|
||||
return $self->processTemplate( $var, $self->get("templateIdListFilesForUserRss") );
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ $VERSION = "1.0.0";
|
|||
|
||||
use strict;
|
||||
use base 'WebGUI::Asset::Wobject';
|
||||
use Carp qw( croak );
|
||||
use File::Find;
|
||||
use File::Spec;
|
||||
use File::Temp qw{ tempdir };
|
||||
use Tie::IxHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Utility;
|
||||
|
|
@ -47,22 +51,22 @@ sub definition {
|
|||
tie my %properties, 'Tie::IxHash', (
|
||||
allowComments => {
|
||||
fieldType => "yesNo",
|
||||
defaultValue => 0,
|
||||
label => $i18n->get("allowComments label"),
|
||||
hoverHelp => $i18n->get("allowComments description"),
|
||||
defaultValue => 1,
|
||||
},
|
||||
othersCanAdd => {
|
||||
fieldType => "yesNo",
|
||||
defaultValue => 0,
|
||||
label => $i18n->get("othersCanAdd label"),
|
||||
hoverHelp => $i18n->get("othersCanAdd description"),
|
||||
},
|
||||
assetIdThumbnail => {
|
||||
fieldType => "asset",
|
||||
defaultValue => undef,
|
||||
},
|
||||
);
|
||||
|
||||
push @{$definition}, {
|
||||
assetName => $i18n->get('assetName'),
|
||||
autoGenerateForms => 0,
|
||||
icon => 'newWobject.gif',
|
||||
autoGenerateForms => 1,
|
||||
tableName => 'GalleryAlbum',
|
||||
className => __PACKAGE__,
|
||||
properties => \%properties,
|
||||
|
|
@ -90,43 +94,56 @@ sub addArchive {
|
|||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $properties = shift;
|
||||
my $gallery = $self->getParent;
|
||||
|
||||
my $archive = Archive::Any->new( $filename );
|
||||
|
||||
croak "Archive will extract to directory outside of storage location!"
|
||||
if $archive->is_naughty;
|
||||
|
||||
use File::Temp qw{ tempdir };
|
||||
my $tempdirName = tempdir( "WebGUI-Gallery-XXXXXXXX", TMPDIR => 1, CLEANUP => 1);
|
||||
$archive->extract( $tempdir );
|
||||
$archive->extract( $tempdirName );
|
||||
|
||||
opendir my $dh, $tempdirName or die "Could not open temp dir $tempdirName: $!";
|
||||
for my $file (readdir $dh) {
|
||||
my $class = $gallery->getAssetClassForFile( $file );
|
||||
# Get all the files in the archive
|
||||
my @files;
|
||||
my $wanted = sub { push @files, $File::Find::name };
|
||||
find( {
|
||||
wanted => $wanted,
|
||||
}, $tempdirName );
|
||||
|
||||
for my $filePath (@files) {
|
||||
my ($volume, $directory, $filename) = File::Spec->splitpath( $filePath );
|
||||
$self->session->errorHandler->info( "trying $filename" );
|
||||
next if $filename =~ m{^[.]};
|
||||
my $class = $gallery->getAssetClassForFile( $filePath );
|
||||
next unless $class; # class is undef for those files the Gallery can't handle
|
||||
|
||||
$self->addChild({
|
||||
className => $class,
|
||||
title => $properties->{title},
|
||||
menuTitle => $properties->{menuTitle} || $properties->{title},
|
||||
synopsis => $properties->{synopsis},
|
||||
});
|
||||
$self->session->errorHandler->info( "Adding $filename to album!" );
|
||||
$properties->{ className } = $class;
|
||||
$properties->{ menuTitle } = $filename;
|
||||
$properties->{ title } = $filename;
|
||||
$properties->{ url } = $self->getUrl . "/" . $filename;
|
||||
|
||||
my $asset = $self->addChild( $properties, undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
$asset->setFile( $filePath );
|
||||
}
|
||||
closedir $dh;
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $self->session );
|
||||
$versionTag->set({
|
||||
"workflowId" => $self->getParent->get("workflowIdCommit"),
|
||||
});
|
||||
$versionTag->requestCommit;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 appendTemplateVarsFileLoop ( vars, options )
|
||||
=head2 appendTemplateVarsFileLoop ( vars, assetIds )
|
||||
|
||||
Append template vars for a file loop with the specified options. C<vars> is
|
||||
a hash reference to add the file loop to. C<options> is a hash reference of
|
||||
options with the following keys:
|
||||
|
||||
perpage => number | "all"
|
||||
If "all", no pagination will be done.
|
||||
url => url
|
||||
The URL to the current page
|
||||
Append template vars for a file loop for the specified assetIds. C<vars> is
|
||||
a hash reference to add the file loop to. C<assetIds> is an array reference
|
||||
of assetIds for the loop.
|
||||
|
||||
Returns the hash reference for convenience.
|
||||
|
||||
|
|
@ -135,17 +152,10 @@ Returns the hash reference for convenience.
|
|||
sub appendTemplateVarsFileLoop {
|
||||
my $self = shift;
|
||||
my $var = shift;
|
||||
my $options = shift;
|
||||
my $assetIds = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
my @assetIds;
|
||||
if ($options->{perpage} eq "all") {
|
||||
@assetIds = @{ $self->getFileIds };
|
||||
}
|
||||
else {
|
||||
@assetIds = @{ $self->getFilePaginator($options->{url})->getPageData };
|
||||
}
|
||||
|
||||
for my $assetId (@assetIds) {
|
||||
for my $assetId (@$assetIds) {
|
||||
push @{$var->{file_loop}},
|
||||
WebGUI::Asset->newByDynamicClass($session, $assetId)->getTemplateVars;
|
||||
}
|
||||
|
|
@ -168,6 +178,7 @@ C<othersCanAdd> is true and the Gallery allows them to add files.
|
|||
sub canAddFile {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
my $gallery = $self->getParent;
|
||||
|
||||
return 1 if $userId eq $self->get("ownerUserId");
|
||||
return 1 if $self->get("othersCanAdd") && $gallery->canAddFile( $userId );
|
||||
|
|
@ -214,11 +225,15 @@ sub canEdit {
|
|||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
my $gallery = $self->getParent;
|
||||
my $form = $self->session->form;
|
||||
|
||||
# Handle adding a photo
|
||||
if ( $form->get("func") eq "add" ) {
|
||||
return $self->canAddFile;
|
||||
}
|
||||
elsif ( $form->get("func") eq "editSave" && $form->get("className") eq __PACKAGE__ ) {
|
||||
return $self->canAddFile;
|
||||
}
|
||||
else {
|
||||
return 1 if $userId eq $self->get("ownerUserId");
|
||||
|
||||
|
|
@ -233,13 +248,23 @@ sub canEdit {
|
|||
Returns true if the user can view this asset. C<userId> is a WebGUI user ID.
|
||||
If no userId is given, checks the current user.
|
||||
|
||||
Users can view this album if they can view the containing Gallery.
|
||||
|
||||
NOTE: It may be possible to view a GalleryAlbum that has no public files. In
|
||||
such cases, the GalleryAlbum will appear empty to unprivileged users. This is
|
||||
not a bug.
|
||||
|
||||
=cut
|
||||
|
||||
# Inherited from superclass
|
||||
sub canView {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
return $self->getParent->canView($userId);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 i18n ( [ session ] )
|
||||
=head2 i18n ( session )
|
||||
|
||||
Get a WebGUI::International object for this class.
|
||||
|
||||
|
|
@ -260,6 +285,19 @@ sub i18n {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getAutoCommitWorkflowId ( )
|
||||
|
||||
Returns the workflowId of the Gallery's approval workflow.
|
||||
|
||||
=cut
|
||||
|
||||
sub getAutoCommitWorkflowId {
|
||||
my $self = shift;
|
||||
return $self->getParent->get("workflowIdCommit");
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getFileIds ( )
|
||||
|
||||
Gets an array reference of asset IDs for all the files in this album.
|
||||
|
|
@ -270,9 +308,7 @@ sub getFileIds {
|
|||
my $self = shift;
|
||||
my $gallery = $self->getParent;
|
||||
|
||||
return $self->assetLineage( ['descendants'], {
|
||||
includeOnlyClasses => $gallery->getAllAssetClassesForFile,
|
||||
});
|
||||
return $self->getLineage( ['descendants'], { } );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -286,7 +322,7 @@ url to the current page that will be given to the paginator.
|
|||
|
||||
sub getFilePaginator {
|
||||
my $self = shift;
|
||||
my $url = shift;
|
||||
my $url = shift || $self->getUrl;
|
||||
|
||||
my $p = WebGUI::Paginator->new( $self->session, $url );
|
||||
$p->setDataByArrayRef( $self->getFileIds );
|
||||
|
|
@ -304,15 +340,77 @@ Gets template vars common to all views.
|
|||
|
||||
sub getTemplateVars {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $gallery = $self->getParent;
|
||||
my $var = $self->get;
|
||||
my $owner = WebGUI::User->new( $session, $self->get("ownerUserId") );
|
||||
|
||||
# Permissions
|
||||
$var->{ canAddFile } = $self->canAddFile;
|
||||
$var->{ canEdit } = $self->canEdit;
|
||||
|
||||
# Add some common template vars from Gallery
|
||||
$gallery->appendTemplateVarsSearchForm( $var );
|
||||
$var->{ url_listAlbums } = $gallery->getUrl('func=listAlbums');
|
||||
$var->{ url_listAlbumsRss } = $gallery->getUrl('func=listAlbumsRss');
|
||||
$var->{ url_listFilesForCurrentUser } = $gallery->getUrl('func=listFilesForUser');
|
||||
$var->{ url_search } = $gallery->getUrl('func=search');
|
||||
|
||||
$var->{ url } = $self->getUrl;
|
||||
# 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_addNoClass } = $self->getUrl("func=add");
|
||||
$var->{ url_delete } = $self->getUrl("func=delete");
|
||||
$var->{ url_edit } = $self->getUrl("func=edit");
|
||||
$var->{ url_listFilesForOwner } = $gallery->getUrl("func=listFilesForUser;userId=".$var->{ownerUserId});
|
||||
$var->{ url_viewRss } = $self->getUrl("func=viewRss");
|
||||
$var->{ url_slideshow } = $self->getUrl("func=slideshow");
|
||||
$var->{ url_thumbnails } = $self->getUrl("func=thumbnails");
|
||||
|
||||
$var->{ fileCount } = $self->getChildCount;
|
||||
$var->{ ownerUsername } = $owner->username;
|
||||
$var->{ thumbnailUrl } = $self->getThumbnailUrl;
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getThumbnailUrl ( )
|
||||
|
||||
Gets the URL for the thumbnail for this asset. If no asset is set, gets the
|
||||
first child.
|
||||
|
||||
NOTE: If the asset does not have a getThumbnailUrl method, this method will
|
||||
return undef.
|
||||
|
||||
=cut
|
||||
|
||||
sub getThumbnailUrl {
|
||||
my $self = shift;
|
||||
my $asset = undef;
|
||||
|
||||
if ( $self->get("assetIdThumbnail") ) {
|
||||
$asset = WebGUI::Asset->newByDynamicClass( $self->session, $self->get("assetIdThumbnail") );
|
||||
}
|
||||
elsif ( $self->getFirstChild ) {
|
||||
$asset = $self->getFirstChild;
|
||||
}
|
||||
else {
|
||||
return undef;
|
||||
}
|
||||
|
||||
if ( $asset->can("getThumbnailUrl") ) {
|
||||
return $asset->getThumbnailUrl;
|
||||
}
|
||||
else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 othersCanAdd ( )
|
||||
|
||||
Returns true if people other than the owner can add files to this album.
|
||||
|
|
@ -360,6 +458,26 @@ sub processStyle {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 processPropertiesFromFormPost ( )
|
||||
|
||||
Process the form to save the asset. Request approval from the Gallery's
|
||||
approval workflow.
|
||||
|
||||
=cut
|
||||
|
||||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
my $errors = $self->SUPER::processPropertiesFromFormPost || [];
|
||||
|
||||
# Return if error
|
||||
return $errors if @$errors;
|
||||
|
||||
# Passes all checks
|
||||
$self->requestAutoCommit;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
||||
method called by the www_view method. Returns a processed template
|
||||
|
|
@ -371,8 +489,10 @@ sub view {
|
|||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $var = $self->getTemplateVars;
|
||||
|
||||
$self->appendTemplateVarsFileLoop( $var );
|
||||
|
||||
my $p = $self->getFilePaginator;
|
||||
$p->appendTemplateVars( $var );
|
||||
$self->appendTemplateVarsFileLoop( $var, $p->getPageData );
|
||||
|
||||
return $self->processTemplate($var, undef, $self->{_viewTemplate});
|
||||
}
|
||||
|
|
@ -384,6 +504,8 @@ sub view {
|
|||
method called by the www_slideshow method. Returns a processed template to be
|
||||
displayed within the page style.
|
||||
|
||||
Show a slideshow of the GalleryAlbum's files.
|
||||
|
||||
=cut
|
||||
|
||||
sub view_slideshow {
|
||||
|
|
@ -391,9 +513,9 @@ sub view_slideshow {
|
|||
my $session = $self->session;
|
||||
my $var = $self->getTemplateVars;
|
||||
|
||||
$self->appendTemplateVarsFileLoop( $var, { perpage => "all" } );
|
||||
$self->appendTemplateVarsFileLoop( $var, $self->getFileIds );
|
||||
|
||||
return $self->processTemplate($var, $self->getParent->get("templateIdSlideshow"));
|
||||
return $self->processTemplate($var, $self->getParent->get("templateIdViewSlideshow"));
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -403,6 +525,9 @@ sub view_slideshow {
|
|||
method called by the www_thumbnails method. Returns a processed template to be
|
||||
displayed within the page style.
|
||||
|
||||
Shows all the thumbnails for this GalleryAlbum. In addition, shows details
|
||||
about a specific thumbnail.
|
||||
|
||||
=cut
|
||||
|
||||
sub view_thumbnails {
|
||||
|
|
@ -410,9 +535,31 @@ sub view_thumbnails {
|
|||
my $session = $self->session;
|
||||
my $var = $self->getTemplateVars;
|
||||
|
||||
$self->appendTemplateVarsFileLoop( $var, { perpage => "all" } );
|
||||
my $fileId = $session->form->get("fileId");
|
||||
|
||||
return $self->processTemplate($var, $self->getParent->get("templateIdThumbnails"));
|
||||
$self->appendTemplateVarsFileLoop( $var, $self->getFileIds );
|
||||
|
||||
# Process the file loop to add an additional URL
|
||||
for my $file ( @{ $var->{file_loop} } ) {
|
||||
$file->{ url_albumViewThumbnails }
|
||||
= $self->getUrl('func=thumbnails;fileId=' . $file->{assetId});
|
||||
}
|
||||
|
||||
# Add direct vars for the requested file
|
||||
my $asset;
|
||||
if ($fileId) {
|
||||
$asset = WebGUI::Asset->newByDynamicClass( $session, $fileId );
|
||||
}
|
||||
# If no fileId given or fileId does not exist
|
||||
if (!$asset) {
|
||||
$asset = $self->getFirstChild;
|
||||
}
|
||||
my %assetVars = %{ $asset->getTemplateVars };
|
||||
for my $key ( keys %assetVars ) {
|
||||
$var->{ 'file_' . $key } = $assetVars{ $key };
|
||||
}
|
||||
|
||||
return $self->processTemplate($var, $self->getParent->get("templateIdViewThumbnails"));
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -428,8 +575,42 @@ sub www_addArchive {
|
|||
|
||||
return $self->session->privilege->insufficient unless $self->canAddFile;
|
||||
|
||||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $var = $self->getTemplateVars;
|
||||
|
||||
$var->{ form_start }
|
||||
= WebGUI::Form::formHeader( $session, {
|
||||
action => $self->getUrl('func=addArchiveSave'),
|
||||
});
|
||||
$var->{ form_end }
|
||||
= WebGUI::Form::formFooter( $session );
|
||||
|
||||
$var->{ form_submit }
|
||||
= WebGUI::Form::submit( $session, {
|
||||
name => "submit",
|
||||
value => "Submit",
|
||||
});
|
||||
|
||||
$var->{ form_archive }
|
||||
= WebGUI::Form::File( $session, {
|
||||
name => "archive",
|
||||
maxAttachments => 1,
|
||||
value => ( $form->get("archive") ),
|
||||
});
|
||||
|
||||
$var->{ form_keywords }
|
||||
= WebGUI::Form::text( $session, {
|
||||
name => "keywords",
|
||||
value => ( $form->get("keywords") ),
|
||||
});
|
||||
|
||||
$var->{ form_friendsOnly }
|
||||
= WebGUI::Form::yesNo( $session, {
|
||||
name => "friendsOnly",
|
||||
value => ( $form->get("friendsOnly") ),
|
||||
});
|
||||
|
||||
return $self->processStyle(
|
||||
$self->processTemplate($var, $self->getParent->get("templateIdAddArchive"))
|
||||
);
|
||||
|
|
@ -446,20 +627,27 @@ Process the form for adding an archive.
|
|||
sub www_addArchiveSave {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient unless $self->canAddfile;
|
||||
return $self->session->privilege->insufficient unless $self->canAddFile;
|
||||
|
||||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $properties = {
|
||||
keywords => $form->get("keywords"),
|
||||
friendsOnly => $form->get("friendsOnly"),
|
||||
};
|
||||
|
||||
my $storage = $form->get("archive", "File");
|
||||
my $filename = $storage->getFilePath( $storage->getFiles->[0] );
|
||||
my $storageId = $form->get("archive", "File");
|
||||
my $storage = WebGUI::Storage->get( $session, $storageId );
|
||||
my $filename = $storage->getPath( $storage->getFiles->[0] );
|
||||
|
||||
$self->addArchive( $filename, $properties );
|
||||
|
||||
return $self->www_view;
|
||||
$storage->delete;
|
||||
|
||||
return $self->processStyle(
|
||||
sprintf $i18n->get('addArchive message'), $self->getUrl,
|
||||
);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
@ -476,7 +664,7 @@ sub www_delete {
|
|||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $var = $self->getTemplateVars;
|
||||
$var->{ url_yes } = $self->getUrl("?func=deleteConfirm");
|
||||
$var->{ url_yes } = $self->getUrl("func=deleteConfirm");
|
||||
|
||||
return $self->processStyle(
|
||||
$self->processTemplate( $var, $self->getParent->get("templateIdDeleteAlbum") )
|
||||
|
|
@ -496,9 +684,130 @@ sub www_deleteConfirm {
|
|||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $gallery = $self->getParent;
|
||||
|
||||
$self->purge;
|
||||
|
||||
return $self->getParent->www_view;
|
||||
return $gallery->www_view;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit ( )
|
||||
|
||||
Show the form to add / edit a GalleryAlbum asset.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $var = $self->getTemplateVars;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
|
||||
# Generate the form
|
||||
if ($form->get("func") eq "add") {
|
||||
$var->{ form_start }
|
||||
= WebGUI::Form::formHeader( $session, {
|
||||
action => $self->getParent->getUrl('func=editSave;assetId=new;class='.__PACKAGE__),
|
||||
});
|
||||
}
|
||||
else {
|
||||
$var->{ form_start }
|
||||
= WebGUI::Form::formHeader( $session, {
|
||||
action => $self->getUrl('func=editSave'),
|
||||
});
|
||||
}
|
||||
$var->{ form_start }
|
||||
.= WebGUI::Form::hidden( $session, {
|
||||
name => "proceed",
|
||||
value => "showConfirmation",
|
||||
});
|
||||
|
||||
$var->{ form_end }
|
||||
= WebGUI::Form::formFooter( $session );
|
||||
|
||||
$var->{ form_cancel }
|
||||
= WebGUI::Form::button( $session, {
|
||||
name => "cancel",
|
||||
value => $i18n->get("cancel"),
|
||||
extras => 'onclick="history.go(-1)"',
|
||||
});
|
||||
|
||||
$var->{ form_submit }
|
||||
= WebGUI::Form::submit( $session, {
|
||||
name => "save",
|
||||
value => $i18n->get("save"),
|
||||
});
|
||||
|
||||
$var->{ form_title }
|
||||
= WebGUI::Form::text( $session, {
|
||||
name => "title",
|
||||
value => $form->get("title") || $self->get("title"),
|
||||
});
|
||||
|
||||
$var->{ form_description }
|
||||
= WebGUI::Form::HTMLArea( $session, {
|
||||
name => "description",
|
||||
value => $form->get("description") || $self->get("description"),
|
||||
});
|
||||
|
||||
# Generate the file loop
|
||||
my $thumbnailUrl = $self->getThumbnailUrl;
|
||||
$self->appendTemplateVarsFileLoop( $var, $self->getFileIds );
|
||||
for my $file ( @{ $var->{file_loop} } ) {
|
||||
if ( $thumbnailUrl eq $file->{thumbnailUrl} ) {
|
||||
$file->{ isAlbumThumbnail } = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $self->processStyle(
|
||||
$self->processTemplate( $var, $self->getParent->get("templateIdEditAlbum") )
|
||||
);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_editSave ( )
|
||||
|
||||
Save the asset edit form. Overridden to give a nice message when a photo or
|
||||
album is added
|
||||
|
||||
=cut
|
||||
|
||||
sub www_editSave {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
my $i18n = __PACKAGE__->i18n($self->session);
|
||||
$self->SUPER::www_editSave;
|
||||
|
||||
if ( $form->get("assetId") eq "new" ) {
|
||||
return sprintf $i18n->get("addFile message"), $self->getUrl,
|
||||
}
|
||||
else {
|
||||
return sprintf $i18n->get("save message"), $self->getUrl,
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_showConfirmation ( )
|
||||
|
||||
Shows the confirmation message after adding / editing a gallery album.
|
||||
Provides links to view the album.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_showConfirmation {
|
||||
my $self = shift;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
|
||||
my $output = sprintf $i18n->get('save message'), $self->getUrl;
|
||||
|
||||
return $self->processStyle(
|
||||
$output
|
||||
);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
@ -547,7 +856,27 @@ sub www_viewRss {
|
|||
|
||||
return $self->session->privilege->insufficient unless $self->canView;
|
||||
|
||||
my $var = $self->getTemplateVars;
|
||||
$self->appendTemplateVarsFileLoop( $var, $self->getFileIds );
|
||||
|
||||
# Fix URLs to be full URLs
|
||||
for my $key ( qw( url url_viewRss ) ) {
|
||||
$var->{ $key } = $self->session->url->getSiteURL . $var->{ $key };
|
||||
}
|
||||
|
||||
# Process the file loop to add additional params
|
||||
for my $file ( @{ $var->{file_loop} } ) {
|
||||
# Fix URLs to be full URLs
|
||||
for my $key ( qw( url ) ) {
|
||||
$file->{ $key } = $self->session->url->getSiteURL . $file->{$key};
|
||||
}
|
||||
|
||||
$file->{ rssDate }
|
||||
= $self->session->datetime->epochToMail( $file->{creationDate} );
|
||||
}
|
||||
|
||||
$self->session->http->setMimeType('text/xml');
|
||||
return $self->processTemplate( $var, $self->getParent->get('templateIdViewAlbumRss') );
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ package WebGUI::Asset;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use Carp qw( croak );
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -82,9 +83,9 @@ sub addChild {
|
|||
$self->session->db->commit;
|
||||
$properties->{assetId} = $id;
|
||||
$properties->{parentId} = $self->getId;
|
||||
my $temp = WebGUI::Asset->newByPropertyHashRef($self->session,$properties);
|
||||
my $temp = WebGUI::Asset->newByPropertyHashRef($self->session,$properties) || croak "Couldn't create a new $properties->{className} asset!";
|
||||
$temp->{_parent} = $self;
|
||||
my $newAsset = $temp->addRevision($properties,$now, {skipAutoCommitWorkflows=>$options->{skipAutoCommitWorkflows}});
|
||||
my $newAsset = $temp->addRevision($properties, $now, $options);
|
||||
$self->updateHistory("added child ".$id);
|
||||
$self->session->http->setStatus(201,"Asset Creation Successful");
|
||||
return $newAsset;
|
||||
|
|
|
|||
|
|
@ -125,18 +125,22 @@ A hash reference containing the exported data.
|
|||
=cut
|
||||
|
||||
sub importAssetData {
|
||||
my $self = shift;
|
||||
my $data = shift;
|
||||
my $error = $self->session->errorHandler;
|
||||
my $id = $data->{properties}{assetId};
|
||||
my $class = $data->{properties}{className};
|
||||
my $version = $data->{properties}{revisionDate};
|
||||
my $self = shift;
|
||||
my $data = shift;
|
||||
my $error = $self->session->errorHandler;
|
||||
my $id = $data->{properties}{assetId};
|
||||
my $class = $data->{properties}{className};
|
||||
my $version = $data->{properties}{revisionDate};
|
||||
|
||||
# Load the class
|
||||
WebGUI::Asset->loadModule( $self->session, $class );
|
||||
|
||||
my $asset;
|
||||
my $assetExists = WebGUI::Asset->assetExists($self->session, $id, $class, $version);
|
||||
if ($assetExists) { # update an existing revision
|
||||
my $assetExists = WebGUI::Asset->assetExists($self->session, $id, $class, $version);
|
||||
if ($assetExists) { # update an existing revision
|
||||
$asset = WebGUI::Asset->new($self->session, $id, $class, $version);
|
||||
$error->info("Updating an existing revision of asset $id");
|
||||
$asset->update($data->{properties});
|
||||
$error->info("Updating an existing revision of asset $id");
|
||||
$asset->update($data->{properties});
|
||||
##Pending assets are assigned a new version tag
|
||||
if ($data->{properties}->{status} eq 'pending') {
|
||||
$self->session->db->write(
|
||||
|
|
@ -144,19 +148,19 @@ sub importAssetData {
|
|||
[WebGUI::VersionTag->getWorking($self->session)->getId, $data->{properties}->{assetId}]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$asset = WebGUI::Asset->new($self->session, $id, $class);
|
||||
if (defined $asset) { # create a new revision of an existing asset
|
||||
$error->info("Creating a new revision of asset $id");
|
||||
$asset = $asset->addRevision($data->{properties}, $version, {skipAutoCommitWorkflows => 1});
|
||||
}
|
||||
$asset = WebGUI::Asset->new($self->session, $id, $class);
|
||||
if (defined $asset) { # create a new revision of an existing asset
|
||||
$error->info("Creating a new revision of asset $id");
|
||||
$asset = $asset->addRevision($data->{properties}, $version, {skipAutoCommitWorkflows => 1});
|
||||
}
|
||||
else { # add an entirely new asset
|
||||
$error->info("Adding $id that didn't previously exist.");
|
||||
$asset = $self->addChild($data->{properties}, $id, $version, {skipAutoCommitWorkflows => 1});
|
||||
}
|
||||
}
|
||||
return $asset;
|
||||
$error->info("Adding $id that didn't previously exist.");
|
||||
$asset = $self->addChild($data->{properties}, $id, $version, {skipAutoCommitWorkflows => 1});
|
||||
}
|
||||
}
|
||||
return $asset;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -188,40 +192,40 @@ A reference to a WebGUI::Storage object that contains a webgui package file.
|
|||
=cut
|
||||
|
||||
sub importPackage {
|
||||
my $self = shift;
|
||||
my $storage = shift;
|
||||
my $decompressed = $storage->untar($storage->getFiles->[0]);
|
||||
my %assets = ();
|
||||
my $error = $self->session->errorHandler;
|
||||
$error->info("Importing package.");
|
||||
foreach my $file (sort(@{$decompressed->getFiles})) {
|
||||
next unless ($decompressed->getFileExtension($file) eq "json");
|
||||
$error->info("Found data file $file");
|
||||
my $data = eval{
|
||||
my $self = shift;
|
||||
my $storage = shift;
|
||||
my $decompressed = $storage->untar($storage->getFiles->[0]);
|
||||
my %assets = ();
|
||||
my $error = $self->session->errorHandler;
|
||||
$error->info("Importing package.");
|
||||
foreach my $file (sort(@{$decompressed->getFiles})) {
|
||||
next unless ($decompressed->getFileExtension($file) eq "json");
|
||||
$error->info("Found data file $file");
|
||||
my $data = eval{
|
||||
local $JSON::UnMapping = 1;
|
||||
JSON::jsonToObj($decompressed->getFileContentsAsScalar($file))
|
||||
};
|
||||
if ($@ || $data->{properties}{assetId} eq "" || $data->{properties}{className} eq "" || $data->{properties}{revisionDate} eq "") {
|
||||
$error->error("package corruption: ".$@) if ($@);
|
||||
return "corrupt";
|
||||
}
|
||||
$error->info("Data file $file is valid and represents asset ".$data->{properties}{assetId});
|
||||
foreach my $storageId (@{$data->{storage}}) {
|
||||
my $assetStorage = WebGUI::Storage->get($self->session, $storageId);
|
||||
$decompressed->untar($storageId.".storage", $assetStorage);
|
||||
}
|
||||
my $asset = $assets{$data->{properties}{parentId}} || $self;
|
||||
my $newAsset = $asset->importAssetData($data);
|
||||
if ($@ || $data->{properties}{assetId} eq "" || $data->{properties}{className} eq "" || $data->{properties}{revisionDate} eq "") {
|
||||
$error->error("package corruption: ".$@) if ($@);
|
||||
return "corrupt";
|
||||
}
|
||||
$error->info("Data file $file is valid and represents asset ".$data->{properties}{assetId});
|
||||
foreach my $storageId (@{$data->{storage}}) {
|
||||
my $assetStorage = WebGUI::Storage->get($self->session, $storageId);
|
||||
$decompressed->untar($storageId.".storage", $assetStorage);
|
||||
}
|
||||
my $asset = $assets{$data->{properties}{parentId}} || $self;
|
||||
my $newAsset = $asset->importAssetData($data);
|
||||
$newAsset->importAssetCollateralData($data);
|
||||
$assets{$newAsset->getId} = $newAsset;
|
||||
}
|
||||
if ($self->session->setting->get("autoRequestCommit")) {
|
||||
$assets{$newAsset->getId} = $newAsset;
|
||||
}
|
||||
if ($self->session->setting->get("autoRequestCommit")) {
|
||||
if ($self->session->setting->get("skipCommitComments")) {
|
||||
WebGUI::VersionTag->getWorking($self->session)->requestCommit;
|
||||
} else {
|
||||
$self->session->http->setRedirect($self->getUrl("op=commitVersionTag;tagId=".WebGUI::VersionTag->getWorking($self->session)->getId));
|
||||
$self->session->http->setRedirect($self->getUrl("op=commitVersionTag;tagId=".WebGUI::VersionTag->getWorking($self->session)->getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,12 +79,12 @@ If this is set to 1 then assets that normally send notifications will (like CS P
|
|||
sub addRevision {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
my $now = shift || $self->session->datetime->time();
|
||||
my $options = shift;
|
||||
|
||||
my $now = shift || $self->session->datetime->time();
|
||||
my $options = shift;
|
||||
|
||||
my $autoCommitId = $self->getAutoCommitWorkflowId() unless ($options->{skipAutoCommitWorkflows});
|
||||
|
||||
my $workingTag
|
||||
|
||||
my $workingTag
|
||||
= ($autoCommitId)
|
||||
? WebGUI::VersionTag->create($self->session, {groupToUse=>'12', workflowId=>$autoCommitId})
|
||||
: WebGUI::VersionTag->getWorking($self->session)
|
||||
|
|
@ -104,8 +104,7 @@ sub addRevision {
|
|||
$self->session->user->userId,
|
||||
$workingTag->getId,
|
||||
$self->getId,
|
||||
]
|
||||
);
|
||||
]);
|
||||
|
||||
foreach my $definition (@{$self->definition($self->session)}) {
|
||||
unless ($definition->{tableName} eq "assetData") {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ package WebGUI::Form;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use Carp qw( croak );
|
||||
use Scalar::Util qw( blessed );
|
||||
use Tie::IxHash;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::RichEdit;
|
||||
|
|
@ -92,7 +94,7 @@ sub formFooter {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 formHeader ( session, hashRef )
|
||||
=head2 formHeader ( session, options )
|
||||
|
||||
Returns a form header.
|
||||
|
||||
|
|
@ -100,7 +102,7 @@ Returns a form header.
|
|||
|
||||
A reference to the current session.
|
||||
|
||||
=head3 hashRef
|
||||
=head3 options
|
||||
|
||||
A hash reference that contains one or more of the following parameters.
|
||||
|
||||
|
|
@ -108,6 +110,9 @@ A hash reference that contains one or more of the following parameters.
|
|||
|
||||
The form action. Defaults to the current page.
|
||||
|
||||
NOTE: If the C<action> contains a query string (?param=value), C<formHeader>
|
||||
will translate the parameters into hidden form elements automatically.
|
||||
|
||||
=head4 method
|
||||
|
||||
The form method. Defaults to "post".
|
||||
|
|
@ -118,28 +123,36 @@ The form enctype. Defaults to "multipart/form-data".
|
|||
|
||||
=head4 extras
|
||||
|
||||
If you want to add anything special to the form header like javascript actions or stylesheet info, then use this.
|
||||
If you want to add anything special to the form header like javascript
|
||||
actions or stylesheet info, then use this.
|
||||
|
||||
=cut
|
||||
|
||||
sub formHeader {
|
||||
my $session = shift;
|
||||
my $params = shift;
|
||||
my $action = $params->{action} || $session->url->page();
|
||||
my $hidden;
|
||||
if ($action =~ /\?/) {
|
||||
my ($path,$query) = split(/\?/,$action);
|
||||
$action = $path;
|
||||
my @params = split(/\;/,$query);
|
||||
foreach my $param (@params) {
|
||||
$param =~ s/amp;(.*)/$1/;
|
||||
my ($name,$value) = split(/\=/,$param);
|
||||
$hidden .= hidden($session,{name=>$name,value=>$value});
|
||||
}
|
||||
}
|
||||
my $method = $params->{method} || "post";
|
||||
my $enctype = $params->{enctype} || "multipart/form-data";
|
||||
return '<form action="'.$action.'" enctype="'.$enctype.'" method="'.$method.'" '.$params->{extras}.'><div class="formContents">'.$hidden;
|
||||
my $session = shift;
|
||||
my $params = shift || {};
|
||||
|
||||
croak "First parameter must be WebGUI::Session object"
|
||||
unless blessed $session && $session->isa( "WebGUI::Session" );
|
||||
croak "Second parameter must be hash reference"
|
||||
if ref $params ne "HASH";
|
||||
|
||||
my $action = exists $params->{ action } ? $params->{ action } : $session->url->page();
|
||||
my $method = exists $params->{ method } ? $params->{ method } : "post";
|
||||
my $enctype = exists $params->{ enctype } ? $params->{ enctype } : "multipart/form-data";
|
||||
|
||||
# Fix a query string in the action URL
|
||||
my $hidden;
|
||||
if ($action =~ /\?/) {
|
||||
($action, my $query) = split /\?/, $action, 2;
|
||||
my @params = split /[&;]/, $query;
|
||||
foreach my $param ( @params ) {
|
||||
my ($name, $value) = split /=/, $param;
|
||||
$hidden .= hidden( $session, { name => $name, value => $value } );
|
||||
}
|
||||
}
|
||||
|
||||
return '<form action="'.$action.'" enctype="'.$enctype.'" method="'.$method.'" '.$params->{extras}.'><div class="formContents">'.$hidden;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
101
lib/WebGUI/Form/SelectRichEditor.pm
Normal file
101
lib/WebGUI/Form/SelectRichEditor.pm
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
package WebGUI::Form::SelectRichEditor;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2007 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::Form::SelectBox';
|
||||
use WebGUI::International;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
WebGUI::Form::SelectRichEditor
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Creates a select box to choose a Rich Text Editor asset.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::SelectBox.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
The following methods are specifically available from this class. Check the superclass for additional methods.
|
||||
|
||||
=cut
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 defaultValue
|
||||
|
||||
Defaults to the Post Rich Editor, the least-featured Rich Text Editor and the
|
||||
one most likely to be selected by users of this form control.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift || [];
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
push @{$definition}, {
|
||||
formName => {
|
||||
defaultValue => $i18n->get("475"),
|
||||
},
|
||||
defaultValue => {
|
||||
defaultValue => '',
|
||||
},
|
||||
};
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 new
|
||||
|
||||
Create a new WebGUI::Form::SelectRichEditor object and populate it with all
|
||||
the available Rich Text Editor assets.
|
||||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $self = $class->SUPER::new(@_);
|
||||
|
||||
# Get all the RTEs available to this site
|
||||
my $options
|
||||
= $self->session->db->buildHashRef( q{
|
||||
SELECT DISTINCT(assetData.assetId), assetData.title
|
||||
FROM asset, assetData
|
||||
WHERE asset.className='WebGUI::Asset::RichEdit'
|
||||
AND asset.assetId=assetData.assetId
|
||||
ORDER BY assetData.title
|
||||
});
|
||||
|
||||
$self->set( "options", $options );
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
229
lib/WebGUI/Help/Asset_Gallery.pm
Normal file
229
lib/WebGUI/Help/Asset_Gallery.pm
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
package WebGUI::Help::Asset_Gallery;
|
||||
|
||||
our $HELP = {
|
||||
'help searchForm' => {
|
||||
title => 'help searchForm title',
|
||||
body => 'help searchForm body',
|
||||
variables => [
|
||||
{
|
||||
name => 'searchForm_start',
|
||||
description => 'helpvar searchForm_start',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_end',
|
||||
description => 'helpvar searchForm_end',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_basicSearch',
|
||||
description => 'helpvar searchForm_basicSearch',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_title',
|
||||
description => 'helpvar searchForm_title',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_description',
|
||||
description => 'helpvar searchForm_description',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_keywords',
|
||||
description => 'helpvar searchForm_keywords',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_className',
|
||||
description => 'helpvar searchForm_className',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_creationDate_after',
|
||||
description => 'helpvar searchForm_creationDate_after',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_creationDate_before',
|
||||
description => 'helpvar searchForm_creationDate_before',
|
||||
},
|
||||
{
|
||||
name => 'searchForm_submit',
|
||||
description => 'helpvar searchForm_submit',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help common' => {
|
||||
title => 'help common title',
|
||||
body => 'help common body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help searchForm',
|
||||
namespace => 'Asset_Gallery',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'url_addAlbum',
|
||||
description => 'helpvar url_addAlbum',
|
||||
},
|
||||
{
|
||||
name => 'url_listAlbums',
|
||||
description => 'helpvar url_listAlbums',
|
||||
},
|
||||
{
|
||||
name => 'url_listAlbumsRss',
|
||||
description => 'helpvar url_listAlbumsRss',
|
||||
},
|
||||
{
|
||||
name => 'url_listFilesForCurrentUser',
|
||||
description => 'helpvar url_listFilesForCurrentUser',
|
||||
},
|
||||
{
|
||||
name => 'url_search',
|
||||
description => 'helpvar url_search',
|
||||
},
|
||||
{
|
||||
name => 'canEdit',
|
||||
description => 'helpvar canEdit',
|
||||
},
|
||||
{
|
||||
name => 'canAddFile',
|
||||
description => 'helpvar canAddFile',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help listAlbums' => {
|
||||
title => 'help listAlbums title',
|
||||
body => 'help listAlbums body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Gallery',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'albums',
|
||||
description => 'helpvar albums',
|
||||
},
|
||||
],
|
||||
related => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help listAlbumsRss' => {
|
||||
title => 'help listAlbumsRss title',
|
||||
body => 'help listAlbumsRss body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Gallery',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'albums',
|
||||
description => 'helpvar albums rss',
|
||||
variables => [
|
||||
{
|
||||
name => 'rssDate',
|
||||
description => 'helpvar rssDate',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
related => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help search' => {
|
||||
title => 'help search title',
|
||||
body => 'help search body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Gallery',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'search_results',
|
||||
description => 'helpvar search_results',
|
||||
},
|
||||
],
|
||||
# All classes that can be found by a Gallery search go in here
|
||||
related => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Photo',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help listFilesForUser' => {
|
||||
title => 'help listFilesForUser title',
|
||||
body => 'help listFilesForUser body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Gallery',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'user_albums',
|
||||
description => 'helpvar user_albums',
|
||||
},
|
||||
{
|
||||
name => 'user_files',
|
||||
description => 'helpvar user_files',
|
||||
},
|
||||
{
|
||||
name => 'userId',
|
||||
description => 'helpvar userId',
|
||||
},
|
||||
{
|
||||
name => 'url_rss',
|
||||
description => 'helpvar url_rss',
|
||||
},
|
||||
{
|
||||
name => 'username',
|
||||
description => 'helpvar username',
|
||||
},
|
||||
],
|
||||
# All classes that can be found by a Gallery search go in here
|
||||
related => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Photo',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help listFilesForUserRss' => {
|
||||
title => 'help listFilesForUserRss title',
|
||||
body => 'help listFilesForUserRss body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help listFilesForUser',
|
||||
namespace => 'Asset_Gallery',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
309
lib/WebGUI/Help/Asset_GalleryAlbum.pm
Normal file
309
lib/WebGUI/Help/Asset_GalleryAlbum.pm
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
package WebGUI::Help::Asset_GalleryAlbum;
|
||||
|
||||
our $HELP = {
|
||||
|
||||
'help common' => {
|
||||
title => 'help common title',
|
||||
body => 'help common body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help searchForm',
|
||||
namespace => 'Asset_Gallery',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'canAddFile',
|
||||
description => 'helpvar canAddFile',
|
||||
},
|
||||
{
|
||||
name => 'canEdit',
|
||||
description => 'helpvar canEdit',
|
||||
},
|
||||
{
|
||||
name => 'url_listAlbums',
|
||||
description => 'helpvar url_listAlbums',
|
||||
},
|
||||
{
|
||||
name => 'url_listAlbumsRss',
|
||||
description => 'helpvar url_listAlbumsRss',
|
||||
},
|
||||
{
|
||||
name => 'url_listFilesForCurrentUser',
|
||||
description => 'helpvar url_listFilesForCurrentUser',
|
||||
},
|
||||
{
|
||||
name => 'url_search',
|
||||
description => 'helpvar url_search',
|
||||
},
|
||||
{
|
||||
name => 'url_addArchive',
|
||||
description => 'helpvar url_addArchive',
|
||||
},
|
||||
{
|
||||
name => 'url_addPhoto',
|
||||
description => 'helpvar url_addPhoto',
|
||||
},
|
||||
{
|
||||
name => 'url_addNoClass',
|
||||
description => 'helpvar url_addNoClass',
|
||||
},
|
||||
{
|
||||
name => 'url_delete',
|
||||
description => 'helpvar url_delete',
|
||||
},
|
||||
{
|
||||
name => 'url_edit',
|
||||
description => 'helpvar url_edit',
|
||||
},
|
||||
{
|
||||
name => 'url_listFilesForOwner',
|
||||
description => 'helpvar url_listFilesForOwner',
|
||||
},
|
||||
{
|
||||
name => 'url_viewRss',
|
||||
description => 'helpvar url_viewRss',
|
||||
},
|
||||
{
|
||||
name => 'url_slideshow',
|
||||
description => 'helpvar url_slideshow',
|
||||
},
|
||||
{
|
||||
name => 'url_thumbnails',
|
||||
description => 'helpvar url_thumbnails',
|
||||
},
|
||||
{
|
||||
name => 'fileCount',
|
||||
description => 'helpvar fileCount',
|
||||
},
|
||||
{
|
||||
name => 'ownerUsername',
|
||||
description => 'helpvar ownerUsername',
|
||||
},
|
||||
{
|
||||
name => 'thumbnailUrl',
|
||||
description => 'helpvar thumbnailUrl',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help fileLoop' => {
|
||||
title => 'help fileLoop title',
|
||||
body => 'help fileLoop body',
|
||||
variables => [
|
||||
{
|
||||
name => 'file_loop',
|
||||
description => 'helpvar file_loop',
|
||||
},
|
||||
],
|
||||
|
||||
# ADD ALL GalleryAlbum FILE CLASSES HERE!!!
|
||||
related => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Photo',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help view' => {
|
||||
title => 'help view title',
|
||||
body => 'help view body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
{
|
||||
tag => 'help fileLoop',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help slideshow' => {
|
||||
title => 'help slideshow title',
|
||||
body => 'help slideshow body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
{
|
||||
tag => 'help fileLoop',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help thumbnails' => {
|
||||
title => 'help thumbnails title',
|
||||
body => 'help thumbnails body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
{
|
||||
tag => 'help fileLoop',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
|
||||
variables => [
|
||||
{
|
||||
name => 'file_*',
|
||||
description => 'helpvar file_*',
|
||||
},
|
||||
],
|
||||
|
||||
# PUT ALL GalleryAlbum FILE CLASSES HERE ALSO!!!
|
||||
related => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Photo',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help addArchive' => {
|
||||
title => 'help addArchive title',
|
||||
body => 'help addArchive body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
variables => {
|
||||
{
|
||||
name => 'form_start',
|
||||
description => 'helpvar form_start',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_end',
|
||||
description => 'helpvar form_end',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_submit',
|
||||
description => 'helpvar form_submit',
|
||||
},
|
||||
{
|
||||
name => 'form_archive',
|
||||
description => 'helpvar form_archive',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_keywords',
|
||||
description => 'helpvar form_keywords',
|
||||
},
|
||||
{
|
||||
name => 'form_friendsOnly',
|
||||
description => 'helpvar form_friendsOnly',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
'help delete' => {
|
||||
title => 'help delete title',
|
||||
body => 'help delete body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'url_yes',
|
||||
description => 'helpvar url_yes',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help edit' => {
|
||||
title => 'help edit title',
|
||||
body => 'help edit body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
{
|
||||
tag => 'help fileLoop',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'form_start',
|
||||
description => 'helpvar form_start',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_end',
|
||||
description => 'helpvar form_end',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_cancel',
|
||||
description => 'helpvar form_cancel',
|
||||
},
|
||||
{
|
||||
name => 'form_submit',
|
||||
description => 'helpvar form_submit',
|
||||
},
|
||||
{
|
||||
name => 'form_title',
|
||||
description => 'helpvar form_title',
|
||||
},
|
||||
{
|
||||
name => 'form_description',
|
||||
description => 'helpvar form_description',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'file_loop',
|
||||
description => 'helpvar file_loop edit',
|
||||
variables => [
|
||||
{
|
||||
name => 'isAlbumThumbnail',
|
||||
description => 'helpvar isAlbumThumbnail',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help viewRss' => {
|
||||
title => 'help viewRss title',
|
||||
body => 'help viewRss body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
{
|
||||
tag => 'help fileLoop',
|
||||
namespace => 'Asset_GalleryAlbum',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'file_loop',
|
||||
description => 'helpvar file_loop viewRss',
|
||||
variables => [
|
||||
{
|
||||
name => 'rssDate',
|
||||
description => 'helpvar rssDate',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
258
lib/WebGUI/Help/Asset_Photo.pm
Normal file
258
lib/WebGUI/Help/Asset_Photo.pm
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
package WebGUI::Help::Asset_Photo;
|
||||
|
||||
our $HELP = {
|
||||
'help commentForm' => {
|
||||
title => 'help commentForm title',
|
||||
body => 'help commentForm body',
|
||||
variables => [
|
||||
{
|
||||
name => 'commentForm_start',
|
||||
description => 'helpvar commentForm_start',
|
||||
},
|
||||
{
|
||||
name => 'commentForm_end',
|
||||
description => 'helpvar commentForm_end',
|
||||
},
|
||||
{
|
||||
name => 'commentForm_bodyText',
|
||||
description => 'helpvar commentForm_bodyText',
|
||||
},
|
||||
{
|
||||
name => 'commentForm_submit',
|
||||
description => 'helpvar commentForm_submit',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help common' => {
|
||||
title => 'help common title',
|
||||
body => 'help common body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help searchForm',
|
||||
namespace => 'Asset_Gallery',
|
||||
},
|
||||
{
|
||||
tag => 'help commentForm',
|
||||
namespace => 'Asset_Photo',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'canComment',
|
||||
description => 'helpvar canComment',
|
||||
},
|
||||
{
|
||||
name => 'canEdit',
|
||||
description => 'helpvar canEdit',
|
||||
},
|
||||
{
|
||||
name => 'fileUrl',
|
||||
description => 'helpvar fileUrl',
|
||||
},
|
||||
{
|
||||
name => 'numberOfComments',
|
||||
description => 'helpvar numberOfComments',
|
||||
},
|
||||
{
|
||||
name => 'ownerUsername',
|
||||
description => 'helpvar ownerUsername',
|
||||
},
|
||||
{
|
||||
name => 'thumbnailUrl',
|
||||
description => 'helpvar thumbnailUrl',
|
||||
},
|
||||
{
|
||||
name => 'url_delete',
|
||||
description => 'helpvar url_delete',
|
||||
},
|
||||
{
|
||||
name => 'url_demote',
|
||||
description => 'helpvar url_demote',
|
||||
},
|
||||
{
|
||||
name => 'url_edit',
|
||||
description => 'helpvar url_edit',
|
||||
},
|
||||
{
|
||||
name => 'url_gallery',
|
||||
description => 'helpvar url_gallery',
|
||||
},
|
||||
{
|
||||
name => 'url_makeShortcut',
|
||||
description => 'helpvar url_makeShortcut',
|
||||
},
|
||||
{
|
||||
name => 'url_listFilesForOwner',
|
||||
description => 'helpvar url_listFilesForOwner',
|
||||
},
|
||||
{
|
||||
name => 'url_promote',
|
||||
description => 'helpvar url_promote',
|
||||
},
|
||||
{
|
||||
name => 'resolutions_loop',
|
||||
description => 'helpvar resolutions_loop',
|
||||
variables => [
|
||||
{
|
||||
name => 'url_download',
|
||||
description => 'helpvar resolutions_loop url_download',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name => 'exif_*',
|
||||
description => 'helpvar exif_*',
|
||||
},
|
||||
{
|
||||
name => 'exifLoop',
|
||||
description => 'helpvar exifLoop',
|
||||
variables => [
|
||||
{
|
||||
name => 'tag',
|
||||
description => 'helpvar exifLoop tag',
|
||||
},
|
||||
{
|
||||
name => 'value',
|
||||
description => 'helpvar exifLoop value',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help delete' => {
|
||||
title => 'help delete title',
|
||||
body => 'help delete body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Photo',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'url_yes',
|
||||
description => 'helpvar url_yes',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help edit' => {
|
||||
title => 'help edit title',
|
||||
body => 'htlp edit body',
|
||||
variables => [
|
||||
{
|
||||
name => 'url_addArchive',
|
||||
description => 'helpvar url_addArchive',
|
||||
},
|
||||
{
|
||||
name => 'form_start',
|
||||
description => 'helpvar form_start',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_end',
|
||||
description => 'helpvar form_end',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_submit',
|
||||
description => 'helpvar form_submit',
|
||||
},
|
||||
{
|
||||
name => 'form_title',
|
||||
description => 'helpvar form_title',
|
||||
},
|
||||
{
|
||||
name => 'form_synopsis',
|
||||
description => 'helpvar form_synopsis',
|
||||
},
|
||||
{
|
||||
name => 'form_photo',
|
||||
description => 'helpvar form_photo',
|
||||
},
|
||||
{
|
||||
name => 'form_keywords',
|
||||
description => 'helpvar form_keywords',
|
||||
},
|
||||
{
|
||||
name => 'form_location',
|
||||
description => 'helpvar form_location',
|
||||
},
|
||||
{
|
||||
name => 'form_friendsOnly',
|
||||
description => 'helpvar form_friendsOnly',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'help makeShortcut' => {
|
||||
title => 'help makeShortcut title',
|
||||
body => 'htlp makeShortcut body',
|
||||
variables => [
|
||||
{
|
||||
name => 'form_start',
|
||||
description => 'helpvar form_start',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_end',
|
||||
description => 'helpvar form_end',
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => 'form_parentId',
|
||||
description => 'helpvar form_parentId',
|
||||
required => 1,
|
||||
},
|
||||
],
|
||||
}
|
||||
'help view' => {
|
||||
title => 'help view title',
|
||||
body => 'help view body',
|
||||
isa => [
|
||||
{
|
||||
tag => 'help common',
|
||||
namespace => 'Asset_Photo',
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{
|
||||
name => 'commentLoop',
|
||||
description => 'helpvar commentLoop',
|
||||
variables => [
|
||||
{
|
||||
name => 'userId',
|
||||
description => 'helpvar commentLoop userId',
|
||||
},
|
||||
{
|
||||
name => 'visitorIp',
|
||||
description => 'helpvar commentLoop visitorIp',
|
||||
},
|
||||
{
|
||||
name => 'creationDate',
|
||||
description => 'helpvar commentLoop creationDate',
|
||||
},
|
||||
{
|
||||
name => 'bodyText',
|
||||
description => 'helpvar commentLoop bodyText',
|
||||
},
|
||||
{
|
||||
name => 'username',
|
||||
description => 'helpvar commentLoop username',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name => 'commentLoop_pageBar',
|
||||
description => 'helpvar commentLoop_pageBar',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -27,6 +27,9 @@ Package WebGUI::Keyword
|
|||
|
||||
This package provides an API to create and modify keywords used by the asset sysetm.
|
||||
|
||||
Assets can use the C<keywords> property to set keywords automatically. See
|
||||
WebGUI::Asset::update() for more details.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use WebGUI::Keyword;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ package WebGUI::Search;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use Carp qw( croak );
|
||||
use WebGUI::Asset;
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -329,6 +330,9 @@ This rule allows for an array reference of table join clauses.
|
|||
|
||||
join => 'join assetData on assetId = assetData.assetId'
|
||||
|
||||
NOTE: This rule is deprecated and will be removed in a future release. Use
|
||||
joinClass instead.
|
||||
|
||||
=head4 columns
|
||||
|
||||
This rule allows for additional columns to be returned by getResultSet().
|
||||
|
|
@ -344,6 +348,11 @@ placeholders and parameters.
|
|||
sub search {
|
||||
my $self = shift;
|
||||
my $rules = shift;
|
||||
|
||||
# Send the rules through some sanity checks
|
||||
croak "'lineage' rule must be array reference"
|
||||
if ( $rules->{lineage} && ref $rules->{lineage} ne "ARRAY" );
|
||||
|
||||
my @params = ();
|
||||
my $query = "";
|
||||
my @clauses = ();
|
||||
|
|
@ -410,10 +419,31 @@ sub search {
|
|||
if ($rules->{where}) {
|
||||
push(@clauses, $rules->{where});
|
||||
}
|
||||
if ($rules->{join}) { # This join happens in _getQuery
|
||||
$rules->{join} = [$rules->{join}]
|
||||
unless (ref $rules->{join} eq "ARRAY");
|
||||
$self->{_join} = $rules->{join};
|
||||
# deal with custom joined tables if we must
|
||||
if (exists $rules->{joinClass}) {
|
||||
my $join = [ "left join assetData on assetIndex.assetId=assetData.assetId" ];
|
||||
for my $className ( @{ $rules->{ joinClass } } ) {
|
||||
my $cmd = "use " . $className;
|
||||
eval { $cmd };
|
||||
$self->session->errorHandler->fatal("Couldn't compile asset package: ".$className.". Root cause: ".$@) if ($@);
|
||||
foreach my $definition (@{$className->definition($self->session)}) {
|
||||
unless ($definition->{tableName} eq "asset") {
|
||||
my $tableName = $definition->{tableName};
|
||||
push @$join,
|
||||
"left join $tableName on assetData.assetId=".$tableName.".assetId and assetData.revisionDate=".$tableName.".revisionDate";
|
||||
}
|
||||
last;
|
||||
}
|
||||
}
|
||||
# Get only the latest revision
|
||||
push @clauses, "assetData.revisionDate = (SELECT MAX(revisionDate) FROM assetData ad WHERE ad.assetId = assetData.assetId)";
|
||||
# Join happens in _getQuery
|
||||
$self->{_join} = $join;
|
||||
}
|
||||
elsif ($rules->{join}) { # This join happens in _getQuery
|
||||
$rules->{join} = [$rules->{join}]
|
||||
unless (ref $rules->{join} eq "ARRAY");
|
||||
$self->{_join} = $rules->{join};
|
||||
}
|
||||
if ($rules->{columns}) {
|
||||
$rules->{columns} = [$rules->{columns}]
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ package WebGUI::Storage;
|
|||
=cut
|
||||
|
||||
use Archive::Tar;
|
||||
use Carp qw( croak );
|
||||
use Cwd;
|
||||
use File::Copy qw(cp);
|
||||
use FileHandle;
|
||||
use File::Find;
|
||||
|
|
@ -24,7 +26,6 @@ use Storable qw(nstore retrieve);
|
|||
use strict;
|
||||
use warnings;
|
||||
use WebGUI::Utility;
|
||||
use Carp;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -64,6 +65,7 @@ This package provides a mechanism for storing and retrieving files that are not
|
|||
$newstore = $store->untar($filename);
|
||||
|
||||
|
||||
$store->copyFile($filename, $newFilename);
|
||||
$store->delete;
|
||||
$store->deleteFile($filename);
|
||||
$store->rename($filename, $newFilename);
|
||||
|
|
@ -202,6 +204,7 @@ sub addFileFromFormPost {
|
|||
my $filename;
|
||||
my $attachmentCount = 1;
|
||||
foreach my $upload ($self->session->request->upload($formVariableName)) {
|
||||
$self->session->errorHandler->info("Trying to get " . $upload->filename);
|
||||
return $filename if $attachmentCount > $attachmentLimit;
|
||||
my $tempFilename = $upload->filename();
|
||||
next unless $tempFilename;
|
||||
|
|
@ -225,6 +228,7 @@ sub addFileFromFormPost {
|
|||
print $file $buffer;
|
||||
}
|
||||
close($file);
|
||||
$self->session->errorHandler->info("Got ".$upload->filename);
|
||||
} else {
|
||||
$self->_addError("Couldn't open file ".$self->getPath($filename)." for writing due to error: ".$!);
|
||||
return undef;
|
||||
|
|
@ -343,6 +347,31 @@ sub copy {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 copyFile ( filename, newFilename )
|
||||
|
||||
Copy a file in this storage location. C<filename> is the file to copy.
|
||||
C<newFilename> is the new file to create.
|
||||
|
||||
=cut
|
||||
|
||||
sub copyFile {
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $newFilename = shift;
|
||||
|
||||
croak "Can't find '$filename' in storage location " . $self->getId
|
||||
unless -e $self->getPath($filename);
|
||||
croak "Second argument must be a filename"
|
||||
unless $newFilename;
|
||||
|
||||
cp( $self->getPath($filename), $self->getPath($newFilename) )
|
||||
|| croak "Couldn't copy '$filename' to '$newFilename': $!";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 create ( session )
|
||||
|
||||
Creates a new storage location on the file system.
|
||||
|
|
@ -354,9 +383,9 @@ A reference to the current session;
|
|||
=cut
|
||||
|
||||
sub create {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $id = $session->id->generate();
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $id = $session->id->generate();
|
||||
|
||||
#Determine whether or not to use case insensitive files
|
||||
my $config = $session->config;
|
||||
|
|
@ -365,14 +394,16 @@ sub create {
|
|||
|
||||
#$session->errorHandler->warn($caseInsensitive.": $id\n".Carp::longmess()."\n");
|
||||
#For case insensitive operating systems, convert guid to hex
|
||||
if($caseInsensitive) {
|
||||
if ($caseInsensitive) {
|
||||
my $hexId = $session->id->toHex($id);
|
||||
$db->write("insert into storageTranslation (guidValue,hexValue) values (?,?)",[$id,$hexId]);
|
||||
}
|
||||
|
||||
my $self = $class->get($session,$id);
|
||||
$self->_makePath;
|
||||
return $self;
|
||||
$self->_makePath;
|
||||
|
||||
$session->errorHandler->info("Created storage location $id as a $class");
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -446,6 +477,7 @@ sub delete {
|
|||
$db->write("delete from storageTranslation where guidValue=?",[$self->getId]);
|
||||
}
|
||||
}
|
||||
$self->session->errorHandler->info("Deleted storage ".$self->getId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -753,6 +785,8 @@ Returns a full path to this storage location.
|
|||
|
||||
If specified, we'll return a path to the file rather than the storage location.
|
||||
|
||||
NOTE: Does not check if the file exists. This is a feature.
|
||||
|
||||
=cut
|
||||
|
||||
sub getPath {
|
||||
|
|
@ -898,21 +932,22 @@ Pass in a storage location object to create the tar file in, instead of having a
|
|||
=cut
|
||||
|
||||
sub tar {
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $temp = shift || WebGUI::Storage->createTemp($self->session);
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $temp = shift || WebGUI::Storage->createTemp($self->session);
|
||||
chdir $self->getPath or croak 'Unable to chdir to ' . $self->getPath . ": $!";
|
||||
my @files = ();
|
||||
find(sub { push(@files, $File::Find::name)}, ".");
|
||||
if ($Archive::Tar::VERSION eq '0.072') {
|
||||
my $tar = Archive::Tar->new();
|
||||
$tar->add_files(@files);
|
||||
$tar->write($temp->getPath($filename),1);
|
||||
|
||||
} else {
|
||||
Archive::Tar->create_archive($temp->getPath($filename),1,@files);
|
||||
}
|
||||
return $temp;
|
||||
my @files = ();
|
||||
find(sub { push(@files, $File::Find::name)}, ".");
|
||||
if ($Archive::Tar::VERSION eq '0.072') {
|
||||
my $tar = Archive::Tar->new();
|
||||
$tar->add_files(@files);
|
||||
$tar->write($temp->getPath($filename),1);
|
||||
|
||||
}
|
||||
else {
|
||||
Archive::Tar->create_archive($temp->getPath($filename),1,@files);
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -932,12 +967,17 @@ Pass in a storage location object to extract the contents to, instead of having
|
|||
=cut
|
||||
|
||||
sub untar {
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $temp = shift || WebGUI::Storage->createTemp($self->session);
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $temp = shift || WebGUI::Storage->createTemp($self->session);
|
||||
|
||||
my $originalDir = cwd;
|
||||
chdir $temp->getPath;
|
||||
|
||||
Archive::Tar->extract_archive($self->getPath($filename),1);
|
||||
$self->_addError(Archive::Tar->error) if (Archive::Tar->error);
|
||||
|
||||
chdir $originalDir;
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ use WebGUI::Storage::Image;
|
|||
|
||||
These methods are available from this class:
|
||||
|
||||
my $boolean = $self->generateThumbnail($filename);
|
||||
my $url = $self->getThumbnailUrl($filename);
|
||||
my $boolean = $self->isImage($filename);
|
||||
my ($captchaFile, $challenge) = $self->addFileFromCaptcha;
|
||||
$self->resize($imageFile, $width, $height);
|
||||
my $boolean = $self->generateThumbnail($filename);
|
||||
my $url = $self->getThumbnailUrl($filename);
|
||||
my $boolean = $self->isImage($filename);
|
||||
my ($captchaFile, $challenge) = $self->addFileFromCaptcha;
|
||||
$self->resize($imageFile, $width, $height);
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ sub getThumbnailUrl {
|
|||
return '';
|
||||
}
|
||||
if (! isIn($filename, @{ $self->getFiles() })) {
|
||||
$self->session->errorHandler->error("Can't make a thumbnail for a file that is not in my storage location.");
|
||||
$self->session->errorHandler->error("Can't make a thumbnail for a file named '$filename' that is not in my storage location.");
|
||||
return '';
|
||||
}
|
||||
return $self->getUrl("thumb-".$filename);
|
||||
|
|
@ -331,41 +331,42 @@ The new height of the image in pixels.
|
|||
=cut
|
||||
|
||||
sub resize {
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $width = shift;
|
||||
my $height = shift;
|
||||
unless (defined $filename) {
|
||||
$self->session->errorHandler->error("Can't resize when you haven't specified a file.");
|
||||
return 0;
|
||||
}
|
||||
unless ($self->isImage($filename)) {
|
||||
$self->session->errorHandler->error("Can't resize something that's not an image.");
|
||||
return 0;
|
||||
}
|
||||
unless ($width || $height) {
|
||||
$self->session->errorHandler->error("Can't resize with no resizing parameters.");
|
||||
return 0;
|
||||
}
|
||||
my $image = $graphicsPackage->new;
|
||||
my $error = $image->Read($self->getPath($filename));
|
||||
if ($error) {
|
||||
$self->session->errorHandler->error("Couldn't read image for resizing: ".$error);
|
||||
return 0;
|
||||
}
|
||||
my ($x, $y) = $image->Get('width','height');
|
||||
if ($width && !$height) { # proportional scale by width
|
||||
$height = $width / $x * $y;
|
||||
} elsif (!$width && $height) { # proportional scale by height
|
||||
$width = $height * $x / $y;
|
||||
}
|
||||
$image->Scale(width=>$width, height=>$height);
|
||||
$error = $image->Write($self->getPath($filename));
|
||||
if ($error) {
|
||||
$self->session->errorHandler->error("Couldn't create thumbnail: ".$error);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $width = shift;
|
||||
my $height = shift;
|
||||
unless (defined $filename) {
|
||||
$self->session->errorHandler->error("Can't resize when you haven't specified a file.");
|
||||
return 0;
|
||||
}
|
||||
unless ($self->isImage($filename)) {
|
||||
$self->session->errorHandler->error("Can't resize something that's not an image.");
|
||||
return 0;
|
||||
}
|
||||
unless ($width || $height) {
|
||||
$self->session->errorHandler->error("Can't resize with no resizing parameters.");
|
||||
return 0;
|
||||
}
|
||||
my $image = $graphicsPackage->new;
|
||||
my $error = $image->Read($self->getPath($filename));
|
||||
if ($error) {
|
||||
$self->session->errorHandler->error("Couldn't read image for resizing: ".$error);
|
||||
return 0;
|
||||
}
|
||||
my $geometry;
|
||||
if (!$width || !$height) {
|
||||
$geometry = $width || $height;
|
||||
}
|
||||
else {
|
||||
$geometry = $width . "x" . $height;
|
||||
}
|
||||
$image->Resize( geometry => $geometry, filter => "lanczos" );
|
||||
$error = $image->Write($self->getPath($filename));
|
||||
if ($error) {
|
||||
$self->session->errorHandler->error("Couldn't resize image: ".$error);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,554 @@ our $I18N = {
|
|||
message => 'Gallery',
|
||||
lastUpdated => 1131394072,
|
||||
},
|
||||
"groupIdAddComment label" => {
|
||||
message => "Group to Add Comments",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"groupIdAddComment description" => {
|
||||
message => "The group that is allowed to add comments to files.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"groupIdAddFile label" => {
|
||||
message => "Group to Add Files",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"groupIdAddFile description" => {
|
||||
message => "The group that is allowed to add files and albums to this gallery",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"groupIdModerator label" => {
|
||||
message => "Group to Moderate Comments",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"groupIdModerator description" => {
|
||||
message => "The group that is allowed to edit / delete comments in this gallery",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"imageResolutions label" => {
|
||||
message => "Image Resolutions",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"imageResolutions description" => {
|
||||
message => "The sizes of images available for download.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"imageViewSize label" => {
|
||||
message => "Image View Size",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"imageViewSize description" => {
|
||||
message => "The size for images in the gallery. Will default to the Image Size
|
||||
in the site settings.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"imageThumbnailSize label" => {
|
||||
message => "Image Thumbnail Size",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"imageThumbnailSize description" => {
|
||||
message => "The size for thumbnails of images in the gallery. Will default to the
|
||||
Thumbnail Size in the site settings.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"maxSpacePerUser label" => {
|
||||
message => "Max Disk Space Per User",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"maxSpacePerUser description" => {
|
||||
message => "The maximum amount of disk space a user is allowed to use in this Gallery.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"richEditIdFileComment label" => {
|
||||
message => "Rich Editor for Comments",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"richEditIdFileComment description" => {
|
||||
message => "The Rich Text Editor to use for comments",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
'search class galleryalbum' => {
|
||||
message => 'Album',
|
||||
lastUpdated => 0,
|
||||
context => 'Asset name for WebGUI::Asset::Wobject::GalleryAlbum',
|
||||
},
|
||||
'search class any' => {
|
||||
message => 'Any',
|
||||
lastUpdated => 0,
|
||||
context => 'Label to not restrict gallery search by class',
|
||||
},
|
||||
'search class photo' => {
|
||||
message => "Photo",
|
||||
lastUpdated => 0,
|
||||
context => 'Asset name for WebGUI::Asset::File::Image::Photo class',
|
||||
},
|
||||
"search submit" => {
|
||||
message => "Search",
|
||||
lastUpdated => 0,
|
||||
context => 'Label for button to submit search form',
|
||||
},
|
||||
"templateIdAddArchive label" => {
|
||||
message => "Template to Add Multiple",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdAddArchive description" => {
|
||||
message => "Display the form to add an archive of files to the gallery.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdDeleteAlbum label" => {
|
||||
message => "Template to Delete Albums",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdDeleteAlbum description" => {
|
||||
message => "Display the confirmation to delete an album from the gallery.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdDeleteFile label" => {
|
||||
message => "Template to Delete Files",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdDeleteFile description" => {
|
||||
message => "Display the confirmation to delete a file from the gallery.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdEditAlbum label" => {
|
||||
message => "Template to Edit Albums",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdEditAlbum description" => {
|
||||
message => "The template to add / edit an album.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdEditFile label" => {
|
||||
message => "Template to Edit Files",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdEditFile description" => {
|
||||
message => "The template to add / edit a file.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdListAlbums label" => {
|
||||
message => "Template to List Albums",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdListAlbums description" => {
|
||||
message => "Template to show a list of albums in the gallery.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdListAlbumsRss label" => {
|
||||
message => "Template to List Albums RSS",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdListAlbumsRss description" => {
|
||||
message => "Template to show an RSS feed of the albums in this gallery.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdMakeShortcut label" => {
|
||||
message => "Template to Cross Post Files",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdMakeShortcut description" => {
|
||||
message => "Display the form to copy an image to another album.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdSearch label" => {
|
||||
message => "Template to Search",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdSearch description" => {
|
||||
message => "Display the form to search the gallery. Display search results.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewSlideshow label" => {
|
||||
message => "Template for Slideshow",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewSlideshow description" => {
|
||||
message => "Display all the images in an album as a slideshow.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewThumbnails label" => {
|
||||
message => "Template for Thumbnails",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewThumbnails description" => {
|
||||
message => "Display all the images in an album as their thumbnails",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdListFilesForUser label" => {
|
||||
message => "Template to List Files for User",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdListFilesForUser description" => {
|
||||
message => "Display all the files and albums for a specific user.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdListFilesForUserRss label" => {
|
||||
message => "Template to List Files for User RSS",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdListFilesForUserRss description" => {
|
||||
message => "RSS feed for all the files for a specific user.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewAlbum label" => {
|
||||
message => "Template to View Album",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewAlbum description" => {
|
||||
message => "Default view for albums",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewAlbumRss label" => {
|
||||
message => "Template to View Album RSS",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewAlbumRss description" => {
|
||||
message => "RSS feed for a single album",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewFile label" => {
|
||||
message => "Template to View a File",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"templateIdViewFile description" => {
|
||||
message => "Show the details and comments for a specific file",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewDefault label" => {
|
||||
message => "Default View",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewDefault description" => {
|
||||
message => "Select the default view when a user enters the gallery.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewDefault option list" => {
|
||||
message => "List Albums",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewDefault option album" => {
|
||||
message => "Single Album",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewAlbumAssetId label" => {
|
||||
message => "Default View Album",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewAlbumAssetId description" => {
|
||||
message => "The album to view when the default view is 'Album'",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewListOrderBy label" => {
|
||||
message => "List Albums Order By",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewListOrderBy description" => {
|
||||
message => "The field to order the album list by",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewListOrderBy option creationDate" => {
|
||||
message => "Creation Date",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewListOrderBy option lineage" => {
|
||||
message => "Sequence Number",
|
||||
lastUpdated => 0,
|
||||
context => 'Label to order by sequence (as in asset manager)',
|
||||
},
|
||||
"viewListOrderBy option revisionDate" => {
|
||||
message => "Revision Date",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewListOrderBy option title" => {
|
||||
message => "Title",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewListOrderDirection label" => {
|
||||
message => "List Albums Direction",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewListOrderDirection description" => {
|
||||
message => "The direction to order the album list",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"viewListOrderDirection option asc" => {
|
||||
message => "Ascending",
|
||||
lastUpdated => 0,
|
||||
context => 'Label for sorting in ascending order',
|
||||
},
|
||||
"viewListOrderDirection option desc" => {
|
||||
message => "Descending",
|
||||
lastUpdated => 0,
|
||||
context => 'Label for sorting in descending order',
|
||||
},
|
||||
"workflowIdCommit label" => {
|
||||
message => "Approval Workflow",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
"workflowIdCommit description" => {
|
||||
message => "Workflow to approve new Files.",
|
||||
lastUpdated => 0,
|
||||
context => '',
|
||||
},
|
||||
|
||||
'helpvar searchForm_start' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_end' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_basicSearch' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_description' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_keywords' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_className' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_creationDate_after' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_creationDate_before' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar searchForm_submit' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_addAlbum' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_listAlbums' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_listAlbumsRss' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_listFilesForCurrentUser' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_search' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar canEdit' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar canAddFile' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar albums' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar albums rss' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar rssDate' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar search_results' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar user_albums' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar user_files' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar userId' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_rss' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar username' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help searchForm title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help searchForm body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help common title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help common body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help listAlbums title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help listAlbums body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help listAlbumsRss title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help search body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help search title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help listFilesForUser title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help listFilesForUser body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help listFilesForUserRss title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help listFilesForUserRss body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,299 @@
|
|||
package WebGUI::i18n::English::Asset_GalleryAlbum;
|
||||
|
||||
our $I18N = {
|
||||
'addArchive message' => {
|
||||
message => 'Your files have been submitted for approval and commit. <a href="%s">Return to Album</a>',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'assetName' => {
|
||||
message => 'Gallery Album',
|
||||
lastUpdated => 1131394072,
|
||||
},
|
||||
'cancel' => {
|
||||
message => "Cancel",
|
||||
lastUpdated => 0,
|
||||
context => "Label for Cancel button",
|
||||
},
|
||||
'save' => {
|
||||
message => "Save",
|
||||
lastUpdated => 0,
|
||||
context => "Label for Save button",
|
||||
},
|
||||
'save message' => {
|
||||
message => 'Album settings saved. <a href="%s">Return to Album</a>',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help common title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help common body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help fileLoop title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help fileLoop body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help view title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help view body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help slideshow title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help slideshow body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help thumbnails title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help thumbnails body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help addArchive title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help addArchive body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help delete title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help delete body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help edit title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help viewRss title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help viewRss body' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar canAddFile' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar canEdit' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_listAlbums' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_listAlbumsRss' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_listFilesForCurrentUser' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_search' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_addArchive' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_addPhoto' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_addNoClass' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_delete' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_edit' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_listFilesForOwner' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_viewRss' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_slideshow' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_thumbnails' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar fileCount' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar ownerUsername' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar thumbnailUrl' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar file_loop' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar file_*' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_start' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_end' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_submit' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_archive' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_keywords' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_friendsOnly' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_yes' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_start' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_end' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_cancel' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_submit' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_description' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar file_loop edit' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar isAlbumThumbnail' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar file_loop viewRss' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar rssDate' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
291
lib/WebGUI/i18n/English/Asset_Photo.pm
Normal file
291
lib/WebGUI/i18n/English/Asset_Photo.pm
Normal file
|
|
@ -0,0 +1,291 @@
|
|||
package WebGUI::i18n::English::Asset_Photo;
|
||||
|
||||
our $I18N = {
|
||||
'assetName' => {
|
||||
message => q{Photo},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'delete message' => {
|
||||
message => q{The photo has been deleted. <a href="%s">Return to Album</a>},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'save message' => {
|
||||
message => q{Your photo has been submitted for approval and commit. <a href="%s">View Photo</a>. <a href="%s">Add another photo</a>.},
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help commentForm title' => {
|
||||
message => 'Photo -- Comment Form',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help commentForm body' => {
|
||||
message => 'These template variables make up the form to allow users to post comments on Photos',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help common title' => {
|
||||
message => 'Photo -- Common',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help common body' => {
|
||||
message => 'These template variables are shared by all views of the Photo asset.',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help edit title' => {
|
||||
message => 'Photo -- Edit Form',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help edit body' => {
|
||||
message => 'These template variables make up the form to add / edit Photo assets',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help makeShortcut title' => {
|
||||
message => 'Photo -- Make Shortcut Form',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help makeShortcut body' => {
|
||||
message => 'These template variables make up the form to cross-post Photo assets',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help view title' => {
|
||||
message => 'Photo -- Normal View',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'help view body' => {
|
||||
message => 'These template variables make up the normal view of Photo assets',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentForm_start' => {
|
||||
message => 'Begin the comment form',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentForm_end' => {
|
||||
message => 'End the comment form',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentForm_bodyText' => {
|
||||
message => 'The body of the comment. A rich editor as configured by the parent Gallery.',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentForm_submit' => {
|
||||
message => 'Submit the comment form',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar canComment' => {
|
||||
message => 'This is true if the current user can comment on this photo',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar canEdit' => {
|
||||
message => 'This is true if the current user can edit this photo',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar fileUrl' => {
|
||||
message => 'The URL to the normal-sized photo',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar numberOfComments' => {
|
||||
message => 'The total number of comments on this photo',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar ownerUsername' => {
|
||||
message => 'The username of the user who posted this photo',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar thumbnailUrl' => {
|
||||
message => 'The URL to the thumbnail of this photo',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_delete' => {
|
||||
message => 'The URL to delete this photo.',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_demote' => {
|
||||
message => 'The URL to demote this photo in rank. Will return the user directly to the parent GalleryAlbum edit form',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_edit' => {
|
||||
message => 'The URL to edit this photo',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_gallery' => {
|
||||
message => 'The URL to the Gallery that contains this photo.',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_makeShortcut' => {
|
||||
message => 'The URL to make a shortcut to this photo.',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_listFilesForOwner' => {
|
||||
message => 'The URL to list files and albums posted by the owner of this photo',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_promote' => {
|
||||
message => 'The URL to promote this photo in rank. Will return the user directly to the parent GalleryAlbum edit form',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar resolutions_loop' => {
|
||||
message => 'The available resolutions this photo has for download.',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar resolutions_loop url_download' => {
|
||||
message => 'The URL to the resolution to download.',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar exif_*' => {
|
||||
message => 'Each EXIF tag can be referenced by name.',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar exifLoop' => {
|
||||
message => 'A loop of EXIF tags',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar exifLoop tag' => {
|
||||
message => 'The name of the EXIF tag',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar exifLoop value' => {
|
||||
message => 'The value of the EXIF tag',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_addArchive' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_start' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_end' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_submit' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_title' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_synopsis' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_photo' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_keywords' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_location' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_friendsOnly' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_start' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_end' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar form_parentId' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentLoop' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentLoop userId' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentLoop visitorIp' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentLoop creationDate' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentLoop bodyText' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentLoop username' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar commentLoop_pageBar' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'helpvar url_yes' => {
|
||||
message => '',
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue