From 173f3be9544efcd6327e9373f67a07eea948646a Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Fri, 11 Feb 2011 12:09:23 +0000 Subject: [PATCH] IMPROVE help icon functionality - if no help URL is defined, take user to http://www.openstreetmap.org/wiki/Tag:featuretag=featurevalue . Seems a bit pointless slavishly defining the wiki address for every single feature when it can be generated. --- net/systemeD/potlatch2/mapfeatures/Feature.as | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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 ""; + } } } -- 2.36.1