added: Commit Version Tag screen shows revisions in the tag about to be committed

This commit is contained in:
Doug Bell 2008-04-28 01:18:35 +00:00
parent 614da0d2ab
commit 3316f2a0f4
2 changed files with 98 additions and 43 deletions

View file

@ -43,6 +43,7 @@
- fixed: Registration form now saves all progress if there is an error - fixed: Registration form now saves all progress if there is an error
- added: DataForm now can use CAPTCHA for Visitors - added: DataForm now can use CAPTCHA for Visitors
- Spent some time cleaning up DataForm, but it could use more. - Spent some time cleaning up DataForm, but it could use more.
- added: Commit Version Tag screen shows revisions in the tag
7.5.10 7.5.10

View file

@ -202,49 +202,103 @@ A reference to the current session.
=cut =cut
sub www_commitVersionTag { sub www_commitVersionTag {
my $session = shift; my $session = shift;
my $tagId = $session->form->param("tagId"); my $tagId = $session->form->param("tagId");
if ($tagId) {
my $tag = WebGUI::VersionTag->new($session, $tagId); if ( !$tagId ) {
if (defined $tag && $session->user->isInGroup($tag->get("groupToUse"))) { return www_manageVersions( $session );
my $remote = WebGUI::Operation::Spectre::getASpectre($session); }
my $i18n = WebGUI::International->new($session, "VersionTag");
if (!defined $remote) { my $tag = WebGUI::VersionTag->new($session, $tagId);
$session->errorHandler->warn('Unable to connect to spectre. Canceling the commit'); if ( !defined $tag || !$session->user->isInGroup($tag->get("groupToUse")) ) {
my $output = sprintf qq{<h1>%s</h1>\n<p>%s</p><p><a href="%s">%s</a>}, return www_manageVersions( $session );
$i18n->get('broken spectre title', 'WebGUI'), }
$i18n->get('broken spectre body', 'WebGUI'),
$session->url->getBackToSiteURL(), # Make sure we can connect to SPECTRE
$i18n->get('493', 'WebGUI'); my $remote = WebGUI::Operation::Spectre::getASpectre($session);
return $session->style->userStyle($output); my $i18n = WebGUI::International->new($session, "VersionTag");
} if (!defined $remote) {
$remote->disconnect; $session->errorHandler->warn('Unable to connect to spectre. Canceling the commit');
my $f = WebGUI::HTMLForm->new($session); my $output = sprintf qq{<h1>%s</h1>\n<p>%s</p><p><a href="%s">%s</a>},
$f->submit; $i18n->get('broken spectre title', 'WebGUI'),
$f->readOnly( $i18n->get('broken spectre body', 'WebGUI'),
label=>$i18n->get("version tag name"), $session->url->getBackToSiteURL(),
hoverHelp=>$i18n->get("version tag name description commit"), $i18n->get('493', 'WebGUI');
value=>$tag->get("name") return $session->style->userStyle($output);
); }
$f->hidden( $remote->disconnect;
name=>"tagId",
value=>$session->form->param("tagId") # Build the page
); my $output = '';
$f->hidden(
name=>"op", # Commit comments form
value=>"commitVersionTagConfirm" my $f = WebGUI::HTMLForm->new($session);
); $f->submit;
$f->textarea( $f->readOnly(
name=>"comments", label=>$i18n->get("version tag name"),
label=>$i18n->get("comments"), hoverHelp=>$i18n->get("version tag name description commit"),
hoverHelp=>$i18n->get("comments description commit") value=>$tag->get("name")
); );
$f->submit; $f->hidden(
my $ac = WebGUI::AdminConsole->new($session,"versions"); name=>"tagId",
return $ac->render($f->print); value=>$session->form->param("tagId")
} );
} $f->hidden(
return www_manageVersions($session); name=>"op",
value=>"commitVersionTagConfirm"
);
$f->textarea(
name=>"comments",
label=>$i18n->get("comments"),
hoverHelp=>$i18n->get("comments description commit")
);
$f->submit;
$output .= $f->print;
# Revisions in this tag
$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> '
;
my $p
= WebGUI::Paginator->new( $session,
$session->url->page("op=commitVersionTag;tagId=".$tag->getId),
);
$p->setDataByQuery(q{
SELECT assetData.revisionDate, users.username, asset.assetId, asset.className
FROM assetData
LEFT JOIN asset ON assetData.assetId = asset.assetId
LEFT JOIN users ON assetData.revisedBy = users.userId
WHERE assetData.tagId=? },
undef,
undef,
[$tag->getId]
);
foreach my $row ( @{$p->getPageData} ) {
my ( $date, $by, $id, $class) = @{ $row }{ qw( revisionDate username assetId className ) };
my $asset = WebGUI::Asset->new($session, $id, $class, $date);
$output
.= '<tr><td>'
.$session->icon->view("func=view;revision=".$date, $asset->get("url"))
.'</td>
<td>'.$asset->getTitle.'</td>
<td><img src="'.$asset->getIcon(1).'" alt="'.$asset->getName.'" />'.$asset->getName.'</td>
<td>'.$session->datetime->epochToHuman($date).'</td>
<td>'.$by.'</td></tr>';
}
$output .= '</table>'.$p->getBarSimple;
# Render and send
my $ac = WebGUI::AdminConsole->new($session,"versions");
return $ac->render( $output );
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------