-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from gobsmack/master
Initial Commit for Export FeatureSet, with new tests and Grunt
- Loading branch information
Showing
5 changed files
with
328 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.sublime-workspace | ||
*.sublime-project | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module.exports = function(grunt){ | ||
|
||
grunt.initConfig({ | ||
|
||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
watch: { | ||
options: { | ||
livereload: true | ||
} | ||
}, | ||
|
||
connect: { | ||
dev: { | ||
options: { | ||
//port: '?', | ||
port: '62332', | ||
base: '', | ||
hostname: '*' | ||
//open: '' | ||
//open: '//localhost:50390/node_modules/intern/client.html', | ||
//open: true | ||
} | ||
} | ||
}, | ||
open: { | ||
dev: { | ||
path: 'http://localhost:62332/tests/Export/index.html' | ||
} | ||
} | ||
}); | ||
|
||
|
||
// load the tasks | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-connect'); | ||
grunt.loadNpmTasks('grunt-open'); | ||
|
||
// define the tasks | ||
grunt.registerTask('dev', ['connect:dev', 'open:dev', 'watch']); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "cmv-widgets", | ||
"version": "v1.0.0", | ||
"author": "Tim McGee", | ||
"license": "", | ||
"year": "2015", | ||
"devDependencies": { | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-connect": "0.4.x", | ||
"grunt-contrib-watch": "0.5.x", | ||
"grunt-open": "^0.2.3" | ||
}, | ||
"dependencies": { | ||
}, | ||
"engine": "node >= 0.10" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | ||
<title></title> | ||
<link rel="stylesheet" type="text/css" href="//js.arcgis.com/3.13compact/esri/css/esri.css"> | ||
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"> | ||
<link rel="stylesheet" type="text/css" href="/cmv/css/theme/dbootstrap/dbootstrap.css"> | ||
<link rel="stylesheet" type="text/css" href="/cmv/css/main.css"> | ||
<body class="dbootstrap"> | ||
<div class="appHeader"> | ||
<div class="headerLogo"> | ||
<img alt="logo" src="./../../cmv/images/rocket-logo.png" height="54" /> | ||
</div> | ||
<div class="headerTitle"> | ||
<span id="headerTitleSpan"></span> | ||
<div id="subHeaderTitleSpan" class="subHeaderTitle"></div> | ||
</div> | ||
<div class="search"> | ||
</div> | ||
<div class="headerLinks"> | ||
<div id="buttonsDiv"></div> | ||
</div> | ||
</div> | ||
<script type="text/javascript"> | ||
var path = location.pathname.replace(/[^\/]+$/, ''); | ||
var dojoConfig = { | ||
async: true, | ||
packages: [{ | ||
name: 'viewer', | ||
location: path + './../../cmv/js/viewer' | ||
},{ | ||
name: 'gis', | ||
location: path + './../../cmv/js/gis' | ||
},{ | ||
name: 'config', | ||
location: path + './../../config' | ||
},{ | ||
name: 'widgets', | ||
location: path + './../../widgets' | ||
}] | ||
}; | ||
</script> | ||
<!--[if lt IE 9]> | ||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/4.0.3/es5-shim.min.js"></script> | ||
<![endif]--> | ||
<script type="text/javascript" src="//js.arcgis.com/3.13compact/"></script> | ||
<script type="text/javascript"> | ||
require(['dojo/on', 'dojo/dom', 'dojo/dom-construct', 'esri/tasks/FeatureSet', 'esri/tasks/query', 'esri/tasks/QueryTask', 'esri/graphic', 'dijit/form/Button', 'dojo/topic', 'viewer/Controller'], function(on, dom, domConstruct, FeatureSet, Query, QueryTask, Graphic, Button, topic, Controller){ | ||
Controller.startup({ | ||
isDebug: true, | ||
|
||
mapOptions: { | ||
basemap: 'topo', | ||
center: [-120.0417, 39.0917], | ||
zoom: 10, | ||
sliderStyle: 'small' | ||
}, | ||
|
||
titles: { | ||
header: 'CMV Export Tests', | ||
subHeader: 'This is an example of the Export Widget', | ||
pageTitle: 'CMV Export Widget' | ||
}, | ||
|
||
panes: { | ||
left: { | ||
collapsible: false, | ||
style: 'display:none' | ||
}, | ||
bottom: { | ||
id: 'sidebarBottom', | ||
placeAt: 'outer', | ||
splitter: true, | ||
collapsible: true, | ||
region: 'bottom', | ||
style: 'height:200px;', | ||
content: '<div id="attributesContainer"></div>' | ||
} | ||
}, | ||
|
||
collapseButtonsPane: 'center', //center or outer | ||
|
||
operationalLayers: [], | ||
|
||
widgets: { | ||
growler: { | ||
include: true, | ||
id: 'growler', | ||
type: 'domNode', | ||
path: 'gis/dijit/Growler', | ||
srcNodeRef: 'growlerDijit', | ||
options: {} | ||
}, | ||
attributesTable: { | ||
include: true, | ||
id: 'attributesContainer', | ||
type: 'domNode', | ||
srcNodeRef: 'attributesContainer', | ||
path: 'widgets/AttributesTable', | ||
options: { | ||
map: true, | ||
mapClickMode: true, | ||
|
||
// use a tab container for multiple tables or | ||
// show only a single table | ||
useTabs: false, | ||
|
||
// used to open the sidebar after a query has completed | ||
sidebarID: 'sidebarBottom', | ||
|
||
tables: [ | ||
{ | ||
title: 'Census', | ||
topicID: 'censusQuery', | ||
queryOptions: { | ||
queryParameters: { | ||
url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/4', | ||
maxAllowableOffset: 100, | ||
where: 'STATE_FIPS = \'06\' OR STATE_FIPS = \'08\'' | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
exportDialog: { | ||
include: true, | ||
id: 'export', | ||
type: 'floating', | ||
path: 'widgets/Export', | ||
title:'Export Widget Test', | ||
options: {} | ||
} | ||
} | ||
}); // end Controller | ||
|
||
var buttonsDiv = dom.byId('buttonsDiv'); | ||
|
||
new Button({ | ||
label: 'Show Parameter Missing', | ||
onClick: function() { | ||
topic.publish('exportWidget/openDialog', { | ||
|
||
}); | ||
} | ||
}, domConstruct.create('div', {}, buttonsDiv)); | ||
|
||
new Button({ | ||
label: 'Show Parameter False', | ||
onClick: function() { | ||
topic.publish('exportWidget/openDialog', { | ||
show: false | ||
}); | ||
} | ||
}, domConstruct.create('div', {}, buttonsDiv)); | ||
|
||
new Button({ | ||
label: 'Pass No Data', | ||
onClick: function() { | ||
topic.publish('exportWidget/openDialog', { | ||
show: true | ||
}); | ||
} | ||
}, domConstruct.create('div', {}, buttonsDiv)); | ||
|
||
new Button({ | ||
label: 'Export QueryTask', | ||
onClick: function() { | ||
|
||
var query = new Query(); | ||
var queryTask = new QueryTask('http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/4'); | ||
query.where = 'STATE_FIPS = \'06\' OR STATE_FIPS = \'08\''; | ||
query.returnGeometry = false; | ||
query.outFields = ["*"]; | ||
query.maxAllowableOffset = 100; | ||
queryTask.execute(query, function(theFeatureSet) { | ||
topic.publish('exportWidget/openDialog', { | ||
show: true, | ||
featureSet: theFeatureSet | ||
}); | ||
}); | ||
} | ||
}, domConstruct.create('div', {}, buttonsDiv)); | ||
|
||
new Button({ | ||
label: 'Export Manual FeatureSet', | ||
onClick: function() { | ||
var attr = { | ||
'col1': 'val1', | ||
'col2': 'val2', | ||
'col3': 'val3' | ||
}; | ||
var graphic = new Graphic(null, null, attr, null); | ||
var features= []; | ||
features.push(graphic); | ||
var featureSet = new FeatureSet(); | ||
featureSet.features = features; | ||
featureSet.fieldAliases = { | ||
'col1': 'Column 1', | ||
'col2': 'Column 2', | ||
'col3': 'Column 3' | ||
}; | ||
topic.publish('exportWidget/openDialog', { | ||
show: true, | ||
featureSet: featureSet | ||
}); | ||
} | ||
}, domConstruct.create('div', {}, buttonsDiv)); | ||
|
||
}); //end require | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters