Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed Jun 15, 2016
2 parents 4f7f107 + dccd7fb commit 76587c7
Show file tree
Hide file tree
Showing 45 changed files with 8,734 additions and 8,124 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The GeoForm template can be accessed via the ArcGIS template gallery or item det
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.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 defaults.js file. You can now run the application on your web server or customize the application further.

Expand Down
2 changes: 1 addition & 1 deletion config/templateConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ define({
"latlon"
],
// For esri hosted envoronments only. Will automatically create a sharingurl and proxyurl for the application.
esriEnvironment: true
esriEnvironment: false
});
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" type="text/css" href="js/vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="js/vendor/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" type="text/css" href="//js.arcgis.com/3.16/esri/css/esri.css">
<link rel="stylesheet" type="text/css" href="//js.arcgis.com/3.16/dijit/themes/claro/claro.css">
<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.17/dijit/themes/claro/claro.css">
<link rel="stylesheet" type="text/css" href="js/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link id="rtlCSS" rel="stylesheet" />
Expand Down Expand Up @@ -72,7 +72,7 @@
dojoConfig.locale = RegExp.$1;
}
</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" src="js/vendor/offline/offline.min.js"></script>
<script type="text/javascript" src="js/vendor/IndexedDBShim.min.js"></script>
<script type="text/javascript">
Expand Down
21 changes: 14 additions & 7 deletions js/SearchSources.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/array", "dojo/_base
//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 @@ -27,6 +28,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/array", "dojo/_base
return {
map: this.map,
sources: this._createSources(),
enableSearchingAll: this.enableSearchingAll,
activeSourceIndex: this._getActiveSource()
};
},
Expand Down Expand Up @@ -55,15 +57,20 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/array", "dojo/_base

_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 () {
Expand Down
9 changes: 8 additions & 1 deletion js/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ define([
_loadCSS: function () {
var cssStyle;
cssStyle = dom.byId("rtlCSS");
cssStyle.href = "js/vendor/bootstrap/css/bootstrap.rtl.css";
cssStyle.href = "js/vendor/bootstrap-rtl.min.css";
},

_swapContents: function () {
Expand Down Expand Up @@ -531,6 +531,13 @@ define([

//function to set the title, logo-path and description from config
_populateDetails: function () {
// use app title if current title is not set
if (!this.currentConfig.details.Title) {
if (this.response && this.response.item) {
// use app title
this.config.details.Title = this.response.item.title;
}
}
dom.byId("detailTitleInput").value = this.currentConfig.details.Title;
dom.byId("detailLogoInput").value = this.currentConfig.details.Logo;
dom.byId("detailDescriptionInput").innerHTML = this.currentConfig.details.Description;
Expand Down
109 changes: 67 additions & 42 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ define([
currentLocation: null,
dateFormat: "LLL",

startup: function () {
var config = arguments[0];
var isPreview = arguments[2];
var node = arguments[3];
startup: function (config, appResponse, isPreview, node) {

document.documentElement.lang = kernel.locale;

this._appResponse = appResponse;
var localStorageSupport = new localStorageHelper();
if (localStorageSupport.supportsStorage() && localStorage.getItem("geoform_config")) {
config = JSON.parse(localStorage.getItem("geoform_config"));
Expand Down Expand Up @@ -125,7 +126,7 @@ define([
_loadCSS: function () {
var cssStyle;
cssStyle = dom.byId("rtlCSS");
cssStyle.href = "js/vendor/bootstrap/css/bootstrap.rtl.css";
cssStyle.href = "js/vendor/bootstrap-rtl.min.css";
},

_init: function () {
Expand Down Expand Up @@ -836,13 +837,22 @@ define([
}, inputContent);
domClass.add(inputContent, "form-control");
}
array.forEach(currentField.subTypes, lang.hitch(this, function (currentOption) {
selectOptions = domConstruct.create("option", {}, inputContent);
selectOptions.text = currentOption.name;
selectOptions.value = currentOption.id;
//default values for subtypes(if any) has to be handled here
}));

if(currentField.domain){
array.forEach(currentField.domain.codedValues, lang.hitch(this, function (currentOption) {
selectOptions = domConstruct.create("option", {}, inputContent);
selectOptions.text = currentOption.name;
selectOptions.value = currentOption.code;
//default values for subtypes(if any) has to be handled here
}));
}
else if(currentField.subTypes){
array.forEach(currentField.subTypes, lang.hitch(this, function (currentOption) {
selectOptions = domConstruct.create("option", {}, inputContent);
selectOptions.text = currentOption.name;
selectOptions.value = currentOption.id;
//default values for subtypes(if any) has to be handled here
}));
}
}
on($("#" + fieldname), "change", lang.hitch(this, function (evt) {
//function call to take appropriate actions on selection of a subtypes
Expand Down Expand Up @@ -1790,7 +1800,7 @@ define([
def = new Deferred();
layer = this.map.getLayer(key);
//this block will be called if the layer is already loaded
if (layer.url) {
if (layer && layer.url) {
if (layer.loaded) {
if (layer.isEditable() && layer.geometryType === 'esriGeometryPoint') {
this._pushToLayerDrpDwn(webmapLayers, key, layer);
Expand Down Expand Up @@ -2072,35 +2082,40 @@ define([
theme: "btn btn-default"
}, domConstruct.create('div'));
this.currentLocation.startup();
// on current location submit
on(this.currentLocation, "locate", lang.hitch(this, function (evt) {
// remove error
var errorMessageNode = dom.byId('errorMessageDiv');
domConstruct.empty(errorMessageNode);
// if error
if (evt.error) {
alert(nls.user.locationNotFound);
} else {
this.addressGeometry = evt.graphic.geometry;
this._setSymbol(evt.graphic.geometry);
this._resizeMap();
//If the location is found we will remove the location-error message if it exists
this._removeErrorNode(dom.byId("select_location").nextSibling);
}
// reset button
$('#geolocate_button').button('reset');
}));
// event for clicking node
on(dom.byId('geolocate_button'), a11yclick, lang.hitch(this, function (evt) {
// remove graphic
this._clearSubmissionGraphic();
// set loading button
$('#geolocate_button').button('loading');
// widget locate
this.currentLocation.locate();
evt.stopPropagation();
evt.preventDefault();
}));
if(this.currentLocation.visible){
// on current location submit
on(this.currentLocation, "locate", lang.hitch(this, function (evt) {
// remove error
var errorMessageNode = dom.byId('errorMessageDiv');
domConstruct.empty(errorMessageNode);
// if error
if (evt.error) {
alert(nls.user.locationNotFound);
} else {
this.addressGeometry = evt.graphic.geometry;
this._setSymbol(evt.graphic.geometry);
this._resizeMap();
//If the location is found we will remove the location-error message if it exists
this._removeErrorNode(dom.byId("select_location").nextSibling);
}
// reset button
$('#geolocate_button').button('reset');
}));
// event for clicking node
on(dom.byId('geolocate_button'), a11yclick, lang.hitch(this, function (evt) {
// remove graphic
this._clearSubmissionGraphic();
// set loading button
$('#geolocate_button').button('loading');
// widget locate
this.currentLocation.locate();
evt.stopPropagation();
evt.preventDefault();
}));
}
else{
$('#geolocate_button').addClass('hidden');
}
},

// geocoder with bootstrap
Expand All @@ -2111,6 +2126,8 @@ define([
itemData: this.config.itemInfo.itemData
};
if (this.config.searchConfig) {
searchOptions.enableSearchingAll = this.config.searchConfig.enableSearchingAll;
searchOptions.activeSourceIndex = this.config.searchConfig.activeSourceIndex;
searchOptions.applicationConfiguredSources = this.config.searchConfig.sources || [];
} else {
var configuredSearchLayers = (this.config.searchLayers instanceof Array) ? this.config.searchLayers : JSON.parse(this.config.searchLayers);
Expand Down Expand Up @@ -2146,6 +2163,10 @@ define([
//To populate data for apply edits
featureData = new Graphic();
featureData.attributes = {};
// start with layer defaults
if (this._formLayer.templates[0] && this._formLayer.templates[0].prototype.attributes) {
featureData.attributes = this._formLayer.templates[0].prototype.attributes;
}
//condition to filter out radio inputs
array.forEach(query(".geoFormQuestionare .form-control"), function (currentField) {
key = domAttr.get(currentField, "id");
Expand Down Expand Up @@ -2677,6 +2698,10 @@ define([
}
// if no app title
if (!this.config.details.Title) {
if (this._appResponse && this._appResponse.item) {
// use app title
this.config.details.Title = this._appResponse.item.title;
}
// if item
if (this.config.itemInfo && this.config.itemInfo.item) {
// use webmap title
Expand Down
Loading

0 comments on commit 76587c7

Please sign in to comment.