在谷歌应用引擎中替换GDownloadUrl

时间:2014-05-26 22:56:22

标签: jquery python google-maps

更新 我现在看到,也许我没有包含足够的使用GDownloadUrl的函数的代码,并在下面添加了。在代码中GDownloadUrl(url, function(doc)function ajaxLoad(url,callback,postData,plain)替换为变量callback,postData,plain的变量是什么?感谢。

在谷歌应用版本3之前,我的working maps app被少数人成功使用。然后是一个关键功能,它触发了我的一个" singlerightclick"在现有的地图引脚上不起作用,谷歌似乎不太可能解决这个问题。所以我一直在尝试更新应用程序但是被decommitted函数GDownloadUrl困扰了。

虽然最近我已经越来越熟悉在另一个项目中使用jQuery,并且在stackoverflow.com上搜索,我认为jQuery是GDownloadUrl的替代品,我不知所措

1)如何在这里使用jQuery,以及

2)更重要的是,如何链接到旧版用户使用Google默认数据库和Python代码中的class Pin(db.Model)创建地图图钉的现有数据集。

我的一些遗留代码如下。

function process(form) {
    // == obtain the data
    var ID = myArray.length + 1;
    var details = escape(form.data.value);
    var category = parseInt(form.category.value);
    var color = colors[category];
    var label = form.label.value;
    var lat = lastmarker.getPoint().lat();
    var lng = lastmarker.getPoint().lng();
    var url = "details.txt?Action=add&ID=" +ID+ "&lat=" +lat+ "&lng=" +lng+ "&details="+details+"&category="+category+"&label="+label+"&place={{place}}";
    //GLog.write("About to send "+url+ " to the server"); 

    // ===== send the data to the server
    GDownloadUrl(url, function(doc) { 
        });  

    // == remove the input marker and replace it with a completed marker
    map.closeInfoWindow();
    map.removeOverlay(lastmarker);
    var marker = createMarker(lastmarker.getPoint(),details,ID,color,label,0);
    alert("Your information has been processed. You may hover over pushpins to see who others are.");

  }


readData = function(doc) {
        // === split the document into lines ===
        lines = doc.split("\n");
        for (var i=0; i<lines.length; i++) {
          if (lines[i].length > 1) {
            // === split each line into parts separated by Tab and use the contents ===
            parts = lines[i].split(String.fromCharCode(9));
            var ID  = parts[0];
            var lat = parseFloat(parts[2]);
            var lng = parseFloat(parts[3]);
            var details = parts[4];
            var pincategory = parts[5];
            var label = parts[6];
            var point = new google.maps.LatLng(lat,lng);
            var pinage = parts[7];
            myArray[i] = new Array(lat,lng,details,point,ID,pincategory,label,pinage);
          }
        }
        // create the marker
        for (var j=0; j<myArray.length; j++) {
          var alat = myArray[j][0];
          var alng = myArray[j][1];
          var adetails = myArray[j][2];
          var apoint = myArray[j][3];
          var ID = myArray[j][4];
          var acolor = colors[myArray[j][5]];
          var alabel = myArray[j][6];
          var apinage = myArray[j][7];
          if(!isNaN(alat+alng)){
            // create the marker
            var marker = createMarker(apoint,adetails,ID,acolor,alabel,apinage);
          }
        }
      }


class Pin(db.Model):
    date = db.DateTimeProperty(auto_now_add=True)
    lat = db.FloatProperty()
    lng = db.FloatProperty()
    name = db.StringProperty()
    cornerColor  = db.StringProperty(default='ffffff')
    height = db.IntegerProperty(default=32)
    label = db.StringProperty(default='')
    labelColor = db.StringProperty(default='000000')
    labelSize = db.IntegerProperty(default=2)
    primaryColor = db.StringProperty(default='ff0000')
    shadowColor = db.StringProperty(default='000000')
    shape = db.StringProperty(default='circle')
    strokeColor = db.StringProperty(default='000000')
    width = db.IntegerProperty(default=32)
    category = db.IntegerProperty(default=0)
    scategory = db.StringProperty()
    logindex = db.IntegerProperty(default=0)
    imageindex = db.IntegerProperty(default=0)
    deleteRequested = db.BooleanProperty(default=False)

0 个答案:

没有答案