From 09af3e8785051d3faf50321b8bd9a3b87529fa21 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 25 Jul 2006 21:11:14 +0000 Subject: [PATCH] - Added "Save and Commit" option for environments where the appearance of workflow is unwanted. --- docs/changelog/7.x.x.txt | 2 ++ docs/upgrades/upgrade_7.0.2-7.0.3.pl | 7 +++++++ etc/WebGUI.conf.original | 12 +++++++++--- lib/WebGUI/Asset.pm | 7 +++++++ lib/WebGUI/TabForm.pm | 13 +++++++++++++ lib/WebGUI/i18n/English/Asset.pm | 6 ++++++ 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 03692b7ac..f3c76695f 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -53,6 +53,8 @@ than the array() method. - Added more tests to the test suite. - fix: Search Feature Select Box Not Working + - Added "Save and Commit" option for environments where the appearance of + workflow is unwanted. 7.0.2 diff --git a/docs/upgrades/upgrade_7.0.2-7.0.3.pl b/docs/upgrades/upgrade_7.0.2-7.0.3.pl index fb239c8ae..105253286 100644 --- a/docs/upgrades/upgrade_7.0.2-7.0.3.pl +++ b/docs/upgrades/upgrade_7.0.2-7.0.3.pl @@ -22,10 +22,17 @@ sleep(1); # todd prevent duplicate timestamps my $session = start(); # this line required deleteTemplate(); +addConfigOption(); finish($session); # this line required +#------------------------------------------------- +sub addConfigOption { + print "\tAdding save and commit option.\n" unless ($quiet); + $session->config->set("enableSaveAndCommit", 0); +} + #------------------------------------------------- sub deleteTemplate { print "\tDeleting a template that was accidentally added.\n" unless ($quiet); diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index c75acd83b..e6109c41b 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -214,6 +214,11 @@ # "WebGUI:::Asset::Template" : 4 # }, +# Optionally add a "Save and Commit" button to assets so that you +# don't have to hit "Commit My Changes" seperately. + +"enableSaveAndCommit" : 0, + # Optionally override the default UI Level of any asset. This # determines whether the current user has the appropriate UI Level # to add assets of that type. @@ -355,14 +360,15 @@ "WebGUI::Image::Graph::XYGraph::Line" ], -#Optional script to run upon successful login. The script can contain macros +# Optional script to run upon successful login. The script can contain macros # ex: /data/WebGUI/sbin/doLogin.pl --configFile=dev.localhost.localdomain.conf --loginPage=^PageUrl(); "runOnLogin" : "", -#Optional script to run upon successful logout. The script can contain macros -# ex: /data/WebGUI/sbin/doLogout.pl --configFile=dev.localhost.localdomain.conf --logoutPage=^PageUrl(); +# Optional script to run upon successful logout. The script can contain macros +# Example: /data/WebGUI/sbin/doLogout.pl --configFile=dev.localhost.localdomain.conf --logoutPage=^PageUrl(); "runOnLogout" : "" + } diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index d73b464ed..507b0d6b6 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -603,6 +603,9 @@ sub getEditForm { my $uiLevelOverride = $self->get("className"); $uiLevelOverride =~ s/\:\:/_/g; my $tabform = WebGUI::TabForm->new($self->session,undef,undef,$self->getUrl(),$uiLevelOverride); + if ($self->session->config->get("enableSaveAndCommit")) { + $tabform->submitAppend(WebGUI::Form::submit($self->session, {name=>"saveAndCommit", value=>$i18n->get("save and commit")})); + } $tabform->hidden({ name=>"func", value=>"editSave" @@ -1963,6 +1966,10 @@ sub www_editSave { } $object->updateHistory("edited"); + if ($self->session->form->process("saveAndCommit") ne "") { + $self->session->http->setRedirect($self->getUrl("op=commitVersionTag;tagId=".WebGUI::VersionTag->getWorking($self->session)->getId)); + return "1"; + } if ($self->session->form->process("proceed") eq "manageAssets") { $self->session->asset($object->getParent); return $self->session->asset->www_manageAssets; diff --git a/lib/WebGUI/TabForm.pm b/lib/WebGUI/TabForm.pm index cc879574e..140bd498f 100644 --- a/lib/WebGUI/TabForm.pm +++ b/lib/WebGUI/TabForm.pm @@ -280,6 +280,19 @@ sub submit { $self->{_submit} = WebGUI::Form::Submit($self->session,$submit); } +#------------------------------------------------------------------- + +=head2 submitAppend ( html ) + +Appends some HTML to the submit button. + +=cut + +sub submitAppend { + my $self = shift; + my $html = shift; + $self->{_submit} .= $html; +} 1; diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm index b8a8aad85..49e0d2df6 100644 --- a/lib/WebGUI/i18n/English/Asset.pm +++ b/lib/WebGUI/i18n/English/Asset.pm @@ -1,6 +1,12 @@ package WebGUI::i18n::English::Asset; our $I18N = { + 'save and commit' => { + message => q|save & commit|, + lastUpdated => 0, + context => q|A button added to all asset properties pages when save and commit mode is enabled.| + }, + 'add the missing page' => { message => q|Add the missing page.|, lastUpdated => 0,