changeset 74:6e19a9af00e6

htmlHead() included
author fknauft
date Thu, 02 Sep 2010 11:41:42 +0200
parents 695b6612d4c6
children 20ba7e626692
files RestDbInterface.py
diffstat 1 files changed, 70 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/RestDbInterface.py	Wed Sep 01 17:42:13 2010 +0200
+++ b/RestDbInterface.py	Thu Sep 02 11:41:42 2010 +0200
@@ -230,9 +230,69 @@
         kmlFileName=self.getKMLname(data=data,table=table)
         initializeStringForGoogleMaps="""onload=\"initialize(\'http://chinagis.mpiwg-berlin.mpg.de/chinagis/REST/daten/"""+kmlFileName+"""\')\""""#+str(data)
         initializeStringForGoogleMaps=initializeStringForGoogleMaps.replace("None","0")
-        googleMap_page=self.htmlHead()+str(self.getGoogleMapString(kml=initializeStringForGoogleMaps))
+        googleMap_page=str(self.htmlHead())+str(self.getGoogleMapString(initializeStringForGoogleMaps))
         return googleMap_page
+        
+    def htmlHead(self):
+        return """ <!DOCTYPE html>
+<html>
+ <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <meta http-Equiv="Cache-Control" Content="no-cache">
+    <meta http-Equiv="Pragma" Content="no-cache">
+    <meta http-Equiv="Expires" Content="0">
+  <link rel="stylesheet" type="text/css"
+     href="../../../../mpiwgstyles.css">
+  <style type="text/css">
+    html { height: 100% }
+    body { height: 100%; margin: 0px; padding: 0px }
+    #map_canvas { height: 100% }
+  </style>
+  <style type="text/css">
+     td {height:10; font-size:12;}
+     th {height:10; font-size:12;}
+     b {height:10; font-size:12;}
+     h4 {height:10; font-size:15;}
+  </style>
+    <style type="text/css">
+      .tooltip {
+        background-color:#ffffff;
+        font-weight:bold;
+        border:2px #006699 solid;
+      }
+    </style>
 
+
+   <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
+
+<!--****************
+    Now follow the additional Layers: -->
+
+   <script type="text/javascript" tal:content="python:here.getFunctionAddLayers()">
+   </script>
+
+<!--**************** -->
+
+<!--  <script src="/chinagis/javascript/geoxml.js" type="text/javascript"></script>  
+  <script src="/chinagis/javascript/showSelectedInMap_kml.js" type="text/javascript"></script>
+  <script src="/chinagis/javascript/labeledMarker.js" type="text/javascript"></script>-->
+  <script type="text/javascript">
+   var map = null;
+   function initialize(data) {
+       kmlURL=initialize.arguments[0];
+       map = new google.maps.Map(document.getElementById("map_canvas"));
+       map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
+       var latlng = new google.maps.LatLng(29,116);
+       map.setCenter(latlng); //(LatLng)
+       map.setZoom(5); // (Zoom-Level)
+
+       //geocoder = new google.maps.Geocoder();
+       newMarker=new google.maps.KmlLayer(kmlURL);
+       newMarker.setMap(map);
+    }
+  </script>
+  </head>  """
+  
     def getKmlUrl(self,schema='chgis',table='mpdl',id=[],doc=None):
         logging.debug("getKmlUrl")
         data = self.getDataForGoogleMap(schema,table,id,doc)
@@ -330,7 +390,7 @@
 
     def getGoogleMapString(self,kml):
         logging.debug("getGoogleMapString")
-        printed= '<body %s> '%kml +"""\n <div id="map_canvas" style="width: 98%; height: 95%"> </div> \n </body>" \n </html>"""
+        printed= '<body %s> '%kml +"""\n <div id="map_canvas" style="width: 98%; height: 95%"> </div> \n </body> \n </html>"""
         return printed
     
     def getPoint4GISid(self,gis_id):
@@ -442,16 +502,16 @@
 
         
 
-#       constructors = (
+#        constructors = (
 #          REST_test.manage_addRESTclassForm,
 #          REST_test.manage_addRESTclass
 #          )
         
 
-        context.registerClass(
-        RestDbInterface.RestDbInterface,
-        constructors = (
-          RestDbInterface.manage_addRestDbInterfaceForm,
-          RestDbInterface.manage_addRestDbInterface
-          )
-        )
+#        self.registerClass(
+#        RestDbInterface.RestDbInterface,
+#        constructors = (
+#          RestDbInterface.manage_addRestDbInterfaceForm,
+#          RestDbInterface.manage_addRestDbInterface
+#          )
+#        )