[Mapbender-commits] r2252 - in branches/nimix_dev/http: html javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Mar 14 07:07:58 EDT 2008


Author: nimix
Date: 2008-03-14 07:07:58 -0400 (Fri, 14 Mar 2008)
New Revision: 2252

Modified:
   branches/nimix_dev/http/html/mod_treefolder2.php
   branches/nimix_dev/http/javascripts/core.js
   branches/nimix_dev/http/javascripts/map.js
Log:
add experimental new event MapRequest failed for status in treefolder2

Modified: branches/nimix_dev/http/html/mod_treefolder2.php
===================================================================
--- branches/nimix_dev/http/html/mod_treefolder2.php	2008-03-14 11:05:17 UTC (rev 2251)
+++ branches/nimix_dev/http/html/mod_treefolder2.php	2008-03-14 11:07:58 UTC (rev 2252)
@@ -97,13 +97,15 @@
 //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']];
 
-parent.mb_registerloadWmsSubFunctions("window.frames['treeGDE'].reloadTree();");
-parent.mb_registerInitFunctions("window.frames['treeGDE'].loadTree();");
+parent.eventMapRequestFailed.register(function(t){imgerror(t)});
+
+parent.eventAfterLoadWMS.register(reloadTree);
+parent.eventInit.register(loadTree);
 if(showstatus=='true'||alerterror=='true'){
-	parent.mb_registerSubFunctions("window.frames['treeGDE'].init_mapcheck();");
+	parent.eventAfterMapRequest.register(init_mapcheck);
 	init_mapcheck();
 }
-parent.mb_registerSubFunctions("window.frames['treeGDE'].updateScale();");
+parent.eventAfterMapRequest.register(updateScale);
 if(wmsbuttons != "true")
 	jst_highlight = false;
 
@@ -209,11 +211,11 @@
 	}
 }
 
-function imgerror(){
+function imgerror(t){
 	var map=parent.getMapObjIndexByName(mod_treeGDE_map);
-	var wms=Number(this.id.substr(4));
-	this.onerror=null;
-	this.onabort=null;
+	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 "'+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?')){
@@ -243,8 +245,8 @@
 	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;
+//			parent.frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
+//			parent.frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
 	
 			if(showstatus=='true')
 				setNodeImage(img, "loading_folder.gif");

Modified: branches/nimix_dev/http/javascripts/core.js
===================================================================
--- branches/nimix_dev/http/javascripts/core.js	2008-03-14 11:05:17 UTC (rev 2251)
+++ branches/nimix_dev/http/javascripts/core.js	2008-03-14 11:07:58 UTC (rev 2252)
@@ -23,6 +23,11 @@
 var eventBeforeMapRequest = new MapbenderEvent();
 
 /**
+ * Triggered if map request fails
+ */
+var eventMapRequestFailed = new MapbenderEvent();
+
+/**
  * Triggered before the scale is calculated.
  */
 var eventBeforeGetScale = new MapbenderEvent();

Modified: branches/nimix_dev/http/javascripts/map.js
===================================================================
--- branches/nimix_dev/http/javascripts/map.js	2008-03-14 11:05:17 UTC (rev 2251)
+++ branches/nimix_dev/http/javascripts/map.js	2008-03-14 11:07:58 UTC (rev 2252)
@@ -767,14 +767,16 @@
 						newMapRequest += newMapURL;
 						mb_mapObj[i].mapURL[ii] = newMapURL;	
 						mb_mapObj[i].wms[ii].mapURL = newMapURL;
-						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'></div>";   
+						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height;
+						newMapRequest += "' onError='parent.eventMapRequestFailed.trigger(this);' onAbort='parent.eventMapRequestFailed.trigger(this);' border='0'></div>";   
 					}
 					else{
 						mb_mapObj[i].mapURL[ii] = false;
 						mb_mapObj[i].wms[ii].mapURL = false;
 						newMapRequest += "<div id='" + myDivId + "' style='position:absolute; top:0px; left:0px; z-index:" + ii + "'>";
 						newMapRequest += "<img id='"+myMapId+"' name='mapimage' src='" + mb_trans.src;
-						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
+						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height;
+						newMapRequest += "' onError='parent.eventMapRequestFailed.trigger(this);' onAbort='parent.eventMapRequestFailed.trigger(this);' border='0'>";
 						newMapRequest +="</div>";
 					}
 				}
@@ -876,13 +878,15 @@
 						newMapRequest += newMapURL;
 						mb_mapObj[i].mapURL[ii] = newMapURL;
 						mb_mapObj[i].wms[ii].mapURL = newMapURL;
-						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
+						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height;
+						newMapRequest += "' onError='parent.eventMapRequestFailed.trigger(this);' onAbort='parent.eventMapRequestFailed.trigger(this);' border='0'>";
 					}
 					else{
 						mb_mapObj[i].mapURL[ii] = false;
 						mb_mapObj[i].wms[ii].mapURL = false;
 						newMapRequest = "<img id='"+myMapId+"' name='mapimage' src='" + mb_trans.src;
-						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
+						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height;
+						newMapRequest += "' onError='parent.eventMapRequestFailed.trigger(this);' onAbort='parent.eventMapRequestFailed.trigger(this);' border='0'>";
 					}        
 					//prompt("",newMapRequest);
 					if(mb_log){
@@ -1019,7 +1023,9 @@
 				else if(path && validation){
 					newfeatureInfoRequest += requestParams;
 					try{
-						var p = new mb_popup("Feature Info","url:"+path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr,300,400);
+						var p = new mb_popup({title:"Feature Info",
+						url:path+"?url="+escape(newfeatureInfoRequest)+"&"+mb_nr,
+						width:300,height:400,balloon:true,left:x+parseInt(document.getElementById(fName).style.left),top:y+parseInt(document.getElementById(fName).style.top)});
 						p.show();
 					}catch(e){
 						window.open(path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr, "" , "width=300,height=400,scrollbars=yes,resizable=yes");
@@ -1029,8 +1035,12 @@
 				else if(validation){
 					newfeatureInfoRequest += requestParams;
 					try{
-						var p = new mb_popup("Feature Info","url:"+newfeatureInfoRequest,300,400);
+						var p = new mb_popup({title:"Feature Info",
+						url:newfeatureInfoRequest,balloon:true,
+						width:300,height:200,left:x+parseInt(document.getElementById(fName).style.left),top:y+parseInt(document.getElementById(fName).style.top)});
 						p.show();
+						//var p = new mb_popup("Feature Info","url:"+newfeatureInfoRequest,300,400);
+						//p.show();
 					}
 					catch(e){
 						window.open(newfeatureInfoRequest, "" , "width=300,height=400,scrollbars=yes,resizable=yes");					



More information about the Mapbender_commits mailing list