Better info for Assets that require commit before adding children. Add link is always availiable now, an error message is displayed if you try to post a child to an uncommitted parent. Additionally a new method was added to AssetVersionion.pm to determine whether or not an asset has been committed.

This commit is contained in:
Frank Dillon 2008-09-16 20:08:15 +00:00
parent 0e80937c6b
commit 58f231c87b
9 changed files with 94 additions and 22 deletions

View file

@ -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 ( )

View file

@ -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 ( )

View file

@ -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( @_ );
}
#----------------------------------------------------------------------------

View file

@ -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 {

View file

@ -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.

View file

@ -900,8 +900,10 @@ our $I18N = {
lastUpdated => 0,
context => 'Description of the asset property workflowIdCommit',
},
'asset not committed' => {
message => q{<h1>Error!</h1><p>You need to commit this calendar before you can create a new event</p>},
lastUpdated => 1166848379,
},
};
1;

View file

@ -1650,6 +1650,11 @@ the Collaboration Asset, the user will be notified.|,
message => q|Keywords|,
lastUpdated => 1170543345,
},
'asset not committed' => {
message => q{<h1>Error!</h1><p>You need to commit this collaboration system before you can create a new thread</p>},
lastUpdated => 1166848379,
},
};

View file

@ -489,6 +489,11 @@ listing of pages that are related to a specific keyword?| },
lastUpdated=> 0,
},
'asset not committed' => {
message => q{<h1>Error!</h1><p>You need to commit this wiki before you can create a new wiki entry</p>},
lastUpdated => 1166848379,
},
};
1;