Skip to content
Permalink
Browse files

Fix for relations, add also to mobile client option to add new record…

… to relate table
  • Loading branch information
uprel committed Jan 11, 2020
1 parent ee7bc70 commit 0f29798df0c190f519d1e8c1b6779239f445e0d4
Showing with 24 additions and 2 deletions.
  1. +8 −2 client/site/js/FeatureInfoDisplay.js
  2. +16 −0 client_mobile/src/gui.js
@@ -455,11 +455,17 @@ function parseFIResult(node) {

if (countRelations == 1) {
var show = '';
var add = '';
var table = projectData.relations[layerName][0].relate_layer;
var tableId = Eqwc.common.getLayerId(table);
var field = projectData.relations[layerName][0].join_field;
var rid = table+"."+id;
var add = '<a class="i-add" href="javascript:;" onclick="identifyAction(\'addRelation\',\'' + rid + '\',\'' + field + '\');"></a>';
htmlText += "<tr><td colspan='2'>" + show + add + "</td></tr>";
if(Eqwc.plugins["editing"] !== undefined && projectData.layers[tableId].wfs) {
add = '<a class="i-add" href="javascript:;" onclick="identifyAction(\'addRelation\',\'' + rid + '\',\'' + field + '\');"></a>';
}
if (show > '' || add > '') {
htmlText += "<tr><td colspan='2'>" + show + add + "</td></tr>";
}
}

while (attributeNode) {
@@ -803,6 +803,7 @@ Gui.showXMLFeatureInfoResults = function (results) {
for (var i = 0; i < results.length; i++) {
var result = results[i];
var layer = Map.layers[result.layer];
var countRelations = 0;

//replace back layer
if (layer == undefined) {
@@ -817,6 +818,10 @@ Gui.showXMLFeatureInfoResults = function (results) {
layerTitle = layer.title;
}

if(projectData.relations[layerTitle]) {
countRelations = projectData.relations[layerTitle].length;
}

html += '<div data-role="collapsible" data-collapsed="false" data-theme="c">';
html += '<h3>' + layerTitle + ' ('+result.features.length+')</h3>';

@@ -844,6 +849,17 @@ Gui.showXMLFeatureInfoResults = function (results) {
html += '<a href="javascript:Eqwc.common.callEditor(\''+layer.id+'\','+feature.id+', \'goto\');" data-theme="e" data-inline="true" data-mini="true" data-role="button">'+I18n.editor.goto+'</a>';
}

if (countRelations == 1) {
var table = projectData.relations[layerTitle][0].relate_layer;
var tableId = Eqwc.common.getLayerId(table);
var field = projectData.relations[layerTitle][0].join_field;

if(typeof(Editor) == 'function' && Config.data.wfslayers[tableId]) {
//feature.id can be string, so need to quote here
html += '<a href="javascript:Eqwc.common.callEditor(\''+tableId+'\',\''+feature.id+'\', \'addRelation\', \''+field+'\');" data-theme="a" data-inline="true" data-mini="true" data-role="button">'+TR.editAdd+'</a>';
}
}

html += '<ul class="ui-listview-inset ui-corner-all" data-role="listview">';

for (var k = 0; k < feature.attributes.length; k++) {

0 comments on commit 0f29798

Please sign in to comment.
You can’t perform that action at this time.