[Mapbender-commits] r1022 - in trunk/mapbender/http: html
javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Jan 24 05:28:58 EST 2007
Author: nimix
Date: 2007-01-24 05:28:58 -0500 (Wed, 24 Jan 2007)
New Revision: 1022
Modified:
trunk/mapbender/http/html/mod_treefolder2.php
trunk/mapbender/http/javascripts/jsTree.js
Log:
adapt code conventions to coding style
Modified: trunk/mapbender/http/html/mod_treefolder2.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolder2.php 2007-01-24 09:01:34 UTC (rev 1021)
+++ trunk/mapbender/http/html/mod_treefolder2.php 2007-01-24 10:28:58 UTC (rev 1022)
@@ -1,6 +1,24 @@
<?php
+# $Id:
+# http://www.mapbender.org/index.php/Mod_treefolder2.php
+# Copyright (C) 2007 Melchior Moos
+#
+# 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.
+
session_start();
-require_once("../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
$gui_id = $_SESSION["mb_user_gui"];
@@ -16,14 +34,13 @@
include '../include/dyn_css.php';
?>
<script language='JavaScript'>
-/* Treefolder2, written 2006 by Melchior Moos*/
function openwindow(Adresse) {
Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
Fenster1.focus();
}
</script>
-<script src="../javascripts/jsTreeID.js" type="text/javascript" language="JavaScript"></script>
+<script src="../javascripts/jsTree.js" type="text/javascript" language="JavaScript"></script>
<?php
echo "<script language='JavaScript'>";
$sql = "SELECT e_target FROM gui_element WHERE e_id = $1 AND fkey_gui_id = $2";
@@ -77,12 +94,10 @@
//var menu_layer_switch = ['menu_zoom', ['Zjjj ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow("../php/mod_layerMetadata.php?id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
//var menu_info_switch = ['menu_zoom', ['Zmn ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow("../php/mod_layerMetadata.php?id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
-function select(i,ii,iii)
-{
+function select(i,ii,iii){
//ignore if selected
if(selectedMap==i && selectedWMS==ii && selectedLayer==iii)return;
- if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1)
- {
+ if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1){
selectedMap=i;
selectedWMS=ii;
selectedLayer=iii;
@@ -114,8 +129,7 @@
selectedLayer=iii;
}
-function updateScale()
-{
+function updateScale(){
if(!init)return;
for(var i=0; i<parent.mb_mapObj.length; i++){
var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
@@ -146,17 +160,14 @@
}
}
-function operaLoad()
-{
+function operaLoad(){
initArray();
renderTree();
setTimeout('initWmsCheckboxen();updateScale();',100);
}
-function loadTree()
-{
- if(window.opera)
- {
+function loadTree(){
+ if(window.opera){
setTimeout('operaLoad()',200);
return;
}
@@ -166,8 +177,7 @@
updateScale();
}
-function reloadTree()
-{
+function reloadTree(){
if(!init) return;
selectedMap=-1;
selectedWMS=-1;
@@ -180,8 +190,7 @@
renderTree();
if(window.opera)
setTimeout('initWmsCheckboxen();updateScale();',100);
- else
- {
+ else{
initWmsCheckboxen();
updateScale();
}
@@ -189,24 +198,20 @@
parent.mb_registerloadWmsSubFunctions("window.frames['treeGDE'].reloadTree();");
parent.mb_registerInitFunctions("window.frames['treeGDE'].loadTree();");
-if(showstatus=='true'||alerterror=='true')
-{
+if(showstatus=='true'||alerterror=='true'){
parent.mb_registerSubFunctions("window.frames['treeGDE'].init_mapcheck();");
init_mapcheck();
}
parent.mb_registerSubFunctions("window.frames['treeGDE'].updateScale();");
-function imgerror()
-{
+function imgerror(){
var map=parent.getMapObjIndexByName(mod_treeGDE_map);
var wms=Number(this.id.substr(4));
this.onerror=null;
this.onabort=null;
- if(state[wms]!=-1 && alerterror=='true')
- {
+ if(state[wms]!=-1 && alerterror=='true'){
state[wms]=-1;
- if(confirm('Failed to Load WMS "'+parent.mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+parent.mb_mapObj[map].wms[wms].wms_getmap.substr(0,parent.mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?'))
- {
+ if(confirm('Failed to Load WMS "'+parent.mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+parent.mb_mapObj[map].wms[wms].wms_getmap.substr(0,parent.mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?')){
window.open(this.src,"");
}
}
@@ -216,17 +221,12 @@
setNodeImage(arrNodes[0][0]+"|"+parent.mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
}
-function checkComplete(wms, map, img, first)
-{
- if(parent.frames[mod_treeGDE_map].document.getElementById(map).complete)
- {
- if(state[wms]!=-1)
- {
+function checkComplete(wms, map, img, first){
+ if(parent.frames[mod_treeGDE_map].document.getElementById(map).complete){
+ if(state[wms]!=-1){
var ind=parent.getMapObjIndexByName(mod_treeGDE_map);
- for(var i=1;i<parent.mb_mapObj[ind].wms[wms].objLayer.length;i++)
- {
- if(parent.mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1)
- {
+ for(var i=1;i<parent.mb_mapObj[ind].wms[wms].objLayer.length;i++){
+ if(parent.mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1){
state[wms]=1;
if(showstatus=='true')
setNodeImage(img);
@@ -235,10 +235,8 @@
}
}
}
- else
- {
- if(first)
- {
+ else{
+ if(first){
state[wms]=0;
parent.frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
parent.frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
@@ -256,23 +254,19 @@
if(!init)return;
errors = 0;
var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
- if(!parent.mb_mapObj[ind]||!init)
- {
+ if(!parent.mb_mapObj[ind]||!init){
setTimeout("init_mapcheck();",100);
return;
}
- for(var wms=0;wms<parent.mb_mapObj[ind].wms.length;wms++)
- {
+ for(var wms=0;wms<parent.mb_mapObj[ind].wms.length;wms++){
var wmsimgid="map_"+wms;
- if(parent.frames[mod_treeGDE_map].document.getElementById(wmsimgid))
- {
+ if(parent.frames[mod_treeGDE_map].document.getElementById(wmsimgid)){
checkComplete(wms, wmsimgid, arrNodes[0][0]+'|'+parent.mb_mapObj[ind].wms[wms].wms_id, true);
}
}
}
-function handleSelectedLayer(mapObj,wms_id,layername,type,status)
-{
+function handleSelectedLayer(mapObj,wms_id,layername,type,status){
var mywms = new Array();
mywms[0] = wms_id;
var mylayername = new Array();
@@ -280,19 +274,15 @@
parent.handleSelectedLayer_array(mapObj, mywms, mylayername, type, status);
}
-function zoomToLayer(j,k,l)
-{
- if(!j&&!k&&!l)
- {
+function zoomToLayer(j,k,l){
+ if(!j&&!k&&!l){
j=selectedMap;
k=selectedWMS;
l=selectedLayer;
}
var my=parent.mb_mapObj[j].wms[k].objLayer[l].layer_epsg;
- for(var i=0;i<my.length-1;i++)
- {
- if(my[i]["epsg"]==parent.mb_mapObj[j].epsg)
- {
+ for(var i=0;i<my.length-1;i++){
+ if(my[i]["epsg"]==parent.mb_mapObj[j].epsg){
parent.mb_calculateExtent(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
var arrayExt = parent.mb_mapObj[j].extent.split(",");
parent.mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
@@ -301,23 +291,18 @@
}
}
-function move_up(j,k,l)
-{
- if(!j&&!k&&!l)
- {
+function move_up(j,k,l){
+ if(!j&&!k&&!l){
j=selectedMap;
k=selectedWMS;
l=selectedLayer;
}
- if(j==-1||k==-1||l==-1)
- {
+ if(j==-1||k==-1||l==-1){
alert("You have to select the WMS you want to move up!")
return;
}
- if(l!=0)
- {
- if(l==1)
- {
+ if(l!=0){
+ if(l==1){
alert("The Layer you selected is already on top of the WMS");
return;
}
@@ -334,18 +319,15 @@
}
var previousWMS=-1;
for(var i=k-1;i>=0;i--)
- if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1)
- {
+ if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1){
previousWMS=i;
break;
}
- if(previousWMS==-1)
- {
+ if(previousWMS==-1){
alert("The selected WMS is already on top!")
return;
}
- if (parent.mb_swapWmsByIndex(j, previousWMS, k) == true)
- {
+ if (parent.mb_swapWmsByIndex(j, previousWMS, k) == true){
parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
parent.mb_execloadWmsSubFunctions();
select(j, previousWMS, 0);
@@ -353,24 +335,19 @@
}
}
-function move_down(j,k,l)
-{
- if(!j&&!k&&!l)
- {
+function move_down(j,k,l){
+ if(!j&&!k&&!l){
j=selectedMap;
k=selectedWMS;
l=selectedLayer;
}
- if(j==-1||k==-1||l==-1)
- {
+ if(j==-1||k==-1||l==-1){
alert("You have to select the WMS you want to move down!")
return;
}
- if(l!=0)
- {
+ if(l!=0){
var my = parent.mb_mapObj[j];
- if(selectedLayer==my.wms[k].objLayer.length-1)
- {
+ if(selectedLayer==my.wms[k].objLayer.length-1){
alert("The Layer you selected is already on bottom of the WMS");
return;
}
@@ -385,21 +362,17 @@
return;
}
var nextWMS=-1;
- for(var i=k+1;i<parent.mb_mapObj[j].wms.length;i++)
- {
- if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1)
- {
+ for(var i=k+1;i<parent.mb_mapObj[j].wms.length;i++){
+ if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1){
nextWMS=i;
break;
}
}
- if(nextWMS==-1)
- {
+ if(nextWMS==-1){
alert("The selected WMS is already on bottom!")
return;
}
- if (parent.mb_swapWmsByIndex(j, k, nextWMS) == true)
- {
+ if (parent.mb_swapWmsByIndex(j, k, nextWMS) == true){
parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
parent.mb_execloadWmsSubFunctions();
select(j, nextWMS, 0);
@@ -407,21 +380,17 @@
}
}
-function remove_wms(j,k,l)
-{
- if(!j&&!k&&!l)
- {
+function remove_wms(j,k,l){
+ if(!j&&!k&&!l){
j=selectedMap;
k=selectedWMS;
l=selectedLayer;
}
- if(j==-1||k==-1||l==-1)
- {
+ if(j==-1||k==-1||l==-1){
alert("You have to select the WMS you want to delete!")
return;
}
- if(l!=0)
- {
+ if(l!=0){
alert("It is not possible to delete a single layer, please select a WMS!")
return;
}
@@ -429,28 +398,24 @@
for(var i=0;i<parent.mb_mapObj[j].wms.length;i++)
if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1)
visibleWMS++;
- if(visibleWMS<=1)
- {
+ if(visibleWMS<=1){
alert ("Last WMS can't be removed.\n(Der letzte WMS kann nicht entfernt werden.)");
return;
}
- if(confirm('Are you sure you want to remove "'+parent.mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?'))
- {
+ if(confirm('Are you sure you want to remove "'+parent.mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
parent.mb_mapObjremoveWMS(j,k);
parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
parent.mb_execloadWmsSubFunctions();
}
}
-function updateParent(path)
-{
+function updateParent(path){
if(lock)return;
lock=true;
var state=getChildrenCheckState(path, 0);
//enableCheckbox(path, (state!=-1)); //3rd state
checkNode(path, 0, (state==1));
- if(state==0 && showstatus=='true')
- {
+ if(state==0 && showstatus=='true'){
/* var arrPath = path.split(jst_delimiter[0])
var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
for(var wms=0;wms<parent.mb_mapObj[ind].wms.length;wms++)
@@ -464,8 +429,7 @@
lock=false;
}
-function handleSelectedWMS(path)
-{
+function handleSelectedWMS(path){
if(lock)return;
lock=true;
var bChk = IsChecked(path, 0);
@@ -477,8 +441,7 @@
lock=false;
}
-function initArray()
-{
+function initArray(){
var parentObj = "";
var controls="";
if(parent.mb_mapObj.length > 0){
@@ -533,8 +496,7 @@
init=true;
}
-function initWmsCheckboxen()
-{
+function initWmsCheckboxen(){
var hidden=0;
if(parent.mb_mapObj.length > 0){
for(var i=0; i<parent.mb_mapObj.length; i++){
@@ -564,8 +526,7 @@
<BODY VLINK="#000000" ALINK="#000000" LINK="#000000" BGCOLOR="#ffffff" TEXT="#000000"
MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">
<SCRIPT language="JavaScript" type="text/javascript">
-if(wmsbuttons=='true')
-{
+if(wmsbuttons=='true'){
document.writeln("<div>");
document.writeln('<a href="javascript:move_up()"><img src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a>');
document.writeln('<a href="javascript:move_down()"><img src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a>');
Property changes on: trunk/mapbender/http/html/mod_treefolder2.php
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/mapbender/http/javascripts/jsTree.js
===================================================================
--- trunk/mapbender/http/javascripts/jsTree.js 2007-01-24 09:01:34 UTC (rev 1021)
+++ trunk/mapbender/http/javascripts/jsTree.js 2007-01-24 10:28:58 UTC (rev 1022)
@@ -1,5 +1,5 @@
/***************************************************************
-* $Id: jsTree.js 855 2006-11-20 14:06:28Z christoph $
+# $Id:
* http://www.mapbender.org/index.php/Mod_treefolder2.php
*
* Copyright notice
Property changes on: trunk/mapbender/http/javascripts/jsTree.js
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the Mapbender_commits
mailing list