diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 3f1f89b9c..a91a1df8e 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -57,6 +57,7 @@ - rfe: Added canEdit and canAddFile template vars to Folder assets - rfe: Add logged-in time to Login History - rfe: cancel button (for edit profile screen) + - rfe: Better info for Assets that require commit before adding children. Add link is always availble now. If the asset has not yet been committed an error is displayed. 7.5.22 - fixed: Layout template now gets prepared correctly diff --git a/lib/WebGUI/Asset/Wobject/Calendar.pm b/lib/WebGUI/Asset/Wobject/Calendar.pm index 27f2e077a..cf5c1a60a 100644 --- a/lib/WebGUI/Asset/Wobject/Calendar.pm +++ b/lib/WebGUI/Asset/Wobject/Calendar.pm @@ -425,12 +425,6 @@ sub canAddEvent { : $self->session->user ; - # Events can only be added after the Calendar has been committed once - return 0 if ( - $self->get("status") ne "approved" - && $self->getTagCount <= 1 - ); - return 1 if ( $user->isInGroup( $self->get("groupIdEventEdit") ) ); @@ -1761,6 +1755,26 @@ sub wrapIcal { return join "\r\n ",@text; } +#------------------------------------------------------------------- + +=head2 www_add ( ) + +Returns an error message if the collaboration system has not yet been posted. + +=cut + +sub www_add { + my $self = shift; + + #Check to see if the asset has been committed + unless ($self->hasBeenCommitted ) { + my $i18n = WebGUI::International->new($self->session,"Asset_Calendar"); + return $self->processStyle($i18n->get("asset not committed")); + } + return $self->SUPER::www_add( @_ ); +} + + #---------------------------------------------------------------------------- =head2 www_edit ( ) diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 876b8ed13..a1e29f16a 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -321,13 +321,8 @@ sub canStartThread { : $self->session->user ; return ( - ( - $self->get("status") eq "approved" || - $self->getTagCount > 1 # checks to make sure that the cs has been committed at least once - ) && ( - $user->isInGroup($self->get("canStartThreadGroupId")) - || $self->SUPER::canEdit( $userId ) - ) + $user->isInGroup($self->get("canStartThreadGroupId")) + || $self->SUPER::canEdit( $userId ) ); } @@ -1382,6 +1377,26 @@ sub view { return $out; } +#------------------------------------------------------------------- + +=head2 www_add ( ) + +Returns an error message if the collaboration system has not yet been posted. + +=cut + +sub www_add { + my $self = shift; + + #Check to see if the asset has been committed + unless ( $self->hasBeenCommitted ) { + my $i18n = WebGUI::International->new($self->session,"Asset_Collaboration"); + return $self->processStyle($i18n->get("asset not committed")); + } + return $self->SUPER::www_add( @_ ); +} + + #------------------------------------------------------------------- =head2 www_editSave ( ) diff --git a/lib/WebGUI/Asset/Wobject/Gallery.pm b/lib/WebGUI/Asset/Wobject/Gallery.pm index c6f63cbf1..d3c97db05 100644 --- a/lib/WebGUI/Asset/Wobject/Gallery.pm +++ b/lib/WebGUI/Asset/Wobject/Gallery.pm @@ -1033,15 +1033,12 @@ instead of having to block things from being added. sub www_add { my $self = shift; - if ( $self->getRevisionCount <= 1 && $self->get('status') eq "pending" ) { + unless ( $self->hasBeenCommitted ) { my $i18n = WebGUI::International->new($self->session, 'Asset_Gallery'); - return $self->processStyle( - $i18n->get("error add uncommitted") - ); - } - else { - return $self->SUPER::www_add( @_ ); + return $self->processStyle($i18n->get("error add uncommitted")); } + + return $self->SUPER::www_add( @_ ); } #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/WikiMaster.pm b/lib/WebGUI/Asset/Wobject/WikiMaster.pm index 5b17ff534..282dfe4a1 100644 --- a/lib/WebGUI/Asset/Wobject/WikiMaster.pm +++ b/lib/WebGUI/Asset/Wobject/WikiMaster.pm @@ -392,6 +392,26 @@ sub view { return $self->processTemplate($var, undef, $template); } +#------------------------------------------------------------------- + +=head2 www_add ( ) + +Returns an error message if the collaboration system has not yet been posted. + +=cut + +sub www_add { + my $self = shift; + + #Check to see if the asset has been committed + unless ($self->hasBeenCommitted ) { + my $i18n = WebGUI::International->new($self->session,"Asset_WikiMaster"); + return $self->processStyle($i18n->get("asset not committed")); + } + return $self->SUPER::www_add( @_ ); +} + + #------------------------------------------------------------------- sub www_byKeyword { diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index 3a95195b3..a7317b250 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -301,6 +301,19 @@ sub getTagCount { #------------------------------------------------------------------- +=head2 hasBeenCommitted ( ) + +Returns whether or not this asset has been committed + +=cut + +sub hasBeenCommitted { + my $self = shift; + return $self->getTagCount > 1 || $self->get('status') ne "pending"; +} + +#------------------------------------------------------------------- + =head2 isLocked ( ) Returns a boolean indicating whether the asset is locked for editing by the versioning system. diff --git a/lib/WebGUI/i18n/English/Asset_Calendar.pm b/lib/WebGUI/i18n/English/Asset_Calendar.pm index 2a063b81f..25c5d7e27 100755 --- a/lib/WebGUI/i18n/English/Asset_Calendar.pm +++ b/lib/WebGUI/i18n/English/Asset_Calendar.pm @@ -900,8 +900,10 @@ our $I18N = { lastUpdated => 0, context => 'Description of the asset property workflowIdCommit', }, - - + 'asset not committed' => { + message => q{
You need to commit this calendar before you can create a new event
}, + lastUpdated => 1166848379, + }, }; 1; diff --git a/lib/WebGUI/i18n/English/Asset_Collaboration.pm b/lib/WebGUI/i18n/English/Asset_Collaboration.pm index 5d6ec4309..6849a4aaa 100644 --- a/lib/WebGUI/i18n/English/Asset_Collaboration.pm +++ b/lib/WebGUI/i18n/English/Asset_Collaboration.pm @@ -1650,6 +1650,11 @@ the Collaboration Asset, the user will be notified.|, message => q|Keywords|, lastUpdated => 1170543345, }, + + 'asset not committed' => { + message => q{You need to commit this collaboration system before you can create a new thread
}, + lastUpdated => 1166848379, + }, }; diff --git a/lib/WebGUI/i18n/English/Asset_WikiMaster.pm b/lib/WebGUI/i18n/English/Asset_WikiMaster.pm index 4a043c936..121e21db9 100644 --- a/lib/WebGUI/i18n/English/Asset_WikiMaster.pm +++ b/lib/WebGUI/i18n/English/Asset_WikiMaster.pm @@ -489,6 +489,11 @@ listing of pages that are related to a specific keyword?| }, lastUpdated=> 0, }, + 'asset not committed' => { + message => q{You need to commit this wiki before you can create a new wiki entry
}, + lastUpdated => 1166848379, + }, + }; 1;