Author: hqm
Date: 2007-08-01 07:20:01 -0700 (Wed, 01 Aug 2007)
New Revision: 5894

Modified:
   openlaszlo/branches/legals/demos/weatherblox/weather_component.lzx
Log:
Change 20070801-hqm-4 by [EMAIL PROTECTED] on 2007-08-01 10:19:02 EDT
    in /cygdrive/c/users/hqm/openlaszlo/legals3/demos/weatherblox
    for http://svn.openlaszlo.org/openlaszlo/branches/legals/demos/weatherblox

Summary:  update to use yahoo XML weather feed RSS 

New Features:

Bugs Fixed:

Technical Reviewer: josh
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
    

Tests:



Modified: openlaszlo/branches/legals/demos/weatherblox/weather_component.lzx
===================================================================
--- openlaszlo/branches/legals/demos/weatherblox/weather_component.lzx  
2007-08-01 09:58:22 UTC (rev 5893)
+++ openlaszlo/branches/legals/demos/weatherblox/weather_component.lzx  
2007-08-01 14:20:01 UTC (rev 5894)
@@ -1,6 +1,6 @@
 <!-- * X_LZ_COPYRIGHT_BEGIN 
 ***************************************************
-* Copyright 2001-2006 Laszlo Systems, Inc.  All Rights Reserved.              
+* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              
 * Use is subject to license terms.                                            
 * X_LZ_COPYRIGHT_END 
 ****************************************************** -->
@@ -23,8 +23,7 @@
 
     <!-- DATA SOURCE -->
     <dataset name="weatherdata"
-        src="http://www.laszlosystems.com/cgi-pub/weather.cgi";
-    querystring="zip=94107" request="true"/>
+        src="http://weather.yahoo.com/forecastrss"; nsprefix="true" 
ondata="Debug.write('ondata recvd')"/>
 
     <!-- LASZLO CLASSES -->
     <class name="weather_image">
@@ -32,18 +31,26 @@
         if (d == null) { return; }
             setSource( d );
         </method>
+
     </class>
+    <class name="yahooImageCode">
+        <method name="applyData" args="d" >
+           if (d == null) { return; }
+           var url = "http://l.yimg.com/us.yimg.com/i/us/we/52/"; + d + ".gif";
+           setSource( url );
+        </method>
+    </class>
 
     <class name="weatherSummary" font="Verity" 
         fontsize="8" width="34" height="34" x="2">
-        <weather_image name="icon" width="32" height="32" stretches="both" 
x="1" y="1"
-            datapath="@imageurl"/>
+        <yahooImageCode name="icon" width="32" height="32" stretches="both" 
x="1" y="1"
+               datapath="@code"/>
         <text name="day"  x="38" fgcolor="#000000" width="140" 
-            fontstyle="bold" datapath="@label">Tonight</text>
+            fontstyle="bold" datapath="@day">Tonight</text>
         <text name="desc" x="38" y="14" fgcolor="#000000" 
-            width="140" datapath="@desc">T-storms possible</text>
+            width="140" datapath="@text">T-storms possible</text>
     <text name="temp" x="120" width="60" fgcolor="#000000" 
-            fontstyle="bold" datapath="@temp">Hi 80 F</text>
+            fontstyle="bold" datapath="@high">Hi 80 F</text>
     </class>
 
     <style name="streetstyle" basecolor="0x97ABBE" />
@@ -86,7 +93,7 @@
         <basetabslider id="weatherContent" width="180" height="332"
             style="streetstyle"
                     mintabheight="20" 
-                    datapath="weatherdata:/weather[1]">
+                    datapath="weatherdata:/rss[1]/channel[1]">
         
             <tabelement name="tab1"
                         text="Current Conditions" selected="true"
@@ -102,55 +109,56 @@
                 placement="header" x="${this.xoffset + 5}" y="${this.yoffset + 
5}" opacity="1"
                 xoffset="${this.width / 2}" yoffset="${this.width / 2}"/>
 
-                        <view id="currentData" width="180" y="2" 
datapath="current[1]" >
+                        <view id="currentData" width="180" y="2" >
                             <view  name="form" width="180" font="Helvetica" 
                     fontsize="14">
-                                <text name="where" width="180" 
fgcolor="#000000" 
-                                    fontstyle="bold" 
datapath="where[1]/text()"/>
-                                <weather_image name="icon"  y="23" width="64" 
-                                    height="64" 
-                                    stretches="both" 
-                                    
datapath="/weather[1]/forecast[1]/day[1]/@imageurl"/>
-                                <text name="temp"  x="64" y="15" width="240" 
-                                    fontsize="48" 
+                              <attribute name="city" 
value="$path{'yweather:location/@city '}"/>
+                              <attribute name="region" 
value="$path{'yweather:location/@region'}"/>
+                              <text name="where" width="240" x="15" 
fgcolor="#000000"
+                                    fontstyle="bold" text="${parent.city + ', 
' + parent.region}"/>
+                              <yahooImageCode name="icon"  x="13" y="27" 
width="64"
+                                                height="64"
+                                                
datapath="item[1]/yweather:condition/@code"/>
+                                <text name="temp"  x="69" y="22" width="240" 
+                                    fontsize="54" 
                                     fgcolor="#000000" fontstyle="bold" 
-                                    datapath="temp[1]/text()"/>
+                                    
datapath="item[1]/yweather:condition/@temp"/>
                                 <text name="description" width="240" y="90" 
                                     fgcolor="#000000" fontstyle="bold" 
-                                    datapath="desc[1]/text()"/>
+                                    
datapath="item[1]/yweather:condition/@text"/>
                             </view>
                             <view name="moredata" pixellock="true">
                                 <view name="labels" fontsize="8" font="Verity" 
fontstyle="plain">
                                     <text fgcolor="#000000" width="90">
-                    <b>Humidity:</b>
+                                      <b>Humidity:</b>
                                     </text>
                                     
                                     <text 
fgcolor="#000000"><b>Barometer:</b></text>
                                     <text 
fgcolor="#000000"><b>Windspeed:</b></text>
-                                    <text 
fgcolor="#000000"><b>Dewpoint:</b></text>
-                                    <text 
fgcolor="#000000"><b>Heatindex:</b></text>
-                                    <text fgcolor="#000000"><b>Last 
Update:</b></text>
+                                    <text 
fgcolor="#000000"><b>Sunrise:</b></text>
+                                    <text 
fgcolor="#000000"><b>Sunset:</b></text>
+                                    <text fgcolor="#000000"><b>Wind 
Chill:</b></text>
                                     <simplelayout axis="y" spacing="3" />
                                 </view>
                                 <view name="fields" fontsize="8" font="Verity" 
fontstyle="plain">
-                                    <text name="humidity" width="180" 
-                                        fgcolor="#000000" 
-                                        datapath="humidity[1]/text()"/>
-                                    <text name="barometer" width="160" 
-                                        fgcolor="#000000" 
-                                        datapath="barometer[1]/text()"/>
-                                    <text name="windspeed" width="160" 
-                                        fgcolor="#000000" 
-                                        datapath="windspeed[1]/text()"/>
-                                    <text name="dewpoint"  width="160" 
-                                        fgcolor="#000000" 
-                                        datapath="dewpoint[1]/text()"/>
-                                    <text name="heatindex" width="160" 
-                                        fgcolor="#000000" 
-                                        datapath="heatindex[1]/text()"/>
-                                    <text name="when" width="160" 
-                                        fgcolor="#000000" 
-                                        datapath="when[1]/text()"/>
+<text name="humidity" width="180"
+                        fgcolor="#000000"
+                        datapath="yweather:atmosphere[1]/@humidity"/>
+                  <text name="barometer" width="160"
+                        fgcolor="#000000"
+                        datapath="yweather:atmosphere[1]/@pressure"/>
+                  <text name="windspeed" width="160"
+                  fgcolor="#000000"
+                  datapath="yweather:wind[1]/@speed"/>
+            <text name="sunrise" width="160"
+                  fgcolor="#000000"
+                  datapath="yweather:astronomy[1]/@sunrise"/>
+            <text name="sunset" width="160"
+                  fgcolor="#000000"
+                  datapath="yweather:astronomy[1]/@sunset"/>
+            <text name="windchill" width="160"
+                  fgcolor="#000000"
+                  datapath="yweather:wind[1]/@chill"/>
                                     <simplelayout axis="y" spacing="3" />
                                 </view>
                                 <simplelayout axis="x" spacing="-24" />
@@ -170,11 +178,19 @@
             placement="header" x="${this.xoffset + 5}" y="${this.yoffset + 5}" 
opacity="1"
             xoffset="${this.width / 2}" yoffset="${this.width / 2}" 
rotation="-90"/>
                     <view id="radarData" y="10" align="center">
-                        <view name="shadow" x="3" y="3" width="173" 
-                            height="130"  
+                        <view name="shadow" x="3" y="3" width="240" 
+                            height="162"  
                             opacity=".33"/>
-                        <weather_image name="radarscan" width="173" 
height="130" 
-                            stretches="both" datapath="radar[1]/@src"/>
+                        <image name="satellite" width="210" height="120" 
stretches="both">
+                          <handler name="oninit">
+                            
this.setSource("http://weather.yahoo.com/images/ussat_440x297.jpg";);
+                          </handler>
+                        </image>
+                        <image name="radarscan" width="210" height="120" 
y="110" stretches="both">
+                          <handler name="oninit">
+                            
this.setSource("http://weather.yahoo.com/images/us_radar_medium_usen.jpg";);
+                          </handler>
+                        </image>
                     </view>
                 </tabelement>
                 
@@ -188,7 +204,7 @@
             placement="header" x="${this.xoffset + 5}" y="${this.yoffset + 5}" 
opacity="1"
             xoffset="${this.width / 2}" yoffset="${this.width / 2}"/>
                         <view id="forecastData" y="5">
-                            <weatherSummary datapath="forecast[1]/day[1-6]"/>
+                            <weatherSummary 
datapath="item[1]/yweather:forecast[1-2]"/>
                             <simplelayout axis="y" spacing="5"/>
             </view>
                 </tabelement>
@@ -198,8 +214,9 @@
             <!-- METHODS for weatherApp -->
             <method name="loadWeather">
                 var z = zipcode.getText();
-                weatherContent.datapath.getDataset().setQueryString({zip:  z});
+                weatherContent.datapath.getDataset().setQueryString({p:  z});
                 weatherContent.datapath.getDataset().doRequest();
+                Debug.write ("Load Weather",z)
             </method>
 
         </view>


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to