Skip to content
Permalink
Browse files

New feature: relations - add new record in case of editor plugin and …

…WFS published related layer
  • Loading branch information
uprel committed Jan 9, 2020
1 parent 15be8e0 commit eef6101b2202f386a78c59a2cc9d0b2066603de6
Showing with 76 additions and 3 deletions.
  1. +23 −0 client/site/css/popup.css
  2. +48 −2 client/site/js/FeatureInfoDisplay.js
  3. +4 −0 client_common/load.php
  4. +1 −1 index.php
@@ -42,6 +42,29 @@
background: url(../gis_icons/mActionClear.png);
}

.i-add {
display: inline-block;
-moz-box-sizing: border-box;
box-sizing: border-box;
height: 16px;
width: 16px;
padding-top: 16px;
overflow: hidden;
background: url(../libs/ext/resources/images/default/dd/drop-add.gif);

}

.i-table {
display: inline-block;
-moz-box-sizing: border-box;
box-sizing: border-box;
height: 16px;
width: 16px;
padding-top: 16px;
overflow: hidden;
background: url(../gis_icons/contextmenu/table.png);
}


/*
a:link, a:visited
@@ -415,14 +415,20 @@ function parseFIResult(node) {
var layerName = Eqwc.common.getIdentifyLayerNameRevert(sourceLayerName);
var layerId = wmsLoader.layerTitleNameMapping[layerName];
var layer = wmsLoader.layerProperties[layerId];
var countRelations = 0;
var layerTitle = layer.title;
if (showFILayerTitle) {
htmlText += "<h2>" + layerTitle + "</h2>";
}

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

while (layerChildNode) {

var fid = layerTitle+"."+layerChildNode.id;
var id = layerChildNode.id;
var fid = layerTitle+"."+id;

if (layerChildNode.hasChildNodes() && layerChildNode.nodeName === "Feature") {
var attributeNode = layerChildNode.firstChild;
@@ -446,6 +452,16 @@ function parseFIResult(node) {
}
htmlText += "<tr><td colspan='2'>" + select + edit + clear + "</td></tr>";
}

if (countRelations == 1) {
var show = '';
var table = projectData.relations[layerName][0].relate_layer;
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>";
}

while (attributeNode) {
if (attributeNode.nodeName == "Attribute") {
var attName = attributeNode.getAttribute("name");
@@ -477,6 +493,16 @@ function parseFIResult(node) {
htmlText += "<td>" + attName + ":</td>";
}

//TODO finish this for layers with more than 1 relation
if(countRelations > 1) {
var search = projectData.relations[layerName].find(function(currentValue, index, arr) {
return currentValue.count_field.toUpperCase() === attNameCase;
});
if(search) {
attValue += ' ' + search.join_field+'='+id;
}
}

if (attNameCase == filesAlias){
if (attValue>'') {
var attArr = Ext.util.JSON.decode(attValue);
@@ -621,7 +647,7 @@ function updateAddress(data, location, field, template, templateMin, factor) {

}

function identifyAction(type,id) {
function identifyAction(type, id, extra) {

var layer = id.split('.')[0];
if (id.split('.')[1] == 'undefined') {
@@ -648,6 +674,26 @@ function identifyAction(type,id) {

break;

case 'addRelation' :

var check = checkEditorState(layerId);
if(check) {
var preparePass = prepareEdit(projectData.layers[layerId]);

var feat = new OpenLayers.Feature.Vector();
feat.state = OpenLayers.State.INSERT;

if (preparePass) {

feat.data[extra] = id.split('.')[1];

editor.editLayer.addFeatures([feat]);
editor.attributesForm.loadRecord(feat);
}
}

break;

case 'select' :

var hasGeom = false;
@@ -27,6 +27,9 @@
if (!property_exists($settings, "wsgi")) {
$settings->wsgi = null;
}
if (!property_exists($settings, "relations")) {
$settings->relations = null;
}
if (!property_exists($settings, "locationServices")) {
$settings->locationServices = null;
}
@@ -80,6 +83,7 @@
projectData.layerSpecifics = eval(<?php echo json_encode($settings->layerSpecifics) ?>);
projectData.geoCode = eval(<?php echo json_encode($settings->geoCode) ?>);
projectData.wsgi = eval(<?php echo json_encode($settings->wsgi) ?>);
projectData.relations = eval(<?php echo json_encode($settings->relations) ?>);
projectData.locationServices = eval(<?php echo json_encode($settings->locationServices) ?>);
projectData.defaultCoordinatesCrsCode = eval(<?php echo json_encode($settings->defaultCoordinatesCrsCode) ?>);
projectData.editor = eval(<?php echo json_encode($settings->editor) ?>);
@@ -245,7 +245,7 @@ function goMobile($lang, $scanner) {
<link rel="stylesheet" type="text/css" href="client/site/libs/ext/ux/css/ux-all.css?v=20180219"/>
<link rel="stylesheet" type="text/css" href="client/site/css/TriStateTreeAndCheckbox.css?v=20191026"/>
<link rel="stylesheet" type="text/css" href="client/site/css/ThemeSwitcherDataView.css"/>
<link rel="stylesheet" type="text/css" href="client/site/css/popup.css?v=20171108"/>
<link rel="stylesheet" type="text/css" href="client/site/css/popup.css?v=20200109"/>
<link rel="stylesheet" type="text/css" href="client/site/css/layerOrderTab.css"/>
<link rel="stylesheet" type="text/css" href="client/site/css/contextMenu.css?v=20191222"/>

0 comments on commit eef6101

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