[Mapbender-commits] r5988 - in trunk/mapbender/http: classes plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Apr 20 10:51:43 EDT 2010


Author: kmq
Date: 2010-04-20 10:51:43 -0400 (Tue, 20 Apr 2010)
New Revision: 5988

Modified:
   trunk/mapbender/http/classes/class_kml_parser_ows.php
   trunk/mapbender/http/plugins/mb_loadkmlgeorss.js
Log:
add errorhandling

Modified: trunk/mapbender/http/classes/class_kml_parser_ows.php
===================================================================
--- trunk/mapbender/http/classes/class_kml_parser_ows.php	2010-04-20 14:49:03 UTC (rev 5987)
+++ trunk/mapbender/http/classes/class_kml_parser_ows.php	2010-04-20 14:51:43 UTC (rev 5988)
@@ -134,6 +134,18 @@
 					$currentPlacemark->setProperty("Mapbender:name", "unknown");
 					$currentPlacemark->setProperty("Mapbender:id", $kmlId);
 					$currentPlacemark->setProperty("Mapbender:placemarkId", $id);
+
+					// add description and name:
+					$namesNode = $node->getElementsByTagName('name');
+					if($namesNode->length > 0){
+						$name = $namesNode->item(0)->nodeValue;
+					}
+					$descriptionsNode = $node->getElementsByTagName('description');
+					if($descriptionsNode->length > 0){
+						$description = $descriptionsNode->item(0)->nodeValue;
+					}
+					$currentPlacemark->setProperty("name", $name);
+					$currentPlacemark->setProperty("description", $description);
 					array_push($this->placemarkArray, $currentPlacemark);
 				}
 				$id ++;		    
@@ -180,6 +192,14 @@
 					}
 				}
 			}
+			if(mb_strtoupper($this->sepNameSpace($child->nodeName)) == "STYLE"){
+			$hrefNodes = $child->getElementsByTagName("href");	
+			if($hrefNodes->length > 0){
+				$href = $hrefNodes->item(0)->nodeValue;
+				$metadataArray["iconurl"] = $href;	
+			}	
+					
+			}
 		}
 		return $metadataArray;		
 	}

Modified: trunk/mapbender/http/plugins/mb_loadkmlgeorss.js
===================================================================
--- trunk/mapbender/http/plugins/mb_loadkmlgeorss.js	2010-04-20 14:49:03 UTC (rev 5987)
+++ trunk/mapbender/http/plugins/mb_loadkmlgeorss.js	2010-04-20 14:51:43 UTC (rev 5988)
@@ -25,7 +25,11 @@
 							type: "POST",
 							dataType: "json",
 							success: function(data,textStatus,xhr){
-							console.log(data);
+						
+							if(data.errorMessage){
+								$("<div>Could not load Document</div>").dialog({ buttons: {"OK":function(){ $(this).dialog("close");  }} });
+								return;
+							}
 
 							var map = $('#mapframe1').mapbender();
 							var markers = [];



More information about the Mapbender_commits mailing list