mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-25 06:55:46 +00:00
Tag commits with imagery used
This commit is contained in:
@@ -103,7 +103,7 @@ iD.Connection = function() {
|
||||
return oauth.authenticated();
|
||||
}
|
||||
|
||||
connection.putChangeset = function(changes, comment, callback) {
|
||||
connection.putChangeset = function(changes, comment, imagery_used, callback) {
|
||||
oauth.xhr({
|
||||
method: 'PUT',
|
||||
path: '/api/0.6/changeset/create',
|
||||
|
||||
@@ -15,14 +15,15 @@ iD.format.XML = {
|
||||
return s.replace(/>/g,'>').replace(/</g,'<').replace(/"/g,'"');
|
||||
},
|
||||
// Generate Changeset XML. Returns a string.
|
||||
changeset: function(comment) {
|
||||
changeset: function(comment, imagery_used) {
|
||||
return (new XMLSerializer()).serializeToString(
|
||||
JXON.unbuild({
|
||||
osm: {
|
||||
changeset: {
|
||||
tag: [
|
||||
{ '@k': 'created_by', '@v': 'iD 0.0.0' },
|
||||
{ '@k': 'comment', '@v': comment || '' }
|
||||
{ '@k': 'comment', '@v': comment || '' },
|
||||
{ '@k': 'imagery_used', '@v': imagery_used.join(';')}
|
||||
],
|
||||
'@version': 0.3,
|
||||
'@generator': 'iD'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
iD.History = function() {
|
||||
var stack, index,
|
||||
var stack, index, imagery_used,
|
||||
dispatch = d3.dispatch('change');
|
||||
|
||||
function perform(actions) {
|
||||
@@ -16,7 +16,9 @@ iD.History = function() {
|
||||
graph = actions[i](graph);
|
||||
}
|
||||
|
||||
return {graph: graph, annotation: annotation};
|
||||
imagery_used = 'Bing'; // TODO, un-hardcode
|
||||
|
||||
return {graph: graph, annotation: annotation, imagery_used: imagery_used};
|
||||
}
|
||||
|
||||
function change(previous) {
|
||||
@@ -108,6 +110,10 @@ iD.History = function() {
|
||||
};
|
||||
},
|
||||
|
||||
imagery_used: function(source) {
|
||||
return _.unique(_.pluck(stack.slice(1, index + 1), 'imagery_used'));
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
stack = [{graph: iD.Graph()}];
|
||||
index = 0;
|
||||
|
||||
@@ -99,7 +99,7 @@ window.iD = function(container) {
|
||||
function save(e) {
|
||||
d3.select('.shaded').remove();
|
||||
var l = iD.loading('Uploading changes to OpenStreetMap.');
|
||||
connection.putChangeset(history.changes(), e.comment, function(err, changeset_id) {
|
||||
connection.putChangeset(history.changes(), e.comment, history.imagery_used(), function(err, changeset_id) {
|
||||
l.remove();
|
||||
history.reset();
|
||||
map.flush().redraw();
|
||||
|
||||
Reference in New Issue
Block a user