Consider extending substitution default definition to WEB metadata too... #4568

Closed
sdlime opened this Issue Jan 18, 2013 · 2 comments

Projects

None yet

1 participant

@sdlime
Member
sdlime commented Jan 18, 2013

Presently setting defaults for substitutions is done at the layer level only. In some cases it is advantageous to set these at the WEB level so that multiple layers could make use of the default. One use case is during development when multiple database environments need to be accessed across many layers (dev/test/prod). Changing from one environment to the other would be trivial if a default could be set at this higher level.

Steve

@sdlime
Member
sdlime commented Jan 18, 2013
diff --git a/mapfile.c b/mapfile.c
index d543a4a..1842eb1 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -6400,8 +6400,10 @@ void msApplyDefaultSubstitutions(mapObj *map)

   for(i=0; i<map->numlayers; i++) {
     layerObj *layer = GET_LAYER(map, i);
-    applyLayerDefaultSubstitutions(layer, &(layer->validation));
+    applyLayerDefaultSubstitutions(layer, &(layer->validation)); /* layer settings take precedence */
     applyLayerDefaultSubstitutions(layer, &(layer->metadata));
+    applyLayerDefaultSubstitutions(layer, &(map->web.validation));
+    applyLayerDefaultSubstitutions(layer, &(map->web.metadata));
   }
 }
@sdlime sdlime added a commit that referenced this issue Jan 22, 2013
@sdlime sdlime Modified mapfile.c for ticket #4568. dbc929d
@sdlime sdlime added a commit that referenced this issue Jan 22, 2013
@sdlime sdlime Modified mapfile.c for ticket #4568. 8f1f986
@sdlime
Member
sdlime commented Jan 22, 2013

Change is simple enough that I just went ahead and committed it to branch-6-2 and master. This fix provides a nice way to set variables even with included layers. Plus, if you don't set a validation pattern the default value is always used and cannot be overridden. --Steve

@sdlime sdlime closed this Jan 22, 2013
@mkofahl mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
@sdlime sdlime Modified mapfile.c for ticket #4568. ab23040
@mkofahl mkofahl pushed a commit to faegi/mapserver that referenced this issue Apr 9, 2013
@sdlime sdlime Modified mapfile.c for ticket #4568. bd9109d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment