...
The communitySave object is used for giving a widget specific saved data for a given community, for example giving an intelligence community KML specific to a region of interest for a map widget or using a certain color scheme specific to business operations for a statistics widget. The communitySave objects can only be set external to a widget in http://infinite.ikanow.com/manager/fileUploader.jsp To make a communitySave in the fileUploader just upload a json file with a community selected and use type widgetSave, any json available to a user when a widgetLoads will be passed into the WidgetSaveObject.communitySave when onLoadWidgetOptions is called from then on.
Info | ||
---|---|---|
| ||
1. Create a JSON file with the data you want to pass in (see KML example below for the built in map's kml layer adder)
|
Any JSON saved int his manner will be available to users in that community in the onLoadWidgetOptions as seen below:
Code Block | ||
---|---|---|
| ||
public function onLoadWidgetOptions( widgetOptions:WidgetSaveObject ):void { if ( widgetOptions != null ) { //this holds a users last map if ( widgetOptions.userSave != null ) { //...code from above here } if ( widgetOptions.communitySave != null ) { //Any shares you have access to with type widgetSave will be provided here //Here we will be given a map of community ids to shares e.g. { "commid12345": {"key1":"value1"}, "commid67890":{"anotherkey",["blue","green","red"]}} for ( var commid:String in widgetOptions.communitySave ) { //this is the object saved in the share for community <commid> //Now you can do what you want with it (we printed it out) var community_save_object = widgetOptions.communitySave[commid]; for ( var key:String in community_save_object ) { trace("CommId: " + commid + " key: " + key + " value: " + community_save_object[key]); } } } } } |
...