Skip to content

Commit

Permalink
3.18 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed Sep 14, 2016
1 parent 4a8e3fb commit ff1cc0b
Show file tree
Hide file tree
Showing 42 changed files with 402 additions and 182 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The template can be configured using the following options:
3. Change the sharing host, found in defaults.js inside the config folder for the application, to the sharing URL for ArcGIS Online or Portal. For ArcGIS Online users, keep the default value of www.arcgis.com or specify the name of your organization.
- ArcGIS Online Example: `"sharinghost": location.protocol + "//" + “<your organization name>.maps.arcgis.com`
- Portal Example where `arcgis` is the name of the Web Adaptor: `"sharinghost": location.protocol + "//" + "webadaptor.domain.com/arcgis"`
4. If you are using Portal or a local install of the ArcGIS API for JavaScript, change all references to the ArcGIS API for JavaScript in index.html to refer to your local copy of the API. Search for the references containing `"//js.arcgis.com/3.17"` and replace this portion of the reference with the url to your local install.
4. If you are using Portal or a local install of the ArcGIS API for JavaScript, change all references to the ArcGIS API for JavaScript in index.html to refer to your local copy of the API. Search for the references containing `"//js.arcgis.com/3.18"` and replace this portion of the reference with the url to your local install.
- For example: `"//webadaptor.domain.com/arcgis/jsapi/jsapi"` where `arcgis` is the name of your Web Adaptor.
5. Copy a map or group ID from Portal/ArcGIS Online and replace the default web map ID in the application’s index.html page. You can now run the application on your web server or customize the application further.

Expand Down
4 changes: 2 additions & 2 deletions config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ define({
"hideNotesLayerPopups": true,
"enableInstagram": true,
"instagramVisible": false,
"instagramTime": "",
"enableFlickr": true,
"flickrVisible": false,
"flickrSearch": "",
Expand All @@ -71,7 +70,8 @@ define({
"twitterSigninUrl": location.protocol + "//utility.arcgis.com/tproxy/signin",
"flickr_key": "404ebea7d5bc27aa5251d1207620e99b",
"webcams_key": "65939add1ebe8bc9cc4180763f5df2ca",
"instagram_key": "288c36a1a42c49de9a2480a05d054619",
"instagramClientId": "47ce2d7ea1494adb98708f4b47319227",
"instagramSigninUrl": "https://www.instagram.com/oauth/authorize",
"youtube_key": "AIzaSyBvrlsx50mxX_W-Ra2cJ8PB0jKt0jACZfg",
/*
"bannedUsersService": location.protocol + "//services.arcgis.com/QJfoC7c7Z2icolha/ArcGIS/rest/services/fai/FeatureServer/2",
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta property="og:site_name" content="esri" />
<!-- End Facebook -->
<!--Use protocol relative urls that way if the browser is viewing the page via HTTPS the js/css file will be requested using the HTTPS protocol-->
<link rel="stylesheet" type="text/css" href="//js.arcgis.com/3.17/esri/css/esri.css" />
<link rel="stylesheet" type="text/css" href="//js.arcgis.com/3.18/esri/css/esri.css" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Lato:300,400,700" />
<!--Load any application specific styles-->
<link rel="stylesheet" type="text/css" href="css/dijit.css" />
Expand Down Expand Up @@ -115,7 +115,7 @@
dojoConfig.locale = RegExp.$1;
}
</script>
<script type="text/javascript" src="//js.arcgis.com/3.17"></script>
<script type="text/javascript" src="//js.arcgis.com/3.18"></script>
<script type="text/javascript">
require([
"config/templateConfig",
Expand Down
45 changes: 45 additions & 0 deletions instagram-callback.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OAuth Popup Callback</title>
<style type="text/css">
html,
body {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
font-family: Lucida Sans, Lucida Grande, Arial !important;
font-size: 14px;
}

</style>
<script type="text/javascript" src="//js.arcgis.com/3.17"></script>
<script type="text/javascript">
require([
"esri/urlUtils",
"dojo/domReady!"
], function (urlUtils) {
var url = document.location.href;
var urlObject = urlUtils.urlToObject(url);
urlObject.query = urlObject.query || {};
var redirect = urlObject.query.redirect;
if (redirect) {
location.href = redirect + location.hash;
}
else {
window.opener.instagramCallback(location.hash);
window.close();
}
});

</script>
</head>

<body>
<!--OAuth Popup Callback-->
</body>

</html>
45 changes: 24 additions & 21 deletions js/InstagramLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function (
filterWords: [],
autopage: true,
visible: true,
maxpage: 3,
maxpage: 10,
limit: 100,
title: 'Instagram',
id: 'instagram',
Expand All @@ -47,9 +47,9 @@ function (
maxScale: null,
symbol: null,
infoTemplate: null,
time: 5, // from the past days: 1, 2, 3, 4, 5, 6, 7
key: '',
key: "",
refreshTime: 4000,
token: "",
url : 'https://api.instagram.com/v1/media/search/'
},
constructor: function (options) {
Expand All @@ -74,7 +74,6 @@ function (
this.set("minScale", defaults.minScale);
this.set("maxScale", defaults.maxScale);
this.set("refreshTime", defaults.refreshTime);
this.set("time", defaults.time);
this.set("graphics", []);
this.set("noGeo", []);
// listeners
Expand Down Expand Up @@ -269,24 +268,14 @@ function (
distance : radius
};
},
_getTimestamp: function(){
var days = parseInt(this.get("time"), 10) || 5;
var d = new Date();
d.setDate(d.getDate() - days);
return Math.round(d.getTime() / 1000);
},
_constructQuery: function () {
var unix_timestamp = this._getTimestamp();
var radius = this._getRadius();
this.query = {
client_id: this.key,
count: this.limit,
lat: radius.lat,
lng: radius.lng,
min_timestamp: unix_timestamp,
max_timestamp: Math.round(new Date().getTime() / 1000),
distance: radius.distance,
page: 1,
lat: radius.lat,
lng: radius.lng,
distance: radius.distance,
access_token: this.token,
format: "json"
};
// make the actual API call
Expand All @@ -304,12 +293,18 @@ function (
preventCache: true,
load: lang.hitch(this, function (data) {
if (data.meta && data.meta.code === 200) {
if(!this.get("authorized")){
this.set("authorized", true);
this.emit("authorize", {
authorized: true
});
}
if (data.data.length > 0) {
this._mapResults(data);
// display results for multiple pages
if ((this.autopage) && (this.maxpage > this.pageCount) && (data.data.length === this.limit) && (this.query)) {
if ((this.autopage) && (!this.maxpage || this.maxpage > this.pageCount) && data.pagination && data.pagination.next_max_id) {
this.pageCount++;
this.query.page++;
this.query.max_id = data.pagination.next_max_id;
this._sendRequest(this.url, this.query);
} else {
this._updateEnd();
Expand All @@ -320,6 +315,12 @@ function (
}
} else {
if(data.meta){
if(data.meta.code === 400){
this.set("authorized", false);
this.emit("authorize", {
authorized: false
});
}
console.log('Instagram::' + data.meta.code + ' - ' + this.title + ': ' + data.meta.error_message);
}
// No results found, try another search term
Expand Down Expand Up @@ -377,7 +378,9 @@ function (
result.height = result.images.thumbnail.height;
result.username = result.user.username;
result.full_name = result.user.full_name;
result.location_name = result.location.name;
if(result.location){
result.location_name = result.location.name;
}
// eliminate geo photos which we already have on the map
if (this._dataIds[result.id]) {
return;
Expand Down
Loading

0 comments on commit ff1cc0b

Please sign in to comment.