Skip to content

Commit

Permalink
Intergrate post-delivery modifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabanc committed Nov 26, 2018
1 parent 4063109 commit ebf6616
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 78 deletions.
Binary file modified images/icons_black/print.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/icons_white/print.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 45 additions & 59 deletions js/FeatureList/FeatureList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "es
"dijit/_WidgetBase", "dijit/_TemplatedMixin", "dojo/on",
"dojo/Deferred", "dojo/promise/all", "dojo/query",
"esri/tasks/query", "esri/tasks/QueryTask",
"dojox/layout/ContentPane",
"dojo/text!application/FeatureList/Templates/FeatureList.html",
"dojo/dom", "dojo/dom-class", "dojo/dom-attr", "dojo/dom-style", "dojo/dom-construct", "dojo/_base/event",
"dojo/string",
Expand All @@ -20,7 +19,6 @@ define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "es
_WidgetBase, _TemplatedMixin, on,
Deferred, all, query,
Query, QueryTask,
ContentPane,
FeatureList,
dom, domClass, domAttr, domStyle, domConstruct, event,
string,
Expand Down Expand Up @@ -177,69 +175,54 @@ define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "es
r = results[i];

if(r) {
var content = '<table tabindex=0 class="FeatureTableAttributes">';

var fieldsMap = layer.infoTemplate._fieldsMap;
for(var p in fieldsMap) {
if(fieldsMap.hasOwnProperty(p) && fieldsMap[p].visible)
{
var pField = fieldsMap[p];
var fieldName = '${'+pField.fieldName+'}';
var fieldValue = fieldName;
if(pField.format)
{
if(pField.format.dateFormat) {
fieldValue='FORMAT_DATE('+fieldName+',"'+pField.format.dateFormat+'")';
}
else if(pField.format.time) {
fieldValue='FORMAT_TIME('+fieldName+',"'+pField.format.time+'")';
}
else if(pField.format.hasOwnProperty("digitSeparator")) {
fieldValue='FORMAT_NUM('+fieldName+',"'+pField.format.places+'|'+pField.format.digitSeparator+'")';
}
else {
fieldValue=fieldName;
}
}

// content+='<tr class="featureItem_${_layerId}_${_featureId} hideAttr" tabindex="0" aria-label="'+pField.label+', '+fieldValue+',"">\n';
content+='<tr class="featureItem_${_layerId}_${_featureId} hideAttr">\n';
// content+=' <td valign="top"></td>\n';
content+=' <th valign="top" align="right">'+pField.label+'</th>\n';
// content+=' <td valign="top">:</td>\n';
content+=' <td valign="top">'+fieldValue+'</td>\n';
content+='</tr>\n';
}
}
content += '</table>';
for(var j = 0; j<r.features.length; j++) {
var f = r.features[j];
if(window._prevSelected && window._prevSelected.split('_')[1] == f.attributes[r.objectIdFieldName]) {
preselected = f;
}

var featureListItem = this._getFeatureListItem(i, f, r.objectIdFieldName, layer, listTemplate);
var featureListItem = this._getFeatureListItem(i, f, r.objectIdFieldName, layer, content, listTemplate);
if(featureListItem)
{
var li = domConstruct.create("li", {
domConstruct.create("li", {
// tabindex : 0,
innerHTML : featureListItem
}, list);
var liTdContent =li.querySelector('.featureContent_'+i+'_'+f.attributes[layer.objectIdField]);

var contentPane = new ContentPane({ }, liTdContent);
contentPane.startup();

var myContent = layer.infoTemplate.getContent(f);

contentPane.set("content", myContent).then(lang.hitch(this, function() {
var mainView = liTdContent.querySelector('.esriViewPopup');
if(mainView) {
domAttr.set(mainView, 'tabindex',0);

var mainSection = mainView.querySelector('.mainSection');
if(mainSection) {
domConstruct.destroy(mainSection.querySelector('.header'));
}

var attrTables = query('.attrTable', mainSection);
if(attrTables && attrTables.length > 0) {
for(var i = 0; i<attrTables.length; i++) {
var attrTable = attrTables[i];
// domAttr.set(attrTable, 'role', 'presentation');
var attrNames = query('td.attrName', attrTable);
if(attrNames && attrNames.length > 0) {
for(var j = 0; j<attrNames.length; j++) {
attrNames[j].outerHTML = attrNames[j].outerHTML.replace(/^<td/, '<th').replace(/td>$/, 'th>');
}
}
}
}

var images = query('.esriViewPopup img', myContent.domNode);
if(images) {
images.forEach(function(img) {
var alt = domAttr.get(img, 'alt');
if(!alt) {
domAttr.set(img,'alt','');
} else {
domAttr.set(img,'tabindex',0);
if(!domAttr.get(img, 'title'))
{
domAttr.set(img,'title', alt);
}
}
});
}
}
}));

// console.log(liTdContent);
}
}
}
Expand Down Expand Up @@ -437,16 +420,17 @@ define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "es

on(this.map, "extent-change", lang.hitch(this, this._reloadList), this);

_getFeatureListItem = function(r, f, objectIdFieldName, layer, listTemplate) {

_getFeatureListItem = function(r, f, objectIdFieldName, layer, content, listTemplate) {
try {
var featureId = f.attributes[objectIdFieldName];
var popupValues = layer.infoTemplate._getPopupValues(f);
var description = layer.infoTemplate._getPopupValues(f).description;
if(description && description != "")
content = description;
var attributes = {
_featureId:featureId,
_layerId:r,
_title:layer.infoTemplate.title(f),
// _content:popupValues.hasDescription ? popupValues.description : content,
_content:content,
_panTo: i18n.widgets.featureList.panTo,
_zoomTo: i18n.widgets.featureList.zoomTo,
hint:Ri18n.skip.featureDetaills,
Expand Down Expand Up @@ -474,7 +458,7 @@ define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "es
}

matches.push(m);
}
};

matches.forEach(function(g) {
// console.log('g', g[0], g[1]);
Expand All @@ -487,7 +471,9 @@ define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "es

return(template);
};
content = _substitute(content, attributes);

// content = string.substitute(content, attributes);
listTemplate=_substitute(listTemplate, attributes);
var result = _substitute(listTemplate, attributes);
var re = /((>)((?:http:\/\/www\.|https:\/\/www\.|ftp:\/\/www.|www\.)[a-z0-9]+(?:[\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(?:\/.*)?)(?:<))|(FORMAT_(DATE|TIME|NUM)\((-?\d*\.?\d*),\"(.+)\"\))/gm;
Expand Down
6 changes: 0 additions & 6 deletions js/FeatureList/Templates/FeatureList.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
.FeatureTableAttributes td {
font-weight: bold;
}

.featureContent {
margin-left: -8px;
margin-right: -4px;
}

/*.featureItem tr .filterBtn {
width:18px;
height:18px;
Expand Down
5 changes: 4 additions & 1 deletion js/FeatureList/Templates/FeatureListTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
</tr>
<tr class="featureItem_${_layerId}_${_featureId} hideAttr">
<td></td>
<td class="featureContent featureContent_${_layerId}_${_featureId}">
<td>
<!-- <table tabindex=0 class="FeatureTableAttributes"> -->
${_content}
<!-- </table> -->
</td>
</tr>
</table>
Expand Down
19 changes: 7 additions & 12 deletions js/PopupInfo/PopupInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,18 +398,13 @@ define(["dojo/Evented", "dojo/_base/declare", "dojo/_base/lang", "dojo/has", "es
// domAttr.set(header[0], 'tabindex', 0);
// }

var attrTables = query('.attrTable', mainSection[0]);
if(attrTables && attrTables.length > 0) {
// domAttr.set(attrTables[0], 'role', 'presentation');
for(var i = 0; i<attrTables.length; i++) {
var attrTable = attrTables[i];
var attrNames = query('td.attrName', attrTable);
if(attrNames && attrNames.length > 0) {
for(var j = 0; j<attrNames.length; j++) {
attrNames[j].outerHTML = attrNames[j].outerHTML.replace(/^<td/, '<th').replace(/td>$/, 'th>');
}
}
}
var attrTable = query('.attrTable', mainSection[0]);
if(attrTable && attrTable.length > 0) {
domAttr.set(attrTable[0], 'role', 'presentation');
// var rows = query('tr', attrTable[0]);
// if(rows) {
// rows.forEach(function(row) {domAttr.set(row, 'tabindex', 0);});
// }
}
// else {
// var description = query('[dojoattachpoint=_description]', mainSection[0]);
Expand Down

0 comments on commit ebf6616

Please sign in to comment.