Changeset 941
- Timestamp:
- 08/27/08 13:18:12 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/camptocamp/MapFishUnhcr/client/mfbase/mapfish/widgets/editing/FeatureOfflineManager.js
r930 r941 19 19 20 20 /** 21 * @requires OpenLayers/Protocol/SQL .js21 * @requires OpenLayers/Protocol/SQL/Gears.js 22 22 * @requires core/Offline.js 23 23 */ … … 83 83 /** 84 84 * Method: download 85 * For a given layer, read the data from the remote server and write it 86 * in the offline storage. 85 87 * 86 88 * Parameters: … … 129 131 /** 130 132 * Method: upload 133 * For a given layer, read the data from the offline storage and write 134 * it to the remove server. 131 135 * 132 136 * Parameters: … … 150 154 var protocol = this.switchLayerProtocol(id); 151 155 152 var count = 0;153 156 function cleanup() { 154 if (count <= 0) { 155 this.switchCurrentLayerProtocol(id, protocol); 156 mapfish.Offline.transitionTaskDone(taskId); 157 } 158 } 157 this.switchCurrentLayerProtocol(id, protocol); 158 mapfish.Offline.transitionTaskDone(taskId); 159 } 160 159 161 function callback(resp) { 160 162 if (resp.code != OpenLayers.Protocol.Response.SUCCESS) { … … 162 164 'failed to commit features to server'); 163 165 } 164 count--; 165 cleanup.call(this); 166 } 167 168 count = protocol.commit(resp.features, { 166 } 167 168 // write data to remote server 169 resp = protocol.commit(resp.features, { 169 170 'create': {'callback': callback, 'scope': this}, 170 171 'update': {'callback': callback, 'scope': this}, 171 'delete': {'callback': callback, 'scope': this} 172 }); 173 174 cleanup.call(this); 172 'delete': {'callback': callback, 'scope': this}, 173 'callback': cleanup, 174 'scope': this 175 }); 176 177 if (resp.length <= 0) { 178 cleanup.call(this); 179 } 175 180 }, 176 181 … … 225 230 return new OpenLayers.Filter.Spatial({ 226 231 type: OpenLayers.Filter.Spatial.BBOX, 227 value: new OpenLayers.Geometry.Rectangle( 228 bounds.left, 229 bounds.bottom, 230 bounds.right - bounds.left, 231 bounds.top - bounds.bottom 232 ) 232 value: bounds 233 233 }); 234 234 }, … … 266 266 return mapfish.Protocol.SQL.factory({ 267 267 tableName: id, 268 options: {'d elete': {'dontDelete': true}}268 options: {'dontDelete': true} 269 269 }); 270 270 }