public class StatusFetcher {
/* Class to fetch the status for newly loaded objects.
- At present this is rather specialised to WTFE (wtfe.gryph.de).
+ Not currently functional.
*/
public var _url:String;
case "node": entity=conn.getNode(exml.@id); break;
}
- // **** Specific WTFE-parsing code starts here
- // FIXME: should be generalised
- // if all users are "yes" or "auto", status is 'ok' (3, green)
- // if first user is "no", status is 'no' (0, red)
- // if any other users are no, status is 'partial' (1, softer red)
- // otherwise, status is 'unsure' (2, yellow)
- var s:uint=3; // ok
- for each (var user:XML in exml.user) {
- if (user.@severity=='harmless' || user.@severity=='none') continue; // ignore if harmless
- if (user.@decision=='no' && user.@version=='first') { s=0; } // no from v1
- else if (user.@decision=='no') { s=Math.min(s,1); } // no from later version
- else if (user.@decision=='undecided' || user.@decision=='anonymous') { s=Math.min(s,2); } // unsure
- }
- status=STATUSES[s];
- // **** Specific WTFE-parsing code ends here
+ // FIXME: needs some code to parse the XML, and set 'status' accordingly
entity.setStatus(status);
}
}
<s:CheckBox width="100%" label="Show mouse latitude/longitude" selected="false" id="latlongcheck"
change="FlexGlobals.topLevelApplication.coordsbox.visible=latlongcheck.selected" />
- <s:CheckBox width="100%" label="Show licence status" selected="false" id="licencecheck"
- change="licenceToggle()" />
-
<s:HGroup width="100%" verticalAlign="middle">
<s:Label text="Simplify accuracy: "/>
<mx:HSlider id="simplifyslider"
cursorcheck.selected = FlexGlobals.topLevelApplication.theController.cursorsEnabled;
tigercheck.selected = userState.data['tiger_highlighted'];
latlongcheck.selected = FlexGlobals.topLevelApplication.coordsbox.visible;
- licencecheck.selected = Map(Globals.vars.root).editableLayer.connection.statusFetcher!=null;
simplifyslider.value = userState.data['simplify_tolerance'] ? userState.data['simplify_tolerance']/0.00001 : 5;
}
userState.setProperty("simplify_tolerance",simplifyslider.value*0.00001);
try { userState.flush(); } catch (e:Error) {}
}
-
- private function licenceToggle():void {
- // ** FIXME: this is an inelegant patch for the short-term issue of highlighting licensing status
- var conn:Connection=Map(Globals.vars.root).editableLayer.connection;
- if (conn.statusFetcher) {
- conn.statusFetcher=null;
- userState.setProperty("licence_status",false);
- } else {
- conn.statusFetcher=new StatusFetcher("http://wtfe.gryph.de/api/0.6/problems",conn);
- conn.statusFetcher.fetch(conn.getAllLoadedEntities());
- userState.setProperty("licence_status",true);
- // ** FIXME: needs to also switch map style
- }
- }
]]>
</fx:Script>
conn.addEventListener(MapEvent.ERROR, onMapError);
conn.addEventListener(AttentionEvent.ATTENTION, onAttention);
conn.addEventListener(AttentionEvent.ALERT, onAlert);
- if (params['licence_status']) conn.statusFetcher=new StatusFetcher("http://wtfe.gryph.de/api/0.6/problems",conn);
theMap.addLayer(conn, Stylesheets.instance().selected.url, false, true);
// Auto-load vector backgrounds from config