+ function createNote(feature, form) {
+ var location = unproj(feature.geometry.getBounds().getCenterLonLat());
+
+ $(form).find("input[type=submit]").prop("disabled", true);
+
+ $.ajax($("#createnoteanchor").attr("href"), {
+ type: "POST",
+ data: {
+ lon: location.lon,
+ lat: location.lat,
+ text: $(form.text).val()
+ },
+ success: function (data) {
+ map.noteSelector.unselect(feature);
+
+ feature.attributes = data.properties;
+
+ map.noteLayer.drawFeature(feature);
+
+ map.noteMover.deactivate();
+ }
+ });
+ }
+
+ function updateNote(feature, form, close) {
+ var url = close ? feature.attributes.close_url : feature.attributes.comment_url;
+
+ $(form).find("input[type=submit]").prop("disabled", true);
+
+ $.ajax(url, {
+ type: "POST",
+ data: {
+ text: $(form.text).val()
+ },
+ success: function (data) {
+ map.noteSelector.unselect(feature)
+
+ feature.attributes = data.properties;
+
+ map.noteSelector.select(feature)
+ }
+ });
+ }
+