From 3316f2a0f4a87a8be28ad2b33d05640f3cf25e47 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Mon, 28 Apr 2008 01:18:35 +0000 Subject: [PATCH] added: Commit Version Tag screen shows revisions in the tag about to be committed --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Operation/VersionTag.pm | 140 ++++++++++++++++++++--------- 2 files changed, 98 insertions(+), 43 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 09c0a645a..ca5601af4 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -43,6 +43,7 @@ - fixed: Registration form now saves all progress if there is an error - added: DataForm now can use CAPTCHA for Visitors - Spent some time cleaning up DataForm, but it could use more. + - added: Commit Version Tag screen shows revisions in the tag 7.5.10 diff --git a/lib/WebGUI/Operation/VersionTag.pm b/lib/WebGUI/Operation/VersionTag.pm index e9f978af8..a19431324 100644 --- a/lib/WebGUI/Operation/VersionTag.pm +++ b/lib/WebGUI/Operation/VersionTag.pm @@ -202,49 +202,103 @@ A reference to the current session. =cut sub www_commitVersionTag { - 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"))) { - my $remote = WebGUI::Operation::Spectre::getASpectre($session); - my $i18n = WebGUI::International->new($session, "VersionTag"); - if (!defined $remote) { - $session->errorHandler->warn('Unable to connect to spectre. Canceling the commit'); - my $output = sprintf qq{

%s

\n

%s

%s}, - $i18n->get('broken spectre title', 'WebGUI'), - $i18n->get('broken spectre body', 'WebGUI'), - $session->url->getBackToSiteURL(), - $i18n->get('493', 'WebGUI'); - return $session->style->userStyle($output); - } - $remote->disconnect; - my $f = WebGUI::HTMLForm->new($session); - $f->submit; - $f->readOnly( - label=>$i18n->get("version tag name"), - hoverHelp=>$i18n->get("version tag name description commit"), - 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"), - hoverHelp=>$i18n->get("comments description commit") - ); - $f->submit; - my $ac = WebGUI::AdminConsole->new($session,"versions"); - return $ac->render($f->print); - } - } - return www_manageVersions($session); + my $session = shift; + my $tagId = $session->form->param("tagId"); + + if ( !$tagId ) { + return www_manageVersions( $session ); + } + + my $tag = WebGUI::VersionTag->new($session, $tagId); + if ( !defined $tag || !$session->user->isInGroup($tag->get("groupToUse")) ) { + return www_manageVersions( $session ); + } + + # Make sure we can connect to SPECTRE + my $remote = WebGUI::Operation::Spectre::getASpectre($session); + my $i18n = WebGUI::International->new($session, "VersionTag"); + if (!defined $remote) { + $session->errorHandler->warn('Unable to connect to spectre. Canceling the commit'); + my $output = sprintf qq{

%s

\n

%s

%s}, + $i18n->get('broken spectre title', 'WebGUI'), + $i18n->get('broken spectre body', 'WebGUI'), + $session->url->getBackToSiteURL(), + $i18n->get('493', 'WebGUI'); + return $session->style->userStyle($output); + } + $remote->disconnect; + + # Build the page + my $output = ''; + + # Commit comments form + my $f = WebGUI::HTMLForm->new($session); + $f->submit; + $f->readOnly( + label=>$i18n->get("version tag name"), + hoverHelp=>$i18n->get("version tag name description commit"), + 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"), + hoverHelp=>$i18n->get("comments description commit") + ); + $f->submit; + $output .= $f->print; + + # Revisions in this tag + $output + .= '' + . '' + . '' + . '' + . '' + . '' + . '' + . ' ' + ; + + 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 + .= ' + + + + '; + } + $output .= '
'.$i18n->get(99,"Asset").''.$i18n->get("type","Asset").''.$i18n->get("revision date","Asset").''.$i18n->get("revised by","Asset").'
' + .$session->icon->view("func=view;revision=".$date, $asset->get("url")) + .''.$asset->getTitle.''.$asset->getName.''.$asset->getName.''.$session->datetime->epochToHuman($date).''.$by.'
'.$p->getBarSimple; + + # Render and send + my $ac = WebGUI::AdminConsole->new($session,"versions"); + return $ac->render( $output ); } #-------------------------------------------------------------------