mirror of
https://github.com/Esri/offline-editor-js.git
synced 2026-02-07 14:26:22 +00:00
commit
5235be0b29
11
.npmignore
Normal file
11
.npmignore
Normal file
@ -0,0 +1,11 @@
|
||||
# Mac
|
||||
.DS_Store
|
||||
Icon
|
||||
._*
|
||||
.Spotlight-V100
|
||||
|
||||
# SublimeText
|
||||
/*.sublime-project
|
||||
*.sublime-workspace
|
||||
*.sublime-project
|
||||
.idea/*
|
||||
19
CHANGELOG.md
19
CHANGELOG.md
@ -1,20 +1,33 @@
|
||||
# offline-editor-js - Changelog
|
||||
|
||||
## Version 2.13.1 - Aug. 12, 2015
|
||||
|
||||
No breaking changes.
|
||||
|
||||
**Enhancements**
|
||||
* Closes #372 - adds an NPM package repository. New name is 'esri-offline-maps.'
|
||||
* Adds build automation, github syncing and npm update via npm scripts.
|
||||
* Added a scripts directory for bash scripts.
|
||||
* Added gh-release as an npm package.
|
||||
* Updated package.json
|
||||
|
||||
## Version 2.13.0 - Aug. 10, 2015
|
||||
|
||||
No breaking changes.
|
||||
|
||||
##Bug Fixes**
|
||||
**Bug Fixes**
|
||||
* Closes #386 - getMinMaxLOD calculation
|
||||
* Closes #390 - In offlineFeatureManager, wait for pushPhantomGraphic callback before setting attributes and styles of phantom graphics.
|
||||
* For token based security, when syncing feature edits, provide direct access to the featureLayer.credentials.token instead of looping thru the kernel object (as introduced in v2.12.0)
|
||||
|
||||
## Version 2.12.1 - Aug. 10, 2015
|
||||
|
||||
##Enhancements**
|
||||
No breaking changes.
|
||||
|
||||
**Enhancements**
|
||||
* Closes #388 - remove infoTemplate object from applyEdits request. Now also removed from adds as well as updates.
|
||||
|
||||
## Version 2.12
|
||||
## Version 2.12 - Aug. 7, 2015
|
||||
|
||||
No breaking changes.
|
||||
|
||||
|
||||
@ -130,6 +130,4 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.registerTask('build',['jshint','concat','uglify']);
|
||||
grunt.registerTask('test',['jshint']);
|
||||
|
||||
//grunt.registerTask('buildAll',['jshint','concat','uglify']);
|
||||
};
|
||||
24
README.md
24
README.md
@ -1,15 +1,15 @@
|
||||
offline-editor-js
|
||||
=================
|
||||
|
||||
Offline-editor-js is an open source family of libraries for building offline capabilities into web mapping applications. It's specifically designed to work with the ArcGIS API for JavaScript and ArcGIS Online. It enables you to store features, attachments, map tiles and TPKs (Tile Packages).
|
||||
Offline-editor-js is a family of libraries for building offline capabilities into web mapping applications. It's specifically designed to work with the ArcGIS API for JavaScript and ArcGIS Online. It enables you to store feature edits, attachments, map tiles and TPKs (Tile Packages).
|
||||
|
||||
Online samples and getting started tutorials are available here: **[http://esri.github.io/offline-editor-js/demo/](http://esri.github.io/offline-editor-js/demo/)**
|
||||
|
||||
*IMPORTANT:* If you need a fully integrated, robust offline solution then you should be using our ArcGIS Runtime SDKs for .NET, WPF, Java, iOS, Android and Qt.
|
||||
*IMPORTANT:* If you need a fully integrated, robust offline solution then you should be using our native ArcGIS Runtime SDKs for .NET, WPF, Java, iOS, Android and Qt.
|
||||
|
||||
This repo contains the following libraries:
|
||||
|
||||
- `/dist`:
|
||||
- `/dist` - contains src and min versions of each library:
|
||||
* `offline-edit-min.js` - stores adds, updates and deletes of features as well as limited attachment support while offline. Resync's edits with server once connection is reestablished.
|
||||
* `offline-tiles-basic-min.js` - caches map tiles for partial offline use cases. Use this library with ArcGIS Online Web maps as well as with tiled map services. This repo will not work with browser restarts or reloads while offline.
|
||||
* `offline-tiles-advanced-min.js` - Extends any ArcGIS Tiled Map Service that has a requirement for offline browser reload and/or restart. This library should be used in conjunction with an HTML5 application cache coding pattern.
|
||||
@ -28,9 +28,9 @@ The following workflow is currently supported for both both features and tiles:
|
||||
|
||||
4) Return online when you want to resync edits.
|
||||
|
||||
This workflow is supported for intermittent (or partial) offline and full offline. There are samples in the `/samples` directory for both use cases. For more information on the differences between check out this [blog post](http://www.andygup.net/going-offline-with-html5-and-javascript-part-1/).
|
||||
This workflow is supported for intermittent offline and full offline. There are samples in the `/samples` directory for both use cases. For more information on the differences between intermittent and full offline check out this [blog post](http://www.andygup.net/going-offline-with-html5-and-javascript-part-1/).
|
||||
|
||||
Full offline requires the use of an [application manifest](https://developer.mozilla.org/en-US/docs/HTML/Using_the_application_cache) to allow for browser reloads and restarts while offline. The application manifest lets you store .html, .js, .css and image files locally.
|
||||
Full offline requires the use of an [application manifest](https://developer.mozilla.org/en-US/docs/HTML/Using_the_application_cache) to allow for browser reloads and restarts while offline. The application manifest lets you store .html, .js, .css and image files locally. There is also a [wiki doc](https://github.com/Esri/offline-editor-js/wiki/Working-with-Application-Cache) to help you learn more about using the cache with this library.
|
||||
|
||||
__Attachment Support__: Attachments are supported with some limitations. See documentation [here](./doc/attachments.md)
|
||||
|
||||
@ -52,24 +52,26 @@ Go __[here](https://github.com/Esri/offline-editor-js/wiki/FAQ)__ for answers to
|
||||
1. [Fork and clone the repo.](https://help.github.com/articles/fork-a-repo)
|
||||
2. After cloning from github, `cd` into the `offline-editor-js` folder
|
||||
3. Run `git submodule init` and `git submodule update`
|
||||
4. Try out the apps in the `/samples` folder.
|
||||
4. Try out the apps in the `/samples` folder. If they run, then everything is set up correctly.
|
||||
|
||||
##Build Instructions
|
||||
|
||||
1. From the root directory run `npm install`
|
||||
2. Run `Grunt build`. If there are no errors, the minimized _(min)_ and source _(src)_ versions of the libraries will be output to `\dist`
|
||||
2. Run `Grunt build`. If there are no errors, the minimized _(min)_ and source _(src)_ versions of the libraries will be output to `/dist`
|
||||
3. For production automation see the npm scripts listed in [package.json](https://github.com/Esri/offline-editor-js/blob/master/package.json).
|
||||
|
||||
##Limitations
|
||||
|
||||
* Currently does not support related tables, domains or subtypes. The ArcGIS Runtime SDKs fully support these.
|
||||
* Currently does not support related tables, domains or subtypes. The ArcGIS Runtime SDKs fully support these and more.
|
||||
* Attachments are supported with some limitations listed [here](./doc/attachments.md).
|
||||
* Browser storage space on mobile devices is a known limitation. This applies to stand-alone web applications and hybrid applications.
|
||||
|
||||
##Dependencies
|
||||
|
||||
* ArcGIS API for JavaScript (v3.8+)
|
||||
* ArcGIS API for JavaScript (v3.12+)
|
||||
* Node.js required for building the source
|
||||
* NOTE: browser limitations and technical dependencies. The offline capabilities in this toolkit depend on certain HTML5 capabilities being present in the browser. Go [here](doc/dependencies.md) for a detailed breakdown of the information.
|
||||
* We offer browser support for the latest versions of Chrome, Firefox and Safari only.
|
||||
* We only offer browser support for the latest versions of Chrome, Firefox and Safari only.
|
||||
|
||||
* Sub-modules (see `/vendor` directory)
|
||||
|
||||
@ -86,7 +88,7 @@ Go __[here](https://github.com/Esri/offline-editor-js/wiki/FAQ)__ for answers to
|
||||
|
||||
## Resources
|
||||
|
||||
* [ArcGIS Developers](http://developers.arcgis.com)
|
||||
* [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/)
|
||||
* [ArcGIS REST Services](http://resources.arcgis.com/en/help/arcgis-rest-api/)
|
||||
* [twitter@esri](http://twitter.com/esri)
|
||||
|
||||
|
||||
2
dist/offline-edit-min.js
vendored
2
dist/offline-edit-min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/offline-edit-src.js
vendored
2
dist/offline-edit-src.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! offline-editor-js - v2.13.0 - 2015-08-10
|
||||
/*! esri-offline-maps - v2.13.1 - 2015-08-12
|
||||
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
|
||||
* Apache License*/
|
||||
/*jshint -W030 */
|
||||
|
||||
2
dist/offline-tiles-advanced-min.js
vendored
2
dist/offline-tiles-advanced-min.js
vendored
File diff suppressed because one or more lines are too long
2852
dist/offline-tiles-advanced-src.js
vendored
2852
dist/offline-tiles-advanced-src.js
vendored
File diff suppressed because one or more lines are too long
2
dist/offline-tiles-basic-min.js
vendored
2
dist/offline-tiles-basic-min.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! offline-editor-js - v2.13.0 - 2015-08-10
|
||||
/*! esri-offline-maps - v2.13.1 - 2015-08-12
|
||||
* 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,f){c._tilesCore=new O.esri.Tiles.TilesCore,c._lastTileUrl="",c._imageType="",c._minZoom=null,c._maxZoom=null,void 0===f||null===f?(c.DB_NAME="offline_tile_store",c.DB_OBJECTSTORE_NAME="tilepath"):(c.DB_NAME=f.dbName,c.DB_OBJECTSTORE_NAME=f.objectStoreName),c._getTileUrl=c.getTileUrl;var g=!0;return"undefined"!=typeof e&&(g=e),c.showBlankTiles=!0,c.offline={online:g,store:new O.esri.Tiles.TilesStore,proxyPath:null},c.offline.store.isSupported()?(c.offline.store.dbName=c.DB_NAME,c.offline.store.objectStoreName=c.DB_OBJECTSTORE_NAME,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,c.showBlankTiles),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()-Math.abs(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++)8*e+6*h>32*a.length?d.push(b):d.push(c.charAt(g>>6*(3-h)&63));return d.join("")},/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||
|
||||
2688
dist/offline-tiles-basic-src.js
vendored
2688
dist/offline-tiles-basic-src.js
vendored
File diff suppressed because one or more lines are too long
2
dist/offline-tpk-min.js
vendored
2
dist/offline-tpk-min.js
vendored
File diff suppressed because one or more lines are too long
8246
dist/offline-tpk-src.js
vendored
8246
dist/offline-tpk-src.js
vendored
File diff suppressed because one or more lines are too long
34
package.json
34
package.json
@ -1,20 +1,44 @@
|
||||
{
|
||||
"name": "offline-editor-js",
|
||||
"version": "2.13.0",
|
||||
"description": "Lightweight set of libraries for working offline with map tiles and ArcGIS feature services",
|
||||
"name": "esri-offline-maps",
|
||||
"version": "2.13.1",
|
||||
"description": "Lightweight set of libraries for working offline with map tiles and editing with ArcGIS feature services",
|
||||
"author": "Andy Gup <agup@esri.com> (http://blog.andygup.net)",
|
||||
"license": "Apache 2",
|
||||
"license": "Apache 2.0",
|
||||
"main": "dist/offline-edit-min.js",
|
||||
"contributors": [
|
||||
"Javier Abadia <javier.abadia@esri.es>"
|
||||
"Javier Abadia",
|
||||
"Rob Speer"
|
||||
],
|
||||
"keywords": [
|
||||
"arcgis",
|
||||
"esri",
|
||||
"offline",
|
||||
"gis",
|
||||
"maps",
|
||||
"mapping"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Esri/offline-editor-js.git"
|
||||
},
|
||||
"readmeFilename": "README.md",
|
||||
"homepage": "http://esri.github.io/offline-editor-js/demo/",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.5",
|
||||
"gh-release": "^2.0.0",
|
||||
"grunt-contrib-compress": "^0.13.0",
|
||||
"grunt-contrib-concat": "^0.5.1",
|
||||
"grunt-contrib-jshint": "^0.11.1",
|
||||
"grunt-contrib-uglify": "^0.9.1",
|
||||
"grunt-contrib-watch": "^0.6.1"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "grunt jshint",
|
||||
"concat": "grunt concat",
|
||||
"uglify": "grunt uglify",
|
||||
"prepush": "./scripts/preprocessor.sh",
|
||||
"push": "./scripts/push.sh",
|
||||
"pull": "./scripts/pull.sh"
|
||||
}
|
||||
}
|
||||
|
||||
19
scripts/preprocessor.sh
Executable file
19
scripts/preprocessor.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# For the log
|
||||
echo "$(date)"
|
||||
echo "$NAME"
|
||||
echo "v$VERSION"
|
||||
echo ""
|
||||
|
||||
# Lint the dist files
|
||||
echo "run lint"
|
||||
npm run lint || exit 1
|
||||
|
||||
# Concat the dist files
|
||||
echo "concat files"
|
||||
npm run concat || exit 1
|
||||
|
||||
# Uglify the dist files
|
||||
echo "uglify dist"
|
||||
npm run uglify || exit 1
|
||||
45
scripts/pull.sh
Executable file
45
scripts/pull.sh
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
##########################################################
|
||||
# ONLY use this script after using the push script.
|
||||
# This script helps sync up your local git with master
|
||||
# and origin.
|
||||
#
|
||||
# To use: npm run pull
|
||||
##########################################################
|
||||
|
||||
# SET VARS
|
||||
VERSION=$(node --eval "console.log(require('./package.json').version);")
|
||||
|
||||
# Sync up local master with origin/master
|
||||
echo "checkout master"
|
||||
git checkout master
|
||||
|
||||
echo "pull upstream master"
|
||||
git pull upstream master
|
||||
|
||||
read -p "Press [Enter] to push origin master..."
|
||||
git push origin master
|
||||
|
||||
# Delete the version branch
|
||||
echo "delete the version branch"
|
||||
git branch -D $VERSION
|
||||
|
||||
# Sync and merge gh-pages
|
||||
echo "checkout gh-pages"
|
||||
git checkout gh-pages
|
||||
|
||||
read -p "Press [Enter] to merge gh-pages with master..."
|
||||
git merge master
|
||||
|
||||
echo "push origin gh-pages"
|
||||
read -p "Press [Enter] to push gh-pages to origin..."
|
||||
git push origin gh-pages
|
||||
|
||||
# publish release on NPM
|
||||
read -p "Press [Enter] to npm publish..."
|
||||
npm publish
|
||||
|
||||
echo "Now create a pull request for gh-pages manually on github."
|
||||
echo "This gives you a final chance to review your changes."
|
||||
echo "Once pull request has been merged, don't forget to run 'git pull upstream gh-pages' and 'git push origin gh-pages'"
|
||||
61
scripts/push.sh
Executable file
61
scripts/push.sh
Executable file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
##########################################################
|
||||
# This script provides final build automation for the repo.
|
||||
# It's responsible for pushing the build. Once your
|
||||
# branch has been merged by master then use the pull script
|
||||
# to finalize syncing up your git and github repos.
|
||||
#
|
||||
# PRE-REQS:
|
||||
# 1. Make sure you have node, npm and grunt installed
|
||||
# 2. Before you can use this repo: npm init
|
||||
#
|
||||
#
|
||||
# INSTRUCTIONS:
|
||||
#
|
||||
# 0. MAKE SURE you look thru the steps here and that everything is in order before you hit the button. The only file
|
||||
# that should be pending for commit is CHANGELOG and/or package.json.
|
||||
# 1. Make sure in package.json to name your releases after the version number, such as v2.0.0, v2.0.1, v2.1.1, etc.
|
||||
# 2. To submit changes to your github branch: npm run push. You can still make changes on this branch if you need to.
|
||||
# 3. After those changes have been merged on esri/master then sync up gh-pages: npm run pull
|
||||
# 4. After those changes have been merged on esri/gh-pages: 'git pull upstream gh-pages' then 'git push origin gh-pages'
|
||||
#
|
||||
##########################################################
|
||||
|
||||
# SET VARS
|
||||
VERSION=$(node --eval "console.log(require('./package.json').version);")
|
||||
NAME=$(node --eval "console.log(require('./package.json').name);")
|
||||
|
||||
# Checkout temp branch for release
|
||||
git checkout v$VERSION
|
||||
|
||||
# Add files, get ready to commit.
|
||||
# CHANGELOG should have pending changes
|
||||
read -p "Press [Enter] to add git files..."
|
||||
git add CHANGELOG.md
|
||||
git add package.json
|
||||
git add dist
|
||||
|
||||
# Create the release zip file
|
||||
echo "creating zip of /dist"
|
||||
zip -r $NAME-v$VERSION.zip dist
|
||||
|
||||
# Run gh-release to create the tag and push release to github
|
||||
read -p "Press [Enter] to push a release file..."
|
||||
gh-release --assets $NAME-v$VERSION.zip
|
||||
|
||||
# Remove the temp zip file
|
||||
rm $NAME-v$VERSION.zip
|
||||
|
||||
# Commit changes + commit message
|
||||
git commit -m "$VERSION"
|
||||
|
||||
# Push to origin
|
||||
read -p "Press [Enter] to push commits to origin..."
|
||||
git push origin v$VERSION
|
||||
|
||||
echo "zip file deleted"
|
||||
echo "push script: done"
|
||||
|
||||
echo "Go to your github branch $VERSION, review changes then create pull request to esri/master"
|
||||
echo "Once the PR is accepted and merged then run the pull script"
|
||||
Loading…
x
Reference in New Issue
Block a user