From feda6700e0cbc61c7270a0aa71c799206f0494ca Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 16 Mar 2006 18:51:49 +0000 Subject: [PATCH] added commit comments --- docs/changelog/6.x.x.txt | 14 +++--- docs/upgrades/upgrade_6.8.7-6.99.0.pl | 1 + lib/WebGUI/Macro/AdminBar.pm | 2 +- lib/WebGUI/Operation.pm | 1 + lib/WebGUI/Operation/VersionTag.pm | 67 ++++++++++++++++++++++++--- lib/WebGUI/VersionTag.pm | 11 +++++ lib/WebGUI/i18n/English/VersionTag.pm | 6 +++ 7 files changed, 88 insertions(+), 14 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 7e54d0e54..a94f99e58 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -1,19 +1,21 @@ 6.99.0 + - Added a workflow system. + - Added a workflow scheduler system. + - Converted the runHourly.pl scripts to run as scheduled workflows. + - Added version tags menu to admin bar. + - Added versioning commit comments. + - Removed autocommit mode in favor of workflow controlled commits. + - Added a revisions list to the edit screen of assets, so that you can + quickly edit/view an old revision. - Addded a lock menu item to explicitly lock an asset from editing. - Run on registration and alert on new user have been converted to a single workflow. - Many changes for better XHTML compliance. - Refactored admin bar to be more dynamic. - - Added version tags menu to admin bar. - - Added a revisions list to the edit screen of assets, so that you can - quickly edit/view an old revision. - Removed start/end dates from assets in favor of the workflow system. - Readded the purge option to the trash manager. - Added archive/unarchive options to CS threads. - Added a database cache option as an alternative to memcached. - - Added a workflow system. - - Added a workflow scheduler system. - - Converted the runHourly.pl scripts to run as scheduled workflows. - Converted WebGUI to use a new object oriented session system. More details in migation.txt. - Added a lot more tests to the test suite. diff --git a/docs/upgrades/upgrade_6.8.7-6.99.0.pl b/docs/upgrades/upgrade_6.8.7-6.99.0.pl index 90a9f56be..00205675d 100644 --- a/docs/upgrades/upgrade_6.8.7-6.99.0.pl +++ b/docs/upgrades/upgrade_6.8.7-6.99.0.pl @@ -78,6 +78,7 @@ sub addWorkflow { $session->db->write("alter table assetVersionTag add column lockedBy varchar(22) binary not null"); $session->db->write("alter table assetVersionTag add column groupToUse varchar(22) binary not null"); $session->db->write("alter table assetVersionTag add column workflowId varchar(22) binary not null"); + $session->db->write("alter table assetVersionTag add column comments text"); $session->db->write("create table WorkflowSchedule ( taskId varchar(22) binary not null primary key, title varchar(255) not null default 'Untitled', diff --git a/lib/WebGUI/Macro/AdminBar.pm b/lib/WebGUI/Macro/AdminBar.pm index ba6942f29..79c48a2b1 100644 --- a/lib/WebGUI/Macro/AdminBar.pm +++ b/lib/WebGUI/Macro/AdminBar.pm @@ -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' }); diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm index 1f170fd01..e03b4230b 100644 --- a/lib/WebGUI/Operation.pm +++ b/lib/WebGUI/Operation.pm @@ -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', diff --git a/lib/WebGUI/Operation/VersionTag.pm b/lib/WebGUI/Operation/VersionTag.pm index c2edbf192..b062e52da 100644 --- a/lib/WebGUI/Operation/VersionTag.pm +++ b/lib/WebGUI/Operation/VersionTag.pm @@ -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( + '

'.$i18n->get("commit accepted").'

' + .'' + ); + } + } + 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/
/g; - $output .= '

'.$comments.'

'; + $output .= $comments; } $output .= ' '; diff --git a/lib/WebGUI/VersionTag.pm b/lib/WebGUI/VersionTag.pm index 8cfb3c7bf..da37920d0 100644 --- a/lib/WebGUI/VersionTag.pm +++ b/lib/WebGUI/VersionTag.pm @@ -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}); } diff --git a/lib/WebGUI/i18n/English/VersionTag.pm b/lib/WebGUI/i18n/English/VersionTag.pm index 85456197b..53bb27123 100644 --- a/lib/WebGUI/i18n/English/VersionTag.pm +++ b/lib/WebGUI/i18n/English/VersionTag.pm @@ -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,
'.$i18n->get(99,"Asset").''.$i18n->get("type","Asset").''.$i18n->get("revision date","Asset").''.$i18n->get("revised by","Asset").'