From 82bea1825c38bdabee2ed826654c331971573254 Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Tue, 31 Oct 2006 18:17:06 +0000 Subject: [PATCH] Fixed a a settings bug and a poll bug --- docs/changelog/7.x.x.txt | 4 ++++ docs/gotcha.txt | 10 +++++++++- docs/upgrades/upgrade_7.1.2-7.1.3.pl | 26 +++++++++++++++++++------- lib/WebGUI/Asset/Wobject/Poll.pm | 25 +++++++++++++++---------- 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6490735dc..04a1df658 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -28,6 +28,10 @@ - WebGUI::Session::Stow now warns if set() is called when cache is disabled - Fixed a bug in the LDAP auth module where LDAP links could not connect to the LDAP server (Martin Kamerbeek / Procolix) + - Fixed a bug where the Automatic LDAP Registration setting could not be set. + (Martin Kamerbeek / Procolix) + - Fixed a bug in the Poll where using graphs could result in errors. See + gotcha.txt for details. (Martin Kamerbeek / Procolix) 7.1.2 - Fixed a bug where logging in/out would cause a blank page display. diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 9a13f0804..14e6b64ad 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -15,7 +15,15 @@ save you many hours of grief. users to use in the config file. Also you'll have to check the spellchecker checkbox in the RichEdit asset you're using. - +7.1.3 +-------------------------------------------------------------------- + * The column that stores the graph configuration in the Poll table + has the wrong type. In MySQL 5 this results in corrpution of this + hash. The upgrade script will fix the column type, but not the + corrupted graph configs. Polls with an erroneous configuration + will diplay the old text based graphs. To fix the Polls, just edit + them, set the correct graphing options again and finally save. + 7.0.8 -------------------------------------------------------------------- * 7.0.7 was released with a critical bug that broke the search engine diff --git a/docs/upgrades/upgrade_7.1.2-7.1.3.pl b/docs/upgrades/upgrade_7.1.2-7.1.3.pl index d6755a467..2520ff290 100644 --- a/docs/upgrades/upgrade_7.1.2-7.1.3.pl +++ b/docs/upgrades/upgrade_7.1.2-7.1.3.pl @@ -20,19 +20,31 @@ my $quiet; # this line required my $session = start(); # this line required -# upgrade functions go here +insertAutomaticLDAPRegistrationSetting($session); +changeGraphConfigColumnType($session); finish($session); # this line required -##------------------------------------------------- -#sub exampleFunction { -# my $session = shift; -# print "\tWe're doing some stuff here that you should know about.\n" unless ($quiet); -# # and here's our code -#} +#------------------------------------------------- +sub insertAutomaticLDAPRegistrationSetting { + my $session = shift; + print "\tAdding Automatic LDAP Registration setting to database.\n" unless ($quiet); + my ($hasSetting) = $session->db->quickArray('select name from settings where value=?', ['automaticLDAPRegistration']); + unless ($hasSetting) { + $session->db->write('insert into settings (name, value) values (?,?)', ['automaticLDAPRegistration', 0]); + } +} + +#------------------------------------------------- +sub changeGraphConfigColumnType { + my $session = shift; + print "\tFixing the the charts in the Poll asset (PLEASE SEE NOTES IN docs/gotcha.txt).\n" unless ($quiet); + + $session->db->write('alter table Poll change column graphConfiguration graphConfiguration blob'); +} # ---- DO NOT EDIT BELOW THIS LINE ---- diff --git a/lib/WebGUI/Asset/Wobject/Poll.pm b/lib/WebGUI/Asset/Wobject/Poll.pm index b8f47a3fd..2c1819916 100644 --- a/lib/WebGUI/Asset/Wobject/Poll.pm +++ b/lib/WebGUI/Asset/Wobject/Poll.pm @@ -20,6 +20,7 @@ use WebGUI::Utility; use WebGUI::Asset::Wobject; use WebGUI::Image::Graph; use WebGUI::Storage::Image; +use Storable; our @ISA = qw(WebGUI::Asset::Wobject); @@ -388,19 +389,23 @@ sub view { my $config = {}; if ($self->get('graphConfiguration')) { $config = Storable::thaw($self->get('graphConfiguration')); - - my $graph = WebGUI::Image::Graph->loadByConfiguration($self->session, $config); - $graph->addDataset(\@dataset); - $graph->setLabels(\@labels); - $graph->draw; + if ($config) { + my $graph = WebGUI::Image::Graph->loadByConfiguration($self->session, $config); + $graph->addDataset(\@dataset); + $graph->setLabels(\@labels); - my $storage = WebGUI::Storage::Image->createTemp($self->session); - my $filename = 'poll'.$self->session->id->generate.".png"; - $graph->saveToStorageLocation($storage, $filename); + $graph->draw; - $var{graphUrl} = $storage->getUrl($filename); - $var{hasImageGraph} = 1; + my $storage = WebGUI::Storage::Image->createTemp($self->session); + my $filename = 'poll'.$self->session->id->generate.".png"; + $graph->saveToStorageLocation($storage, $filename); + + $var{graphUrl} = $storage->getUrl($filename); + $var{hasImageGraph} = 1; + } else { + $self->session->errorHandler->error('The graph configuration hash of the Poll ('.$self->getUrl.') is corrupt.'); + } } }