Skip to content

Commit

Permalink
Updated grunt tasks, readme, proxys, and tagged commit as v1.2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSpriggs committed Aug 21, 2014
1 parent a8f6521 commit 3248169
Show file tree
Hide file tree
Showing 13 changed files with 907 additions and 226 deletions.
11 changes: 3 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ module.exports = function(grunt) {
pkg: grunt.file.readJSON('package.json'),
tag: {
banner: '/* <%= pkg.name %>\n' +
' * @version <%= pkg.version %>\n' +
' * @author <%= pkg.author %>\n' +
' * version <%= pkg.version %>\n' +
' * Project: <%= pkg.homepage %>\n' +
' * Copyright <%= pkg.year %>. <%= pkg.license %> licensed.\n' +
' */\n'
},
copy: {
Expand All @@ -19,7 +17,7 @@ module.exports = function(grunt) {
},
clean: {
build: {
src: ['dist/viewer']
src: ['dist']
}
},
autoprefixer: {
Expand Down Expand Up @@ -58,10 +56,7 @@ module.exports = function(grunt) {
}],
options: {
banner: '<%= tag.banner %>',
sourceMap: true,
sourceMapName: function(filePath) {
return filePath + '.map';
}
sourceMap: true
}
}
},
Expand Down
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

This JS web app can be easily configured or used as a boilerplate/starting point for basic viewers. It also demonstrates best practices for modular design and OOP via classes in JS using dojo's great [declare](http://dojotoolkit.org/reference-guide/1.9/dojo/_base/declare.html) system.

![screen shot 2014-08-20 at 9 59 48 pm](https://cloud.githubusercontent.com/assets/661156/3991302/5aa2e0f2-28df-11e4-94d0-9c813937d933.png)

## Demo Site
[http://davidspriggs.github.io/ConfigurableViewerJSAPI/viewer](http://davidspriggs.github.io/ConfigurableViewerJSAPI/viewer)

Note: Not all functions work in the demo site due to a limitation in GitHub project hosting (no functioning proxy page).

## Installation:
* Download the latest release [here](https://github.com/DavidSpriggs/ConfigurableViewerJSAPI/releases).
Expand All @@ -18,10 +18,10 @@ Note: Not all functions work in the demo site due to a limitation in GitHub proj
* Enjoy!

## Customize:
* Use the ConfigurableViewerJSAPI\js\config\viewer.js file to customize your own map layers, task urls and widgets.
* Use the [wiki](https://github.com/DavidSpriggs/ConfigurableViewerJSAPI/wiki) documentation for guidance on configuring widgets.
* Use the `ConfigurableViewerJSAPI\js\config\viewer.js` file to customize your own map layers, task urls and widgets.
* Use the [wiki](https://github.com/DavidSpriggs/ConfigurableViewerJSAPI/wiki) documentation for guidance on configuring individual widgets.

## Widgets Included:
# Widgets Included:
* Base Maps
* Bookmarks
* Directions
Expand All @@ -30,49 +30,53 @@ Note: Not all functions work in the demo site due to a limitation in GitHub proj
* Find
* Geocoder
* Growler
* Help Button
* Help
* Home
* Identify (for dynamic layers)
* Identify
* Legend
* Locate Button (Geolocation)
* Measure
* Overview Map
* Print (Advanced)
* Print
* Scalebar
* StreetView
* Table of contents
* If there is a feature you would like to request, add it to the projects [trello board](https://trello.com/b/TjjipGmV/configurable-map-viewer) for consideration.
* Find
* Map Right click menu with various widget functions.
* Highly configurable UI, right or left sidebars with widgets in both, top and bottom regions for other content.

## Proposing Features
If there is a feature you would like to request, add it to the [issues list](https://github.com/DavidSpriggs/ConfigurableViewerJSAPI/issues) for consideration.

## Change log:
See [releases](https://github.com/DavidSpriggs/ConfigurableViewerJSAPI/releases) for change logs.

## IRC
# Community
We have an IRC channel: `#cmv` on freenode for the project. If you have questions, stop on by. I recommend [HexChat](http://hexchat.github.io) as an IRC client or you can use freenode's [webchat](http://webchat.freenode.net) client.

## Contributing to the project
### Contributing to the project
There are many ways to contribute:

1. Contribute code as widgets (see below).
2. Created documentation in [the wiki](https://github.com/DavidSpriggs/ConfigurableViewerJSAPI/wiki).
3. Submit issues you find the the [issue log](https://github.com/DavidSpriggs/ConfigurableViewerJSAPI/issues?state=open).
4. Vote, comment on, and submit ideas for things to build and improvements to the viewer in the [trello board](https://trello.com/b/TjjipGmV/configurable-map-viewer).
3. Submit issues you find in the [issues log](https://github.com/DavidSpriggs/ConfigurableViewerJSAPI/issues?state=open).

### Grunt tasks
This project uses grunt to automate tasks like minifying css and js as well as js linting and css prefixing.

### To get started setup you dev machine:
- Install [node](http://nodejs.org).
- Install the grunt cli (command line interface) globally from the command line with : `npm install -g grunt-cli` this only needs to be done once per dev machine.
- Install jshint globally from the command line with : `npm install -g jshint` this only needs to be done once per dev machine.
- Install the grunt cli (command line interface) globally from the command line with : `npm install -g grunt-cli`, this only needs to be done once per dev machine.
- Install jshint globally from the command line with : `npm install -g jshint`, this only needs to be done once per dev machine.

### Get the code and install dev dependencies:
- Fork the repo into your own github account.
- Clone your fork and in the repos directory:
- Install the local dev dependencies for the project in the repo from the command line: `npm install` This only needs to be done once per dev machine.
- Run grunt from the repo with: `grunt` this will lint your js as you code.
- Clone your fork and in cloned directory:
- Install the local dev dependencies for the project in the repo from the command line: `npm install`, this only needs to be done once per dev machine.
- Run grunt from the repo with: `grunt` this will launch a mini dev server and lint your js as you code.
- Run grunt from the repo with: `grunt build` this will create a `dist` folder with minified code ready for deployment.
- There are other grunt tasks use: `grunt -h` to see a list
- There are other grunt tasks, use: `grunt -h` to see a list.

## License
# License

MIT
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ConfigurableViewerJSAPI",
"version": "v1.0.1",
"name": "ConfigurableMapViewerCMV",
"version": "1.2.0",
"author": "David Spriggs",
"license": "MIT",
"year": "2014",
Expand Down
Binary file added resource-proxy.zip
Binary file not shown.
96 changes: 96 additions & 0 deletions viewer/proxy/PROXY_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
DotNet Proxy File
=================

A .NET proxy that handles support for
* Accessing cross domain resources
* Requests that exceed 2048 characters
* Accessing resources secured with token based authentication.
* [OAuth 2.0 app logins](https://developers.arcgis.com/en/authentication).
* Enabling logging
* Both resource and referer based rate limiting

##Instructions

* Download and unzip the .zip file or clone the repository. You can download [a released version](https://github.com/Esri/resource-proxy/releases) (recommended) or the [most recent daily build](https://github.com/Esri/resource-proxy/archive/master.zip).
* Install the contents of the DotNet folder as a .NET Web Application, specifying a .NET 4.0 application pool or later
* Test that the proxy is able to forward requests directly in the browser using:
```
http://[yourmachine]/DotNet/proxy.ashx?http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson
```
* Edit the proxy.config file in a text editor to set up your proxy configuration settings.
* Update your application to use the proxy for the specified services. In this JavaScript example requests to route.arcgis.com will utilize the proxy.

```
urlUtils.addProxyRule({
urlPrefix: "route.arcgis.com",
proxyUrl: "http://[yourmachine]/proxy/proxy.ashx"
});
```
* Security tip: By default, the proxy.config allows any referrer. To lock this down, replace the ```*``` in the ```allowedReferers``` property with your own application URLs.

##Proxy Configuration Settings

* Use the ProxyConfig tag to specify the following proxy level settings.
* **mustMatch="true"** : When true only the sites listed using serverUrl will be proxied. Set to false to proxy any site, which can be useful in testing. However, we recommend setting it to "true" for production sites.
* **allowedReferers="http://server.com/app1,http://server.com/app2"** : A comma-separated list of referer URLs. Only requests coming from referers in the list will be proxied.
* Add a new \<serverUrl\> entry for each service that will use the proxy. The proxy.config allows you to use the serverUrl tag to specify one or more ArcGIS Server services that the proxy will forward requests to. The serverUrl tag has the following attributes:
* **url**: Location of the ArcGIS Server service (or other URL) to proxy. Specify either the specific URL or the root (in which case you should set matchAll="false").
* **matchAll="true"**: When true all requests that begin with the specified URL are forwarded. Otherwise, the URL requested must match exactly.
* **username**: Username to use when requesting a token - if needed for ArcGIS Server token based authentication.
* **password**: Password to use when requesting a token - if needed for ArcGIS Server token based authentication.
* **clientId**. Used with clientSecret for OAuth authentication to obtain a token - if needed for OAuth 2.0 authentication. **NOTE**: If used to access hosted services, the service(s) must be owned by the user accessing it, (with the exception of credit-based esri services, e.g. routing, geoenrichment, etc.)
* **clientSecret**: Used with clientId for OAuth authentication to obtain a token - if needed for OAuth 2.0 authentication.
* **oauth2Endpoint**: When using OAuth 2.0 authentication specify the portal specific OAuth 2.0 authentication endpoint. The default value is https://www.arcgis.com/sharing/oauth2/.
* **accessToken**: OAuth2 access token to use instead of on-demand access-token generation using clientId & clientSecret.
* **rateLimit**: The maximum number of requests with a particular referer over the specified **rateLimitPeriod**.
* **rateLimitPeriod**: The time period (in minutes) within which the specified number of requests (rate_limit) sent with a particular referer will be tracked. The default value is 60 (one hour).

Note: Refresh the proxy application after updates to the proxy.config have been made.

Example of proxy using application credentials and limiting requests to 10/minute
```
<serverUrl url="http://route.arcgis.com"
clientId="6Xo1d-example-9Kn2"
clientSecret="5a5d50-example-c867b6efcf969bdcc6a2"
rateLimit="600"
rateLimitPeriod="60"
matchAll="true">
</serverUrl>
```
Example of a tag for a resource which does not require authentication
```
<serverUrl url="http://sampleserver6.arcgisonline.com/arcgis/rest/services"
matchAll="true">
</serverUrl>
```
Note: You may have to refresh the proxy application after updates to the proxy.config have been made.

##Folders and Files

The proxy consists of the following files:
* proxy.config: This file contains the configuration settings for the proxy. This is where you will define all the resources that will use the proxy. After updating this file you might need to refresh the proxy application using IIS tools in order for the changes to take effect.
* **Important note:** In order to keep your credentials safe, ensure that your web server will not display the text inside your proxy.config in the browser (ie: http://[yourmachine]/proxy/proxy.config).
* proxy.ashx: The actual proxy application. In most cases you will not need to modify this file.
* web.config: An XML file that stores ASP.NET configuration data. Use this file to configure logging for the proxy. By default the proxy will write log messages to a file named auth_proxy.log located in 'C:\Temp\Shared\proxy_logs'. Note that the folder location needs to exist in order for the log file to be successfully created.
##Requirements

* ASP.NET 4.0 or greater (4.5 is required on Windows 8/Server 2012, see [this article] (http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45) for more information)

##Issues

Found a bug or want to request a new feature? Let us know by submitting an issue.

##Contributing

All contributions are welcome.

##Licensing

Copyright 2014 Esri

Licensed under the Apache License, Version 2.0 (the "License");
You may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for specific language governing permissions and limitations under the license.
18 changes: 18 additions & 0 deletions viewer/proxy/Web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0"/>
</system.web>
<system.diagnostics>
<switches>
<add name="TraceLevelSwitch" value="Info" />
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="agsProxyLogListener" type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\Temp\Shared\proxy_logs\auth_proxy.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
Loading

0 comments on commit 3248169

Please sign in to comment.