[Mapbender-commits] r9002 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jul 25 04:50:26 PDT 2014


Author: armin11
Date: 2014-07-25 04:50:26 -0700 (Fri, 25 Jul 2014)
New Revision: 9002

Modified:
   trunk/mapbender/http/classes/class_wmc.php
Log:
Allow other mimetypes if available

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2014-07-25 11:30:41 UTC (rev 9001)
+++ trunk/mapbender/http/classes/class_wmc.php	2014-07-25 11:50:26 UTC (rev 9002)
@@ -639,13 +639,20 @@
 					$layerDoc = simplexml_load_string($layer->saveXML());
 					foreach($layerDoc->xpath('/Layer/StyleList/Style[@current="1"]') as $styleObject) {
 						//only one current style is possible!
-						//if old legendurl was given, exchange it with new from database 
+						//if old legendurl was given, exchange it with new from database
 						if($styleObject->LegendURL->OnlineResource){
-							if (isset($style[(integer)$layerId][(string)$styleObject->Name]['image/png']) && $style[(integer)$layerId][(string)$styleObject->Name]['image/png'] != '') {
-								//set
-								$e = new mb_notice("class_wmc: exchange old legendurl url : ".$layer->StyleList->Style->LegendURL->OnlineResource->attributes('xlink', true)->href." with new legendurl: ".$style[(integer)$layerId][(string)$styleObject->Name]['image/png']);
-								$layer->StyleList->Style->LegendURL->OnlineResource->attributes('xlink', true)->href = $style[(integer)$layerId][(string)$styleObject->Name]['image/png'];
+							//check mimetype
+							if (isset($styleObject->LegendURL->attributes()->format) && isset($style[(integer)$layerId][(string)$styleObject->Name][(string)$styleObject->LegendURL->attributes()->format])) {
+								$mimeType = (string)$styleObject->LegendURL->attributes()->format;
+								
+							} else {
+								$mimeType = 'image/png';
 							}
+							$e = new mb_exception("class_wmc: mimetype for legendurl: ".$mimeType);
+							if (isset($style[(integer)$layerId][(string)$styleObject->Name][$mimeType]) && $style[(integer)$layerId][(string)$styleObject->Name][$mimeType] != '') {
+								$e = new mb_notice("class_wmc: exchange old legendurl url : ".$layer->StyleList->Style->LegendURL->OnlineResource->attributes('xlink', true)->href." with new legendurl: ".$style[(integer)$layerId][(string)$styleObject->Name][$mimeType]);
+								$layer->StyleList->Style->LegendURL->OnlineResource->attributes('xlink', true)->href = $style[(integer)$layerId][(string)$styleObject->Name][$mimeType];
+							}
 							
 						}
 					}



More information about the Mapbender_commits mailing list