Skip to content

Commit

Permalink
add nls support to find and identify widgets
Browse files Browse the repository at this point in the history
and drop meetupHometowns layer reference, it isn't being used anymore
  • Loading branch information
iled committed Jul 14, 2016
1 parent 89b3801 commit 8c3b11a
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 168 deletions.
215 changes: 110 additions & 105 deletions viewer/js/config/find.js
Original file line number Diff line number Diff line change
@@ -1,112 +1,117 @@
/*eslint no-console: 0, no-alert: 0*/
define({
map: true,
zoomExtentFactor: 2,
queries: [
{
description: 'Find A Public Safety Location By Name',
url: 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
layerIds: [1, 2, 3, 4, 5, 6, 7],
searchFields: ['FDNAME, PDNAME', 'NAME', 'RESNAME'],
minChars: 2,
gridColumns: [
{
field: 'Name',
label: 'Name'
},
{
field: 'layerName',
label: 'Layer',
width: 100,
sortable: false,
resizable: false
}
],
sort: [
{
attribute: 'Name',
descending: false
}
],
prompt: 'fdname, pdname, name or resname',
selectionMode: 'single'
},
{
description: 'Find Incident By Code/Description',
url: 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
layerIds: [15, 17, 18],
searchFields: ['FCODE', 'DESCRIPTION'],
minChars: 4,
gridColumns: [
{
field: 'layerName',
label: 'Layer',
width: 100,
sortable: false,
resizable: false
},
{
field: 'Fcode',
label: 'Fcode',
width: 100
},
{
field: 'Description',
label: 'Descr'
},
{
field: 'SORT_VALUE',
visible: false,
get: function (findResult) {
return findResult.layerName + ' ' + findResult.feature.attributes.Fcode; //seems better to use attributes[ 'Fcode' ] but fails build. Attribute names will be aliases and may contain spaces and mixed cases.
define([
'dojo/i18n!./nls/main'
], function (i18n) {

return {
map: true,
zoomExtentFactor: 2,
queries: [
{
description: i18n.find.louisvillePubSafety,
url: 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
layerIds: [1, 2, 3, 4, 5, 6, 7],
searchFields: ['FDNAME, PDNAME', 'NAME', 'RESNAME'],
minChars: 2,
gridColumns: [
{
field: 'Name',
label: 'Name'
},
{
field: 'layerName',
label: 'Layer',
width: 100,
sortable: false,
resizable: false
}
}
],
sort: [
{
attribute: 'SORT_VALUE',
descending: false
}
],
prompt: 'fdname, pdname, name or resname',
customGridEventHandlers: [
{
event: '.dgrid-row:click',
handler: function (event) {
alert('You clicked a row!');
console.log(event);
],
sort: [
{
attribute: 'Name',
descending: false
}
],
prompt: 'fdname, pdname, name or resname',
selectionMode: 'single'
},
{
description: i18n.find.sf311Incidents,
url: 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
layerIds: [15, 17, 18],
searchFields: ['FCODE', 'DESCRIPTION'],
minChars: 4,
gridColumns: [
{
field: 'layerName',
label: 'Layer',
width: 100,
sortable: false,
resizable: false
},
{
field: 'Fcode',
label: 'Fcode',
width: 100
},
{
field: 'Description',
label: 'Descr'
},
{
field: 'SORT_VALUE',
visible: false,
get: function (findResult) {
return findResult.layerName + ' ' + findResult.feature.attributes.Fcode; //seems better to use attributes[ 'Fcode' ] but fails build. Attribute names will be aliases and may contain spaces and mixed cases.
}
}
],
sort: [
{
attribute: 'SORT_VALUE',
descending: false
}
],
prompt: 'fdname, pdname, name or resname',
customGridEventHandlers: [
{
event: '.dgrid-row:click',
handler: function (event) {
alert('You clicked a row!');
console.log(event);
}
}
]
}
],
selectionSymbols: {
polygon: {
type: 'esriSFS',
style: 'esriSFSSolid',
color: [255, 0, 0, 62],
outline: {
type: 'esriSLS',
style: 'esriSLSSolid',
color: [255, 0, 0, 255],
width: 3
}
},
point: {
type: 'esriSMS',
style: 'esriSMSCircle',
size: 25,
color: [255, 0, 0, 62],
angle: 0,
xoffset: 0,
yoffset: 0,
outline: {
type: 'esriSLS',
style: 'esriSLSSolid',
color: [255, 0, 0, 255],
width: 2
}
]
}
],
selectionSymbols: {
polygon: {
type: 'esriSFS',
style: 'esriSFSSolid',
color: [255, 0, 0, 62],
outline: {
type: 'esriSLS',
style: 'esriSLSSolid',
color: [255, 0, 0, 255],
width: 3
}
},
point: {
type: 'esriSMS',
style: 'esriSMSCircle',
size: 25,
color: [255, 0, 0, 62],
angle: 0,
xoffset: 0,
yoffset: 0,
outline: {
type: 'esriSLS',
style: 'esriSLSSolid',
color: [255, 0, 0, 255],
width: 2
}
}
},
selectionMode: 'extended'
selectionMode: 'extended'
}
});
119 changes: 58 additions & 61 deletions viewer/js/config/identify.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,64 @@
define({
map: true,
mapClickMode: true,
mapRightClickMenu: true,
identifyLayerInfos: true,
identifyTolerance: 5,
define([
'dojo/i18n!./nls/main'
], function (i18n) {

// config object definition:
// {<layer id>:{
// <sub layer number>:{
// <pop-up definition, see link below>
// }
// },
// <layer id>:{
// <sub layer number>:{
// <pop-up definition, see link below>
// }
// }
// }
return {
map: true,
mapClickMode: true,
mapRightClickMenu: true,
identifyLayerInfos: true,
identifyTolerance: 5,
draggable: false,

// for details on pop-up definition see: https://developers.arcgis.com/javascript/jshelp/intro_popuptemplate.html
// config object definition:
// {<layer id>:{
// <sub layer number>:{
// <pop-up definition, see link below>
// }
// },
// <layer id>:{
// <sub layer number>:{
// <pop-up definition, see link below>
// }
// }
// }

identifies: {
meetupHometowns: {
0: {
title: 'Hometowns',
fieldInfos: [{
fieldName: 'Location',
visible: true
}]
}
},
louisvillePubSafety: {
2: {
title: 'Police Station',
fieldInfos: [{
fieldName: 'Name',
visible: true
}, {
fieldName: 'Address',
visible: true
}, {
fieldName: 'Type',
visible: true
}, {
fieldName: 'Police Function',
visible: true
}, {
fieldName: 'Last Update Date',
visible: true
}]
},
8: {
title: 'Traffic Camera',
description: '{Description} lasted updated: {Last Update Date}',
mediaInfos: [{
title: '',
caption: '',
type: 'image',
value: {
sourceURL: '{Location URL}',
linkURL: '{Location URL}'
}
}]
// for details on pop-up definition see: https://developers.arcgis.com/javascript/jshelp/intro_popuptemplate.html

identifies: {
louisvillePubSafety: {
2: {
title: i18n.identify.louisvillePubSafety.policeStation,
fieldInfos: [{
fieldName: 'Name',
visible: true
}, {
fieldName: 'Address',
visible: true
}, {
fieldName: 'Type',
visible: true
}, {
fieldName: 'Police Function',
visible: true
}, {
fieldName: 'Last Update Date',
visible: true
}]
},
8: {
title: i18n.identify.louisvillePubSafety.trafficCamera,
description: '{Description} lasted updated: {Last Update Date}',
mediaInfos: [{
title: '',
caption: '',
type: 'image',
value: {
sourceURL: '{Location URL}',
linkURL: '{Location URL}'
}
}]
}
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion viewer/js/config/nls/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,22 @@ define({
bookmarks: {
usa: 'USA'
},
find: {
louisvillePubSafety: 'Find A Public Safety Location By Name',
sf311Incidents: 'Find Incident By Code/Description'
},
identify: {
louisvillePubSafety: {
policeStation: 'Police Station',
trafficCamera: 'Traffic Camera'
}
},
viewer: {
operationalLayers: {
damageAssessment: 'Damage Assessment',
louisvillePubSafety: 'Louisville Public Safety',
restaurants: 'Restaurants',
sf311Incidents: 'San Francisco 311 Incidents',
sf311Incidents: 'San Francisco 311 Incidents'
},
titles: {
header: 'Configurable Map Viewer',
Expand Down
12 changes: 11 additions & 1 deletion viewer/js/config/nls/pt-pt/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ define({
bookmarks: {
usa: 'EUA'
},
find: {
louisvillePubSafety: 'Encontrar um local de Segurança Pública pelo nome',
sf311Incidents: 'Encontrar incidente por código/descrição'
},
identify: {
louisvillePubSafety: {
policeStation: 'Esquadra da Polícia',
trafficCamera: 'Câmara de trânsito'
}
},
viewer: {
operationalLayers: {
damageAssessment: 'Avaliação de dano',
louisvillePubSafety: 'Segurança Pública de Louisville',
restaurants: 'Restaurantes',
sf311Incidents: 'Incidentes do 311 de São Francisco',
sf311Incidents: 'Incidentes do 311 de São Francisco'
},
titles: {
header: 'Configurable Map Viewer',
Expand Down

0 comments on commit 8c3b11a

Please sign in to comment.