[Mapbender-commits] r2976 - in branches/tree_dev/http: html
javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Sep 18 09:11:53 EDT 2008
Author: nimix
Date: 2008-09-18 09:11:52 -0400 (Thu, 18 Sep 2008)
New Revision: 2976
Modified:
branches/tree_dev/http/html/mod_treefolder2.php
branches/tree_dev/http/javascripts/jsTree.js
Log:
make treeGDE2 aware of categorie folders
Modified: branches/tree_dev/http/html/mod_treefolder2.php
===================================================================
--- branches/tree_dev/http/html/mod_treefolder2.php 2008-09-18 12:58:42 UTC (rev 2975)
+++ branches/tree_dev/http/html/mod_treefolder2.php 2008-09-18 13:11:52 UTC (rev 2976)
@@ -24,7 +24,7 @@
<HTML>
<HEAD>
<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
?>
<TITLE>Treefolder</TITLE>
<?php
@@ -47,9 +47,20 @@
$e_target = db_result($res,0,"e_target");
echo "mod_treeGDE_map = '".$e_target."';";
echo "</script>";
+session_write_close();
?>
<SCRIPT language="JavaScript" type="text/javascript">
+var msgObj = {};
+msgObj.tooltipHandleWms = '<?php echo _mb("(De)activate this service");?>';
+msgObj.tooltipLayerVisible = '<?php echo _mb("Toggles the visibility of this service");?>';
+msgObj.tooltipLayerQuerylayer = '<?php echo _mb("Toggles the queryability of this service");?>';
+msgObj.tooltipLayerContextMenu = '<?php echo _mb("Opens the layer context menu");?>';
+msgObj.tooltipWmsContextMenu = '<?php echo _mb("Opens the WMS context menu");?>';
+msgObj.tooltipRemoveWms = '<?php echo _mb("Removes the selected WMS");?>';
+msgObj.tooltipMoveSelectionUp = '<?php echo _mb("Moves the selection up");?>';
+msgObj.tooltipMoveSelectionDown = '<?php echo _mb("Moves the selection down");?>';
+
var jst_container = "document.getElementById('treeContainer')";
var jst_image_folder = imagedir;
var jst_display_root = false;
@@ -64,38 +75,100 @@
var errors = 0;
var state=Array();
var treeState = "";
-var arrNodes =
-[
- ['root_id', ['Layer','javascript:_foo()']
+<?php
+//load structure
+$sql = "SELECT * FROM gui_treegde WHERE fkey_gui_id = $1 ORDER BY lft;";
+$v = array($_SESSION["mb_user_gui"]);
+$t = array("s");
+$res = db_prep_query($sql, $v, $t);
+//init tree converting arrays
+$nr = array(); //array for nested sets numbers
+$str = array(); //array for js array elements
+$categories = array(); //array for wms folders
+$path = array(); //stack for actual path elements
+$rights = array(); //stack for rights of open elements
+
+//build javascript data array for jsTree
+while($row = db_fetch_array($res)){
+ //push javascript array elements to a single array with lefts and rights
+ $left = "['folder_".$row['id']."', ['".$row['my_layer_title']."', 'javascript:_foo()'],[";
+ $right = "]],";
+ array_push($nr, $row['lft']);
+ array_push($str, $left);
+ array_push($nr, $row['rgt']);
+ array_push($str, $right);
+
+ //finish all nodes that have no further childs
+ while(count($rights) > 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
+ echo "var arrNodesStr = \"[['root_id', ['Layer','javascript:_foo()'],[".implode("",$str)."]]];\";\n";
+ echo "var categories = {".implode(",", $categories)."};\n";
+}
+else{
+//if there is no structure take default
+?>
+var arrNodesStr = "[['root_id', ['Layer','javascript:_foo()']]];";
+var categories = {};
+<?php
+}
+?>
+/*var arrNodesStr = "[['root_id', ['Layer','javascript:_foo()'], [['test1',['Einfach so','javascript:_foo()']],['test2',['Schönes Wetter','javascript:_foo()']],['test3',['Sonstiges','javascript:_foo()']]]]];"
+
+var categories = {"wms_407":arrNodes[0][0]+"|test1","wms_911":arrNodes[0][0]+"|test2", "wms_914":arrNodes[0][0]+"|test2"};
+var arrNodes = [
+ String: node id,
+ [
+ String: title,
+ String: href,
+ String: target,
+ String: image,
+ String: tooltip,
+ Folder definition: node context menu,
+ String: controls
+ ],
+ Folder definition: sub folder
]
-];
-function _foo(){}
+*/
+var arrNodes = eval(arrNodesStr);
+function _foo(){selectedMap=-1;selectedWMS=-1;selectedLayer=-1}
// some defaults
-try{if (reverse){}}catch(e){reverse = 'false';}
-try{if (switchwms){}}catch(e){switchwms = 'true';}
-try{if (ficheckbox){}}catch(e){ficheckbox = 'false';}
-try{if (metadatalink){}}catch(e){metadatalink = 'false';}
-try{if (wmsbuttons){}}catch(e){wmsbuttons = 'false';}
-try{if (showstatus){}}catch(e){showstatus = 'false';}
-try{if (alerterror){}}catch(e){alerterror = 'false';}
-try{if (openfolder){}}catch(e){openfolder = 'false';}
-try{if (handlesublayer){}}catch(e){handlesublayer = 'false';}
-try{if (menu){}}catch(e){menu = '';}
-try {
- if (redirectToMetadataUrl) {
- if (redirectToMetadataUrl == "false") {
+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;
}
- }
-}
-catch (e) {
- var redirectToMetadataUrl = true;
-}
+
var defaultMetadataUrl = '../php/mod_layerMetadata.php?';
if (redirectToMetadataUrl) {
defaultMetadataUrl += 'redirectToMetadataUrl=1';
@@ -124,6 +197,8 @@
init_mapcheck();
}
parent.eventAfterMapRequest.register(updateScale);
+parent.eventAfterMapRequest.register(updateCheckState);
+
if(wmsbuttons != "true")
jst_highlight = false;
@@ -140,21 +215,21 @@
var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
if(scale < parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
if(selectedLayer==0)
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
else
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
}
else if(scale > parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) != 0){
if(selectedLayer==0)
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
else
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
}
else{
if(selectedLayer==0)
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
else
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '');
}
selectedMap=i;
@@ -171,21 +246,21 @@
for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){
if(iii==0)
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
else
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '#999999');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '#999999');
}
else if(scale > parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
if(iii==0)
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
else
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '#999999');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '#999999');
}
else{
if(iii==0)
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[i].wms[ii].wms_id, '');
else
- setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '');
+ setNodeColor(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '');
}
}
}
@@ -193,6 +268,27 @@
}
}
+function updateCheckState(){
+ if(!init||lock_check)return;
+ lock_check=true;
+ for(var i=0; i<parent.mb_mapObj.length; i++){
+ var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
+ if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
+ for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+ for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+ if(!parent.mb_mapObj[i].wms[ii].objLayer[iii].has_childs){
+ path = arrNodes[0][0]+"|wms_"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id;
+ checkNode(path, 0, parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_visible=='1', false);
+ if(ficheckbox == 'true')
+ checkNode(path, 1, parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_querylayer=='1', false);
+ }
+ }
+ }
+ }
+ }
+ lock_check=false;
+}
+
function operaLoad(){
initArray();
renderTree();
@@ -216,7 +312,7 @@
selectedWMS=-1;
selectedLayer=-1;
init=false;
- arrNodes = [['root_id', ['Layer','javascript:_foo()']]];
+ arrNodes = eval(arrNodesStr)
initArray();
if(showstatus=='true'||alerterror=='true')
init_mapcheck();
@@ -243,7 +339,7 @@
state[wms]=-1;
errors++;
if(showstatus=='true')
- setNodeImage(arrNodes[0][0]+"|"+parent.mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
+ setNodeImage(arrNodes[0][0]+"|wms_"+parent.mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
}
function checkComplete(wms, map, img, first){
@@ -288,7 +384,7 @@
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)){
- checkComplete(wms, wmsimgid, arrNodes[0][0]+'|'+parent.mb_mapObj[ind].wms[wms].wms_id, true);
+ checkComplete(wms, wmsimgid, arrNodes[0][0]+'|wms_'+parent.mb_mapObj[ind].wms[wms].wms_id, true);
}
}
}
@@ -368,7 +464,7 @@
if(l!=0)
selectNode(String(lid));
else
- selectNode(String(parent.mb_mapObj[j].wms[k].wms_id));
+ selectNode("wms_"+String(parent.mb_mapObj[j].wms[k].wms_id));
}
}
}
@@ -400,7 +496,7 @@
if(l!=0)
selectNode(String(lid));
else
- selectNode(String(parent.mb_mapObj[j].wms[k].wms_id));
+ selectNode("wms_"+String(parent.mb_mapObj[j].wms[k].wms_id));
}
}
}
@@ -452,12 +548,14 @@
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 = parent.getMapObjIndexByName(mod_treeGDE_map);
- var layername = parent.mb_mapObj[ind].wms[parent.getWMSIndexById(mod_treeGDE_map,t[t.length-1])].objLayer[0].layer_name;
+ var wms = parent.getWMSIndexById(mod_treeGDE_map,wms_id);
+ var layername = parent.mb_mapObj[ind].wms[wms].objLayer[0].layer_name;
var bChk = IsChecked(path, 0);
- handleSelectedLayer(mod_treeGDE_map,t[t.length-1],layername,"visible",bChk?"1":"0");
- handleSelectedLayer(mod_treeGDE_map,t[t.length-1],layername,"querylayer",bChk?"1":"0");
+ parent.mb_mapObj[ind].wms[wms].handleLayer(layername,"visible",bChk?"1":"0");
+ parent.mb_mapObj[ind].wms[wms].handleLayer(layername,"querylayer",bChk?"1":"0");
lock_check=true;
checkChildren(path, 0, bChk);
if(ficheckbox)checkChildren(path, 1, bChk);
@@ -465,9 +563,9 @@
setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
if(reset_lock)
{
+ parent.mb_restateLayers(mod_treeGDE_map,wms_id);
+ parent.setSingleMapRequest(mod_treeGDE_map,wms_id);
lock_check=false;
- parent.mb_restateLayers(mod_treeGDE_map,t[t.length-1]);
- parent.setSingleMapRequest(mod_treeGDE_map,t[t.length-1]);
}
}
@@ -479,11 +577,15 @@
// enableCheckbox(path, 0, true);
checkChildren(path, box, bChk);
if(reset_lock){
+ //find wms id from path
var t = path.split("|");
- lock_check=false;
- parent.mb_restateLayers(mod_treeGDE_map,t[1]);
+ for(var i=1;t[i].indexOf("wms_")!=0;i++){}
+ var wms_id = t[i].substr(4);
+ //set maprequest
+ parent.mb_restateLayers(mod_treeGDE_map,wms_id);
if(box==0)
- parent.setSingleMapRequest(mod_treeGDE_map,t[1]);
+ parent.setSingleMapRequest(mod_treeGDE_map,wms_id);
+ lock_check=false;
}
}
@@ -500,6 +602,13 @@
if(parent.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_"+parent.mb_mapObj[i].wms[ii].wms_id) !== undefined)
+ parentNode = eval("categories.wms_"+parent.mb_mapObj[i].wms[ii].wms_id);
+ else
+ eval("categories['wms_"+parent.mb_mapObj[i].wms[ii].wms_id+"'] = parentNode");
+
var c_menu="[";
if(reverse=="true"){
if(menu.indexOf("wms_down")!=-1 && ii!=parent.mb_mapObj[i].wms.length-1)c_menu+="menu_move_up,";
@@ -516,10 +625,10 @@
if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
c_menu+="]";
controls=null;
- if(switchwms=='true')controls='<INPUT type="checkbox" checked onclick="handleSelectedWMS(\''+arrNodes[0][0]+'|'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />';
+ if(switchwms=='true')controls='<INPUT type="checkbox" title="' + msgObj.tooltipHandleWms + '" checked onclick="handleSelectedWMS(\''+parentNode+'|wms_'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />';
if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
- addNode(arrNodes[0][0],[parent.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 = arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id;
+ addNode(parentNode,["wms_"+parent.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_"+parent.mb_mapObj[i].wms[ii].wms_id;
}
if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent && (handlesublayer=="true"||parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent=="0")){
var parentLayer = "";
@@ -551,18 +660,40 @@
if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
c_menu+="]";
- controls='<input type="checkbox" '+(temp.layer_name==""?'style="display:none;" ':"")+((temp.gui_layer_visible=='1')?'checked ':'')+(temp.gui_layer_selectable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);"+((ficheckbox == 'false')?"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);":"")+"handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 0);updateParent('"+parentObj+parentLayer+"');\" />";
- if(ficheckbox == 'true')controls+='<input type="checkbox" '+(temp.gui_layer_querylayer=='1'?'checked ':'')+(temp.gui_layer_queryable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1, this.checked?1:0)\" />";
- if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
- 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,[i,ii,iii]]],false,false,reverse=="true");
+ controls = [];
+ controls.push('<input type="checkbox" title="' + msgObj.tooltipLayerVisible + '" ');
+ if(temp.layer_name=="")
+ controls.push('style="display:none;" ');
+ if(temp.gui_layer_visible=='1')
+ controls.push('checked ');
+ if(temp.gui_layer_selectable!='1')
+ controls.push('disabled ');
+ controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);");
+ if(ficheckbox == 'false')
+ controls.push("handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
+ controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 0);");
+ controls.push("updateParent('"+parentObj+parentLayer+"');\" />");
+ if(ficheckbox == 'true'){
+ controls.push('<input type="checkbox" title="' + msgObj.tooltipLayerQuerylayer + '" ');
+ if(temp.gui_layer_querylayer=='1')
+ controls.push('checked ');
+ if(temp.gui_layer_queryable!='1')
+ controls.push('disabled ');
+ controls.push("onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);");
+ controls.push("handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1);\" />");
}
+ if(wmsbuttons == 'true'&&metadatalink == 'true'){
+ controls.push('<a href="javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');"><img src="'+imagedir+'/info.png" /></a>');
}
+ 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");
}
}
}
}
}
}
+ }
+ }
init=true;
}
@@ -600,9 +731,9 @@
<SCRIPT language="JavaScript" type="text/javascript">
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>');
- document.writeln('<a href="javascript:remove_wms()"><img src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>');
+ document.writeln('<a href="javascript:move_up()"><img title="'+msgObj.tooltipMoveSelectionUp+'" src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a>');
+ document.writeln('<a href="javascript:move_down()"><img title="'+msgObj.tooltipMoveSelectionDown+'" src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a>');
+ document.writeln('<a href="javascript:remove_wms()"><img title="'+msgObj.tooltipRemoveWms+'" src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>');
document.writeln("</div>");
}
</SCRIPT>
Modified: branches/tree_dev/http/javascripts/jsTree.js
===================================================================
--- branches/tree_dev/http/javascripts/jsTree.js 2008-09-18 12:58:42 UTC (rev 2975)
+++ branches/tree_dev/http/javascripts/jsTree.js 2008-09-18 13:11:52 UTC (rev 2976)
@@ -227,7 +227,7 @@
function _getState(tBody, path){
var hasSub = false
- for(var c = 0; c < tBody.childNodes.length; c++){
+ for(var c = 0; tBody!=null && c < tBody.childNodes.length; c++){
var tr = tBody.childNodes[c]
if(childExists(tr) && isExpanded(tr)){
_getState(tBody.childNodes[c + 1].childNodes[1].firstChild.firstChild, path + (path != "" ? jst_delimiter[0] : "") + tr.id)
@@ -306,45 +306,23 @@
var parts = path.split(jst_delimiter[0])
var arrData = null;
- for(var p = 0; p < parts.length; p++){
- arrData = eval(ps);
- for(var d = 0; d < arrData.length; d++){
- if(parts[p] == arrData[d][0]){
- if(p == parts.length - 1){
- eval(ps)[d][1][3]=Img;
- var nd = getDomNode(path);
- if(nd){
- var cb = nd.childNodes[1].childNodes[0];
- if(cb && cb.nodeName=="IMG"){
- if(Img)
- cb.src=jst_image_folder+"/"+Img;
- else if(eval(ps)[d][2]){
- if(childExists(nd)){
- var s = nd.nextSibling.style
- if(s.display == ""){
- cb.src = jst_image_folder + "/expanded_folder.png";
- }else{
- cb.src = jst_image_folder + "/closed_folder.png";
- }
- }else{
- cb.src = jst_image_folder + "/expanded_folder.png";
- }
- }
- else
- rebuildNode(path, true);
- }
- else
- rebuildNode(path, true);
- }
- return true
+ var nd = getDomNode(path);
+ if(nd){
+ var cb = nd.childNodes[1].childNodes[0];
+ if(cb && cb.nodeName=="IMG"){
+ if(Img)
+ cb.src=jst_image_folder+"/"+Img;
+ else if(childExists(nd)){
+ var s = nd.nextSibling.style
+ if(s.display == ""){
+ cb.src = jst_image_folder + "/expanded_folder.png";
}else{
- ps = ps + "[" + d + "][2]"
+ cb.src = jst_image_folder + "/closed_folder.png";
}
- break;
}
}
}
- return false
+ return true
}
function selectNode(path){
@@ -422,16 +400,17 @@
return true;
}
-function checkNode(path, ctrlNr, bChk){
+function checkNode(path, ctrlNr, bChk, triggerOnclick){
var nd = getDomNode(path)
+ if(typeof(triggerOnclick)=='undefined')
+ triggerOnclick = true;
if(nd){
var fc = nd.childNodes[1].firstChild;
if(fc && fc.nodeName=="IMG")ctrlNr++;
var cb = nd.childNodes[1].childNodes[ctrlNr];
if(cb && cb.nodeName=="INPUT"){
cb.checked = bChk;
- if(cb.onclick)cb.onclick();
-//TODO DataNode anpassen
+ if(cb.onclick&&triggerOnclick)cb.onclick();
return true;
}
}
@@ -446,7 +425,6 @@
var cb = nd.childNodes[1].childNodes[ctrlNr];
if(cb && cb.nodeName=="INPUT"){
cb.disabled = !pEnabled;
-//TODO DataNode anpassen
return true;
}
}
@@ -519,11 +497,11 @@
}
function childExists(tr){
- try{
- return tr.nextSibling.childNodes[1].firstChild.nodeName == "TABLE"
- }catch(e){
- return false
- }
+ var n = tr.nextSibling;
+ if(!n||n.childNodes.length<2)return false;
+ n=n.childNodes[1].firstChild;
+ if(!n)return false;
+ return n.nodeName == "TABLE";
}
function getPath(strData){
@@ -584,16 +562,12 @@
if(s.display == ""){
s.display = "none"
ctlImg.src = img1 + "closed.png"
- if(eval(strData.substr(0, strData.length-3)+"[1][3]"))
- fldImg.src = jst_image_folder + "/" + eval(strData.substr(0, strData.length-3)+"[1][3]");
- else
+ if(String(fldImg.src).indexOf("expanded")!=-1)
fldImg.src = jst_image_folder + "/closed_folder.png";
}else{
s.display = ""
ctlImg.src = img1 + "expanded.png"
- if(eval(strData.substr(0, strData.length-3)+"[1][3]"))
- fldImg.src = jst_image_folder + "/" + eval(strData.substr(0, strData.length-3)+"[1][3]");
- else
+ if(String(fldImg.src).indexOf("closed")!=-1)
fldImg.src = jst_image_folder + "/expanded_folder.png";
}
return
More information about the Mapbender_commits
mailing list