[Laszlo-checkins] r6070 - in openlaszlo/branches/wafflecone: . demos/weather demos/weatherblox
ben@openlaszlo.org
ben at openlaszlo.org
Wed Aug 15 14:40:50 PDT 2007
Author: ben
Date: 2007-08-15 14:40:49 -0700 (Wed, 15 Aug 2007)
New Revision: 6070
Modified:
openlaszlo/branches/wafflecone/
openlaszlo/branches/wafflecone/demos/weather/weather.lzx
openlaszlo/branches/wafflecone/demos/weatherblox/weather_component.lzx
Log:
Merged revisions 5748-5750,5752,5754,5756,5758-5766,5768-5770,5772,5775,5777-5809,5811-5819,5821-5860,5862-5890,5892-6065,6068-6069 via svnmerge from
http://svn.openlaszlo.org/openlaszlo/branches/legals
.......
r5859 | hqm | 2007-07-31 08:34:27 -0700 (Tue, 31 Jul 2007) | 24 lines
Change 20070731-hqm-2 by hqm at IBM-2E06404CB67 on 2007-07-31 11:32:40 EDT
in /cygdrive/c/users/hqm/openlaszlo/legals3/demos/weather
for http://svn.openlaszlo.org/openlaszlo/branches/legals/demos/weather
Summary: fix weather demo to use yahoo data rss feed
New Features:
Bugs Fixed:
Technical Reviewer: josh (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Tests:
.......
r5894 | hqm | 2007-08-01 07:20:01 -0700 (Wed, 01 Aug 2007) | 24 lines
Change 20070801-hqm-4 by hqm at IBM-2E06404CB67 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:
.......
Property changes on: openlaszlo/branches/wafflecone
___________________________________________________________________
Name: svnmerge-integrated
- /openlaszlo/branches/legals:1-5746,5748-5756,5758-5770,5772-5813 /openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334
+ /openlaszlo/branches/legals:1-5746,5748-5756,5758-5770,5772-5819,5821-5860,5862-5890,5892-6065,6068-6069 /openlaszlo/trunk:1-3892,3894-3952,3954-4393,4395-4461,4463-4467,4469-4471,4473-5085,5087-5171,5173-5203,5205-5209,5211-5331,5333-5334
Modified: openlaszlo/branches/wafflecone/demos/weather/weather.lzx
===================================================================
--- openlaszlo/branches/wafflecone/demos/weather/weather.lzx 2007-08-15 21:31:08 UTC (rev 6069)
+++ openlaszlo/branches/wafflecone/demos/weather/weather.lzx 2007-08-15 21:40:49 UTC (rev 6070)
@@ -32,7 +32,7 @@
<!-- DATA SOURCE -->
<dataset name="weatherdata"
- src="http://www.laszlosystems.com/cgi-pub/weather.cgi"/>
+ src="http://weather.yahooapis.com/forecastrss" nsprefix="true"/>
<!-- LASZLO CLASSES -->
<include href="base/basetabslider.lzx"/>
@@ -44,6 +44,15 @@
setSource( d );
</method>
</class>
+
+ <!-- Retrieve icon of weather condition based on numeric code. -->
+ <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>
<!-- WEATHER CLASSES -->
@@ -102,16 +111,21 @@
<!-- CLASS: weatherSummary -->
<class name="weatherSummary" font="Helvetica"
fontsize="12" bgcolor="#000000" width="34" height="34" x="10">
- <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="42" fgcolor="#FFFFFF" width="140"
- fontstyle="bold" datapath="@label">Tonight</text>
+ fontstyle="bold" datapath="@day">Tonight</text>
<text name="desc" x="42" y="14" fgcolor="#FFFFFF"
- width="140" datapath="@desc">T-storms possible</text>
- <text name="temp" x="168" width="60" fgcolor="#FFFFFF"
- fontstyle="bold" datapath="@temp">Hi 80 F</text>
+ width="140" datapath="@text">T-storms possible</text>
+ <text name="temphi" x="168" width="60" fgcolor="#FFFFFF"
+ fontstyle="bold" datapath="@high">Hi 80 F</text>
+ <text name="templo" x="168" y="14" width="60" fgcolor="#FFFFFF"
+ fontstyle="bold" datapath="@low">Lo 80 F</text>
+ <text x="145" fgcolor="#FFFFFF" fontstyle="bold" pixellock="true">Hi:</text>
+ <text x="145" y="14" fgcolor="#FFFFFF" fontstyle="bold" pixellock="true">Lo:</text>
</class>
+
<!-- MAIN: WEATHER APP -->
<view id="weatherApp" x="0" y="0" width="240" height="320" clip="true"
font="Tahoma,Geneva,sans-serif" fontsize="9">
@@ -137,7 +151,7 @@
weatherApp.loadWeather();
}
</method>
- </edittext>
+ </edittext>
<text width="240" fgcolor="#222222" x="206" y="7">
<b>OK</b>
</text>
@@ -159,23 +173,24 @@
</view>
</state>
- <view name="topBar" y="-16" onmouseup="weatherApp.hideWeather()">
+ <view name="topBar" resource="weather_topBar" y="-16"
+ opacity="0"
+ onmouseup="weatherApp.hideWeather()">
<attribute name="on" value="null"/>
- <view resource="weather_topBar" opacity="0" y="1">
- <state apply="${weatherApp.topBar.on == true}">
- <animator attribute="opacity" to="1" duration="333"/>
- <animator attribute="y" to="0" duration="333" target="weatherApp.topBar"/>
- </state>
- <state apply="${weatherApp.topBar.on == false}">
- <animator attribute="opacity" to="0" duration="333"/>
- <animator attribute="y" to="-16" duration="333" target="weatherApp.topBar"/>
- </state>
- </view>
-
<text name="zip" fontstyle="bold" fgcolor="#CAD0EC" width="100"
x="194" y="1" />
+
+ <state apply="${parent.on == true}">
+ <animator attribute="opacity" to="1" duration="333"/>
+ <animator attribute="y" to="0" duration="333"/>
+ </state>
+
+ <state apply="${parent.on == false}">
+ <animator attribute="opacity" to="0" duration="333"/>
+ <animator attribute="y" to="-16" duration="333"/>
+ </state>
</view>
<basetabslider id="weatherContent" name="content"
@@ -183,79 +198,90 @@
height="305"
slideduration="300"
width="100%"
- datapath="weatherdata:/weather[1]" >
+ datapath="weatherdata:/rss[1]/channel[1]" >
- <weathertab name="tab1" label="Current Conditions" font="Tahoma,Geneva,sans-serif" > <!-- -->
- <view id="currentData" width="240" y="10" datapath="current[1]" >
- <view name="form" width="240" font="Helvetica"
- fontsize="14">
- <text name="where" width="240" x="15" fgcolor="#FFFFFF"
- fontstyle="bold" datapath="where[1]/text()"/>
- <image name="icon" x="18" y="23" width="64"
- height="64"
- stretches="both"
- datapath="/weather[1]/forecast[1]/day[1]/@imageurl"/>
- <text name="temp" x="95" y="20" width="240"
- fontsize="60"
- fgcolor="#FFFFFF" fontstyle="bold"
- datapath="temp[1]/text()"/>
- <text name="description" width="240" x="15" y="90"
- fgcolor="#FFFFFF" fontstyle="bold"
- datapath="desc[1]/text()"/>
- </view>
- <view name="moredata" x="15" pixellock="true">
- <view name="labels" font="Tahoma,Geneva,sans-serif" >
- <text fgcolor="#FFFFFF" width="90">
- <b>Humidity:</b>
- </text>
+ <weathertab name="tab1" label="Current Conditions" font="Tahoma,Geneva,sans-serif" > <!-- -->
+ <view id="currentData" width="240" y="10" >
+ <view name="form" width="240" font="Helvetica"
+ fontsize="14">
+ <attribute name="city" value="$path{'yweather:location/@city '}"/>
+ <attribute name="region" value="$path{'yweather:location/@region'}"/>
+ <text name="where" width="240" x="15" fgcolor="#FFFFFF"
+ fontstyle="bold" text="${parent.city + ', ' + parent.region}"/>
+ <view bgcolor="#FFFFFF" x="26" y="28" width="52"
+ height="52"/>
+ <yahooImageCode name="icon" x="26" y="28" width="64"
+ height="64"
+ datapath="item[1]/yweather:condition/@code"/>
+ <text name="temp" x="95" y="20" width="240"
+ fontsize="60"
+ fgcolor="#FFFFFF" fontstyle="bold"
+ datapath="item[1]/yweather:condition/@temp"/>
+ <text name="description" width="240" x="15" y="90"
+ fgcolor="#FFFFFF" fontstyle="bold"
+ datapath="item[1]/yweather:condition/@text"/>
+ </view>
+ <view name="moredata" x="15" pixellock="true">
+ <view name="labels" font="Tahoma,Geneva,sans-serif" >
+ <text fgcolor="#FFFFFF" width="90"><b>Humidity:</b></text>
+ <text fgcolor="#FFFFFF"><b>Barometer:</b></text>
+ <text fgcolor="#FFFFFF"><b>Windspeed:</b></text>
+ <text fgcolor="#FFFFFF"><b>Sunrise:</b></text>
+ <text fgcolor="#FFFFFF"><b>Sunset:</b></text>
+ <text fgcolor="#FFFFFF"><b>Wind Chill:</b></text>
+
+ <simplelayout axis="y" spacing="1" />
+ </view>
+ <view name="fields">
+ <text name="humidity" width="160"
+ fgcolor="#FFFFFF"
+ datapath="yweather:atmosphere[1]/@humidity"/>
+ <text name="barometer" width="160"
+ fgcolor="#FFFFFF"
+ datapath="yweather:atmosphere[1]/@pressure"/>
+ <text name="windspeed" width="160"
+ fgcolor="#FFFFFF"
+ datapath="yweather:wind[1]/@speed"/>
+ <text name="sunrise" width="160"
+ fgcolor="#FFFFFF"
+ datapath="yweather:astronomy[1]/@sunrise"/>
+ <text name="sunset" width="160"
+ fgcolor="#FFFFFF"
+ datapath="yweather:astronomy[1]/@sunset"/>
+ <text name="windchill" width="160"
+ fgcolor="#FFFFFF"
+ datapath="yweather:wind[1]/@chill"/>
+ <text name="when" width="160"
+ fgcolor="#FFFFFF"
+ datapath="item[1]/condition[1]/@date"/>
+ <simplelayout axis="y" spacing="1" />
+ </view>
+ <simplelayout axis="x" spacing="-10" />
+ </view>
+ <simplelayout axis="y" spacing="10" />
+ </view>
+ </weathertab>
- <text fgcolor="#FFFFFF"><b>Barometer:</b></text>
- <text fgcolor="#FFFFFF"><b>Windspeed:</b></text>
- <text fgcolor="#FFFFFF"><b>Dewpoint:</b></text>
- <text fgcolor="#FFFFFF"><b>Heatindex:</b></text>
- <text fgcolor="#FFFFFF"><b>Last Update:</b></text>
- <simplelayout axis="y" spacing="1" />
- </view>
- <view name="fields">
- <text name="humidity" width="160"
- fgcolor="#FFFFFF"
- datapath="humidity[1]/text()"/>
- <text name="barometer" width="160"
- fgcolor="#FFFFFF"
- datapath="barometer[1]/text()"/>
- <text name="windspeed" width="160"
- fgcolor="#FFFFFF"
- datapath="windspeed[1]/text()"/>
- <text name="dewpoint" width="160"
- fgcolor="#FFFFFF"
- datapath="dewpoint[1]/text()"/>
- <text name="heatindex" width="160"
- fgcolor="#FFFFFF"
- datapath="heatindex[1]/text()"/>
- <text name="when" width="160"
- fgcolor="#FFFFFF"
- datapath="when[1]/text()"/>
- <simplelayout axis="y" spacing="1" />
- </view>
- <simplelayout axis="x" spacing="-10" />
- </view>
- <simplelayout axis="y" spacing="10" />
- </view>
- </weathertab>
<weathertab name="tab2" label="Radar Maps">
- <view id="radarData" y="10" align="center">
- <view name="shadow" x="3" y="3" width="173"
- height="130" bgcolor="#000000"
+ <view id="radarData" y="10" align="center" width="240" height="162">
+ <view name="shadow" x="23" y="23" width="200"
+ height="135" bgcolor="#000000"
opacity=".33"/>
- <image name="radarscan" width="173" height="130"
- stretches="both" datapath="radar[1]/@src"/>
+ <image name="radarscan" x="20" y="20"
+ width="200" height="135"
+ stretches="both">
+ <handler name="oninit">
+ this.setSource("http://weather.yahoo.com/images/ussat_440x297.jpg");
+ </handler>
+ </image>
</view>
</weathertab>
+
<weathertab name="tab3" label="Forecast">
<view id="forecastData" y="10">
- <weatherSummary datapath="forecast[1]/day"/>
+ <weatherSummary datapath="item[1]/yweather:forecast"/>
<simplelayout axis="y" spacing="10"/>
</view>
</weathertab>
@@ -303,7 +329,7 @@
zipBtn.animate('x',-2000,333,true);
error.setText("Loading weather data...");
//Debug.write("zip=" + z);
- weatherContent.datapath.getDataset().setQueryString({zip: z});
+ weatherContent.datapath.getDataset().setQueryString({p: z});
weatherContent.datapath.getDataset().doRequest();
//Debug.write( "dataset: " + weatherApp.datapath.getDataset() );
weatherApp.topBar.zip.setText(z);
Modified: openlaszlo/branches/wafflecone/demos/weatherblox/weather_component.lzx
===================================================================
--- openlaszlo/branches/wafflecone/demos/weatherblox/weather_component.lzx 2007-08-15 21:31:08 UTC (rev 6069)
+++ openlaszlo/branches/wafflecone/demos/weatherblox/weather_component.lzx 2007-08-15 21:40:49 UTC (rev 6070)
@@ -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>
More information about the Laszlo-checkins
mailing list