@@ -12,7 +12,7 @@ Hoot.model.export = function (context)
12
12
var model_export = { } ;
13
13
var statusTimer ;
14
14
var outputname ;
15
- var selectedInput ;
15
+ var selectedInputUUID ;
16
16
var selExportTypeDesc ;
17
17
//var removeConflationRes;
18
18
var selectedOutType ;
@@ -27,7 +27,8 @@ Hoot.model.export = function (context)
27
27
outputname = container . select ( '#fileExportOutputName' ) . value ( ) ||
28
28
container . select ( '#fileExportOutputName' ) . attr ( 'placeholder' ) ;
29
29
}
30
- selectedInput = data . name || outputname ;
30
+
31
+ selectedInputUUID = data . id ;
31
32
32
33
if ( container . exporttype ) { selExportTypeDesc = container . exporttype ; }
33
34
else {
@@ -36,12 +37,11 @@ Hoot.model.export = function (context)
36
37
}
37
38
38
39
var _expType = {
39
- 'File Geodatabase' : 'gdb' ,
40
- 'Shapefile' : 'shp' ,
41
- /*'Web Feature Service (WFS)':'wfs',*/
42
- 'OpenStreetMap (OSM)' :'osm' ,
43
- 'OpenStreetMap (PBF)' :'osm.pbf' ,
44
- 'OSM API Database' :'osm_api_db'
40
+ 'File Geodatabase' : 'gdb' ,
41
+ 'Shapefile' : 'shp' ,
42
+ 'OpenStreetMap (OSM)' : 'osm' ,
43
+ 'OpenStreetMap (PBF)' : 'osm.pbf' ,
44
+ 'OSM API Database' : 'osm_api_db'
45
45
} ;
46
46
selectedOutType = _expType [ selExportTypeDesc ] || selExportTypeDesc ;
47
47
@@ -85,7 +85,7 @@ Hoot.model.export = function (context)
85
85
selectedTranslation = transName + '.js' ;
86
86
}
87
87
88
- if ( ! selectedInput || ! selectedOutType ) {
88
+ if ( isNaN ( selectedInputUUID ) || ! selectedOutType ) {
89
89
iD . ui . Alert ( 'Please enter valid values.' , 'error' , new Error ( ) . stack ) ;
90
90
return ;
91
91
}
@@ -143,7 +143,7 @@ Hoot.model.export = function (context)
143
143
}
144
144
145
145
param . inputtype = 'db' ;
146
- param . input = selectedInput ;
146
+ param . inputId = selectedInputUUID ;
147
147
param . outputtype = selectedOutType ;
148
148
param . outputname = outputname ;
149
149
param . append = appendTemplate . toString ( ) ;
@@ -168,8 +168,7 @@ Hoot.model.export = function (context)
168
168
} ) ;
169
169
} ;
170
170
171
- var _exportResultHandler = function ( error , result )
172
- {
171
+ var _exportResultHandler = function ( error , result ) {
173
172
174
173
if ( result . status !== 'running' ) {
175
174
Hoot . model . REST . WarningHandler ( result ) ;
@@ -182,27 +181,8 @@ Hoot.model.export = function (context)
182
181
exportCallback ( result . status ) ;
183
182
}
184
183
185
- if ( result . status !== 'failed' ) {
186
- //Huh?
187
- // if(removeConflationRes === 'true'){
188
- // d3.json('/hoot-services/osm/api/0.6/map/delete/' + mapId)
189
- // .header('Content-Type', 'text/plain')
190
- // .post('', function (error, data) {
191
-
192
- // });
193
- // }
194
-
195
- /* if(selectedOutType === 'wfs'){
196
- // var capaUrl = location.origin + '/hoot-services/ogc/' + result.jobId +
197
- // '?service=WFS&version=1.1.0&request=GetCapabilities';
198
- //alert('WFS Resource URL:\n' + capaUrl);
199
- var param = {};
200
- param.id = result.jobId;
201
- context.hoot().control.utilities.wfsdataset.wfsDetailPopup(param);
202
- }
203
- else */
204
- if ( selectedOutType === 'osm_api_db' )
205
- {
184
+ if ( result . status !== 'failed' ) {
185
+ if ( selectedOutType === 'osm_api_db' ) {
206
186
//OSM API db export writes directly to an osm api database and involves no file
207
187
//download for export.
208
188
var summaryStartIndex = result . statusDetail . indexOf ( 'Changeset(s)' ) ;
@@ -212,8 +192,7 @@ Hoot.model.export = function (context)
212
192
//having difficulty accessing the iD alerts in cucumber tests, so using a regular
213
193
//alert instead
214
194
alert ( 'Successful export to an OSM API database:\n\n' + summary ) ;
215
- }
216
- else {
195
+ } else {
217
196
var sUrl = '/hoot-services/job/export/' + result . jobId + '?' + outNameParam + '&removecache=true' ;
218
197
if ( selectedOutType === 'osm.pbf' ) {
219
198
// specify the file ext since the default is zip and there is no need to zip a pbf file
@@ -256,14 +235,12 @@ Hoot.model.export = function (context)
256
235
257
236
var _initVariables = function ( )
258
237
{
259
- statusTimer = null ;
260
- outputname = null ;
261
- selectedInput = null ;
238
+ statusTimer = null ;
239
+ outputname = null ;
240
+ selectedInputUUID = null ;
262
241
selExportTypeDesc = null ;
263
- //removeConflationRes = null;
264
- selectedOutType = null ;
265
- exportCallback = null ;
266
- //mapId = null;
242
+ selectedOutType = null ;
243
+ exportCallback = null ;
267
244
} ;
268
245
269
246
return model_export ;
0 commit comments