Skip to content

Commit

Permalink
Use JSONP to access geoportal_ids endpoint. #118
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Glaser committed Aug 21, 2014
1 parent c661b06 commit 4b47cb1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
34 changes: 19 additions & 15 deletions _site_generated/assets/js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -30814,7 +30814,7 @@ angular.module('wcodpApp').factory('solr', ['$http', '$location', function($http
angular.module('wcodpApp').factory('marinePlanner', ['$http', '$timeout', function($http, $timeout) {

var _availableLayers = [],
_availableLayersEndpoint = 'http://wcodp-md.apps.pointnineseven.com/data_manager/geoportal_ids',
_availableLayersEndpoint = 'http://wcodp-md.apps.pointnineseven.com/data_manager/geoportal_ids?callback=JSON_CALLBACK',
_slugPlaceholder = '{layerSlug}',
_layerUrlPattern = 'http://wcodp-md.apps.pointnineseven.com/visualize/#' + _slugPlaceholder;

Expand All @@ -30828,30 +30828,34 @@ angular.module('wcodpApp').factory('marinePlanner', ['$http', '$timeout', functi
callback(_availableLayers);
} else {
// Grab list of visualizable layers from mp.
//$http.get(_availableLayersEndpoint).success(function (data) {
$http.jsonp(_availableLayersEndpoint).success(function (data) {
// 'data' should be a collection of objects, each containing
// an id and a slug.

// Cache result so we don't always have to fetch the list
// from marine planner.
//_availableLayers = data;
_availableLayers = data;

_availableLayers = {
geoportal_layers: [
{
uuid: "174BE5C6-F9E8-4978-9F1B-CF0862920AA8",
name: "American Indian Trust Lands (USCB, 2010)",
slug: "american-indian-trust-lands-uscb-2010"
}
]
};
//
// For testing purposes comment the above line adn replace with this:
//
// _availableLayers = {
// geoportal_layers: [
// {
// uuid: "174BE5C6-F9E8-4978-9F1B-CF0862920AA8",
// name: "American Indian Trust Lands (USCB, 2010)",
// slug: "american-indian-trust-lands-uscb-2010"
// }
// ]
// };
//

// Satisfy the current request.
callback(_availableLayers);

// }).error(function (data) {
// if (console) { console.log('Error getting available layers list from marine planner.'); }
// });
}).error(function (data, status, headers, config) {
if (console) { console.log('Error getting available layers list from marine planner.'); }
});
}
}

Expand Down
34 changes: 19 additions & 15 deletions site_raw/_includes/js/services/MarinePlanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
angular.module('wcodpApp').factory('marinePlanner', ['$http', '$timeout', function($http, $timeout) {

var _availableLayers = [],
_availableLayersEndpoint = 'http://wcodp-md.apps.pointnineseven.com/data_manager/geoportal_ids',
_availableLayersEndpoint = 'http://wcodp-md.apps.pointnineseven.com/data_manager/geoportal_ids?callback=JSON_CALLBACK',
_slugPlaceholder = '{layerSlug}',
_layerUrlPattern = 'http://wcodp-md.apps.pointnineseven.com/visualize/#' + _slugPlaceholder;

Expand All @@ -16,30 +16,34 @@ angular.module('wcodpApp').factory('marinePlanner', ['$http', '$timeout', functi
callback(_availableLayers);
} else {
// Grab list of visualizable layers from mp.
//$http.get(_availableLayersEndpoint).success(function (data) {
$http.jsonp(_availableLayersEndpoint).success(function (data) {
// 'data' should be a collection of objects, each containing
// an id and a slug.

// Cache result so we don't always have to fetch the list
// from marine planner.
//_availableLayers = data;
_availableLayers = data;

_availableLayers = {
geoportal_layers: [
{
uuid: "174BE5C6-F9E8-4978-9F1B-CF0862920AA8",
name: "American Indian Trust Lands (USCB, 2010)",
slug: "american-indian-trust-lands-uscb-2010"
}
]
};
//
// For testing purposes comment the above line adn replace with this:
//
// _availableLayers = {
// geoportal_layers: [
// {
// uuid: "174BE5C6-F9E8-4978-9F1B-CF0862920AA8",
// name: "American Indian Trust Lands (USCB, 2010)",
// slug: "american-indian-trust-lands-uscb-2010"
// }
// ]
// };
//

// Satisfy the current request.
callback(_availableLayers);

// }).error(function (data) {
// if (console) { console.log('Error getting available layers list from marine planner.'); }
// });
}).error(function (data, status, headers, config) {
if (console) { console.log('Error getting available layers list from marine planner.'); }
});
}
}

Expand Down

0 comments on commit 4b47cb1

Please sign in to comment.