diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6632a7c47..61fc201ee 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -19,6 +19,10 @@ - Added more information about workflow instance errors, so we can debug without having to watch SPECTRE's debug output. - fixed: List style Content profile fields broken + - Added additional error messages + - fixed: Added a friendly message so when a user who approves a version tag, + but cannot view the version tag (is not in Turn Admin On group), they do + not see "Permission Denied" 7.5.15 - fixed: Colorpicker window would not open (Martin Kamerbeek / Oqapi) diff --git a/lib/WebGUI/Operation/VersionTag.pm b/lib/WebGUI/Operation/VersionTag.pm index ad75ee13f..7ccae568a 100644 --- a/lib/WebGUI/Operation/VersionTag.pm +++ b/lib/WebGUI/Operation/VersionTag.pm @@ -159,20 +159,33 @@ sub www_approveVersionTag { my $instance = $tag->getWorkflowInstance; my $activity = $instance->getNextActivity; - if ( $session->form->process("status", "selectBox") eq "approve" ) { + my $approve = $session->form->process( "status", "selectBox" ) eq "approve"; + if ( $approve ) { $activity->setApproved( $instance ); - } + } else { $activity->setDenied( $instance ); - } + } $tag->set( { comments => $session->form->process("comments", "textarea"), - }); + }); - return www_manageVersions($session); + # If we can't view the version tag after this, show a different message + if ( !canViewVersionTag( $session, $tag ) ) { + my $i18n = WebGUI::International->new( $session, "VersionTag" ); + return $session->style->userStyle( + sprintf $i18n->get( 'approveVersionTag message' ), + ( $approve ? $i18n->get( "approved" ) : $i18n->get( "denied" ) ), + $session->url->getBackToSiteURL, + ); + } + else { + return www_manageVersions($session); + } } + #------------------------------------------------------------------- =head2 www_editVersionTag ( session, [ tagId ] ) @@ -706,6 +719,8 @@ sub www_manageRevisionsInTag { ); # Output the revisions + ### FIXME: Users who only pass canApproveVersionTag() and not canViewVersionTag() should + # probably not be allowed to see the Actions or modify the Start and End dates $output .= WebGUI::Form::formHeader( $session, {} ) . WebGUI::Form::hidden( $session, { name => 'op', value=> 'manageRevisionsInTag' } ) diff --git a/lib/WebGUI/i18n/English/VersionTag.pm b/lib/WebGUI/i18n/English/VersionTag.pm index 365784241..dc5f03db0 100644 --- a/lib/WebGUI/i18n/English/VersionTag.pm +++ b/lib/WebGUI/i18n/English/VersionTag.pm @@ -436,7 +436,24 @@ our $I18N = { message => q|End Time|, lastUpdated => 1148360141, }, + + 'approved' => { + message => q{approved}, + lastUpdated => 0, + context => 'Status of version tag', + }, + 'denied' => { + message => q{denied}, + lastUpdated => 0, + context => 'Status of version tag', + }, + + 'approveVersionTag message' => { + message => q{Your version tag has been %s. Back to site.}, + lastUpdated => 0, + context => q{Message for when someone approves a version tag}, + }, }; 1;