From b8127bafec31b50a860392cabf41e93130791b72 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 8 Sep 2009 11:02:15 -0500 Subject: [PATCH 01/11] Revert "When opening or duplicating Session objects, pass on any Apache2::Request object" This reverts commit ed97fa1ecd06d0ccf3b5a36c5a5072c0de2db8fd. --- lib/WebGUI/Asset/Wobject/StoryArchive.pm | 2 +- lib/WebGUI/AssetAspect/RssFeed.pm | 2 +- lib/WebGUI/AssetExportHtml.pm | 2 -- lib/WebGUI/Session.pm | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/StoryArchive.pm b/lib/WebGUI/Asset/Wobject/StoryArchive.pm index e234a6f28..16d2cf162 100644 --- a/lib/WebGUI/Asset/Wobject/StoryArchive.pm +++ b/lib/WebGUI/Asset/Wobject/StoryArchive.pm @@ -221,7 +221,7 @@ sub exportAssetCollateral { my $printSession = WebGUI::Session->open( $self->session->config->getWebguiRoot, $self->session->config->getFilename, - $self->session->request, + undef, undef, $self->session->getId, ); diff --git a/lib/WebGUI/AssetAspect/RssFeed.pm b/lib/WebGUI/AssetAspect/RssFeed.pm index f7b322007..b1caab66f 100644 --- a/lib/WebGUI/AssetAspect/RssFeed.pm +++ b/lib/WebGUI/AssetAspect/RssFeed.pm @@ -232,7 +232,7 @@ sub exportAssetCollateral { my $exportSession = WebGUI::Session->open( $self->session->config->getWebguiRoot, $self->session->config->getFilename, - $self->session->request, + undef, undef, $self->session->getId, ); diff --git a/lib/WebGUI/AssetExportHtml.pm b/lib/WebGUI/AssetExportHtml.pm index d22e0eb82..cfa8f68c3 100644 --- a/lib/WebGUI/AssetExportHtml.pm +++ b/lib/WebGUI/AssetExportHtml.pm @@ -267,7 +267,6 @@ sub exportAsHtml { my $exportSession = WebGUI::Session->open( $session->config->getWebguiRoot, $session->config->getFilename, - $session->request, ); my $esGuard = Scope::Guard->new(sub { $exportSession->var->end; @@ -503,7 +502,6 @@ sub exportGetDescendants { $session = WebGUI::Session->open( $session->config->getWebguiRoot, $session->config->getFilename, - $session->request, ); $session->user( { userId => $user->userId } ); $sGuard = Scope::Guard->new(sub { diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index c53abc3df..1ffcd69a5 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -252,7 +252,7 @@ sub duplicate { my $newSession = WebGUI::Session->open( $self->config->getWebguiRoot, $self->config->getFilename, - $self->request, + undef, undef, $self->getId, ); From 1671aefee5a9a30c2d20aba3c852f1089dc2ed09 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 8 Sep 2009 17:05:00 -0700 Subject: [PATCH 02/11] Write a test that says that loading Form plugins from a place other than /data/WebGUI/lib/WebGUI works. --- t/Form/DynamicField.t | 40 +++++++++++++++++++++++++++ t/lib/WebGUI/Form/FormTest.pm | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 t/Form/DynamicField.t create mode 100644 t/lib/WebGUI/Form/FormTest.pm diff --git a/t/Form/DynamicField.t b/t/Form/DynamicField.t new file mode 100644 index 000000000..404648b18 --- /dev/null +++ b/t/Form/DynamicField.t @@ -0,0 +1,40 @@ +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2009 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use FindBin; +use strict; +use lib "$FindBin::Bin/../lib"; + +use WebGUI::Test; +use WebGUI::Form; +use WebGUI::Form::FieldType; +use WebGUI::Session; + +#The goal of this test is to verify that Email form elements work. +#The Email form accepts and validates an email address. + +use Test::More; # increment this value for each test you create + +my $session = WebGUI::Test->session; + +# put your tests here + +my $formClass = 'WebGUI::Form::DynamicField'; + +my $numTests = 1; + +plan tests => $numTests; + +my $form = WebGUI::Form::DynamicField->new($session, + fieldType => 'FormTest', +); + +diag "Test loading a Form from a location outside of /data/WebGUI/lib/WebGUI"; +isa_ok($form, 'WebGUI::Form::FormTest'); diff --git a/t/lib/WebGUI/Form/FormTest.pm b/t/lib/WebGUI/Form/FormTest.pm new file mode 100644 index 000000000..c042a3e7e --- /dev/null +++ b/t/lib/WebGUI/Form/FormTest.pm @@ -0,0 +1,52 @@ +package WebGUI::Form::FormTest; + +=head1 LEGAL + + ------------------------------------------------------------------- + WebGUI is Copyright 2001-2009 Plain Black Corporation. + ------------------------------------------------------------------- + Please read the legal notices (docs/legal.txt) and the license + (docs/license.txt) that came with this distribution before using + this software. + ------------------------------------------------------------------- + http://www.plainblack.com info@plainblack.com + ------------------------------------------------------------------- + +=cut + +use strict; +use base 'WebGUI::Form::Control'; +use WebGUI::International; + +=head1 NAME + +Package WebGUI::Form::FormTest + +=head1 DESCRIPTION + +Dummy Form plugin for testing dynamic loading of Forms from other locations. + +=head1 SEE ALSO + +This is a subclass of WebGUI::Form::Control. + +=head1 METHODS + +The following methods are specifically available from this class. Check the superclass for additional methods. + +=cut + +#------------------------------------------------------------------- + +=head2 getName ( session ) + +Returns the human readable name of this control. + +=cut + +sub getName { + my ($self, $session) = @_; + return 'FormTest'; +} + +1; From 5cb3a6e005cfc1423bff5b7d1687728a4635ac9f Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 8 Sep 2009 18:04:41 -0700 Subject: [PATCH 03/11] Add default values to the Matrix to newly added columns. bug #10889 --- docs/upgrades/upgrade_7.7.19-7.8.0.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/upgrades/upgrade_7.7.19-7.8.0.pl b/docs/upgrades/upgrade_7.7.19-7.8.0.pl index 37d6204b4..f16cdd794 100644 --- a/docs/upgrades/upgrade_7.7.19-7.8.0.pl +++ b/docs/upgrades/upgrade_7.7.19-7.8.0.pl @@ -33,6 +33,7 @@ my $session = start(); # this line required # upgrade functions go here reorganizeAdSpaceProperties($session); fixTemplateSettingsFromShunt($session); +addMatrixColumnDefaults($session); finish($session); # this line required @@ -58,6 +59,18 @@ sub reorganizeAdSpaceProperties { print "DONE!\n" unless $quiet; } +#---------------------------------------------------------------------------- +# Describe what our function does +sub addMatrixColumnDefaults { + my $session = shift; + print "\tUpdate existing Matrixes with default values for maxComparisons... " unless $quiet; + $session->db->write(q|UPDATE Matrix set maxComparisons=25 where maxComparisons IS NULL|); + $session->db->write(q|UPDATE Matrix set maxComparisonsGroup=25 where maxComparisonsGroup IS NULL|); + $session->db->write(q|UPDATE Matrix set maxComparisonsPrivileged=25 where maxComparisonsPrivileged IS NULL|); + # and here's our code + print "DONE!\n" unless $quiet; +} + sub fixTemplateSettingsFromShunt { my $session = shift; print "\tClear isPackage and set isDefault on recently imported templates... " unless $quiet; From 2cf67ecba498e7fdce2470815a515ec77d13a726 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 8 Sep 2009 20:05:47 -0500 Subject: [PATCH 04/11] fixed #10889: Old Matrixs break for Admin users --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/Matrix.pm | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ecf1432e6..e9d1cc3a4 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -25,6 +25,7 @@ - fixed #10925: Wrong message in i18n - relabel Help in the Admin Console to Template Help - fixed #10928: EMS Print Ticket -- Time not processed for timezone + - fixed #10889: Old Matrixs break for Admin users 7.7.19 - fixed #10838: Forwarded forum post email to new CS adds reply to original thread diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index 13ed6b3cc..fa65ae3a8 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -472,7 +472,8 @@ sub getCompareForm { } else{ $maxComparisons = $self->get('maxComparisonsPrivileged'); - } + } + $maxComparisons += 0; $form .= "\n