Merge pull request #316 from andygup/v2.6.1

V2.6.1
This commit is contained in:
Andy 2015-04-13 10:55:12 -06:00
commit bd2b14cc45
12 changed files with 59 additions and 19 deletions

View File

@ -1,5 +1,13 @@
# offline-editor-js - Changelog
## Version 2.6.1 - April 13, 2015
Patch release. Recommended update. No breaking changes.
**Bug Fixes**
* Closes #315 - editsStore.pushEdit() - failed to insert undefined objectId into database.
## Version 2.6 - April 9, 2015
Recommended update. No breaking changes.

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
/*jshint -W030 */
@ -94,6 +94,13 @@ define([
extend: function (layer, callback, dataStore) {
var self = this;
// NOTE: At v2.6.1 we've discovered that not all feature layers support objectIdField.
// However, we want to try to be consistent here with how the library is managing Ids.
// So, we force the layer.objectIdField to DB_UID. This should be consistent with
// how esri.Graphics assign a unique ID to a graphic. If it is not, then this
// library will break and we'll have to re-architect how we manage UIDs.
layer.objectIdField = this.DB_UID;
// Initialize the database as well as set offline data.
this._initializeDB(dataStore,callback);
@ -113,9 +120,9 @@ define([
operations supported offline:
1. add a new attachment to an existing feature (DONE)
2. add a new attachment to a new feature (DONE)
3. remove an attachment that is already in the server... (NOT YET)
3. remove an attachment that is already in the server... (DONE)
4. remove an attachment that is not in the server yet (DONE)
5. update an existing attachment to an existing feature (NOT YET)
5. update an existing attachment to an existing feature (DONE)
6. update a new attachment (NOT YET)
concerns:
@ -289,6 +296,7 @@ define([
var deferred = new Deferred();
var objectId = this._getNextTempId();
addEdit.attributes[this.objectIdField] = objectId;
var thisLayer = this;
@ -407,7 +415,15 @@ define([
*/
layer.convertGraphicLayerToJSON = function (features, updateEndEvent, callback) {
var layerDefinition = {};
// We want to be consistent, but we've discovered that not all feature layers have an objectIdField
if(updateEndEvent.target.hasOwnProperty("objectIdField"))
{
layerDefinition.objectIdFieldName = updateEndEvent.target.objectIdField;
}else {
layerDefinition.objectIdFieldName = this.objectIdField;
}
layerDefinition.globalIdFieldName = updateEndEvent.target.globalIdField;
layerDefinition.geometryType = updateEndEvent.target.geometryType;
layerDefinition.spatialReference = updateEndEvent.target.spatialReference;

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
define([

View File

@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
define(["dojo/query","dojo/request","esri/geometry/Polygon","dojo/_base/declare"],function(a,b,c,d){"use strict";return d("O.esri.Tiles.OfflineTilesEnabler",[],{getBasemapLayer:function(a){var b=a.layerIds[0];return a.getLayer(b)},extend:function(c,d,e){c._tilesCore=new O.esri.Tiles.TilesCore,c._lastTileUrl="",c._imageType="",c._minZoom=null,c._maxZoom=null,c._getTileUrl=c.getTileUrl;var f=!0;return"undefined"!=typeof e&&(f=e),c.offline={online:f,store:new O.esri.Tiles.TilesStore,proxyPath:null},c.offline.store.isSupported()?(c.offline.store.init(function(b){b&&(c.resampling=!1,c.getTileUrl=function(b,d,e){var f=this._getTileUrl(b,d,e);if(this.offline.online)return""==c._imageType&&(c._imageType=this.tileInfo.format.toLowerCase()),c._lastTileUrl=f,f;f=f.split("?")[0];var g="void:/"+b+"/"+d+"/"+e,h=null;return c._tilesCore._getTiles(h,this._imageType,f,g,this.offline.store,a),g},d&&d(!0))}.bind(this)),c.getLevelEstimation=function(a,b,c){var d=new O.esri.Tiles.TilingScheme(this),e=d.getAllCellIdsInExtent(a,b),f={level:b,tileCount:e.length,sizeBytes:e.length*c};return f},c.prepareForOffline=function(a,b,d,e){c._tilesCore._createCellsForOffline(this,a,b,d,function(a){this._doNextTile(0,a,e)}.bind(this))},c.goOffline=function(){this.offline.online=!1},c.goOnline=function(){this.offline.online=!0,this.refresh()},c.isOnline=function(){return this.offline.online},c.deleteAllTiles=function(a){var b=this.offline.store;b.deleteAll(a)},c.getOfflineUsage=function(a){var b=this.offline.store;b.usedSpace(a)},c.getTilePolygons=function(a){c._tilesCore._getTilePolygons(this.offline.store,c.url,this,a)},c.saveToFile=function(a,b){c._tilesCore._saveToFile(a,this.offline.store,b)},c.loadFromFile=function(a,b){c._tilesCore._loadFromFile(a,this.offline.store,b)},c.getMaxZoom=function(a){null==this._maxZoom&&(this._maxZoom=c.tileInfo.lods[c.tileInfo.lods.length-1].level),a(this._maxZoom)},c.getMinZoom=function(a){null==this._minZoom&&(this._minZoom=c.tileInfo.lods[0].level),a(this._minZoom)},c.getMinMaxLOD=function(a,b){var d={},e=c.getMap(),f=e.getLevel()+a,g=e.getLevel()+b;return null!=this._maxZoom&&null!=this._minZoom?(d.max=Math.min(this._maxZoom,g),d.min=Math.max(this._minZoom,f)):(c.getMinZoom(function(a){d.min=Math.max(a,f)}),c.getMaxZoom(function(a){d.max=Math.min(a,g)})),d},c.estimateTileSize=function(a){c._tilesCore._estimateTileSize(b,this._lastTileUrl,this.offline.proxyPath,a)},c.getExtentBuffer=function(a,b){return b.xmin-=a,b.ymin-=a,b.xmax+=a,b.ymax+=a,b},c.getTileUrlsByExtent=function(a,b){var d=new O.esri.Tiles.TilingScheme(c),e=d.getAllCellIdsInExtent(a,b),f=[];return e.forEach(function(a){f.push(c.url+"/"+b+"/"+a[1]+"/"+a[0])}.bind(this)),f},void(c._doNextTile=function(a,b,d){var e=b[a],f=this._getTileUrl(e.level,e.row,e.col);c._tilesCore._storeTile(f,this.offline.proxyPath,this.offline.store,function(c,f){c||(f={cell:e,msg:f});var g=d({countNow:a,countMax:b.length,cell:e,error:f,finishedDownloading:!1});g||a===b.length-1?d({finishedDownloading:!0,cancelRequested:g}):this._doNextTile(a+1,b,d)}.bind(this))})):d(!1,"indexedDB not supported")}})}),"undefined"!=typeof O?O.esri.Tiles={}:(O={},O.esri={Tiles:{}}),O.esri.Tiles.Base64Utils={},O.esri.Tiles.Base64Utils.outputTypes={Base64:0,Hex:1,String:2,Raw:3},O.esri.Tiles.Base64Utils.addWords=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c},O.esri.Tiles.Base64Utils.stringToWord=function(a){for(var b=8,c=(1<<b)-1,d=[],e=0,f=a.length*b;f>e;e+=b)d[e>>5]|=(a.charCodeAt(e/b)&c)<<e%32;return d},O.esri.Tiles.Base64Utils.wordToString=function(a){for(var b=8,c=(1<<b)-1,d=[],e=0,f=32*a.length;f>e;e+=b)d.push(String.fromCharCode(a[e>>5]>>>e%32&c));return d.join("")},O.esri.Tiles.Base64Utils.wordToHex=function(a){for(var b="0123456789abcdef",c=[],d=0,e=4*a.length;e>d;d++)c.push(b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15));return c.join("")},O.esri.Tiles.Base64Utils.wordToBase64=function(a){for(var b="=",c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=[],e=0,f=4*a.length;f>e;e+=3)for(var g=(a[e>>2]>>8*(e%4)&255)<<16|(a[e+1>>2]>>8*((e+1)%4)&255)<<8|a[e+2>>2]>>8*((e+2)%4)&255,h=0;4>h;h++)d.push(8*e+6*h>32*a.length?b:c.charAt(g>>6*(3-h)&63));return d.join("")},/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */

View File

@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
define([

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! offline-editor-js - v2.6.0 - 2015-04-09
/*! offline-editor-js - v2.6.1 - 2015-04-13
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
* Apache License*/
/**

View File

@ -91,6 +91,13 @@ define([
extend: function (layer, callback, dataStore) {
var self = this;
// NOTE: At v2.6.1 we've discovered that not all feature layers support objectIdField.
// However, we want to try to be consistent here with how the library is managing Ids.
// So, we force the layer.objectIdField to DB_UID. This should be consistent with
// how esri.Graphics assign a unique ID to a graphic. If it is not, then this
// library will break and we'll have to re-architect how we manage UIDs.
layer.objectIdField = this.DB_UID;
// Initialize the database as well as set offline data.
this._initializeDB(dataStore,callback);
@ -110,9 +117,9 @@ define([
operations supported offline:
1. add a new attachment to an existing feature (DONE)
2. add a new attachment to a new feature (DONE)
3. remove an attachment that is already in the server... (NOT YET)
3. remove an attachment that is already in the server... (DONE)
4. remove an attachment that is not in the server yet (DONE)
5. update an existing attachment to an existing feature (NOT YET)
5. update an existing attachment to an existing feature (DONE)
6. update a new attachment (NOT YET)
concerns:
@ -286,6 +293,7 @@ define([
var deferred = new Deferred();
var objectId = this._getNextTempId();
addEdit.attributes[this.objectIdField] = objectId;
var thisLayer = this;
@ -404,7 +412,15 @@ define([
*/
layer.convertGraphicLayerToJSON = function (features, updateEndEvent, callback) {
var layerDefinition = {};
// We want to be consistent, but we've discovered that not all feature layers have an objectIdField
if(updateEndEvent.target.hasOwnProperty("objectIdField"))
{
layerDefinition.objectIdFieldName = updateEndEvent.target.objectIdField;
}else {
layerDefinition.objectIdFieldName = this.objectIdField;
}
layerDefinition.globalIdFieldName = updateEndEvent.target.globalIdField;
layerDefinition.geometryType = updateEndEvent.target.geometryType;
layerDefinition.spatialReference = updateEndEvent.target.spatialReference;

View File

@ -1,6 +1,6 @@
{
"name": "offline-editor-js",
"version": "2.6.0",
"version": "2.6.1",
"description": "Lightweight set of libraries for working offline with map tiles and ArcGIS feature services",
"author": "Andy Gup <agup@esri.com> (http://blog.andygup.net)",
"license": "Apache 2",

View File

@ -9,7 +9,7 @@
"appHomePage": "appcache-features.html",
"optimizedApiURL": "../samples/jsolib",
"arcGISBaseURL": "http://js.arcgis.com/3.11",
"version": "2.6.0",
"version": "2.6.1",
"private": true,
"description": "manifest generator project",
"repository": {