[Mapbender-commits] r2241 - branches/2.5/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Mar 13 11:07:32 EDT 2008
Author: verenadiewald
Date: 2008-03-13 11:07:32 -0400 (Thu, 13 Mar 2008)
New Revision: 2241
Modified:
branches/2.5/http/javascripts/mod_wfs_gazetteer_client.php
Log:
merged files
Modified: branches/2.5/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- branches/2.5/http/javascripts/mod_wfs_gazetteer_client.php 2008-03-13 14:26:04 UTC (rev 2240)
+++ branches/2.5/http/javascripts/mod_wfs_gazetteer_client.php 2008-03-13 15:07:32 UTC (rev 2241)
@@ -38,14 +38,7 @@
<?php
include '../include/dyn_js.php';
include '../include/dyn_php.php';
- $fname = dirname(__FILE__) . "/../../conf/" . $wfs_spatial_request_conf_filename;
- if (file_exists($fname)) {
- include($fname);
- }
- else {
- $e = new mb_exception("mod_wfs_gazetteer_client.php: Configuration file " . $wfs_spatial_request_conf_filename . " not found.");
- }
-
+
echo "var targetString = '" . $target . "';";
echo "var wfsConfIdString = '" . $wfsConfIdString . "';";
echo "var e_id_css = '" . $e_id_css . "';";
@@ -65,8 +58,6 @@
maxHighlightedPoints = 0;
// var e = new parent.Mb_warning("mod_wfs_gazetteer_client.php: Element var maxHighlightedPoints is not set, see 'edit element vars'.");
}
-// Element var showResultInPopup
-try {if(showResultInPopup){}}catch(e) {showResultInPopup = 1;}
var targetArray = targetString.split(",");
var global_wfsConfObj;
@@ -74,174 +65,14 @@
var point_px = 10;
var resultGeom = null;
var cw_fillcolor = "#cc33cc";
-var frameName = e_id_css;
-//start button management spatialRequest ////////
-var button_point = "point";
-var button_polygon = "polygon";
-var button_rectangle = "rectangle";
-var button_extent = "extent";
-var mb_wfs_tolerance = 8;
-var activeButton = null;
-var mod_wfs_spatialRequest_geometry = null;
-var mod_wfs_spatialRequest_frameName = "";
-var mod_wfs_spatialRequest_epsg;
-var mod_wfs_spatialRequest_width;
-var mod_wfs_spatialRequest_height;
-
-var spatialRequestGeom = null;
-var spatialRequestType = null;
-
-var geomArray;
-
-var buttonWfs_id = [];
-var buttonWfs_on = [];
-var buttonWfs_src = [];
-var buttonWfs_title_off = [];
-var buttonWfs_title_on = [];
-var buttonWfs_x = [];
-var buttonWfs_y = [];
-
-function addButtonWfs(id, isOn, src, title, x, y) {
- buttonWfs_id.push(id);
- buttonWfs_on.push(isOn);
- buttonWfs_src.push(src);
- buttonWfs_title_off.push(title);
- buttonWfs_title_on.push(title);
- buttonWfs_x.push(x);
- buttonWfs_y.push(y);
-}
-// end of button management spatialRequest ///////////
-
parent.mb_registerInitFunctions("window.frames['"+this.name+"'].initModWfsGazetteer()");
-parent.mb_registerInitFunctions("window.frames['"+this.name+"'].init_wfsSpatialRequest()");
-function init_wfsSpatialRequest() {
- //parent.mb_ajax_json("../php/mod_wfsSpatialRequest_messages.php", function(obj, status) {
- // msgObj = obj;
- buttonWfs_id = [];
- buttonWfs_on = [];
- buttonWfs_src = [];
- buttonWfs_title_off = [];
- buttonWfs_title_on = [];
- buttonWfs_x = [];
- buttonWfs_y = [];
- addButtonWfs("rectangle", buttonRectangle.status, buttonRectangle.img, buttonRectangle.title, buttonRectangle.x, buttonRectangle.y);
- addButtonWfs("polygon", buttonPolygon.status, buttonPolygon.img, buttonPolygon.title, buttonPolygon.x, buttonPolygon.y);
- addButtonWfs("point", buttonPoint.status, buttonPoint.img, buttonPoint.title, buttonPoint.x, buttonPoint.y);
- addButtonWfs("extent", buttonExtent.status, buttonExtent.img, buttonExtent.title, buttonExtent.x, buttonExtent.y);
- displayButtons();
- //});
+function openwindow(Adresse) {
+ Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+ Fenster1.focus();
}
-
-function wfsInitFunction (j) {
- var functionCall = "parent.mb_regButton_frame('initWfsButton', '"+frameName+"', "+j+")";
- var x = new Function ("", functionCall);
- x();
-}
-
-function initWfsButton(ind, pos) {
- parent.mb_button[ind] = document.getElementById(buttonWfs_id[pos]);
- parent.mb_button[ind].img_over = buttonWfs_imgdir + buttonWfs_src[pos].replace(/_off/,"_over");
- parent.mb_button[ind].img_on = buttonWfs_imgdir + buttonWfs_src[pos].replace(/_off/,"_on");
- parent.mb_button[ind].img_off = buttonWfs_imgdir + buttonWfs_src[pos];
- parent.mb_button[ind].img_out = buttonWfs_imgdir + buttonWfs_src[pos];
- parent.mb_button[ind].status = 0;
- parent.mb_button[ind].elName = buttonWfs_id[pos];
- parent.mb_button[ind].frameName = frameName;
- parent.mb_button[ind].go = new Function ("wfsEnable(parent.mb_button["+ind+"], " + pos + ")");
- parent.mb_button[ind].stop = new Function ("wfsDisable(parent.mb_button["+ind+"], " + pos + ")");
- var ind = parent.getMapObjIndexByName("mapframe1");
- mod_wfs_spatialRequest_width = parent.mb_mapObj[ind].width;
- mod_wfs_spatialRequest_height = parent.mb_mapObj[ind].height;
- mod_wfs_spatialRequest_epsg = parent.mb_mapObj[ind].epsg;
- parent.mb_registerPanSubElement("measuring");
-}
-
-function displayButtons() {
- for (var i = 0 ; i < buttonWfs_id.length ; i ++) {
- if (parseInt(buttonWfs_on[i])==1) {
- var currentImg = document.createElement("img");
- currentImg.id = buttonWfs_id[i];
- currentImg.name = buttonWfs_id[i];
- currentImg.title = buttonWfs_title_off[i];
- currentImg.src = buttonWfs_imgdir+buttonWfs_src[i];
- currentImg.style.marginRight = "5px;";
- currentImg.onmouseover = new Function("wfsInitFunction("+i+")");
-
- document.getElementById("displaySpatialButtons").appendChild(currentImg);
- }
- }
-}
-
-function disableButtons() {
- removeChildNodes(document.getElementById("displaySpatialButtons"));
-}
-
-function wfsEnable(obj) {
- var el = parent.window.frames["mapframe1"].document;
- el.onmouseover = null;
- el.onmousedown = null;
- el.onmouseup = null;
- el.onmousemove = null;
-
- if (obj.id == button_point) {
- if (activeButton == null) {
- activeButton = obj;
- }
- }
- if (obj.id == button_polygon) {
- if (activeButton == null) {
- activeButton = obj;
- }
- }
- else if (obj.id == button_rectangle){
- if (activeButton == null) {
- activeButton = obj;
- }
- }
- else if (obj.id == button_extent){
- if (activeButton == null) {
- activeButton = obj;
- }
- }
- callRequestGeometryConstructor(obj.id,"mapframe1");
-}
-
-function callRequestGeometryConstructor(selectedType,target){
- if(document.getElementById("res")){
- document.getElementById("res").innerHTML ="";
- spatialRequestGeom = null;
- }
- spatialRequestType = selectedType;
- var geometryConstructor = new parent.RequestGeometryConstructor(target);
- geometryConstructor.getGeometry(selectedType,function(target,queryGeom){
- if(queryGeom !=''){
- var spatialRes = document.createElement("div");
- spatialRes.id = "spatialResHint";
- spatialRes.name = "spatialResHint";
- document.getElementById("res").appendChild(spatialRes);
- document.getElementById("spatialResHint").innerHTML = spatialRequestIsSetMessage;
- spatialRequestGeom = queryGeom;
- }
- });
-}
-
-function wfsDisable(obj) {
- var el = parent.window.frames["mapframe1"].document;
- el.onmousedown = null;
- el.ondblclick = null;
- el.onmousemove = null;
- parent.writeTag("mapframe1","measure_display","");
- parent.writeTag("mapframe1","measure_sub","");
- activeButton = null;
-}
-
-function openwindow(url) {
- window1 = window.open(url, "Information", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
- window1.focus();
-}
//----------------------------------------------------------------------------------
function appendWfsConf(newWfsConfIdString) {
@@ -315,9 +146,7 @@
}
document.getElementById("wfsGeomType").style.visibility = "hidden";
document.getElementById("wfsRemove").style.visibility = "hidden";
-
- geomArray = new parent.GeometryArray();
-
+
parent.mb_ajax_json("../php/mod_wfs_gazetteer_server.php", {command:"getWfsConf",wfsConfIdString:wfsConfIdString}, function(json, status) {
global_wfsConfObj = json;
var wfsCount = 0;
@@ -350,8 +179,7 @@
removeChildNodes(bulbNode);
var imgNode = document.createElement("img");
imgNode.id = "wfsInfoImg";
- //imgNode.src = "../img/button_digitize/geomInfo.png";
- imgNode.src = "../img/tree_new/info.png";
+ imgNode.src = "../img/button_digitize/geomInfo.png";
imgNode.border = 0;
bulbNode.appendChild(imgNode);
bulbNode.href = "javascript:openwindow('../php/mod_featuretypeMetadata.php?wfs_conf_id=" + global_selectedWfsConfId.toString() + "');";
@@ -366,25 +194,24 @@
}
}
if (wfsGeomType.match(/Point/)) {
- wfsGeomTypeNode.src = "../img/button_digitize/point.png";
+ wfsGeomTypeNode.src = "../img/button_digitize/point_off.png";
wfsGeomTypeNode.style.visibility = 'visible';
}
else if (wfsGeomType.match(/Line/)) {
- wfsGeomTypeNode.src = "../img/button_digitize/line.png";
+ wfsGeomTypeNode.src = "../img/button_digitize/line_off.png";
wfsGeomTypeNode.style.visibility = 'visible';
}
else if (wfsGeomType.match(/Polygon/)) {
- wfsGeomTypeNode.src = "../img/button_digitize/polygon.png";
+ wfsGeomTypeNode.src = "../img/button_digitize/polygon_off.png";
wfsGeomTypeNode.style.visibility = 'visible';
}
else {
- var e = new parent.Mb_exception("WFS gazetteer: geometry type unknown.");
+ var e = new parent.Mb_exception("WFS gazetteer: geometry type unknown.");
}
// set image: remove this WFS
var wfsRemoveNode = document.getElementById("wfsRemove");
- //wfsRemoveNode.src = "../img/button_digitize/geomRemove.png";
- wfsRemoveNode.src = "../img/tree_new/delete_wms.png";
+ wfsRemoveNode.src = "../img/button_digitize/geomRemove.png";
wfsRemoveNode.style.visibility = 'visible';
// Internet explorer
if (parent.ie) {
@@ -401,7 +228,7 @@
initModWfsGazetteer();
parent.mb_setWmcExtensionData({"wfsConfIdString":wfsConfIdString});
}
- }
+ }
}
function setWfsConfIdString() {
@@ -419,23 +246,12 @@
var selectNode = document.createElement("select");
selectNode.name = "wfs_conf_sel";
var wfsFormNode = document.getElementById("selectWfsConfForm");
- if (parent.ie) {
- selectNode.onchange = function() {
+ selectNode.onchange = function() {
global_selectedWfsConfId = this.value;
- if(typeof(resultGeometryPopup)!="undefined"){
- resultGeometryPopup.hide();
- }
- if(typeof(wfsPopup)!="undefined"){
- wfsPopup.hide();
- }
- setWfsInfo();
+ setWfsInfo();
appendStyles();
appendWfsForm();
- };
- }
- else{
- selectNode.setAttribute("onchange", "if(typeof(resultGeometryPopup)!='undefined'){resultGeometryPopup.hide();}if(typeof(wfsPopup)!='undefined'){wfsPopup.hide();};global_selectedWfsConfId = this.value;setWfsInfo();appendStyles();appendWfsForm();");
- }
+ };
var isSelected = false;
for (var wfsConfId in global_wfsConfObj) {
var optionNode = document.createElement("option");
@@ -479,253 +295,56 @@
spanNode.setAttribute("id", "ttttt");
spanNode.className = wfsConfElementArray[i].f_label_id;
spanNode.innerHTML = wfsConfElementArray[i].f_label;
- if(wfsConfElementArray[i].f_form_element_html.match(/\<select/)){
- var inputNode = document.createElement("span");
- inputNode.id = wfsConfElementArray[i].element_name+"Select";
- inputNode.innerHTML = wfsConfElementArray[i].f_form_element_html;
- }
- else{
- var inputNode = document.createElement("input");
- inputNode.type = "text";
- inputNode.className = wfsConfElementArray[i].f_style_id;
- inputNode.id = wfsConfElementArray[i].element_name;
- }
+ var inputNode = document.createElement("input");
+ inputNode.type = "text";
+ inputNode.className = wfsConfElementArray[i].f_style_id;
+ inputNode.id = wfsConfElementArray[i].element_name;
+
form.appendChild(spanNode);
form.appendChild(inputNode);
-
- //build imgNode for datepicker image
- if(wfsConfElementArray[i].f_form_element_html.match(/datepicker/)){
- var imgNode = document.createElement("span");
- imgNode.id = wfsConfElementArray[i].element_name+"Img";
- imgNode.innerHTML = wfsConfElementArray[i].f_form_element_html;
- form.appendChild(imgNode);
- }
form.appendChild(document.createElement("br"));
}
}
var submitButton = document.createElement("input");
submitButton.type = "submit";
- submitButton.id = "submitButton";
submitButton.className = global_wfsConfObj[global_selectedWfsConfId].g_button_id;
submitButton.value = global_wfsConfObj[global_selectedWfsConfId].g_button;
form.appendChild(submitButton);
-
- var delFilterButton = document.createElement("input");
- delFilterButton.type = "button";
- delFilterButton.style.marginLeft = "5px;";
- delFilterButton.className = global_wfsConfObj[global_selectedWfsConfId].g_button_id;
- delFilterButton.value = clearFilterButtonLabel;
- // Internet explorer
- if (parent.ie) {
- delFilterButton.onclick = function() {
- var x = new Function ("", "clearFilter();");
- x();
- };
- }
- // Firefox
- else {
- delFilterButton.onclick = function () {
- clearFilter();
- }
- }
- form.appendChild(delFilterButton);
-
- checkSrs();
}
-function checkSrs(){
- //check SRS
- var ind = parent.getMapObjIndexByName("mapframe1");
- var submit = document.getElementById("submitButton");
- if(global_wfsConfObj[global_selectedWfsConfId].featuretype_srs.toUpperCase()!=parent.mb_mapObj[ind].getSRS().toUpperCase()){
- var msg = "Different EPSG of map and wfs featuretype, no spatial request possible!\n";
- msg += parent.mb_mapObj[ind].getSRS()+" und "+global_wfsConfObj[global_selectedWfsConfId].featuretype_srs;
- alert(msg);
-
- //disable Submit Button
- if(submit)submit.disabled = true;
- }
- else{
- //disable Submit Button
- if(submit)submit.disabled = false;
- }
-}
-
-function clearFilter(){
- var wfsConfElementArray = global_wfsConfObj[global_selectedWfsConfId].element;
- for (var i = 0; i < wfsConfElementArray.length; i++){
- if (parseInt(wfsConfElementArray[i].f_search)) {
- document.getElementById(wfsConfElementArray[i].element_name).value = "";
- }
- }
- if(typeof(resultGeometryPopup)!="undefined"){
- resultGeometryPopup.hide();
- }
- if(typeof(wfsPopup)!="undefined"){
- wfsPopup.hide();
- }
- document.getElementById('res').value = "";
-}
-
-function getNumberOfFilterParameters(){
- var cnt = 0;
- var el = global_wfsConfObj[global_selectedWfsConfId].element;
-
- for (var i = 0; i < el.length; i++){
-
- if( el[i]['f_search'] == 1){
- if(el[i]['f_form_element_html'].match(/\<select/)){
- var elementValue = document.getElementById(el[i]['element_name']).options[document.getElementById(el[i]['element_name']).selectedIndex].value;
- }
- else{
- var elementValue = document.getElementById(el[i]['element_name']).value;
- }
-
- if (elementValue != '') {
- cnt++;
- }
- }
- }
- return cnt;
-}
-
function validate(){
- if(geomArray.count()>0){
- geomArray.empty();
- }
global_resultHighlight = new parent.Highlight(targetArray, "wfs_gazetteer_highlight", {"position":"absolute", "top":"0px", "left":"0px", "z-index":100}, 2);
var filterParameterCount = getNumberOfFilterParameters();
- if(filterParameterCount == 0 && spatialRequestGeom == null){
+ if(filterParameterCount == 0){
return false;
}
else{
var andConditions = "";
var el = global_wfsConfObj[global_selectedWfsConfId].element;
- var srs = global_wfsConfObj[global_selectedWfsConfId].featuretype_srs;
-
+
for (var i = 0; i < el.length; i++) {
- if (el[i]['f_search'] == 1){
- if(el[i]['f_form_element_html'].match(/\<select/)){
- var elementValue = document.getElementById(el[i]['element_name']).options[document.getElementById(el[i]['element_name']).selectedIndex].value;
- }
- else{
- var elementValue = document.getElementById(el[i]['element_name']).value;
- }
- }
-
- if (el[i]['f_search'] == 1 && elementValue != '') {
+ if (el[i]['f_search'] == 1 && document.getElementById(el[i]['element_name']).value != '') {
+
var a = new Array();
- a = elementValue.split(",");
+ a = document.getElementById(el[i]['element_name']).value.split(",");
var orConditions = "";
for (var j=0; j < a.length; j++) {
- if(el[i]['f_operator']=='bothside'){
- orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
- orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
- orConditions += "<ogc:Literal>*";
- if(el[i]['f_toupper'] == 1){
- orConditions += a[j].toUpperCase();
- }
- else{
- orConditions += a[j];
- }
- orConditions += "*</ogc:Literal>";
- orConditions += "</ogc:PropertyIsLike>";
- }
- else if(el[i]['f_operator']=='rightside'){
- orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
- orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
- orConditions += "<ogc:Literal>";
- if(el[i]['f_toupper'] == 1){
- orConditions += a[j].toUpperCase();
- }
- else{
- orConditions += a[j];
- }
- orConditions += "*</ogc:Literal>";
- orConditions += "</ogc:PropertyIsLike>";
+
+ orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
+ orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
+ orConditions += "<ogc:Literal>*";
+ if(el[i]['f_toupper'] == 1){
+ orConditions += a[j].toUpperCase();
}
- else if(el[i]['f_operator']=='greater_than'){
- orConditions += "<ogc:PropertyIsGreaterThan>";
- orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
- orConditions += "<ogc:Literal>";
- if(el[i]['f_toupper'] == 1){
- orConditions += a[j].toUpperCase();
- }
- else{
- orConditions += a[j];
- }
- orConditions += "</ogc:Literal>";
- orConditions += "</ogc:PropertyIsGreaterThan>";
- }
- else if(el[i]['f_operator']=='less_than'){
- orConditions += "<ogc:PropertyIsLessThan>";
- orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
- orConditions += "<ogc:Literal>";
- if(el[i]['f_toupper'] == 1){
- orConditions += a[j].toUpperCase();
- }
- else{
- orConditions += a[j];
- }
- orConditions += "</ogc:Literal>";
- orConditions += "</ogc:PropertyIsLessThan>";
- }
- else if(el[i]['f_operator']=='less_equal_than'){
- orConditions += "<ogc:PropertyIsLessThanOrEqualTo>";
- orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
- orConditions += "<ogc:Literal>";
- if(el[i]['f_toupper'] == 1){
- orConditions += a[j].toUpperCase();
- }
- else{
- orConditions += a[j];
- }
- orConditions += "</ogc:Literal>";
- orConditions += "</ogc:PropertyIsLessThanOrEqualTo>";
- }
- else if(el[i]['f_operator']=='greater_equal_than'){
- orConditions += "<ogc:PropertyIsGreaterThanOrEqualTo>";
- orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
- orConditions += "<ogc:Literal>";
- if(el[i]['f_toupper'] == 1){
- orConditions += a[j].toUpperCase();
- }
- else{
- orConditions += a[j];
- }
- orConditions += "</ogc:Literal>";
- orConditions += "</ogc:PropertyIsGreaterThanOrEqualTo>";
- }
- else if(el[i]['f_operator']=='equal'){
- orConditions += "<ogc:PropertyIsEqualTo>";
- orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
- orConditions += "<ogc:Literal>";
- if(el[i]['f_toupper'] == 1){
- orConditions += a[j].toUpperCase();
- }
- else{
- orConditions += a[j];
- }
- orConditions += "</ogc:Literal>";
- orConditions += "</ogc:PropertyIsEqualTo>";
- }
else{
- orConditions += "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
- orConditions += "<ogc:PropertyName>" + el[i]['element_name'] + "</ogc:PropertyName>";
- orConditions += "<ogc:Literal>*";
- if(el[i]['f_toupper'] == 1){
- orConditions += a[j].toUpperCase();
- }
- else{
- orConditions += a[j];
- }
- orConditions += "*</ogc:Literal>";
- orConditions += "</ogc:PropertyIsLike>";
+ orConditions += a[j];
}
+ orConditions += "*</ogc:Literal>";
+ orConditions += "</ogc:PropertyIsLike>";
}
if(a.length > 1){
andConditions += "<Or>" + orConditions + "</Or>";
@@ -735,127 +354,12 @@
}
}
}
-
- if(spatialRequestGeom!=null){
- if(spatialRequestGeom.geomType == "polygon"){
- if(buttonPolygon.filteroption=='within'){
- andConditions += "<Within><ogc:PropertyName>";
- for (var j=0; j < el.length; j++) {
- if(el[j]['f_geom']==1){
- var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
- }
- }
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
- andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- for(var k=0; k<spatialRequestGeom.count(); k++){
- if(k>0) andConditions += " ";
- andConditions += spatialRequestGeom.get(k).x+","+spatialRequestGeom.get(k).y;
- }
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
- andConditions += "</gml:Polygon></Within>";
- }
- else if(buttonPolygon.filteroption=='intersects'){
- andConditions += "<Intersects><ogc:PropertyName>";
- for (var j=0; j < el.length; j++) {
- if(el[j]['f_geom']==1){
- var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
- }
- }
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
- andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- for(var k=0; k<spatialRequestGeom.count(); k++){
- if(k>0) andConditions += " ";
- andConditions += spatialRequestGeom.get(k).x+","+spatialRequestGeom.get(k).y;
- }
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
- andConditions += "</gml:Polygon></Intersects>";
- }
- }
- else if(spatialRequestGeom.geomType == "line"){
- var rectangle = [];
- rectangle = spatialRequestGeom.getBBox();
-
- if(buttonRectangle.filteroption=='within'){
- andConditions += "<Within><ogc:PropertyName>";
- for (var j=0; j < el.length; j++) {
- if(el[j]['f_geom']==1){
- var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
- }
- }
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
- andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- andConditions += rectangle[0].x+","+rectangle[0].y;
- andConditions += " ";
- andConditions += rectangle[0].x+","+rectangle[1].y;
- andConditions += " ";
- andConditions += rectangle[1].x+","+rectangle[1].y;
- andConditions += " ";
- andConditions += rectangle[1].x+","+rectangle[0].y;
- andConditions += " ";
- andConditions += rectangle[0].x+","+rectangle[0].y;
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
- andConditions += "</gml:Polygon></Within>";
- }
- else if(buttonRectangle.filteroption=='intersects'){
- andConditions += "<Intersects><ogc:PropertyName>";
- for (var j=0; j < el.length; j++) {
- if(el[j]['f_geom']==1){
- var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
- }
- }
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\">";
- andConditions += "<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- andConditions += rectangle[0].x+","+rectangle[0].y;
- andConditions += " ";
- andConditions += rectangle[0].x+","+rectangle[1].y;
- andConditions += " ";
- andConditions += rectangle[1].x+","+rectangle[1].y;
- andConditions += " ";
- andConditions += rectangle[1].x+","+rectangle[0].y;
- andConditions += " ";
- andConditions += rectangle[0].x+","+rectangle[0].y;
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>";
- andConditions += "</gml:Polygon></Intersects>";
- }
- }
- else if(spatialRequestGeom.geomType == "point"){
- var tmp = spatialRequestGeom.get(0);
- var mapPos = parent.makeRealWorld2mapPos("mapframe1",tmp.x, tmp.y);
- var buffer = mb_wfs_tolerance/2;
- var mapPosXAddPix = mapPos[0] + buffer;
- var mapPosYAddPix = mapPos[1] +buffer;
- var mapPosXRemovePix = mapPos[0] - buffer;
- var mapPosYRemovePix = mapPos[1] - buffer;
- var realWorld1 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYRemovePix);
- var realWorld2 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
- var realWorld3 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
- var realWorld4 = parent.makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
- andConditions += "<Intersects><ogc:PropertyName>";
- for (var j=0; j < el.length; j++) {
- if(el[j]['f_geom']==1){
- var elementName = el[j]['element_name'];
- andConditions += el[j]['element_name'];
- }
- }
- andConditions += "</ogc:PropertyName><gml:Polygon srsName=\""+srs+"\"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>";
- andConditions += realWorld1[0] + "," + realWorld1[1] + " " + realWorld2[0] + "," + realWorld2[1] + " ";
- andConditions += realWorld3[0] + "," + realWorld3[1] + " " + realWorld4[0] + "," + realWorld4[1] + " " + realWorld1[0] + "," + realWorld1[1];
- andConditions += "</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects>";
- }
- //andConditions += "<ogc:Not><ogc:PropertyIsNull>";
- //andConditions += "<ogc:PropertyName>" + elementName + "</ogc:PropertyName>";
- //andConditions += "</ogc:PropertyIsNull></ogc:Not>";
- }
-
+
var u = global_wfsConfObj[global_selectedWfsConfId].wfs_getfeature + parent.mb_getConjunctionCharacter(global_wfsConfObj[global_selectedWfsConfId].wfs_getfeature);
u += "REQUEST=getFeature&Typename="+global_wfsConfObj[global_selectedWfsConfId].featuretype_name+"&Version=1.0.0&service=WFS";
u += "&filter=";
- if (filterParameterCount > 1 || spatialRequestGeom != null) {
+ if (filterParameterCount > 1) {
andConditions = "<And>" + andConditions + "</And>";
}
@@ -866,223 +370,80 @@
parent.mb_ajax_get("../php/mod_wfs_gazetteer_server.php", parameters, function (jsCode, status) {
document.getElementById("res").innerHTML = "<table><tr><td>Arranging search results...</td></tr></table>";
- if(status=='success'){
- for (var i=0; i < parent.wms.length; i++) {
- for (var j=0; j < parent.wms[i].objLayer.length; j++) {
- var currentLayer = parent.wms[i].objLayer[j];
- var wms_id = parent.wms[i].wms_id;
- if (currentLayer.gui_layer_wfs_featuretype == global_selectedWfsConfId) {
- var layer_name = currentLayer.layer_name;
- parent.handleSelectedLayer_array(targetArray[0],[wms_id],[layer_name],'querylayer',1);
- parent.handleSelectedLayer_array(targetArray[0],[wms_id],[layer_name],'visible',1);
- }
+ eval(jsCode);
+
+ for (var i=0; i < parent.wms.length; i++) {
+ for (var j=0; j < parent.wms[i].objLayer.length; j++) {
+
+ var currentLayer = parent.wms[i].objLayer[j];
+ var wms_id = parent.wms[i].wms_id;
+
+ if (currentLayer.gui_layer_wfs_featuretype == global_selectedWfsConfId) {
+ var layer_name = currentLayer.layer_name;
+ parent.handleSelectedLayer_array(targetArray[0],[wms_id],[layer_name],'querylayer',1);
+ parent.handleSelectedLayer_array(targetArray[0],[wms_id],[layer_name],'visible',1);
}
}
- var geoObj = eval('(' + jsCode + ')');
- if (jsCode) {
- if (typeof(geoObj) == 'object') {
- geomArray.importGeoJSON(geoObj);
- document.getElementById("res").innerHTML = '';
- displayResult(geomArray);
+ }
+
+ var body = "";
+ if (typeof(geom) == 'object') {
+ resultGeom = geom; // set the global variable
+ for (var i=0; i < geom.count(); i++) {
+ body += "<div id='geom"+i+"'style='cursor:pointer;' ";
+ if ((i % 2) === 0) {
+ body += "class='even'";
}
else {
- document.getElementById("res").innerHTML = '';
- displayResult();
+ body += "class='uneven'";
}
+ body += " onmouseover=\"setResult('over', this.id)\" ";
+ body += " onmouseout=\"setResult('out', this.id)\" ";
+ body += " onclick=\"setResult('click', this.id)\">";
+ for (var j=0; j < geom.get(i).e.count(); j++) {
+ body += geom.get(i).e.getValue(j) + " ";
+ }
+ body += "</div>";
}
- else {
- document.getElementById("res").innerHTML = '';
- alert("No results.");
- }
- }
+ }
+ else {
+ body = "Kein Ergebnis.";
+ }
+ document.getElementById('res').innerHTML = body;
});
}
- spatialRequestGeom = null;
return false;
}
-function displayResult(geom){
- geomArray = geom;
- if(geomArray!=null && geomArray.count()>0){
- var contentHtml = createListOfGeometries();
- }
- else{
- var contentHtml = "No results.";
- }
-
- if(showResultInPopup==1){
- if (typeof(resultGeometryPopup) == "undefined") {
- resultGeometryPopup = new parent.mb_popup(searchPopupTitle,contentHtml,searchPopupWidth,searchPopupHeight,searchPopupX,searchPopupY);
- }
- else {
- resultGeometryPopup.hide();
- resultGeometryPopup = new parent.mb_popup(searchPopupTitle,contentHtml,searchPopupWidth,searchPopupHeight,searchPopupX,searchPopupY);
- }
- resultGeometryPopup.show();
- }
- else{
- document.getElementById("res").innerHTML = contentHtml;
- }
-
-}
+function getNumberOfFilterParameters(){
+ var cnt = 0;
+ var el = global_wfsConfObj[global_selectedWfsConfId].element;
-function createListOfGeometries(){
- var listOfGeom = "<table style='background-color:#EEEEEE;'>\n";
- var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
- var labelArray = [];
- if (geomArray.count() > 0) {
- listOfGeom += "<tr>";
- var labelObj = getListTitle();
- for (var k = 1 ; k < labelObj.length; k ++) {
- listOfGeom += "<td>";
- listOfGeom += labelObj[k];
- listOfGeom += "</td>";
- }
- listOfGeom += "</tr>";
- for (var i = 0 ; i < geomArray.count(); i ++) {
- if (geomArray.get(i).get(-1).isComplete()) {
- listOfGeom += "<tr>\n";
- var resultElObj = getListValues(geomArray.get(i));
- for (var l = 1 ; l < resultElObj.length; l ++) {
- if(resultElObj[l]!=''){
- listOfGeom += "<td style='cursor:pointer;\n";
- if(showResultInPopup==1){
- if ((i % 2) === 0) {
- listOfGeom += "color:blue'";
- }
- else {
- listOfGeom += "color:red'";
- }
- }
- else{
- if ((i % 2) === 0) {
- listOfGeom += "' class='even'";
- }
- else {
- listOfGeom += "' class='uneven'";
- }
- }
- if(showResultInPopup==1){
- var domPath = "window.frames['"+frameName+"'].";
- }
- else{
- var domPath = "";
- }
- listOfGeom += " onmouseover=\""+domPath+"setResult('over',"+i+")\" ";
- listOfGeom += " onmouseout=\""+domPath+"setResult('out',"+i+")\" ";
- listOfGeom += " onclick=\""+domPath+"setResult('click',"+i+"); "+domPath+"showWfs("+i+");\" ";
- listOfGeom += ">"+ resultElObj[l] +"</td>";
- }
- }
- listOfGeom += "\t</tr>\n";
+ for (var i = 0; i < el.length; i++){
+ if( el[i]['f_search'] == 1){
+ if (document.getElementById(el[i]['element_name']).value != '') {
+ cnt++;
}
}
}
- listOfGeom += "</table>\n";
- return listOfGeom;
+ return cnt;
}
-
-function getListTitle(){
- var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
- var labelArray = [];
- for (var j = 0 ; j < wfsConf.element.length ; j++) {
- if(wfsConf.element[j].f_show == 1 && wfsConf.element[j].f_label!=''){
- var labelPos = wfsConf.element[j].f_respos;
- labelArray[labelPos] = wfsConf.element[j].f_label;
- }
- }
- return labelArray;
-}
-
-function getListValues(geom){
- var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
- var resultArray = [];
- for (var i = 0 ; i < wfsConf.element.length ; i++) {
- if (wfsConf.element[i].f_show == 1 && geom.e.getElementValueByName(wfsConf.element[i].element_name) !=false) {
- var pos = wfsConf.element[i].f_respos;
- if(pos>0){
- resultArray[pos] = geom.e.getElementValueByName(wfsConf.element[i].element_name);
- }
- }
- }
- return resultArray;
-}
-
-function showWfs(geometryIndex) {
- var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
- var wfsElement = geomArray.get(geometryIndex).e;
- var showDetailsObj = {};
- var details = 0;
- for (var i = 0 ; i <wfsConf.element.length; i ++) {
- if(wfsConf.element[i].f_show_detail == 1 && wfsElement.getElementValueByName(wfsConf.element[i].element_name)!=''){
- var elPos = wfsConf.element[i].f_respos;
- if(elPos>0){
- showDetailsObj[elPos] = {};
- //var elementVal = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
- //showDetailsObj[elPos][wfsConf.element[i].f_label] = elementVal;
- if(wfsConf.element[i].f_form_element_html.indexOf("href")!=-1){
- var setUrl = wfsConf.element[i].f_form_element_html.replace(/href\s*=\s*['|"]\s*['|"]/, "href='http://hnodc.hcmr.gr/hnodc_public_data/"+wfsElement.getElementValueByName(wfsConf.element[i].element_name)+"' target='_blank'");
- if(setUrl.match(/><\/a>/)){
- var newLink = setUrl.replace(/><\/a>/, ">"+wfsElement.getElementValueByName(wfsConf.element[i].element_name)+"</a>");
- }
- else{
- var newLink = setUrl;
- }
- showDetailsObj[elPos][wfsConf.element[i].f_label] = newLink;
- }
- else{
- showDetailsObj[elPos][wfsConf.element[i].f_label] = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
- }
- }
- details = 1;
- }
- }
- var resultHtml = "";
- resultHtml += "<table style='background-color:#EEEEEE;'>\n";
- for (var elPos in showDetailsObj) {
- var currentDetail = showDetailsObj[elPos];
- for(var key in currentDetail){
- var currentDetailName = key;
- var currentDetailValue = currentDetail[key];
- resultHtml +="<tr><td>\n";
- resultHtml += currentDetailName;
- resultHtml +="</td>\n";
- resultHtml += "<td>\n";
- resultHtml += currentDetailValue;
- resultHtml += "</td></tr>\n";
- }
- }
- if(details != 1){
- resultHtml +="<tr><td>No detail information</td></tr>\n";
- }
- resultHtml += "</table>\n";
-
- if (typeof(wfsPopup) == "undefined") {
- wfsPopup = new parent.mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
- }
- else {
- wfsPopup.hide();
- wfsPopup = new parent.mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
- }
- wfsPopup.show();
-}
-
/*
* event -> {over || out || click}
* geom -> commaseparated coordinates x1,y1,x2,y2 ...
*/
-function setResult(event, index){
- var currentGeom = geomArray.get(index);
+function setResult(event, id){
+ var index = parseInt(id.slice(4));
+
+ var currentGeom = resultGeom.get(index);
if (maxHighlightedPoints > 0 && currentGeom.getTotalPointCount() > maxHighlightedPoints) {
currentGeom = currentGeom.getBBox4();
}
if (event == "over") {
global_resultHighlight.add(currentGeom, cw_fillcolor);
- global_resultHighlight.paint();
}
else if (event == "out"){
global_resultHighlight.del(currentGeom, cw_fillcolor);
- global_resultHighlight.paint();
}
else if (event == "click"){
global_resultHighlight.del(currentGeom, cw_fillcolor);
@@ -1094,27 +455,17 @@
parent.mb_calculateExtent(targetArray[0], bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y);
parent.zoom(targetArray[0], 'true', 1.0);
global_resultHighlight.add(currentGeom, cw_fillcolor);
- global_resultHighlight.paint();
}
return true;
}
-
-function callPick(obj){
- dTarget = obj;
- var dp = window.open('../tools/datepicker/datepicker.php?m=Jan_Feb_Mar_Apr_May_June_July_Aug_Sept_Oct_Nov_Dec&d=Mon_Tue_Wed_Thu_Fri_Sat_Sun&t=today','dp','left=200,top=200,width=230,height=210,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0');
- dp.focus();
- return false;
-}
-
</script>
</head>
<body leftmargin='0' topmargin='10' bgcolor='#ffffff'>
<form name='selectWfsConfForm' id='selectWfsConfForm'></form>
-<div name='displaySpatialButtons' id='displaySpatialButtons' style='width:180px'></div>
-<a name='wfsInfo' id='wfsInfo'></a>
-<img src = "" name='wfsRemove' id='wfsRemove'>
<img src = "" name='wfsGeomType' id='wfsGeomType'>
+<img src = "" name='wfsRemove' id='wfsRemove'>
+<a name='wfsInfo' id='wfsInfo'></a>
<form name='wfsForm' id='wfsForm' onsubmit='return validate()'></form>
<div name='res' id='res' style='width:180px'></div>
</body>
-</html>
+</html>
\ No newline at end of file
More information about the Mapbender_commits
mailing list