Google maps 升级到9.0后,Google Maps自定义控件在mobile xpage上不起作用
我正在移动XPages应用程序中使用googlemaps自定义控件()。这在8.5.3中起作用,但在服务器升级到9.0之后,它就不再起作用了 我现在试图缩小这个问题的范围,这就是我的目的:Google maps 升级到9.0后,Google Maps自定义控件在mobile xpage上不起作用,google-maps,xpages,Google Maps,Xpages,我正在移动XPages应用程序中使用googlemaps自定义控件()。这在8.5.3中起作用,但在服务器升级到9.0之后,它就不再起作用了 我现在试图缩小这个问题的范围,这就是我的目的: 创建一个XPage并添加自定义控件—它可以正常工作 创建带有移动前缀的单个XPage,其中包含单个页面应用程序控件和单个应用程序页面。将自定义控件添加到应用程序页面-但它不起作用 当我查看这两个的源代码时,第一个包含一些要在客户端加载时运行的客户端JS。对于移动页面,情况似乎并非如此……:-/ 有没有办法解决
>
>
>
>“&action=openDocument”}]>
>
>
>documentId=“#{javascript:viewScope.currentPlaceUnid}”>
>对于(变量i=0;i0)addr+=“,”addr+=
>v.elementAt(i)}viewScope.address=
>地址;}]>
>
>
>
>在底部需要。。。函数初始化(){
>
>geocoder=new google.maps.geocoder();var myOptions={
>缩放:10,
>mapTypeId:google.maps.mapTypeId.ROADMAP
> };
>map=new google.maps.map(document.getElementById(“map_canvas”),myOptions);var mapcentertype=“Address”;if(mapcentertype==
>“坐标”){
>var map_center_latitude=document.getElementById(“#{id:hdnmapcenteralatitude}”).value;
>var map_center_longitude=document.getElementById(“#{id:hdnMapCenterLongitude}”).value;
>centerMap=新建
>LatLng(parseFloat(地图中心纬度),parseFloat(地图中心经度));
>map.setCenter(centerMap);}else if(mapcentertype==“地址”){
>var address=“#{javascript:viewScope.address}”;
>geocoder.geocode({'address':address},函数(结果,状态){
>if(status==google.maps.GeocoderStatus.OK){
>map.setCenter(结果[0].geometry.location);
>}其他{
>警报(“地理编码中心未成功,原因如下:“+status+”->“+address”);};};}其他{alert(“您
>忘记设置属性映射_center_type。“);}codeAddress();
> }
>
>函数codeAddress(){var valueTitle=
>“#{javascript:document1.getItemValueString(“Name”)}”;var-valueLayer
>=0;var-valueInfotext='{javascript:var-info=”“+document1.getItemValueString(“Name”)+“”;
>var v:java.util.Vector=document1.getItemValue(“地址”);
>对于(变量i=0;如果(i>0)i)info+=“
”
>信息+=v.elementAt(一)
> }
>返回信息;}';var valueIcon='';var valueAddress=“#{javascript:viewScope.address}”var valueAnimation=“DROP”var
>valueLocation_type=“Address”;var valueLocation_经度=0.0;
>var valueLocation_latitude=0.0;显示地图(valueAddress,
>valueAnimation、valueLayer、valueIcon、valueInfotext、valueTitle、,
>valueLocation\类型,valueLocation\经度,
>值位置(纬度);}
>
>函数showMap(地址、标记动画、标记索引、,
>标记图标、标记信息窗口、标记标题、,
>标记位置类型,标记位置经度,
>标记\位置\纬度){//创建标记
>var marker=new google.maps.marker({map:map});if(marker\u location\u type==“坐标”){
>var mylatng=new google.maps.LatLng(parseFloat(标记位置纬度),
>parseFloat(标记位置经度);
>标记器设置位置(myLatLng);
>}else{geocoder.geocode({'address':address}),函数(结果,状态){
>如果(status==google.maps.GeocoderStatus.OK){
>marker.setPosition(结果[0].geometry.location);
>}其他{
>警报(“地理编码因以下原因未成功:“+状态+”->“+地址”);
> }
> });
> }
>
>//设置标记的标题
>如果(标记标题!=“”){
>marker.setTitle(marker\u title);
> };
>//设置标记的图标
>如果(标记图标!=“”){
>marker.setIcon(marker_icon.replace(“/”,“”));
>};//如果(marker_zindex!=“”){marker.setZIndex(parseInt(marker_zindex));};//设置动画,则设置标记的z索引
>如果(标记_动画!=“”){
>如果(标记_动画==“反弹”){
>marker.setAnimation(google.maps.Animation.BOUNCE);}else
>如果(标记_动画==“放置”){
>marker.setAnimation(google.maps.Animation.DROP);}else{//
>不存在};};//设置信息窗口并
>marker console.log的文本(“marker\u infowindow\u text=”+
>marker\u infowindow\u text);if(marker\u infowindow\u text!=“”){var
>infowindow=新建google.maps.infowindow({内容:
>marker\u infowindow\u text});google.maps.event.addListener(marker,
>'click',function(){infowindow.open(map,marker);};};}
>
>功能显示圈(中心类型、中心地址、中心纬度、,
>中心经度、半径、fillColor、fillOpacity、strokeColor、,
>笔划不透明度、笔划权重、可见、zIndex){
>
>if(visible==“false”){visible=false;}else{visible=
>正确;}/
> <xe:appPage id="appPage4" pageName="map" resetContent="true">
> <xe:djxmHeading id="djxmHeading3" label="">
> <xe:this.back><![CDATA[<<]]></xe:this.back>
> <xe:this.moveTo><![CDATA[#{javascript:"place&documentId=" + viewScope.currentPlaceUnid +
> "&action=openDocument"}]]></xe:this.moveTo> </xe:djxmHeading>
> <xp:panel styleClass="container">
> <xp:this.data>
> <xp:dominoDocument var="document1" formName="Place" action="openDocument"
> documentId="#{javascript:viewScope.currentPlaceUnid}">
> <xp:this.postOpenDocument><![CDATA[#{javascript:var v:java.util.Vector = document1.getItemValue("Address"); var addr = "";
> for(var i=0; i<v.size(); i++) { if(i>0) addr += "," addr +=
> v.elementAt(i) } viewScope.address =
> addr;}]]></xp:this.postOpenDocument>
> </xp:dominoDocument>
> </xp:this.data>
> <div id="div1"></div> <!-- <xc:ccGoogleMaps map_height="400" map_width="320" map_width_measurement="px" map_height_measurement="px"
> map_zoom="10" map_type="ROADMAP" map_center_type="Address" map_center_address="#{javascript:viewScope.address}">
> <xc:this.marker>
> <xc:marker location_type="Address" animation="DROP"
> location_address="#{javascript:viewScope.address}">
> <xc:this.infotext><![CDATA[#{javascript:var info = "<b>" + document1.getItemValueString("Name") + "</b></br/>";
> var v:java.util.Vector = document1.getItemValue("Address");
> for(var i=0; i<v.size(); i++) {
> if(i>0) info += "<br/>"
> info += v.elementAt(i)
> }
> return info;}]]></xc:this.infotext>
> <xc:this.title><![CDATA[#{javascript:document1.getItemValueString("Name")}]]></xc:this.title>
> </xc:marker>
> </xc:this.marker>
> </xc:ccGoogleMaps> --> <div id="map_canvas" style="width:320px; height:400px"> </div> <xp:scriptBlock id="scriptBlock1">
> <xp:this.value><![CDATA[var geocoder; // 2013.11.01/Jda - Need to use code directly here instead of from Custom Control - and add
> require at the bottom... function initialize(){
>
> geocoder = new google.maps.Geocoder(); var myOptions = {
> zoom: 10,
> mapTypeId: google.maps.MapTypeId.ROADMAP
> };
> map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var mapcentertype = "Address"; if(mapcentertype ==
> "Coordinates"){
> var map_center_latitude = document.getElementById("#{id:hdnMapCenterLatitude}").value;
> var map_center_longitude = document.getElementById("#{id:hdnMapCenterLongitude}").value;
> centerMap = new
> google.maps.LatLng(parseFloat(map_center_latitude),parseFloat(map_center_longitude));
> map.setCenter(centerMap); }else if(mapcentertype == "Address"){
> var address = "#{javascript:viewScope.address}";
> geocoder.geocode( {'address': address}, function(results, status) {
> if(status == google.maps.GeocoderStatus.OK){
> map.setCenter(results[0].geometry.location);
> }else{
> alert("Geocode center was not successful for the following reason: " + status + " -> " + address); }; }); }else{ alert("You
> forgot to set the property map_center_type."); } codeAddress();
> }
>
> function codeAddress(){ var valueTitle =
> '#{javascript:document1.getItemValueString("Name")}'; var valueLayer
> = 0; var valueInfotext = '#{javascript:var info = "<b>" + document1.getItemValueString("Name") + "</b></br/>";
> var v:java.util.Vector = document1.getItemValue("Address");
> for(var i=0; i<v.size(); i++) {
> if(i>0) info += "<br/>"
> info += v.elementAt(i)
> }
> return info;}'; var valueIcon = ''; var valueAddress = "#{javascript:viewScope.address}"; var valueAnimation = "DROP"; var
> valueLocation_type = "Address"; var valueLocation_longitude = 0.0;
> var valueLocation_latitude = 0.0; showMap(valueAddress,
> valueAnimation, valueLayer, valueIcon, valueInfotext, valueTitle,
> valueLocation_type, valueLocation_longitude,
> valueLocation_latitude); }
>
> function showMap(address, marker_animation, marker_zindex,
> marker_icon, marker_infowindow_text, marker_title,
> marker_location_type, marker_location_longitude,
> marker_location_latitude) { // Create Marker
> var marker = new google.maps.Marker({map: map}); if(marker_location_type=="Coordinates"){
> var myLatLng = new google.maps.LatLng(parseFloat(marker_location_latitude),
> parseFloat(marker_location_longitude));
> marker.setPosition(myLatLng);
> }else{ geocoder.geocode( {'address': address}, function(results, status){
> if (status == google.maps.GeocoderStatus.OK) {
> marker.setPosition(results[0].geometry.location);
> } else {
> alert("Geocode was not successful for the following reason: " + status + " -> " + address);
> }
> });
> }
>
> // Set the title of the marker
> if(marker_title != ""){
> marker.setTitle(marker_title);
> };
> // Set the icon of the marker
> if(marker_icon != ""){
> marker.setIcon(marker_icon.replace("/",""));
> }; // Set the z-index of the marker if(marker_zindex != ""){ marker.setZIndex(parseInt(marker_zindex)); }; // Set the animation
> of the marker if(marker_animation != ""){
> if(marker_animation == "BOUNCE"){
> marker.setAnimation(google.maps.Animation.BOUNCE); }else
> if(marker_animation == "DROP"){
> marker.setAnimation(google.maps.Animation.DROP); }else{ //
> does not exist }; }; // Set the infowindow and
> text of the marker console.log("marker_infowindow_text=" +
> marker_infowindow_text); if(marker_infowindow_text != ""){ var
> infowindow = new google.maps.InfoWindow({content:
> marker_infowindow_text}); google.maps.event.addListener(marker,
> 'click', function() { infowindow.open(map,marker); }); }; }
>
> function showCircle(center_type, center_address, center_latitude,
> center_longitude, radius, fillColor, fillOpacity, strokeColor,
> strokeOpacity, strokeWeight, visible, zIndex) {
>
> if(visible == "false"){ visible = false; }else{ visible =
> true; }; //Create Circle var circle_options = { map: map,
> //center: center, radius: parseInt(radius), fillColor:
> fillColor.toString(), fillOpacity: fillOpacity, strokeColor:
> strokeColor.toString(), strokeOpacity: strokeOpacity,
> strokeWeight: strokeWeight,
> visible: visible,
> zIndex: zIndex }; var circle = new google.maps.Circle(circle_options); if(center_type ==
> "Coordinates"){ circle.setCenter(new
> google.maps.LatLng(parseFloat(center_latitude),
> parseFloat(center_longitude))); }else{ geocoder.geocode(
> {'address': center_address}, function(results, status) {
> if (status == google.maps.GeocoderStatus.OK) {
> circle.setCenter(results[0].geometry.location);
> } else {
> alert("Geocode of the circle was not successful for the following reason: " + status + " -> " + address);
> } });
>
> }; }
>
> require(["dojo/domReady"], function(){ initialize(); });
> ]]></xp:this.value> </xp:scriptBlock> </xp:panel>
> </xe:appPage>
require(["dojo/domReady!"], function(){
// place code here
});