[Mapbender-commits] r1251 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Apr 10 09:41:18 EDT 2007
Author: christoph
Date: 2007-04-10 09:41:18 -0400 (Tue, 10 Apr 2007)
New Revision: 1251
Modified:
trunk/mapbender/http/javascripts/map.php
Log:
refactoring
Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php 2007-04-10 13:40:30 UTC (rev 1250)
+++ trunk/mapbender/http/javascripts/map.php 2007-04-10 13:41:18 UTC (rev 1251)
@@ -21,11 +21,13 @@
require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
session_start();
header('Content-type: application/x-javascript');
+
+echo "var mb_nr = '".session_id()."';";
+echo "var mb_myLogin = '".$_SESSION["mb_login"]."';";
+echo "var mb_styleID = '".md5($_SESSION["mb_user_name"])."';";
+echo "var mb_myBBOX = '".$_SESSION["mb_myBBOX"]."';";
+echo "var owsproxy = '".OWSPROXY."';";
?>
-/* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. */
-
-/*GLOBALS*/
var ie = document.all?1:0;
var n6 = document.getElementById&&!document.all?1:0;
var n4 = document.layers?1:0;
@@ -61,14 +63,6 @@
var mb_loadWmsSubFunctions = new Array();
var mb_security_proxy = "http://wms1.ccgis.de/mapbender/tools/security_proxy.php?mb_ows_security_proxy=";
-<?php
-echo "var mb_nr = '".session_id()."';";
-echo "var mb_myLogin = '".$_SESSION["mb_login"]."';";
-echo "var mb_styleID = '".md5($_SESSION["mb_user_name"])."';";
-echo "var mb_myBBOX = '".$_SESSION["mb_myBBOX"]."';";
-echo "var owsproxy = '".OWSPROXY."';";
-?>
-
var mb_trans = new Image;
mb_trans.src = "../img/transparent.gif";
/*END OF GLOBALS*/
@@ -105,7 +99,7 @@
mb_ajaxWrap_json(url, param, callback);
}
catch(e) {
- alert('map.php: mb_ajax_post_json:'+e);
+ alert('map.php: mb_ajax_json:'+e);
}
}
@@ -480,7 +474,7 @@
}
newMapURL += "EXCEPTIONS="+mb_mapObj[i].wms[ii].gui_wms_exceptionformat;
// add vendor-specifics
- for(var v=0; v<mb_vendorSpecific.length; v++){
+ for(var v=0; v < mb_vendorSpecific.length; v++){
newMapURL += "&" + eval(mb_vendorSpecific[v]);
}
// add Filter
@@ -703,7 +697,7 @@
validation = true;
}
//add vendor-specific
- for(var v=0; v<mb_vendorSpecific.length; v++){
+ for(var v=0; v < mb_vendorSpecific.length; v++){
requestParams += "&" + eval(mb_vendorSpecific[v]);
}
if(mb_log && validation){
@@ -788,64 +782,79 @@
setMapRequest(frameName);
}
-function handleSelectedLayer(frameName,wms_title,layerName,type,status){
- //alert(frameName + " , " +wms_title + " , " +layerName + " , " +type + " , " +status);
- //type = {visible || querylayer] status = {0 || 1}
- for(var i=0; i<mb_mapObj.length; i++){
- if(mb_mapObj[i].frameName == frameName){
- var cnt_layer = 0;
- var str_layer = "";
- var myMapObj = i;
- for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
- if(mb_mapObj[i].wms[ii].wms_title == wms_title){ //ii is true
- var myWMS = ii;
- if(type == "visible"){var arrayLayer = mb_mapObj[i].layers[ii].split(",");}
- if(type == "querylayer"){var arrayLayer = mb_mapObj[i].querylayers[ii].split(",");}
- for(var iii=1; iii<mb_mapObj[i].wms[ii].objLayer.length; iii++){
- var layer_name = mb_mapObj[i].wms[ii].objLayer[iii].layer_name;
- if(type == "querylayer"){
- if(layer_name == layerName && status == 1 && mb_mapObj[i].wms[ii].objLayer[iii].layer_queryable == 1){
- if(cnt_layer > 0){str_layer += ",";}
- str_layer += layer_name;
- cnt_layer++;
- }
- }
- else if(type == "visible"){
- if(layer_name == layerName && status == 1){
- if(cnt_layer > 0){str_layer += ",";}
- str_layer += layer_name;
- cnt_layer++;
- }
- }
- for(var iiii=0; iiii<arrayLayer.length; iiii++){
- if(layer_name == arrayLayer[iiii] && layer_name != layerName){
- if(cnt_layer > 0){str_layer += ",";}
- str_layer += layer_name;
- cnt_layer++;
- }
- }
- }
- }
- }
- }
- }
- if(type == "visible"){
- mb_mapObj[myMapObj].layers[myWMS] = str_layer;
- var array_str_layer = str_layer.split(",");
- var str_styles = "";
- for(var cnt=0; cnt<array_str_layer.length; cnt++){
- if(cnt > 0){str_styles += ",";}
- str_styles += "";
- }
- mb_mapObj[myMapObj].styles[myWMS] = str_styles;
- }
- if(type == "querylayer"){mb_mapObj[myMapObj].querylayers[myWMS] = str_layer;}
- /*
- if(type == 'visible'){
- setSingleMapRequest(frameName,wms_title);
- }
- */
+function handleSelectedLayer (frameName, wms_title, layerName, type, status) {
+// alert(frameName + " , " +wms_title + " , " +layerName + " , " +type + " , " +status);
+// type = {visible || querylayer] status = {0 || 1}
+ for (var i=0; i < mb_mapObj.length; i++) {
+ if (mb_mapObj[i].frameName == frameName) {
+ var cnt_layer = 0;
+ var str_layer = "";
+ var myMapObj = i;
+ for (var ii = 0; ii < mb_mapObj[i].wms.length; ii++) {
+ if (mb_mapObj[i].wms[ii].wms_title == wms_title) { //ii is true
+ var myWMS = ii;
+ if (type == "visible") {
+ var arrayLayer = mb_mapObj[i].layers[ii].split(",");
+ }
+ if (type == "querylayer") {
+ var arrayLayer = mb_mapObj[i].querylayers[ii].split(",");
+ }
+ for (var iii = 1; iii < mb_mapObj[i].wms[ii].objLayer.length; iii++) {
+ var layer_name = mb_mapObj[i].wms[ii].objLayer[iii].layer_name;
+ if (type == "querylayer") {
+ if (layer_name == layerName && status == 1 && mb_mapObj[i].wms[ii].objLayer[iii].layer_queryable == 1){
+ if (cnt_layer > 0) {
+ str_layer += ",";
+ }
+ str_layer += layer_name;
+ cnt_layer++;
+ }
+ }
+ else if (type == "visible") {
+ if (layer_name == layerName && status == 1) {
+ if (cnt_layer > 0) {
+ str_layer += ",";
+ }
+ str_layer += layer_name;
+ cnt_layer++;
+ }
+ }
+ for (var iiii = 0; iiii < arrayLayer.length; iiii++) {
+ if (layer_name == arrayLayer[iiii] && layer_name != layerName) {
+ if (cnt_layer > 0) {
+ str_layer += ",";
+ }
+ str_layer += layer_name;
+ cnt_layer++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (type == "visible") {
+ mb_mapObj[myMapObj].layers[myWMS] = str_layer;
+ var array_str_layer = str_layer.split(",");
+ var str_styles = "";
+ for (var cnt=0; cnt < array_str_layer.length; cnt++) {
+ if (cnt > 0) {
+ str_styles += ",";
+ }
+ str_styles += "";
+ }
+ mb_mapObj[myMapObj].styles[myWMS] = str_styles;
+ }
+ if (type == "querylayer") {
+ mb_mapObj[myMapObj].querylayers[myWMS] = str_layer;
+ }
+/*
+ if(type == 'visible'){
+ setSingleMapRequest(frameName,wms_title);
+ }
+*/
}
+
function handleSelectedLayer_array(mapObj, array_wms, array_layer, type, status){
//alert(mapObj+" / "+array_wms[0]+" / "+ array_layer[0]+" / "+ type+" / "+ status);
var ind = getMapObjIndexByName(mapObj);
@@ -1199,13 +1208,13 @@
var y = "";
var tmp = new Array();
var ind = getMapObjIndexByName(frameName);
- for(var i=0; i<geom.length; i++){
- if(i>0){
+ for(var i=0; i < geom.length; i++){
+ if(i > 0){
x += ":";
y += ":";
}
tmp = geom[i].split(",");
- for(var ii=0; ii<tmp.length; ii+=2){
+ for(var ii=0; ii < tmp.length; ii+=2){
var pos = makeRealWorld2mapPos(frameName,tmp[ii], tmp[ii+1]);
if(ii>0){
x += ",";
@@ -1317,7 +1326,7 @@
node.setAttribute("style", "");
for (var attr in tagStyle) {
- if (typeof(tagStyle[attr] != "function") && typeof(tagStyle[attr] != "object")) {
+ if (typeof(tagStyle[attr]) != "function" && typeof(tagStyle[attr]) != "object") {
var evalString = "node.style."+toCamelCase(attr)+" = \"" + tagStyle[attr] + "\";";
eval(evalString);
}
@@ -1436,15 +1445,19 @@
return nextvalue;
}
<?php
-include("../../conf/mapbender.conf");
$con = db_connect($DBSERVER,$OWNER,$PW);
db_select_db(DB,$con);
-$mb_sql = "SELECT e_js_file FROM gui_element WHERE e_public = 1 AND fkey_gui_id = '".$_REQUEST["gui_id"]."' ORDER BY e_pos";
+
+$mb_sql = "SELECT DISTINCT e_js_file, e_id, e_src, e_target, e_pos FROM gui_element WHERE e_public = 1 AND fkey_gui_id = '".$_REQUEST["gui_id"]."' ORDER BY e_pos";
$mb_res = db_query($mb_sql);
//$mb_cnt = 0;
while($row_js = db_fetch_array($mb_res)){
- if($row_js["e_js_file"] != ""){
- include($row_js["e_js_file"]);
- }
+ if($row_js["e_js_file"] != ""){
+ $e_id = $row_js["e_id"];
+ $e_id_css = $row_js["e_id"];
+ $e_src = $row_js["e_src"];
+ $e_target = $row_js["e_target"];
+ include($row_js["e_js_file"]);
+ }
}
?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list