Skip to content

Commit

Permalink
3.17 code
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed Jun 15, 2016
1 parent 3293021 commit 203928a
Show file tree
Hide file tree
Showing 37 changed files with 3,791 additions and 3,575 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The PMG template is also easily configurable. A complete list of features and en
3. Change the sharing host, found in options.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: `"sharingurl": location.protocol + "//" + “<your organization name>.maps.arcgis.com`
- Portal Example where `arcgis` is the name of the Web Adaptor: `"sharingurl": 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.16"` 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.17"` 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
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<meta property="og:site_name" content="esri" />
<!-- End Facebook -->
<!-- STYLESHEETS -->
<link rel="stylesheet" href="//js.arcgis.com/3.16/dijit/themes/claro/claro.css">
<link href="//js.arcgis.com/3.16/dojox/form/resources/Rating.css" rel="stylesheet" />
<link rel="stylesheet" href="//js.arcgis.com/3.17/dijit/themes/claro/claro.css">
<link href="//js.arcgis.com/3.17/dojox/form/resources/Rating.css" rel="stylesheet" />
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/960.css" rel="stylesheet" type="text/css" />
<link href="css/common.css" rel="stylesheet" type="text/css" />
Expand Down Expand Up @@ -72,7 +72,7 @@ <h1 id="homeHeading"></h1>
<div id="footer"></div>
<!-- JAVASCRIPT -->
<script type="text/javascript" src="javascript/djConfig.js"></script>
<script type="text/javascript" src="//js.arcgis.com/3.16"></script>
<script type="text/javascript" src="//js.arcgis.com/3.17"></script>
<script type="text/javascript">
require(["application/home"], function (App) {
var myApp = App();
Expand Down
94 changes: 59 additions & 35 deletions javascript/SearchSources.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
define([
"dojo/_base/declare",
"dojo/_base/lang",
"dojo/_base/array",
"dojo/dom-construct",
"esri/lang",
"esri/tasks/locator",
"esri/layers/FeatureLayer",
"esri/dijit/Search"
], function (
declare, lang, array,
domConstruct,
esriLang,
Locator, FeatureLayer,
Search
) {
define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/array", "dojo/_base/json", "dojo/dom-construct", "esri/lang", "esri/tasks/locator", "esri/layers/FeatureLayer", "esri/dijit/Search"], function (
declare, lang, array, dojoJson, domConstruct, esriLang, Locator, FeatureLayer, Search) {
return declare(null, {

constructor: function (parameters) {
Expand All @@ -26,6 +12,7 @@ define([
//When true we restrict world locator to the map extent
geocoders: [],
esriSource: null,
enableSearchingAll: true,
//Geocoders defined in helper services
itemData: null,
//web map item info includes operational layers and info about searches configured on web map
Expand All @@ -41,6 +28,7 @@ define([
return {
map: this.map,
sources: this._createSources(),
enableSearchingAll: this.enableSearchingAll,
activeSourceIndex: this._getActiveSource()
};
},
Expand All @@ -49,33 +37,42 @@ define([

//optional array of additional search layers to configure from the application config process
_createSources: function () {
//Create services from org helper services
//Create locators defined in web map item
//Create configured services.
this._createHelperServiceSources();
if (this.itemData) {
this._createWebMapItemSources();
}
if (this.configuredSearchLayers.length > 0) {
this._createConfiguredSources();
if (this.applicationConfiguredSources) {
this._createAppConfigSources();
} else {
//Create services from org helper services
//Create locators defined in web map item
//Create configured services.
this._createHelperServiceSources();
if (this.itemData) {
this._createWebMapItemSources();
}
if (this.configuredSearchLayers.length > 0) {
this._createConfiguredSources();
}
}

return this.sources;
},

_getActiveSource: function () {
var activeIndex = 0;
if (this.sources && this.sources.length > 1) {
activeIndex = "all";
if (this.hasOwnProperty("activeSourceIndex")) {
activeIndex = this.activeSourceIndex;
}
array.some(this.sources, function (s, index) {
if (!s.hasEsri && s.featureLayer) {
activeIndex = index;
return true;
else{
if (this.sources && this.enableSearchingAll && this.sources.length > 1) {
activeIndex = "all";
}
});
array.some(this.sources, function (s, index) {
if (!s.hasEsri && s.featureLayer) {
activeIndex = index;
return true;
}
});
}
return activeIndex;
},

_createHelperServiceSources: function () {
var geocoders = lang.clone(this.geocoders);
array.forEach(geocoders, lang.hitch(this, function (geocoder) {
Expand Down Expand Up @@ -130,10 +127,12 @@ define([
}
//Get existing layer or create new one
var mapLayer = this.map.getLayer(layer.id);
if (mapLayer && mapLayer.type === "FeatureLayer") {
if (mapLayer && (mapLayer.type === "Feature Layer" || mapLayer.type === "FeatureLayer")) {
source.featureLayer = mapLayer;
} else {
source.featureLayer = new FeatureLayer(url);
source.featureLayer = new FeatureLayer(url, {
outFields: ["*"]
});
}
source.name = name;
source.exactMatch = searchLayer.field.exactMatch;
Expand All @@ -146,8 +145,33 @@ define([
}));
}
},
_createAppConfigSources: function () {
// Configured via the new Search Configuation widget
var configSource = lang.clone(this.applicationConfiguredSources);
array.forEach(configSource, lang.hitch(this, function (source) {
if (source.locator) {
source.locator = new Locator(source.url);
} else { //feature layer
var featureLayer = null;
if (source.flayerId) {
featureLayer = this.map.getLayer(source.flayerId);
}
if (!featureLayer && source.url) {
featureLayer = new FeatureLayer(source.url, {
outFields: ["*"]
});
}
source.featureLayer = featureLayer;
}
if (source.searchWithinMap) {
source.searchExtent = this.map.extent;
}
this.sources.push(source);
}));

},
_createConfiguredSources: function () {
// Old configuration using layer/field picker
array.forEach(this.configuredSearchLayers, lang.hitch(this, function (layer) {
var mapLayer = this.map.getLayer(layer.id);
if (mapLayer) {
Expand Down
6 changes: 5 additions & 1 deletion javascript/common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
define([
"dojo/_base/declare",
"dojo/_base/kernel",
"dojo/_base/lang",
"dojo/_base/array",
"dojo/Deferred",
Expand All @@ -24,7 +25,7 @@ define([
"dojo/on",
"esri/IdentityManager"
],
function (declare, lang, array, Deferred, dom, query, i18n, ioScript, domStyle, domGeom, number, esriRequest, config, arcgisUtils, GeometryService, urlUtils, esriPortal, commonConfig, Dialog, domAttr, domClass, domConstruct, on, IdentityManager) {
function (declare, kernel, lang, array, Deferred, dom, query, i18n, ioScript, domStyle, domGeom, number, esriRequest, config, arcgisUtils, GeometryService, urlUtils, esriPortal, commonConfig, Dialog, domAttr, domClass, domConstruct, on, IdentityManager) {
return declare(null, {
orgRequest: function () {
var deferred = new Deferred();
Expand Down Expand Up @@ -200,6 +201,9 @@ define([
// Set default options for the template
/*------------------------------------*/
setDefaultOptions: function () {

document.documentElement.lang = kernel.locale;

// set user agent
this.setUserAgent();
// set up params
Expand Down
8 changes: 4 additions & 4 deletions map.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<meta property="og:site_name" content="esri" />
<!-- End Facebook -->
<!-- STYLESHEETS -->
<link rel="stylesheet" href="//js.arcgis.com/3.16/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="//js.arcgis.com/3.16/esri/css/esri.css">
<link href="//js.arcgis.com/3.16/dojox/form/resources/Rating.css" rel="stylesheet" />
<link rel="stylesheet" href="//js.arcgis.com/3.17/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="//js.arcgis.com/3.17/esri/css/esri.css">
<link href="//js.arcgis.com/3.17/dojox/form/resources/Rating.css" rel="stylesheet" />
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/960.css" rel="stylesheet" type="text/css" />
<link href="css/common.css" rel="stylesheet" type="text/css" />
Expand Down Expand Up @@ -101,7 +101,7 @@ <h2 id="legendHeader"></h2>
<div id="footer"></div>
<!-- JAVASCRIPT -->
<script type="text/javascript" src="javascript/djConfig.js"></script>
<script type="text/javascript" src="//js.arcgis.com/3.16"></script>
<script type="text/javascript" src="//js.arcgis.com/3.17"></script>
<script type="text/javascript">
require(["application/map"], function (App) {
App();
Expand Down
Loading

0 comments on commit 203928a

Please sign in to comment.