added: Two new approval activities, byLineage and byCommitterGroup

added: Show a message to users when they log in
fixed: Gallery search form doesn't work right in IE6
fixed: Minor bug in new gallery approval handling
This commit is contained in:
Doug Bell 2008-06-02 21:16:06 +00:00
parent a0ec44567a
commit 614b37e31d
12 changed files with 515 additions and 32 deletions

View file

@ -0,0 +1,99 @@
package WebGUI::Workflow::Activity::RequestApprovalForVersionTag::ByCommitterGroup;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 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::Workflow::Activity::RequestApprovalForVersionTag';
=head1 NAME
Package WebGUI::Workflow::Activity::RequestApprovalForVersionTag::ByCommitterGroup
=head1 DESCRIPTION
Requests approval for a version tag only if the committer is a member of
the specified group.
In this way, we can make certain groups of users go through additional
approval.
=head1 SYNOPSIS
See WebGUI::Workflow::Activity for details on how to use any activity.
=head1 METHODS
These methods are available from this class:
=cut
#-------------------------------------------------------------------
=head2 definition ( session, definition )
See WebGUI::Workflow::Activity::defintion() for details.
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session, "Activity_RequestApprovalForVersionTag_ByCommitterGroup");
push @{ $definition }, {
name => $i18n->get( "topicName" ),
properties => {
committerGroupId => {
fieldType => "group",
defaultValue => 0,
label => $i18n->get( 'committerGroupId label' ),
hoverHelp => $i18n->get( 'committerGroupId description' ),
},
},
};
return $class->SUPER::definition( $session, $definition );
}
#----------------------------------------------------------------------------
=head2 execute ( tag, instance )
Request the approval. Make sure the tag is covered by the C<committerGroupId>
and then request approval.
If the tag is not covered, just continue with the workflow.
=cut
sub execute {
my $self = shift;
my $tag = shift;
my $instance = shift;
my $committedBy = WebGUI::User->new( $self->session, $tag->get( 'committedBy' ) );
# If tag is handled by this activity
if ( $committedBy->isInGroup( $self->get( 'committerGroupId' ) ) ) {
return $self->SUPER::execute( $tag, $instance );
}
else {
return $self->COMPLETE;
}
}
1;

View file

@ -0,0 +1,103 @@
package WebGUI::Workflow::Activity::RequestApprovalForVersionTag::ByLineage;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 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::Workflow::Activity::RequestApprovalForVersionTag';
=head1 NAME
Package WebGUI::Workflow::Activity::RequestApprovalForVersionTag::ByLineage
=head1 DESCRIPTION
Requests approval for a version tag only if all the content is under
the specified asset.
In this way we can create sections of our site that require approval
from certain people.
=head1 SYNOPSIS
See WebGUI::Workflow::Activity for details on how to use any activity.
=head1 METHODS
These methods are available from this class:
=cut
#-------------------------------------------------------------------
=head2 definition ( session, definition )
See WebGUI::Workflow::Activity::defintion() for details.
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session, "Activity_RequestApprovalForVersionTag_ByLineage");
push @{ $definition }, {
name => $i18n->get( "topicName" ),
properties => {
assetId => {
fieldType => "asset",
defaultValue => 0,
label => $i18n->get( 'assetId label' ),
hoverHelp => $i18n->get( 'assetId description' ),
},
},
};
return $class->SUPER::definition( $session, $definition );
}
#----------------------------------------------------------------------------
=head2 execute ( tag, instance )
Request the approval. Make sure the tag is covered by the C<assetId>
and then request approval.
If the tag is not covered, just continue with the workflow.
=cut
sub execute {
my $self = shift;
my $tag = shift;
my $instance = shift;
my $ancestor = WebGUI::Asset->newByDynamicClass( $self->session, $self->get( 'assetId' ) );
my $lineage = $ancestor->get( 'lineage' );
# Descendant has at least the ancestors lineage plus 6 more character
my $isDescendant = qr{^$lineage.{6}};
# If one piece of content isn't under our ancestor, complete
for my $asset ( @{ $tag->getAssets } ) {
if ( $asset->get( 'lineage' ) !~ $isDescendant ) {
return $self->COMPLETE;
}
}
# Every piece is under our ancestor, get some approval
return $self->SUPER::execute( $tag, $instance );
}
1;