[mapserver-commits] r12068 - sandbox/inspire_soc2011/mapserver

svn at osgeo.org svn at osgeo.org
Thu Aug 18 14:54:13 EDT 2011


Author: stefanl
Date: 2011-08-18 11:54:13 -0700 (Thu, 18 Aug 2011)
New Revision: 12068

Modified:
   sandbox/inspire_soc2011/mapserver/mapows.c
   sandbox/inspire_soc2011/mapserver/mapwms.c
   sandbox/inspire_soc2011/mapserver/rfc73.rst
Log:
no need for option wms_inspire_languagesubstitution as languageparameter will always be appended to onlineresource, similar approach to runtimesubstitution is followed with %language% for DATA resp. CONNECTION metadata, language substituion parameter is automatically validated against inspire_languages, if missing/invalid then substitution with default value is applied

Modified: sandbox/inspire_soc2011/mapserver/mapows.c
===================================================================
--- sandbox/inspire_soc2011/mapserver/mapows.c	2011-08-18 18:52:22 UTC (rev 12067)
+++ sandbox/inspire_soc2011/mapserver/mapows.c	2011-08-18 18:54:13 UTC (rev 12068)
@@ -771,8 +771,8 @@
 {
     char *online_resource = msOWSGetOnlineResource(map, namespaces, metadata_name, req);
 
-    if ( online_resource && validated_language &&
-        msOWSLookupMetadata(&(map->web.metadata), namespaces, "inspire_languagesubstitution") ) {
+    if ( online_resource && validated_language )
+    {
         /* online_resource is already terminated, so we can simply add language=...& */
         /* but first we need to make sure that online_resource has enough capacity */
         online_resource = (char *)msSmallRealloc(online_resource, strlen(online_resource) + strlen(validated_language) +  11);

Modified: sandbox/inspire_soc2011/mapserver/mapwms.c
===================================================================
--- sandbox/inspire_soc2011/mapserver/mapwms.c	2011-08-18 18:52:22 UTC (rev 12067)
+++ sandbox/inspire_soc2011/mapserver/mapwms.c	2011-08-18 18:54:13 UTC (rev 12068)
@@ -2178,6 +2178,16 @@
   /* This function owns validated_language, so remember to free it later*/
   validated_language = msOWSGetInspireLanguage(map, "MO", requested_language);
 
+  if (validated_language != NULL)
+  {
+      for(i=0; i<map->numlayers; i++)
+      {
+         layerObj *layer = GET_LAYER(map, i);
+         if(layer->data) layer->data = msCaseReplaceSubstring(layer->data, "%language%", validated_language);
+         if(layer->connection) layer->connection = msCaseReplaceSubstring(layer->connection, "%language%", validated_language);
+      }
+  }
+
   /* We need this server's onlineresource. */
   /* Default to use the value of the "onlineresource" metadata, and if not */
   /* set then build it: "http://$(SERVER_NAME):$(SERVER_PORT)$(SCRIPT_NAME)?" */

Modified: sandbox/inspire_soc2011/mapserver/rfc73.rst
===================================================================
--- sandbox/inspire_soc2011/mapserver/rfc73.rst	2011-08-18 18:52:22 UTC (rev 12067)
+++ sandbox/inspire_soc2011/mapserver/rfc73.rst	2011-08-18 18:54:13 UTC (rev 12068)
@@ -66,14 +66,13 @@
   - DATA "shapes/rivers.shp"
 need to be provided in the requested language. If the language is not supported (or no language parameter is present), the default language has to be used.
 
-As suggested in Ticket 3608_, all supported languages are specified as comma separated list (first language is default) through "wms_inspire_languages" in the WEB.METADATA section of the mapfile. Through "wms_inspire_languagesubstitution" a language parameter can be added to the onlineresource in the GetCapabilites output.
+As suggested in Ticket 3608_, all supported languages are specified as comma separated list (first language is default) through "wms_inspire_languages" in the WEB.METADATA section of the mapfile. This language parameter is also added to the onlineresource in the GetCapabilites output.
 ::
 
   WEB
    METADATA
     ...
     "wms_inspire_languages" "eng,ger"                         #first default, values according ISO 639-2/B
-    "wms_inspire_languagesubstitution" "true"                 #add language parameter to onlineresource
     ...
    END
   END
@@ -94,14 +93,14 @@
    END
   END
   
-For language dependent reference data, the already existing runtime-substitution_ feature of MapServer is recommended.
+For language dependent reference data, a similar approach like the runtime-substitution_ feature of MapServer is followed (DATA and CONNECTION only).
 ::
 
   ...
     DATA "shapes/rivers_%language%.shp
   ...
 
-...
+If the language parameter is not provided or invalid, the default language is substituted.
 
 4. Provision of INSPIRE specific metadata
 -----------------------------------------
@@ -269,7 +268,7 @@
 1) get language from request and validate it, pass it through all functions as additional parameter
 2) detect if INSPIRE support is activated, if so add corresponding namespace
 3) output extended capabilitities with language list and INSPIRE specific metadata (depending on scenario 1 or 2)
-4) add language parameter to onlineresource in output (if enabled through "wms_inspire_languagesubstitution")
+4) add language parameter to onlineresource in output
 5) consider key extension based on language (e.g. "wms_title_eng") when deriving metadata from the mapobject, use fallback with no extension (e.g. "wms_title")
 6) override style titles and legendURLs if specified in mapfile (e.g. "wms_style_<stylename>_title")
 7) add warnings for missing but mandatory INSPIRE specific metadata



More information about the mapserver-commits mailing list