function openwindow (Adresse) {
Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
Fenster1.focus();
}
var msgObj = {};
msgObj.tooltipHandleWms = '';
msgObj.tooltipLayerVisible = '';
msgObj.tooltipLayerQuerylayer = '';
msgObj.tooltipLayerContextMenu = '';
msgObj.tooltipWmsContextMenu = '';
msgObj.tooltipRemoveWms = '';
msgObj.tooltipMoveSelectionUp = '';
msgObj.tooltipMoveSelectionDown = '';
var jst_container = "document.getElementById('treeContainer')";
var jst_image_folder = imagedir;
var jst_display_root = false;
var defaultTarget = 'examplemain';
var lock=false;
var lock_update=false;
var lock_check=false;
var selectedMap=-1;
var selectedWMS=-1;
var selectedLayer=-1;
var initialized=false;
var errors = 0;
var state=Array();
var treeState = "";
0 && $rights[count($rights)-1]<$row['lft']){
array_pop($rights);
array_pop($path);
}
//set path for each wms that is referenced in this folder
array_push($rights, $row['rgt']);
array_push($path, "folder_".$row['id']);
if($row['wms_id']!=""){
foreach(explode(",",$row['wms_id']) as $wms){
array_push($categories, "'wms_".$wms."':\"root_id|".implode("|", $path)."\"");
}
}
}
//if we have a configured structure output it
if(count($str)>0){
//order js array elements
array_multisort($nr, $str);
//output javascript vars
$arrNodesStr = "[['root_id', ['Layer','javascript:_foo()'],[".implode("",$str)."]]];";
$arrNodesStr = str_replace(array("[]", ",]"),array("","]"),$arrNodesStr);
echo "var arrNodesStr = \"".$arrNodesStr."\";\n";
echo "var categories = {".implode(",", $categories)."};\n";
}
else{
//if there is no structure take default
?>
var arrNodesStr = "[['root_id', ['Layer','javascript:_foo()']]];";
var categories = {};
var arrNodes = eval(arrNodesStr);
function _foo(){selectedMap=-1;selectedWMS=-1;selectedLayer=-1}
// some defaults
if (typeof(reverse) === 'undefined')reverse = 'false';
if (typeof(switchwms) === 'undefined')switchwms = 'true';
if (typeof(ficheckbox) === 'undefined')ficheckbox = 'false';
if (typeof(metadatalink) === 'undefined')metadatalink = 'false';
if (typeof(wmsbuttons) === 'undefined')wmsbuttons = 'false';
if (typeof(showstatus) === 'undefined')showstatus = 'false';
if (typeof(alerterror) === 'undefined')alerterror = 'false';
if (typeof(openfolder) === 'undefined')openfolder = 'false';
if (typeof(handlesublayer) === 'undefined')handlesublayer = 'false';
if (typeof(menu) === 'undefined')menu = '';
if (typeof(redirectToMetadataUrl) !== 'undefined' && redirectToMetadataUrl == "false") {
redirectToMetadataUrl = false;
}
else {
redirectToMetadataUrl = true;
}
var defaultMetadataUrl = '../php/mod_layerMetadata.php?';
if (redirectToMetadataUrl) {
defaultMetadataUrl += 'redirectToMetadataUrl=1';
}
else {
defaultMetadataUrl += 'redirectToMetadataUrl=0';
}
//menu elements
var menu_move_up = ['menu_move_up', [' ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
var menu_move_down = ['menu_move_down', [' ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
var menu_delete = ['menu_delete', [' ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'delete_wms.png']];
var menu_opacity_up = ['menu_opacity_up', [' ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
var menu_opacity_down = ['menu_opacity_down', [' ','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
var menu_metalink = ['menu_metalink', [' ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[ids[0]].wms[ids[1]].objLayer[ids[2]].layer_uid);',,'info.png']];
var menu_zoom = ['menu_zoom', [' ', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];zoomToLayer(ids[0],ids[1],ids[2]);',,'zoom.png']];
var menu_hide = ['menu_hide', [' ', 'javascript:hideMenu()',,'hide.png']];
//var menu_wms_switch = ['menu_zoom', [' ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
//var menu_layer_switch = ['menu_zoom', ['Zjjj ', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&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(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
//parent.eventMapRequestFailed.register(function(t){imgerror(t)});
eventAfterLoadWMS.register(reloadTree);
eventInit.register(loadTree);
if(showstatus=='true'||alerterror=='true'){
eventAfterMapRequest.register(init_mapcheck);
init_mapcheck();
}
eventAfterMapRequest.register(updateScale);
eventAfterMapRequest.register(updateCheckState);
if(wmsbuttons != "true")
jst_highlight = false;
function select(i,ii,iii){
//ignore if selected
if(selectedMap==i && selectedWMS==ii && selectedLayer==iii)return;
if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1){
selectedMap=i;
selectedWMS=ii;
selectedLayer=iii;
return;
}
//scalehints
var scale = parseInt(mb_getScale(mod_treeGDE_map));
if(scale < parseInt(mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
if(selectedLayer==0)
setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
else
setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
}
else if(scale > parseInt( mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) && parseInt( mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) != 0){
if(selectedLayer==0)
setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
else
setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
}
else{
if(selectedLayer==0)
setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
else
setNodeColor(arrNodes[0][0]+"|wms_"+ mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+ mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '');
}
selectedMap=i;
selectedWMS=ii;
selectedLayer=iii;
}
function updateScale(){
if(!initialized)return;
myMapObj = getMapObjByName(mod_treeGDE_map);
if(myMapObj){
var scale = parseInt( mb_getScale(mod_treeGDE_map));
for(var ii=0; ii< myMapObj.wms.length; ii++){
for(var iii=1; iii< myMapObj.wms[ii].objLayer.length; iii++){
if(scale < parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_minscale) && parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_minscale) != 0){
if(iii==0)
setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '#999999');
else
setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '#999999');
}
else if(scale > parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt( myMapObj.wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
if(iii==0)
setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '#999999');
else
setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '#999999');
}
else{
if(iii==0)
setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id, '');
else
setNodeColor(arrNodes[0][0]+"|wms_"+ myMapObj.wms[ii].wms_id+"|"+ myMapObj.wms[ii].objLayer[iii].layer_id, '');
}
}
}
}
}
function updateCheckState(){
if(!initialized||lock_check)return;
lock_check=true;
for(var i=0; i< mb_mapObj.length; i++){
var scale = parseInt( mb_getScale(mod_treeGDE_map));
if( mb_mapObj[i].elementName == mod_treeGDE_map){
for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
for(var iii=1; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
if(! mb_mapObj[i].wms[ii].objLayer[iii].has_childs){
path = arrNodes[0][0]+"|wms_"+ mb_mapObj[i].wms[ii].wms_id+"|"+ mb_mapObj[i].wms[ii].objLayer[iii].layer_id;
checkNode(path, 0, mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_visible=='1', false);
if(ficheckbox == 'true')
checkNode(path, 1, mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_querylayer=='1', false);
}
}
}
}
}
lock_check=false;
}
function operaLoad(){
initArray();
renderTree();
setTimeout('initWmsCheckboxen();updateScale();',100);
}
function loadTree(){
if(wmsbuttons=='true'){
var div = document.createElement("div");
div.innerHTML = '!['+msgObj.tooltipMoveSelectionUp+' move up]('+imagedir+'/move_up.png)
!['+msgObj.tooltipMoveSelectionDown+' move down]('+imagedir+'/move_down.png)
';
document.getElementById("treeGDE").appendChild(div);
}
var div = document.createElement("div");
div.id = "treeContainer"
document.getElementById("treeGDE").appendChild(div);
if(window.opera){
setTimeout('operaLoad()',200);
return;
}
initArray();
renderTree();
initWmsCheckboxen();
updateScale();
}
function reloadTree(){
if(!initialized) return;
selectedMap=-1;
selectedWMS=-1;
selectedLayer=-1;
initialized=false;
arrNodes = eval(arrNodesStr)
initArray();
if(showstatus=='true'||alerterror=='true')
init_mapcheck();
renderTree();
if(window.opera)
setTimeout('initWmsCheckboxen();updateScale();',100);
else{
initWmsCheckboxen();
updateScale();
}
}
function imgerror(t){
var map= getMapObjIndexByName(mod_treeGDE_map);
var wms=Number(t.id.substr(4));
t.onerror=null;
t.onabort=null;
if(state[wms]!=-1 && alerterror=='true'){
state[wms]=-1;
if(confirm('Failed to Load WMS "'+ mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+ mb_mapObj[map].wms[wms].wms_getmap.substr(0, mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?')){
window.open(t.src,"");
}
}
state[wms]=-1;
errors++;
if(showstatus=='true')
setNodeImage(arrNodes[0][0]+"|wms_"+ mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
}
function checkComplete(wms, map, img, first){
var ind= getMapObjIndexByName(mod_treeGDE_map);
if( mb_mapObj[ind].wms[wms].mapURL == false || mb_mapObj[ind].getDomElement().ownerDocument.getElementById(map).complete){
if(state[wms]!=-1){
for(var i=1;i< mb_mapObj[ind].wms[wms].objLayer.length;i++){
if( mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1){
state[wms]=1;
if(showstatus=='true')
setNodeImage(img);
break;
}
}
}
}
else{
if(first){
state[wms]=0;
// frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
// frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
if(showstatus=='true')
setNodeImage(img, "loading_folder.gif");
}
if(state[wms]!=-1)
setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);
}
}
// mb_registerWmsLoadErrorFunctions("window.frames['treeGDE'].imgerror();");
function init_mapcheck(){
if(!initialized)return;
errors = 0;
var ind = getMapObjIndexByName(mod_treeGDE_map);
if(! mb_mapObj[ind]||!initialized){
setTimeout("init_mapcheck();",100);
return;
}
for(var wms=0;wms< mb_mapObj[ind].wms.length;wms++){
var wmsimgid=mod_treeGDE_map+"_map_"+wms;
if( mb_mapObj[ind].getDomElement().ownerDocument.getElementById(wmsimgid)){
checkComplete(wms, wmsimgid, arrNodes[0][0]+'|wms_'+ mb_mapObj[ind].wms[wms].wms_id, true);
}
}
}
function handleSelectedLayer(mapObj,wms_id,layername,type,status){
if(lock_update||lock_check)return;
var ind = getMapObjIndexByName(mapObj);
for(var i=0; i< mb_mapObj[ind].wms.length; i++){
if( mb_mapObj[ind].wms[i].wms_id == wms_id){
mb_mapObj[ind].wms[i].handleLayer(layername, type, status);
break;
}
}
}
function zoomToLayer(j,k,l){
if(!j&&!k&&!l){
j=selectedMap;
k=selectedWMS;
l=selectedLayer;
}
var my= mb_mapObj[j].wms[k].objLayer[l].layer_epsg;
for (var i=0;i ")
return;
}
var lid= mb_mapObj[j].wms[k].objLayer[l].layer_id;
if(! mb_mapObj[j].move( mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?false:true)){
alert("");
return;
}
treeState = getState();
mb_mapObj[j].zoom(true, 1.0);
mb_execloadWmsSubFunctions();
//find layer and select
for(k=0;k< mb_mapObj[j].wms.length;k++){
for(l=0;l< mb_mapObj[j].wms[k].objLayer.length;l++){
if( mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
select(j,k,l);
if(l!=0)
selectNode(String(lid));
else
selectNode("wms_"+String( mb_mapObj[j].wms[k].wms_id));
}
}
}
}
function move_down(j,k,l){
if(isNaN(j)&&isNaN(k)&&isNaN(l)){
j=selectedMap;
k=selectedWMS;
l=selectedLayer;
}
if(j==-1||k==-1||l==-1){
alert("")
return;
}
var lid= mb_mapObj[j].wms[k].objLayer[l].layer_id;
if(! mb_mapObj[j].move( mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?true:false)){
alert("");
return;
}
treeState = getState();
mb_mapObj[j].zoom(true, 1.0);
mb_execloadWmsSubFunctions();
//find layer and select
for(k=0;k< mb_mapObj[j].wms.length;k++){
for(l=0;l< mb_mapObj[j].wms[k].objLayer.length;l++){
if( mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
select(j,k,l);
if(l!=0)
selectNode(String(lid));
else
selectNode("wms_"+String( mb_mapObj[j].wms[k].wms_id));
}
}
}
}
function remove_wms(j,k,l){
if(isNaN(j)&&isNaN(k)&&isNaN(l)){
j=selectedMap;
k=selectedWMS;
l=selectedLayer;
}
if(j==-1||k==-1||l==-1){
alert("")
return;
}
if(l!=0){
alert("")
return;
}
var visibleWMS=0;
for(var i=0;i< mb_mapObj[j].wms.length;i++)
if( mb_mapObj[j].wms[i].gui_wms_visible=='1'|| mb_mapObj[j].wms[i].gui_wms_visible==1)
visibleWMS++;
if(visibleWMS<=1){
alert ("");
return;
}
if(confirm('' + ' "'+ mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
mb_mapObjremoveWMS(j,k);
mb_mapObj[j].zoom(true, 1.0);
mb_execloadWmsSubFunctions();
}
}
function updateParent(path){
if(lock_check)return;
var reset_lock=!lock_update;
lock_update=true;
var state=getChildrenCheckState(path, 0);
//enableCheckbox(path, (state!=-1)); //3rd state
checkNode(path, 0, (state==1));
if(state==0 && showstatus=='true' && path.split(jst_delimiter[0]).length == 2){
setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
}
if(reset_lock)
lock_update=false;
}
function handleSelectedWMS(path){
if(lock_update)return;
var t = path.split("|");
var wms_id = t[t.length-1].substr(4);
var reset_lock=!lock_check;
var ind = getMapObjIndexByName(mod_treeGDE_map);
var wms = getWMSIndexById(mod_treeGDE_map,wms_id);
var layername = mb_mapObj[ind].wms[wms].objLayer[0].layer_name;
var bChk = IsChecked(path, 0);
mb_mapObj[ind].wms[wms].handleLayer(layername,"visible",bChk?"1":"0");
mb_mapObj[ind].wms[wms].handleLayer(layername,"querylayer",bChk?"1":"0");
lock_check=true;
checkChildren(path, 0, bChk);
if(ficheckbox)checkChildren(path, 1, bChk);
if(bChk==false && showstatus=='true')
setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
if(reset_lock)
{
mb_restateLayers(mod_treeGDE_map,wms_id);
setSingleMapRequest(mod_treeGDE_map,wms_id);
lock_check=false;
}
}
function handleSelection(path, box){
if(lock_update)return;
var reset_lock=!lock_check;
lock_check=true;
var bChk = IsChecked(path, box);
// enableCheckbox(path, 0, true);
checkChildren(path, box, bChk);
if(reset_lock){
//find wms id from path
var t = path.split("|");
for(var i=1;t[i].indexOf("wms_")!=0;i++){}
var wms_id = t[i].substr(4);
//set maprequest
mb_restateLayers(mod_treeGDE_map,wms_id);
if(box==0)
setSingleMapRequest(mod_treeGDE_map,wms_id);
lock_check=false;
}
}
function initArray(){
var parentObj = "";
var controls="";
if( mb_mapObj.length > 0){
for(var i=0; i< mb_mapObj.length; i++){
if( mb_mapObj[i].elementName == mod_treeGDE_map){
for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
if( mb_mapObj[i].wms[ii].gui_wms_visible == '1' || mb_mapObj[i].wms[ii].gui_wms_visible == 1){
for(var iii=0; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
var temp = mb_mapObj[i].wms[ii].objLayer[iii];
if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
if(!temp.gui_layer_selectable == '1' && !temp.gui_layer_queryable == '1')
continue;
parentNode = arrNodes[0][0];
if(eval("categories.wms_"+ mb_mapObj[i].wms[ii].wms_id) !== undefined)
parentNode = eval("categories.wms_"+ mb_mapObj[i].wms[ii].wms_id);
else
eval("categories['wms_"+ mb_mapObj[i].wms[ii].wms_id+"'] = parentNode");
var c_menu="[";
if(reverse=="true"){
if(menu.indexOf("wms_down")!=-1 && ii!= mb_mapObj[i].wms.length-1)c_menu+="menu_move_up,";
if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_down,";
}
else{
if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_up,";
if(menu.indexOf("wms_down")!=-1 && ii!= mb_mapObj[i].wms.length-1)c_menu+="menu_move_down,";
}
if(menu.indexOf("remove")!=-1)c_menu+="menu_delete,";
// if(menu.indexOf("wms_switch")!=-1)c_menu+="menu_wms_switch,";
if(menu.indexOf("opacity_up")!=-1 && parseFloat( mb_mapObj[i].wms[ii].gui_wms_mapopacity) < 1)c_menu+="menu_opacity_up,";
if(menu.indexOf("opacity_down")!=-1 && parseFloat( mb_mapObj[i].wms[ii].gui_wms_mapopacity) > 0)c_menu+="menu_opacity_down,";
if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
c_menu+="]";
controls=null;
if(switchwms=='true')controls='';
if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='
';
addNode(parentNode,["wms_"+ mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
parentObj = parentNode+"|wms_"+ mb_mapObj[i].wms[ii].wms_id;
}
if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent && (handlesublayer=="true"|| mb_mapObj[i].wms[ii].objLayer[iii].layer_parent=="0")){
var parentLayer = "";
var j = iii;
while( mb_mapObj[i].wms[ii].objLayer[j].layer_parent!="0"){
//find parent
for(var jj=0; jj < mb_mapObj[i].wms[ii].objLayer.length; jj++){
if( mb_mapObj[i].wms[ii].objLayer[jj].layer_pos==parseInt( mb_mapObj[i].wms[ii].objLayer[j].layer_parent)){
j=jj;
break;
}
}
parentLayer = "|" + mb_mapObj[i].wms[ii].objLayer[j].layer_id + parentLayer;
}
if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
var c_menu="[";
if(reverse=="true"){
if(menu.indexOf("layer_down")!=-1 && iii!= mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_up,";
if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_down,";
}
else{
if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_up,";
if(menu.indexOf("layer_down")!=-1 && iii!= mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_down,";
}
if(menu.indexOf("metainfo")!=-1)c_menu+="menu_metalink,";
if(menu.indexOf("zoom")!=-1 && temp.layer_epsg.length>0)c_menu+="menu_zoom,";
// if(menu.indexOf("layer_switch")!=-1)c_menu+="menu_layer_switch,";
// if(menu.indexOf("info_switch")!=-1)c_menu+="menu_info_switch,";
if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
c_menu+="]";
controls = [];
controls.push('");
if(ficheckbox == 'true'){
controls.push('");
}
if(wmsbuttons == 'true'&&metadatalink == 'true'){
controls.push('
');
}
addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,((c_menu!='[]'&&temp.layer_name!="")?'menu.png':null),temp.layer_title,eval(c_menu),controls.join(""),[i,ii,iii]]],false,false,reverse=="true");
}
}
}
}
}
}
}
}
initialized=true;
}
function initWmsCheckboxen(){
var hidden=0;
if( mb_mapObj.length > 0){
for(var i=0; i< mb_mapObj.length; i++){
if( mb_mapObj[i].elementName == mod_treeGDE_map){
for(var ii=0; ii< mb_mapObj[i].wms.length; ii++){
if( mb_mapObj[i].wms[ii].gui_wms_visible == '1' || mb_mapObj[i].wms[ii].gui_wms_visible == 1){
for(var iii=0; iii< mb_mapObj[i].wms[ii].objLayer.length; iii++){
var temp = mb_mapObj[i].wms[ii].objLayer[iii];
if( mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
updateParent(arrNodes[0][0]+"|"+ mb_mapObj[i].wms[ii].wms_id);
}
}
}
else if(ii<= parseInt(openfolder)+hidden)
hidden++;
}
closeAll()
if(treeState!='')
setState(treeState);
else if(openfolder!='false')
setState(arrNodes[0][0]+"|"+ mb_mapObj[i].wms[ parseInt(openfolder)+hidden].wms_id);
}
}
}
}