diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index fdc22d4b7..53eaa26fa 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,5 +1,8 @@ 7.3.11 - Added an option for enabling coverage tests to testCodebase.pl. + - fix: WeatherData asset not displaying properly + - rfe: Weather-Data not only for US-Cities + - rfe: WeatherData Asset - Convert to International format - fix: Off by 1 error while displaying ad impressions (perlDreamer Consulting, LLC) 7.3.10 diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 7a200a90e..3d6f1f679 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -7,6 +7,15 @@ upgrading from one version to the next, or even between multiple versions. Be sure to heed the warnings contained herein as they will save you many hours of grief. +7.3.11 +-------------------------------------------------------------------- + + * The weather data asset stopped working because our old weather + provider went away. We've remade the weather asset using a data + feed from weather.com. The feed is free, but you'll have to + register to use it on your site. The up side is that the weather + asset now supports international cities. + 7.3.10 -------------------------------------------------------------------- * This version fixes a bug in the 7.2.3-7.3.0 upgrade where the diff --git a/docs/upgrades/upgrade_7.3.10-7.3.11.pl b/docs/upgrades/upgrade_7.3.10-7.3.11.pl index 663abd62b..305b4accd 100644 --- a/docs/upgrades/upgrade_7.3.10-7.3.11.pl +++ b/docs/upgrades/upgrade_7.3.10-7.3.11.pl @@ -20,17 +20,18 @@ my $quiet; # this line required my $session = start(); # this line required -# upgrade functions go here +fixWeather($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 fixWeather { + my $session = shift; + print "\tConverting WeatherData asset to use weather.com\n" unless ($quiet); + $session->db->write("alter table WeatherData add column partnerId varchar(100)"); + $session->db->write("alter table WeatherData add column licenseKey varchar(100)"); +} diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index 8ea183d7a..521916718 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -15,14 +15,13 @@ package WebGUI::Asset::File; =cut use strict; -use WebGUI::Asset; +use base 'WebGUI::Asset'; use WebGUI::Cache; use WebGUI::Storage; use WebGUI::SQL; use WebGUI::Utility; use FileHandle; -our @ISA = qw(WebGUI::Asset); =head1 NAME diff --git a/lib/WebGUI/Asset/File/ZipArchive.pm b/lib/WebGUI/Asset/File/ZipArchive.pm index 26687dfb6..2a73f7072 100644 --- a/lib/WebGUI/Asset/File/ZipArchive.pm +++ b/lib/WebGUI/Asset/File/ZipArchive.pm @@ -15,7 +15,7 @@ package WebGUI::Asset::File::ZipArchive; =cut use strict; -use WebGUI::Asset::File; +use base 'WebGUI::Asset::File'; use WebGUI::HTMLForm; use WebGUI::SQL; use WebGUI::Utility; @@ -23,7 +23,6 @@ use WebGUI::Utility; use Archive::Tar; use Archive::Zip; -our @ISA = qw(WebGUI::Asset::File); =head1 NAME diff --git a/lib/WebGUI/Asset/Wobject/WeatherData.pm b/lib/WebGUI/Asset/Wobject/WeatherData.pm index 5c974bcd4..dd1f7a362 100644 --- a/lib/WebGUI/Asset/Wobject/WeatherData.pm +++ b/lib/WebGUI/Asset/Wobject/WeatherData.pm @@ -12,25 +12,14 @@ package WebGUI::Asset::Wobject::WeatherData; http://www.plainblack.com info@plainblack.com ------------------------------------------------------------------- - Portions of the below are originally from Weather::Underground, - and are not included in this copyright. - =cut use strict; - -use LWP::UserAgent; -use Tie::CPHash; -use Tie::IxHash; -use JSON; -use WebGUI::Cache; +use Weather::Com::Simple; use WebGUI::International; -use WebGUI::SQL; -use WebGUI::Asset::Wobject; +use base 'WebGUI::Asset::Wobject'; use WebGUI::Utility; -our @ISA = qw(WebGUI::Asset::Wobject); - #------------------------------------------------------------------- @@ -46,6 +35,21 @@ sub definition { my $definition = shift; my $i18n = WebGUI::International->new($session, "Asset_WeatherData"); my $properties = { + partnerId => { + fieldType => "text", + tab => "properties", + defaultValue => undef, + hoverHelp => "partnerId help", + label => "partnerId", + subtext => ''.$i18n->get("you need a weather.com key").'', + }, + licenseKey => { + fieldType => "text", + tab => "properties", + defaultValue => undef, + hoverHelp => "licenseKey help", + label => "licenseKey", + }, templateId =>{ fieldType=>"template", tab=>"display", @@ -56,7 +60,7 @@ sub definition { }, locations=>{ fieldType=>"textarea", - defaultValue=>"Grayslake,IL", + defaultValue=>"Madison, WI\nToronto, Canada\n53536", tab=>"properties", hoverHelp=>$i18n->get("Your list of default weather locations"), label=>$i18n->get("Default Locations") @@ -75,49 +79,6 @@ sub definition { #------------------------------------------------------------------- -=head2 _getLocationData ( ) - -Accepts a location, and returns a hashref of information about the weather -at that location. - -=cut - -sub _getLocationData { - my $self = shift; - my $location = shift; - my $cache = WebGUI::Cache->new($self->session,["weatherLocation",$location]); - my $locData = $cache->get; - unless ($locData->{cityState}) { - my $oldagent; - my $ua = LWP::UserAgent->new; - $ua->env_proxy; - $ua->timeout(10); - $oldagent = $ua->agent(); - $ua->agent($self->session->env->get("HTTP_USER_AGENT")); # Act as a proxy. - my $response = $ua->get('http://www.srh.noaa.gov/port/port_zc.php?inputstring='.$location); - my $document = $response->content; - $document =~ s/\n/ /g; - $document =~ s/\s+/ /g; - $document =~ m!