added commit comments

This commit is contained in:
JT Smith 2006-03-16 18:51:49 +00:00
parent 2384bca6ba
commit feda6700e0
7 changed files with 88 additions and 14 deletions

View file

@ -103,7 +103,7 @@ sub process {
if ($working) {
$workingId = $working->getId;
push(@tags, {
url=>$session->url->page("op=commitVersionTag;backToSite=1;tagId=".$workingId),
url=>$session->url->page("op=commitVersionTag;tagId=".$workingId),
title=>$i18n->get("commit my changes"),
icon=>$session->config->get("extrasURL").'/adminConsole/small/versionTags.gif'
});

View file

@ -80,6 +80,7 @@ sub getOperations {
'editVersionTag' => 'WebGUI::Operation::VersionTag',
'editVersionTagSave' => 'WebGUI::Operation::VersionTag',
'commitVersionTag' => 'WebGUI::Operation::VersionTag',
'commitVersionTagConfirm' => 'WebGUI::Operation::VersionTag',
'manageCommittedVersions' => 'WebGUI::Operation::VersionTag',
'manageVersions' => 'WebGUI::Operation::VersionTag',
'manageRevisionsInTag' => 'WebGUI::Operation::VersionTag',

View file

@ -146,9 +146,9 @@ sub www_editVersionTagSave {
#-------------------------------------------------------------------
=head2 www_commitVersionTag ( session )
=head2 www_commitVersionTag ( session )
Commits a version tag.
Prompts a user to apply some comments before they commit their tag.
=head3 session
@ -161,16 +161,69 @@ sub www_commitVersionTag {
my $tagId = $session->form->param("tagId");
if ($tagId) {
my $tag = WebGUI::VersionTag->new($session, $tagId);
$tag->commit if (defined $tag && $session->user->isInGroup($tag->get("groupToUse")));
}
if ($session->form->get("backToSite")) {
return "";
if (defined $tag && $session->user->isInGroup($tag->get("groupToUse"))) {
my $i18n = WebGUI::International->new($session, "VersionTag");
my $f = WebGUI::HTMLForm->new($session);
$f->readOnly(
label=>$i18n->get("version tag name"),
value=>$tag->get("name")
);
$f->hidden(
name=>"tagId",
value=>$session->form->param("tagId")
);
$f->hidden(
name=>"op",
value=>"commitVersionTagConfirm"
);
$f->textarea(
name=>"comments",
label=>$i18n->get("comments")
);
$f->submit;
my $ac = WebGUI::AdminConsole->new($session,"versions");
return $ac->render($f->print);
}
}
return www_manageVersions($session);
}
#-------------------------------------------------------------------
=head2 www_commitVersionTagConfirm ( session )
Commits a version tag.
=head3 session
A reference to the current session.
=cut
sub www_commitVersionTagConfirm {
my $session = shift;
my $tagId = $session->form->param("tagId");
if ($tagId) {
my $tag = WebGUI::VersionTag->new($session, $tagId);
if (defined $tag && $session->user->isInGroup($tag->get("groupToUse"))) {
$tag->set({comments=>$session->form->process("comments", "textarea")});
$tag->commit;
my $i18n = WebGUI::International->new($session, "VersionTag");
my $ac = WebGUI::AdminConsole->new($session,"versions");
$ac->render(
'<p>'.$i18n->get("commit accepted").'</p>'
.'<ul>
<li><a href="'.$session->url->page.'">'.$i18n->get("493","WebGUI").'</a></li>
<li><a href="'.$session->url->page("op=manageVersions").'">'.$i18n->get("manage versions").'</a></li>
</ul>'
);
}
}
return www_manageVersions($session);
}
#-------------------------------------------------------------------
=head2 www_manageCommittedVersions ( session )
Shows a list of the currently available asset version tags.
@ -315,7 +368,7 @@ sub www_manageRevisionsInTag {
if ($tag->get("comments")) {
my $comments = $tag->get("comments");
$comments =~ s/\n/<br \/>/g;
$output .= '<p>'.$comments.'</p>';
$output .= $comments;
}
$output .= '<table width=100% class="content">
<tr><th></th><th>'.$i18n->get(99,"Asset").'</th><th>'.$i18n->get("type","Asset").'</th><th>'.$i18n->get("revision date","Asset").'</th><th>'.$i18n->get("revised by","Asset").'</th></tr> ';

View file

@ -291,6 +291,10 @@ The ID of the workflow that will be triggered when this workflow is committed. D
The ID of the group that's allowed to use this tag. Defaults to the turn admin on group.
=head4 comments
Some text about this version tag, what it's for, why it was committed, why it was denied, why it was approved, etc.
=cut
sub set {
@ -299,6 +303,13 @@ sub set {
$self->{_data}{name} = $properties->{name} || $self->{_data}{name} || "(Autotag) ".$self->session->datetime->epochToHuman()." / ".$self->session->user->username;
$self->{_data}{workflowId} = $properties->{workflowId} || $self->{_data}{workflowId} || $self->session->setting->get("defaultVersionTagWorkflow");
$self->{_data}{groupToUse} = $properties->{groupToUse} || $self->{_data}{groupToUse} || "12";
if (exists $properties->{comments}) {
$self->{_data}{comments}=$self->{_data}{comments}
.$self->session->datetime->epochToHuman.' - '.$self->session->user->username
."\n"
.$properties->{comments}
."\n\n";
}
$self->session->db->setRow("assetVersionTag","tagId",$self->{_data});
}

View file

@ -1,6 +1,12 @@
package WebGUI::i18n::English::VersionTag;
our $I18N = {
'commit accepted' => {
message => q|Your tag has been submitted for approval and commit. It may take some time before it appears live on the site. Where would you like to go next?|,
lastUpdated => 0,
context => q|label on the manage revisions in tag page during the approval process|
},
'comments' => {
message => q|Comments|,
lastUpdated => 0,