Created
April 20, 2011 02:49
Revisions
-
Jim Heising created this gist
Apr 20, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <rfapp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://developer.redfoundry.com/rfml.xsd"> <views> <view> <widgets> <RFUserWidget id="Rating1"> <property name="load-from">RatingsWidget.xml</property> <property name="max-rating">5</property> <property name="icon-width">50</property> <property name="icon-height">50</property> <property name="on-icon">star-on.png</property> <property name="off-icon">star-off.png</property> <actions> <alert on="rating-changed"> <property name="message">[get:Rating1("rating")]</property> </alert> </actions> </RFUserWidget> <RFUserWidget id="Rating2"> <property name="load-from">RatingsWidget.xml</property> <property name="max-rating">5</property> <property name="icon-width">50</property> <property name="icon-height">50</property> <property name="on-icon">star-on.png</property> <property name="off-icon">star-off.png</property> <actions> <alert on="rating-changed"> <property name="message">[get:Rating2("rating")]</property> </alert> </actions> </RFUserWidget> </widgets> </view> </views> </rfapp> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ <?xml version="1.0" encoding="UTF-8"?> <rfapp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://developer.redfoundry.com/rfml.xsd"> <views> <view> <property name="rating">0</property> <datasources> <RFXMLDataProvider id="RatingData"> <property name="allow-cache">NO</property> <property name="data"><![CDATA[[eval:(" var data = "<stars>"; for(i=0; i < [form:max-rating]; i++) { if(i >= [get:user-widget("rating")]) data += '<star on="false"/>'; else data += '<star on="true"/>'; } data += "</stars>"; data; ")]]]></property> </RFXMLDataProvider> </datasources> <widgets> <RFRepeaterWidget id="RatingsRepeater"> <property name="row-data-id">RatingData</property> <property name="row-data-path">stars/star</property> <property name="orientation">horizontal</property> <property name="item-width">[form:icon-width]</property> <property name="item-height">[form:icon-height]</property> <property name="height">[form:icon-height]</property> <property name="width">[eval:("[form:icon-width] * [data-row-count:RatingData("stars/star")]")]</property> <property name="enable-scrolling">NO</property> <widgets> <RFImageWidget> <property name="image">[eval:("if([data:row("@on")]) { '[form:on-icon]'; } else { '[form:off-icon]'; } ")]</property> <property name="animate-touch">NO</property> <actions> <modify on="touch"> <property name="widget-id">user-widget</property> <values> <property name="rating"><![CDATA[[eval:("if([data:row-index] == 0 && [get:user-widget("rating")] == 1) { 0; } else { [data:row-index] + 1; }")]]]></property> </values> </modify> <load_datasource on="touch"> <property name="datasource-id">RatingData</property> </load_datasource> <function on="touch"> <property name="widget-id">user-widget</property> <property name="function-name">raise-event</property> <values> <property name="event-name">rating-changed</property> </values> </function> </actions> </RFImageWidget> </widgets> </RFRepeaterWidget> </widgets> </view> </views> </rfapp>