Refactor gallery code to use old i18n technologies so they can
be verified with the critic_labels test.
This commit is contained in:
parent
e345fd8706
commit
129d45ca2a
3 changed files with 13 additions and 72 deletions
|
|
@ -50,7 +50,7 @@ sub definition {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
my $i18n = WebGUI::International->new($session,'Asset_Photo');
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
views => {
|
||||
|
|
@ -508,23 +508,6 @@ sub getTemplateVars {
|
|||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 i18n ( session )
|
||||
|
||||
Get the i18n object for this class. This sub must not be inherited, so always
|
||||
call it using C<__PACKAGE__>, not C<$self>.
|
||||
|
||||
=cut
|
||||
|
||||
sub i18n {
|
||||
my $self = shift;
|
||||
my $session = shift;
|
||||
# TODO: Make a migration script to move the appropriate parts from
|
||||
# Asset_Photo to Asset_GalleryFile
|
||||
return WebGUI::International->new( $session, "Asset_Photo" );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 isFriendsOnly ( )
|
||||
|
|
@ -610,7 +593,7 @@ sub processCommentEditForm {
|
|||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $now = WebGUI::DateTime->new( $session, time );
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $i18n = WebGUI::International->new( $session,'Asset_Photo' );
|
||||
|
||||
# Using die here to suppress line number and file path info
|
||||
die $i18n->get("commentForm error no commentId") . "\n"
|
||||
|
|
@ -649,7 +632,7 @@ sub processCommentEditForm {
|
|||
|
||||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session,'Asset_Photo' );
|
||||
my $form = $self->session->form;
|
||||
my $errors = $self->SUPER::processPropertiesFromFormPost || [];
|
||||
|
||||
|
|
@ -871,7 +854,7 @@ sub www_deleteComment {
|
|||
|
||||
return $session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $i18n = WebGUI::International->new( $session,'Asset_Photo' );
|
||||
my $commentId = $session->form->get('commentId');
|
||||
|
||||
$self->deleteComment( $commentId );
|
||||
|
|
@ -893,7 +876,7 @@ sub www_deleteConfirm {
|
|||
|
||||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session,'Asset_Photo' );
|
||||
|
||||
$self->purge;
|
||||
|
||||
|
|
@ -965,7 +948,7 @@ Save a comment being edited
|
|||
sub www_editCommentSave {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $i18n = WebGUI::International->new( $session,'Asset_Photo' );
|
||||
|
||||
# Process the form first, so we can know how to check permissions
|
||||
my $comment = eval { $self->processCommentEditForm };
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ sub definition {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_Photo');
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
exifData => {
|
||||
|
|
@ -317,27 +317,6 @@ sub getThumbnailUrl {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 i18n ( [ session ] )
|
||||
|
||||
Get a WebGUI::International object for this class.
|
||||
|
||||
Can be called as a class method, in which case a WebGUI::Session object
|
||||
must be passed in.
|
||||
|
||||
NOTE: This method can NOT be inherited, due to a current limitation
|
||||
in the i18n system. You must ALWAYS call this with C<__PACKAGE__>
|
||||
|
||||
=cut
|
||||
|
||||
sub i18n {
|
||||
my $self = shift;
|
||||
my $session = shift;
|
||||
|
||||
return WebGUI::International->new($session, "Asset_Photo");
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 makeResolutions ( [resolutions] )
|
||||
|
||||
Create the specified resolutions for this Photo. If resolutions is not
|
||||
|
|
@ -617,7 +596,7 @@ Provides links to view the photo and add more photos.
|
|||
|
||||
sub www_showConfirmation {
|
||||
my $self = shift;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session, 'Asset_Photo' );
|
||||
|
||||
return $self->processStyle(
|
||||
sprintf( $i18n->get('save message'),
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ sub definition {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_GalleryAlbum');
|
||||
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
allowComments => {
|
||||
|
|
@ -352,27 +352,6 @@ sub DESTROY {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 i18n ( session )
|
||||
|
||||
Get a WebGUI::International object for this class.
|
||||
|
||||
Can be called as a class method, in which case a WebGUI::Session object
|
||||
must be passed in.
|
||||
|
||||
NOTE: This method can NOT be inherited, due to a current limitation
|
||||
in the i18n system. You must ALWAYS call this with C<__PACKAGE__>
|
||||
|
||||
=cut
|
||||
|
||||
sub i18n {
|
||||
my $self = shift;
|
||||
my $session = shift;
|
||||
|
||||
return WebGUI::International->new($session, "Asset_GalleryAlbum");
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 getAutoCommitWorkflowId ( )
|
||||
|
||||
Returns the workflowId of the Gallery's approval workflow.
|
||||
|
|
@ -937,7 +916,7 @@ sub www_addArchiveSave {
|
|||
|
||||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $i18n = __PACKAGE__->i18n( $session );
|
||||
my $i18n = WebGUI::International->new( $session, 'Asset_GalleryAlbum' );
|
||||
my $properties = {
|
||||
keywords => $form->get("keywords"),
|
||||
friendsOnly => $form->get("friendsOnly"),
|
||||
|
|
@ -1093,7 +1072,7 @@ sub www_deleteConfirm {
|
|||
return $self->session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
my $gallery = $self->getParent;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session, 'Asset_GalleryAlbum' );
|
||||
|
||||
$self->purge;
|
||||
|
||||
|
|
@ -1119,7 +1098,7 @@ sub www_edit {
|
|||
my $session = $self->session;
|
||||
my $form = $self->session->form;
|
||||
my $var = $self->getTemplateVars;
|
||||
my $i18n = __PACKAGE__->i18n($session);
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_GalleryAlbum');
|
||||
|
||||
return $session->privilege->insufficient unless $self->canEdit;
|
||||
|
||||
|
|
@ -1299,7 +1278,7 @@ Provides links to view the album.
|
|||
|
||||
sub www_showConfirmation {
|
||||
my $self = shift;
|
||||
my $i18n = __PACKAGE__->i18n( $self->session );
|
||||
my $i18n = WebGUI::International->new( $self->session, 'Asset_GalleryAlbum' );
|
||||
|
||||
my $output = '<p>' . sprintf( $i18n->get('save message'), $self->getUrl ) . '</p>'
|
||||
. '<p>' . $i18n->get('what next') . '</p>'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue