<?php # $Id$ # http://www.mapbender.org/index.php/addWMSFromFeatureInfo.php # Copyright (C) 2002 CCGIS # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. require_once(dirname(__FILE__)."/../php/mb_validateSession.php"); require_once(dirname(__FILE__)."/../../conf/mapbender.conf"); $con = db_connect($DBSERVER,$OWNER,$PW); db_select_db(DB,$con); $gui_id = $_SESSION["mb_user_gui"]; $e_id_css = 'addWmsFromFeatureInfo'; include(dirname(__FILE__).'/../include/dyn_js.php'); $sql = "SELECT e_src, e_target FROM gui_element WHERE e_id = $1 AND fkey_gui_id = $2 "; $v = array($e_id_css,$gui_id); $t = array('s','s'); $res = db_prep_query($sql,$v,$t); $cnt = 0; while($row = db_fetch_array($res)){ $e_src = $row["e_src"]; $e_target = explode(",",$row["e_target"]); $cnt++; } if($cnt > 1){ echo "alert('digitize_button: ID not unique!');";} echo "var mod_target = '".$e_target[0]."';"; ?> function addWmsFromFeatureInfo(pointer_name, version) { mb_registerloadWmsSubFunctions("addWmsFromInfo_pos()"); var mywms = pointer_name; if(mywms.indexOf("?") > -1){pointer_name += "&";} if(mywms.indexOf("?") == -1){pointer_name += "?";} if (version == '1.0.0'){ var cap = pointer_name + "REQUEST=capabilities&WMTVER=1.0.0"; var load = cap; } else if (version == '1.1.0'){ var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0"; var load = cap; } else if (version == '1.1.1'){ var cap = pointer_name + "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.1"; var load = cap; } if(load){ //if the mapfile WMS ONLINE RESOURCE is set relative, without any host if(load.charAt(0) == '/' && load.charAt(1) == 'c') { mod_addWMS_load('http://localhost' + load); } else{ mod_addWMS_load(load); } } } function addWmsFromInfo_pos(){ if (mod_addWmsFromFeatureInfo_position > 0 && mod_addWmsFromFeatureInfo_position < mb_mapObj[getMapObjIndexByName(mod_target)].wms.length-1) { mb_wmsMoveByIndex(getMapObjIndexByName(mod_target), mb_mapObj[getMapObjIndexByName(mod_target)].wms.length-1, mod_addWmsFromFeatureInfo_position-1); } mb_removeFunctionFromArray("mb_loadWmsSubFunctions", "addWmsFromInfo_pos()"); }