[dev] weather.com block configuration

Rick Emery rick at emery.homelinux.net
Wed Jan 28 19:42:48 PST 2004


The only real outstanding issue(s) I wanted to handle on the weather.com block
was:

1. Documentation of the requirement to register for the XML feed.
2. A way for the admin to supply the partner ID and license key after
registering.

I didn't get any feedback on how to handle this, so I decided to come up with
something to at least get a discussion going :-)

There are two patches here.

1. horde/config/conf.php.dist - Comments document the requirement to register
for the XML feed, and two configuration items allow the admin to set the
partner ID and license key.

2. horde/lib/Block/weatherdotcom.php - Uses the above $conf entries for partner
ID and license key.

Any/all suggestions for accomplishing this differently will be warmly received
(and are greatly anticipated).

Thanks in advance,
Rick

--
Rick Emery

"When once you have tasted flight, you will forever walk the Earth
 with your eyes turned skyward, for there you have been, and there
 you will always long to return"
                                              -- Leonardo Da Vinci
-------------- next part --------------
Index: conf.php.dist
===================================================================
RCS file: /repository/horde/config/conf.php.dist,v
retrieving revision 1.83
diff -u -r1.83 conf.php.dist
--- conf.php.dist	27 Jan 2004 09:01:28 -0000	1.83
+++ conf.php.dist	29 Jan 2004 03:24:53 -0000
@@ -572,3 +572,19 @@
 // to create and set the attributes needed to add/edit/delete users by the
 // LDAP Auth driver
 $conf['hooks']['authldap'] = false;
+
+
+/**
+ ** Portal Block Configuration
+ **/
+
+// Use of the weather.com block requires free registration for the XML
+// feed at http://www.weather.com/services/xmloap.html. After registration,
+// an email will be returned with the Partner ID and license key.
+// NOTE: weather.com guidelines require registration and use of the returned
+// values, but the application appears to fundtion with any string values.
+// Value of the partner ID
+$conf['weather.com']['partner_id'] = '';
+
+// Value of the license key
+$conf['weather.com']['license_key'] = '';
-------------- next part --------------
Index: weatherdotcom.php
===================================================================
RCS file: /repository/horde/lib/Block/weatherdotcom.php,v
retrieving revision 1.6
diff -u -r1.6 weatherdotcom.php
--- weatherdotcom.php	27 Jan 2004 18:32:27 -0000	1.6
+++ weatherdotcom.php	29 Jan 2004 03:29:03 -0000
@@ -73,6 +73,8 @@
      */
     function _content()
     {
+        global $conf;
+
         $cacheDir = Horde::getTempDir();
         $html = '';
 
@@ -84,7 +86,8 @@
 
         $weatherDotCom = &Services_Weather::service("WeatherDotCom");
 
-        $weatherDotCom->setAccountData("<PartnerID>", "<LicenseKey>");
+        $weatherDotCom->setAccountData($conf['weather.com']['partner_id'],
+            $conf['weather.com']['license_key']);
         if (!$cacheDir) {
             return PEAR::raiseError(
                 _("No temporary directory available for cache."),


More information about the dev mailing list