Changeset 418

Show
Ignore:
Timestamp:
07/20/06 10:54:57
Author:
piv
Message:

IE compatibility

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneGoogleMaps/trunk/TODO.txt

    r417 r418  
    66#  * folder view 
    77 
    8  * marker functionality 
     8* marker functionality 
    99 
    10  * map field and widget 
     10* map field and widget 
    1111 
    12  * navigation portlet view (turn on/off overlay functionality) 
     12* navigation portlet view (turn on/off overlay functionality) 
    1313 
    14  * automatic selecting map api key 
     14* automatic selecting map api key 
    1515 
    16     * google maps adaptor for edit_location form 
     16#  * google maps adaptor for edit_location form 
    1717 
    18     * IE compatibility 
     18#  * IE compatibility 
     19 
     20  * adding markers via map layer 
  • qPloneGoogleMaps/trunk/browser/map_view.pt

    r417 r418  
    99            tal:attributes="src string:http://maps.google.com/maps?file=api&v=2&key=${key}"> 
    1010    </script> 
    11     <span tal:replace="structure python:here.maps_markers(longlat=here.getOverlayMarkers(), node='map', controls=here.getMapControl(), loc=here.geoLocation(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), events=True, maptype=here.getMapType(), color=False, zoom=here.getZoom())" /> 
     11    <span tal:replace="structure python:here.maps_markers(longlat=here.getOverlayMarkers(), node='mapView', controls=here.getMapControl(), loc=here.geoLocation(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), events=True, maptype=here.getMapType(), color=False, zoom=here.getZoom())" /> 
    1212  </metal:block> 
    1313</head> 
     
    9393    </tal:gmarker>--> 
    9494 
    95     <div id="map" style="position: relative; height: 480px;" 
     95    <div id="mapView" style="position: relative; height: 480px;" 
    9696         tal:define="height here/getHeight" 
    9797         tal:attributes="style string:height:${height}px"></div> 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/edit_js.py

    r417 r418  
    2222    sGlobVars = """ 
    2323autoCenter = [%f, %f]; 
    24 autoZoom = map.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(%f, %f), new GLatLng(%f, %f)));""" % ((min(lat)+max(lat))/2, (min(lon)+max(lon))/2, min(lat), min(lon), max(lat), max(lon)) 
     24autoZoom = map3.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(%f, %f), new GLatLng(%f, %f)));""" % ((min(lat)+max(lat))/2, (min(lon)+max(lon))/2, min(lat), min(lon), max(lat), max(lon)) 
    2525 
    2626if result: 
     
    2929var point = new GLatLng(parseFloat(%f), parseFloat(%f)); 
    3030var marker = new GMarker(point); 
    31 map.addOverlay(marker);""" % (map_center[0], map_center[1]) 
     31map3.addOverlay(marker);""" % (map_center[0], map_center[1]) 
    3232 
    3333return """ 
     
    4040        var lat = document.getElementById("maplatitude"), 
    4141            lng = document.getElementById("maplongitude"), 
    42             map = new GMap2(document.getElementById("map")); 
    43         this.mp = map
    44         map.addControl(new GLargeMapControl()); 
    45         map.addControl(new GMapTypeControl()); 
    46         map.addControl(new GOverviewMapControl()); 
    47         map.setCenter(new GLatLng(parseFloat(%(lat)f), parseFloat(%(lng)f)), 6, G_HYBRID_MAP); 
     42            map3 = new GMap2(document.getElementById("mapView")); 
     43        this.mp = map3
     44        map3.addControl(new GLargeMapControl()); 
     45        map3.addControl(new GMapTypeControl()); 
     46        map3.addControl(new GOverviewMapControl()); 
     47        map3.setCenter(new GLatLng(parseFloat(%(lat)f), parseFloat(%(lng)f)), 6, G_HYBRID_MAP); 
    4848        %(globvars)s 
    4949        %(marker)s 
     
    5252          var point = new GLatLng(lat, lng); 
    5353          var marker = new GMarker(point) 
    54           map.addOverlay(marker); 
     54          map3.addOverlay(marker); 
    5555        }; 
    5656 
    57         GEvent.addListener(map, 'click', function(marker, point) { 
     57        GEvent.addListener(map3, 'click', function(marker, point) { 
    5858          if (!marker){ 
    59             map.clearOverlays(); 
     59            map3.clearOverlays(); 
    6060            addMarker(point.y, point.x); 
    6161            lat.value = point.y; 
     
    6363          } 
    6464        }); 
    65         return {'widgetMap':map, 'autoZoom':autoZoom, 'autoCenter':autoCenter}; 
     65        return {'widgetMap':map3, 'autoZoom':autoZoom, 'autoCenter':autoCenter}; 
    6666    } 
    6767    else { 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_view.pt

    r417 r418  
    99            tal:attributes="src string:http://maps.google.com/maps?file=api&amp;v=2&amp;key=${here/getMapKey}"> 
    1010    </script> 
    11     <span tal:replace="structure python:here.maps_markers(longlat=here.getOverlayMarkers(), node='map', controls=here.getMapControl(), loc=here.geoLocation(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), events=True, maptype=here.getMapType(), color=False, zoom=here.getZoom(), mapevents=True, auto=here.getAuto())" /> 
     11    <span tal:replace="structure python:here.maps_markers(longlat=here.getOverlayMarkers(), node='mapView', controls=here.getMapControl(), loc=here.geoLocation(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), events=True, maptype=here.getMapType(), color=False, zoom=here.getZoom(), mapevents=True, auto=here.getAuto())" /> 
    1212  </metal:block> 
    1313</head> 
     
    3636    </p> 
    3737 
    38     <div id="map" style="position: relative; height: 480px;"></div> 
     38    <div id="mapView" style="position: relative; height: 480px;"></div> 
    3939<!--         tal:define="height here/getHeight" 
    4040         tal:attributes="style string:height:${height}px"></div>--> 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_widget.pt

    r417 r418  
    1414          tal:replace="structure string:Latitude: ${lat} <br /> Longitude: ${lng}" /> 
    1515    <tal:block replace="structure python:here.view_js(result)" /> 
    16     <div id="map" style="position: relative; height: 480px" 
     16    <div id="mapView" style="position: relative; height: 480px" 
    1717         xmlns:v="urn:schemas-microsoft-com:vml"></div> 
    1818</metal:view_macro> 
     
    3535                                       value longitude"/> 
    3636            </metal:coordinates> 
    37             <div id="map" style="position: relative; height: 480px" 
     37            <div id="mapView" style="position: relative; height: 480px" 
    3838                     xmlns:v="urn:schemas-microsoft-com:vml" 
    3939                     tal:attributes="tabindex tabindex/next"></div> 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/maps_markers.py

    r417 r418  
    4949    sMarkers = "\n".join(["""addMarker(%f, %f, "%s", "%s/view", "%s", "%s");""" % (float(el.geoLocation[0]), float(el.geoLocation[1]), el.Title, el.getURL(), processDesc(el.Description), color) for el in longlat]) 
    5050 
    51 if controls == 'large': sControls += "map.addControl(new GLargeMapControl());\n" 
    52 elif controls == 'small': sControls += "map.addControl(new GSmallMapControl());\n" 
    53 if typeControls: sControls += "map.addControl(new GMapTypeControl());\n" 
    54 if overviewControls: sControls += "map.addControl(new GOverviewMapControl());\n" 
     51if controls == 'large': sControls += "map1.addControl(new GLargeMapControl());\n" 
     52elif controls == 'small': sControls += "map1.addControl(new GSmallMapControl());\n" 
     53if typeControls: sControls += "map1.addControl(new GMapTypeControl());\n" 
     54if overviewControls: sControls += "map1.addControl(new GOverviewMapControl());\n" 
    5555 
    5656#if mapevents: 
     
    6060          if (!marker){ 
    6161            var m = new GMarker(point); 
    62             map.addOverlay(m); 
     62            map1.addOverlay(m); 
    6363            m.openInfoWindowHtml(%s); 
    6464            var ok_buttons = document.getElementsByName('ok'); 
    6565            var c_buttons = document.getElementsByName('cancel'); 
    6666            for (var i=0; i < ok_buttons.length; i++) { 
    67                 ok_buttons[i].addEventListener('click', function(){map.closeInfoWindow()}, false); 
    68                 c_buttons[i].addEventListener('click', function(){map.closeInfoWindow();map.removeOverlay(m);}, false); 
    69                 GEvent.addEvent(m, 'infowindowclose', function(){map.removeOverlay(m);}, false); 
     67                ok_buttons[i].addEventListener('click', function(){map1.closeInfoWindow()}, false); 
     68                c_buttons[i].addEventListener('click', function(){map1.closeInfoWindow();map1.removeOverlay(m);}, false); 
     69                GEvent.addEvent(m, 'infowindowclose', function(){map1.removeOverlay(m);}, false); 
    7070            }; 
    71             //map.removeOverlay(m); 
    72             infowindow = map.getInfoWindow(); 
     71            //map1.removeOverlay(m); 
     72            infowindow = map1.getInfoWindow(); 
    7373            infowindow.reset(point); 
    7474            //window.alert(infowindow instanceof null); 
    75             //GEvent.addListener(infowindow, 'closeclick', function(){map.removeOverlay(m)}); 
     75            //GEvent.addListener(infowindow, 'closeclick', function(){map1.removeOverlay(m)}); 
    7676        } 
    7777      }; 
    78       GEvent.addListener(map, 'click', listener);""" % sMarkerForm 
     78      GEvent.addListener(map1, 'click', listener);""" % sMarkerForm 
    7979 
    8080if events: 
     
    8686    sDefaults = """ 
    8787var centerPoint = new GLatLng(%f, %f), 
    88 autoZoom = map.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(%f, %f), new GLatLng(%f, %f))); 
     88autoZoom = map1.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(%f, %f), new GLatLng(%f, %f))); 
    8989""" % ((min(lat)+max(lat))/2, (min(lon)+max(lon))/2, min(lat), min(lon), max(lat), max(lon)) 
    90     if auto == 'Zoom': sDefaults += """map.setZoom(autoZoom);""" 
    91     elif auto == 'Center': sDefaults += """map.setCenter(centerPoint);""" 
    92     elif auto == 'Full': sDefaults += """map.setCenter(centerPoint, autoZoom);""" 
    93     sDefaults += """map.savePosition();""" 
     90    if auto == 'Zoom': sDefaults += """map1.setZoom(autoZoom);""" 
     91    elif auto == 'Center': sDefaults += """map1.setCenter(centerPoint);""" 
     92    elif auto == 'Full': sDefaults += """map1.setCenter(centerPoint, autoZoom);""" 
     93    sDefaults += """map1.savePosition();""" 
    9494 
    9595if not zoom: zoom = 6 
     
    102102  if (GBrowserIsCompatible()) { 
    103103 
    104     map = new GMap2(document.getElementById('%(node)s')); 
     104    map1 = new GMap2(document.getElementById('%(node)s')); 
    105105    %(controls)s 
    106     map.setCenter(new GLatLng(%(lt)f, %(ln)f), %(zoom)s, %(maptype)s); 
    107     var opt = map.getInfoWindow(), overLays = {}; 
     106    map1.setCenter(new GLatLng(%(lt)f, %(ln)f), %(zoom)s, %(maptype)s); 
     107    var opt = map1.getInfoWindow(), overLays = {}; 
    108108    opt.maxWidth = 400; 
    109109 
     
    119119      var point = new GLatLng(lat, lng); 
    120120      var marker = new GMarker(point, icon) 
    121       map.addOverlay(marker); 
     121      map1.addOverlay(marker); 
    122122      %(event)s 
    123123    }; 
     
    132132            for (var i=0; i < over_obj['boxes'].length; i++) registerEventListener(over_obj['boxes'][i], 'click', 
    133133                function (){ 
    134                     map.clearOverlays(); 
     134                    map1.clearOverlays(); 
    135135                    var bs = getData(); 
    136136                    for (id in bs) { 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/maps_view.pt

    r417 r418  
    1010    <span tal:define="brain python:here.portal_catalog(path='/'.join(here.getPhysicalPath())); 
    1111                      longlat python:test(len(brain)==1 and brain[0].portal_type != 'Map' and brain[0].geoLocation, brain, [])" 
    12           tal:replace="structure python:here.maps_markers(longlat, node='map', events=True, controls='large', typeControls=True, overviewControls=True, zoom=6, loc=longlat[0].geoLocation, auto=None)" /> 
     12          tal:replace="structure python:here.maps_markers(longlat, node='mapView', events=True, controls='large', typeControls=True, overviewControls=True, zoom=6, loc=longlat[0].geoLocation, auto=None)" /> 
    1313  </metal:block> 
    1414</head> 
     
    4040        </div> 
    4141 
    42         <div id="map" style="position: relative; height: 480px;"></div> 
     42        <div id="mapView" style="position: relative; height: 480px;"></div> 
    4343    </metal:body> 
    4444</metal:main_macro> 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/marker_view.pt

    r417 r418  
    88            tal:attributes="src string:http://maps.google.com/maps?file=api&amp;v=2&amp;key=${here/getMapKey}"> 
    99    </script> 
    10     <span tal:replace="structure python:here.maps_markers(here.portal_catalog(path='/'.join(here.getPhysicalPath())), node='map', events=True, loc=here.geoLocation(), controls='large', typeControls=True, overviewControls=True, color=here.getColor(), zoom=6, auto='None')" /> 
     10    <span tal:replace="structure python:here.maps_markers(here.portal_catalog(path='/'.join(here.getPhysicalPath())), node='mapView', events=True, loc=here.geoLocation(), controls='large', typeControls=True, overviewControls=True, color=here.getColor(), zoom=6, auto='None')" /> 
    1111 
    1212  </metal:block> 
     
    4242    </div> 
    4343 
    44     <div id="map" style="position: relative; height: 480px;"></div> 
     44    <div id="mapView" style="position: relative; height: 480px;"></div> 
    4545 
    4646  </tal:main-macro> 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/overlay_view.pt

    r417 r418  
    88            tal:attributes="src string:http://maps.google.com/maps?file=api&amp;v=2&amp;key=${here/getMapKey}"> 
    99    </script> 
    10     <span tal:replace="structure python:here.maps_markers(here.getMarkers(), node='map', events=True, color=here.getMarkersColor(), loc=here.geoLocation(), controls=here.getMapControl(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), maptype=here.getMapType(),)" /> 
     10    <span tal:replace="structure python:here.maps_markers(here.getMarkers(), node='mapView', events=True, color=here.getMarkersColor(), loc=here.geoLocation(), controls=here.getMapControl(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), maptype=here.getMapType(),)" /> 
    1111  </metal:block> 
    1212</head> 
     
    3838        </div> 
    3939 
    40         <div id="map" style="position: relative; height: 480px;"></div> 
     40        <div id="mapView" style="position: relative; height: 480px;"></div> 
    4141    </metal:body> 
    4242</metal:main_macro> 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/prefs_mapkeys_set.cpy

    r417 r418  
    55##bind script=script 
    66##bind subpath=traverse_subpath 
    7 ##parameters= map_api_keys, RESPONSE=None 
     7##parameters= map_api_keys 
    88##title= 
    99## 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/topic_maps_view.pt

    r417 r418  
    1111                      content folderContents|python:contentsMethod(); 
    1212                      longlat python:[el for el in content if el.geoLocation]" 
    13           tal:replace="structure python:here.maps_markers(longlat, node='map', events=True, controls='large', typeControls=True, overviewControls=True)" /> 
     13          tal:replace="structure python:here.maps_markers(longlat, node='mapView', events=True, controls='large', typeControls=True, overviewControls=True)" /> 
    1414  </metal:block> 
    1515</head> 
     
    4141        </div> 
    4242 
    43         <div id="map" style="position: relative; height: 480px;"></div> 
     43        <div id="mapView" style="position: relative; height: 480px;"></div> 
    4444 
    4545    </metal:body> 
  • qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/view_js.py

    r417 r418  
    1616var point = new GLatLng(parseFloat(%f), parseFloat(%f)); 
    1717var marker = new GMarker(point); 
    18 map.addOverlay(marker);""" % (map_center[0], map_center[1]) 
     18map2.addOverlay(marker);""" % (map_center[0], map_center[1]) 
    1919 
    2020return """ 
     
    2525function onMapLoad() { 
    2626    if (GBrowserIsCompatible()) { 
    27         var map = new GMap2(document.getElementById("map")); 
    28         map.addControl(new GLargeMapControl()); 
    29         map.addControl(new GMapTypeControl()); 
    30         map.addControl(new GOverviewMapControl()); 
    31         map.setCenter(new GLatLng(%(lat)f, %(lng)f), 6, G_HYBRID_MAP); 
     27        var map2 = new GMap2(document.getElementById("mapView")); 
     28        map2.addControl(new GLargeMapControl()); 
     29        map2.addControl(new GMapTypeControl()); 
     30        map2.addControl(new GOverviewMapControl()); 
     31        map2.setCenter(new GLatLng(%(lat)f, %(lng)f), 6, G_HYBRID_MAP); 
    3232        %(marker)s 
    3333    }