From: Steve Bennett Date: Fri, 11 Feb 2011 12:09:23 +0000 (+0000) Subject: IMPROVE help icon functionality - if no help URL is defined, take user to http:/... X-Git-Tag: 2.0~94 X-Git-Url: https://git.openstreetmap.org/potlatch2.git/commitdiff_plain/173f3be9544efcd6327e9373f67a07eea948646a IMPROVE help icon functionality - if no help URL is defined, take user to openstreetmap.org/wiki/Tag:featuretag=featurevalue . Seems a bit pointless slavishly defining the wiki address for every single feature when it can be generated. --- diff --git a/net/systemeD/potlatch2/mapfeatures/Feature.as b/net/systemeD/potlatch2/mapfeatures/Feature.as index 0dda0705..4e2b54f9 100644 --- a/net/systemeD/potlatch2/mapfeatures/Feature.as +++ b/net/systemeD/potlatch2/mapfeatures/Feature.as @@ -200,14 +200,23 @@ package net.systemeD.potlatch2.mapfeatures { } } - /** Whether there is a help string defined. */ + /** Whether there is a help string defined or one can be derived from tags. */ public function hasHelpURL():Boolean { - return _xml.help.length() > 0; + return _xml.help.length() > 0 || _tags.length > 0; } - /** The defined help string, if any. */ + /** The defined help string, if any. If none, generate one from tags on the feature, pointing to the OSM wiki. */ public function get helpURL():String { - return _xml.help; + if (_xml.help.length() > 0) + return _xml.help; + else if (_tags.length > 0) { + if (_tags[0].v == "*") + return "http://www.openstreetmap.org/wiki/Key:" + _tags[0].k; + else + return "http://www.openstreetmap.org/wiki/Tag:" + _tags[0].k + "=" + _tags[0].v; + } else + return ""; + } } }