[Mapbender-commits] r4845 - trunk/mapbender/http/html

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Oct 21 03:58:08 EDT 2009


Author: christoph
Date: 2009-10-21 03:58:08 -0400 (Wed, 21 Oct 2009)
New Revision: 4845

Modified:
   trunk/mapbender/http/html/mod_treefolderPlain.php
Log:


Modified: trunk/mapbender/http/html/mod_treefolderPlain.php
===================================================================
--- trunk/mapbender/http/html/mod_treefolderPlain.php	2009-10-21 07:56:11 UTC (rev 4844)
+++ trunk/mapbender/http/html/mod_treefolderPlain.php	2009-10-21 07:58:08 UTC (rev 4845)
@@ -38,6 +38,62 @@
 msgObj.tooltipMoveSelectionDown = '<?php echo _mb("Moves the selection down");?>';
 msgObj.tooltipMetadata = '<?php echo _mb("Show metadata");?>';
 
+
+
+function localizeTree () {
+	var treefolderTitleArray = [];
+	var map = Mapbender.modules[mod_treeGDE_map];
+
+	if (map === null) {
+		return;
+	}
+	for(var i = 0; i < map.wms.length; i++) {
+		var currentWms = map.wms[i];
+		treefolderTitleArray.push({
+			title : currentWms.wms_title,
+			layer : []
+		});
+		
+		for (var j = 0; j < currentWms.objLayer.length; j++) {
+			var currentLayer = currentWms.objLayer[j];
+			treefolderTitleArray[treefolderTitleArray.length-1].layer.push({
+				title : currentLayer.layer_title
+			});
+		}
+	}
+
+	var req = new Mapbender.Ajax.Request({
+		url: "../php/mod_treefolder2_l10n.php",
+		method: "translateServiceData",
+		parameters: {
+			data: treefolderTitleArray
+		},
+		callback: function (obj, success, message) {
+			var translatedTitleArray = obj;
+			for (var i = 0; i < translatedTitleArray.length; i++) {
+				var currentWms = map.wms[i];
+				currentWms.wms_currentTitle = translatedTitleArray[i].title;
+				
+				for(var j = 0; j < currentWms.objLayer.length; j++) {
+					var currentLayer = currentWms.objLayer[j];
+					currentLayer.layer_currentTitle = translatedTitleArray[i].layer[j].title;
+				}
+			}
+			reloadTree();
+		}
+	});
+	req.send();
+}
+
+eventInit.register(function () {
+	localizeTree();
+});
+
+eventLocalize.register(function () {
+	localizeTree();
+});
+
+
 var jst_container = "document.getElementById('treeContainer')";
 var jst_image_folder = imagedir;
 var jst_display_root = false;
@@ -305,7 +361,7 @@
 	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?')){
+		if(confirm('Failed to Load WMS "'+ mb_mapObj[map].wms[wms].objLayer[0].layer_currentTitle+'" 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,"");
 		}
 	}
@@ -500,7 +556,7 @@
 		alert ("<?php echo _mb('Last WMS can not be removed.');?>");
 		return;
 	}
-	if(confirm('<?php echo _mb("Are you sure you want to remove");?>' + ' "'+ mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
+	if(confirm('<?php echo _mb("Are you sure you want to remove");?>' + ' "'+ mb_mapObj[j].wms[k].objLayer[l].layer_currentTitle+'"?')){
   		 mb_mapObjremoveWMS(j,k); 
 		 mb_mapObj[j].zoom(true, 1.0);
 		 mb_execloadWmsSubFunctions();	
@@ -603,7 +659,7 @@
 								controls=null;
 								if(switchwms=='true')controls='<INPUT type="checkbox" title="' + msgObj.tooltipHandleWms + '"  onclick="handleSelectedWMS(\''+parentNode+'|wms_'+ mb_mapObj[i].wms[ii].wms_id+'\');" />';
 								if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img alt="'+msgObj.tooltipMetadata+'" title="'+msgObj.tooltipMetadata+'" src="'+imagedir+'/info.png" /></a>';
-								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");
+								addNode(parentNode,["wms_"+ mb_mapObj[i].wms[ii].wms_id,[temp.layer_currentTitle,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_currentTitle,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")){
@@ -662,7 +718,7 @@
 									if(wmsbuttons == 'true'&&metadatalink == 'true'){
 										controls.push('<a href="javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');"><img alt="'+msgObj.tooltipMetadata+'" title="'+msgObj.tooltipMetadata+'" 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");
+									addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_currentTitle,((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_currentTitle,eval(c_menu),controls.join(""),[i,ii,iii]]],false,false,reverse=="true");
 								}
 							}
 						}



More information about the Mapbender_commits mailing list