function addNoteLayer(map, notesUrl, newNoteControls, newNoteForm, minZoom) {
var newNotes;
- var noteCallback = function (scope, response) {
- for (var f = 0; f < response.features.length; f++) {
- var feature = response.features[f];
- }
- };
-
var saveNewNotes = function (o) {
var layer = o.object;
newNotes = layer.getFeaturesByAttribute("status", "new")
newNotes = undefined;
};
+ var describeNote = function (n) {
+ var description = "<h2>Note " + n.id + "</h2>";
+
+ n.comments.forEach(function (c) {
+ description += "<p><small class='deemphasize'>" + c.action + " by ";
+ description += c.user + " at " + c.date + "</small><br/>" + c.text + "</p>";
+ });
+
+ return description;
+ }
+
var noteSelected = function (o) {
var feature = o.feature;
var location = feature.geometry.getBounds().getCenterLonLat();
content = form.html();
close = false;
} else {
- content = "<p>" + feature.attributes.id + "</p>";
+ content = describeNote(feature.attributes);
close = true;
};
],
protocol: new OpenLayers.Protocol.HTTP({
url: notesUrl,
- format: new OpenLayers.Format.GeoJSON(),
- callback: noteCallback
+ format: new OpenLayers.Format.GeoJSON()
})
});