[Mapbender-commits] r5319 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 13 08:03:44 EST 2010


Author: verenadiewald
Date: 2010-01-13 08:03:44 -0500 (Wed, 13 Jan 2010)
New Revision: 5319

Modified:
   trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php
Log:
removed old result list functionality and jq_upload

Modified: trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php	2010-01-13 12:59:22 UTC (rev 5318)
+++ trunk/mapbender/http/javascripts/mod_wfs_gazetteer_client.php	2010-01-13 13:03:44 UTC (rev 5319)
@@ -1184,7 +1184,6 @@
 						if (typeof(geoObj) == 'object') {
 			        		geomArray.importGeoJSON(geoObj);
 			        		document.getElementById("res").innerHTML = '';
-							displayResult(geomArray);
 							
 							parent.Mapbender.modules.gazetteerWFS.receiveFeatureCollection.trigger(geoObj);
 							
@@ -1192,16 +1191,10 @@
 							resultList.clear();
 							resultList.setWFSconf(global_wfsConfObj[global_selectedWfsConfId]);
 							resultList.addFeatureCollection(geoObj);
-							var popup = function(feature){
-								 alert(feature.e.getElementValueByName('firstname'))
-							 };
-							resultList.addPopupButton({"title":"CLICKME", "callback":popup});
-							resultList.addRowButton({"title":"ImAButton", "callback":popup, "index":-1});
 							resultList.show(); 
 						}
 						else {
 							document.getElementById("res").innerHTML = '';
-							displayResult();
 							parent.Mapbender.modules.gazetteerWFS.receiveFeatureCollection.trigger(null);
 						}
 					}
@@ -1221,224 +1214,6 @@
 	return false;
 }
 
-function displayResult(geom){
-	geomArray = geom;
-	if(geomArray!=null && geomArray.count()>0){
-		var contentHtml = createListOfGeometries();
-	}
-	else{
-		var contentHtml = "No results.";
-	}
-	
-	if(showResultInPopup==1){
-		if (typeof(resultGeometryPopup) == "undefined") {
-			resultGeometryPopup = new parent.mb_popup(searchPopupTitle,contentHtml,searchPopupWidth,searchPopupHeight,searchPopupX,searchPopupY);
-		}
-		else {
-			resultGeometryPopup.destroy();
-			resultGeometryPopup = new parent.mb_popup(searchPopupTitle,contentHtml,searchPopupWidth,searchPopupHeight,searchPopupX,searchPopupY);
-		}
-		resultGeometryPopup.show();
-		parent.$("#resultTable").tablesorter({
-     		sortList: [[0,0]],
-     		widgets: ['zebra'] 
-        });
-	}
-	else{
-		document.getElementById("res").innerHTML = contentHtml;
-	}
-} 
-
-function createListOfGeometries(){
-	if(showResultInPopup==1){
-		var domPath = "window.frames['"+frameName+"'].";
-	}
-	else{
-		var domPath = "";
-	}
-	var listOfGeom = "<form name='resultListForm'><table class='tablesorter' id='resultTable'>\n";
-	var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
-	var labelArray = [];
-	if (geomArray.count() > 0) {
-				
-		if(showResultInPopup==1){
-			listOfGeom += "<thead><tr>";
-			var labelObj = getListTitle();
-			for (var k = 1 ; k < labelObj.length; k ++) {
-				listOfGeom += "<th>";
-				listOfGeom += labelObj[k];
-				listOfGeom += "</th>";
-			}
-			listOfGeom += "</tr></thead>";
-		}
-		listOfGeom += "<tbody>";				
-		for (var i = 0 ; i < geomArray.count(); i ++) {
-			if (geomArray.get(i).get(-1).isComplete()) {
-				listOfGeom += "<tr>\n";
-				var resultElObj = getListValues(geomArray.get(i));
-				for (var l = 1 ; l < resultElObj.length; l ++) {
-					if(resultElObj[l]!=''){
-						listOfGeom += "<td style='cursor:pointer;\n";
-						if(showResultInPopup==1){
-							if ((i % 2) === 0) {
-								listOfGeom += "' class='even'";
-							}
-							else {
-								listOfGeom += "' class='odd'";
-							}
-						}
-						else{
-							if ((i % 2) === 0) {
-								listOfGeom += "' class='even'";
-							}
-							else {
-								listOfGeom += "' class='uneven'";
-							}
-						}
-						listOfGeom += " onmouseover=\""+domPath+"setResult('over',"+i+")\" ";
-						listOfGeom += " onmouseout=\""+domPath+"setResult('out',"+i+")\" ";
-						listOfGeom += " onclick=\""+domPath+"setResult('click',"+i+"); "+domPath+"showWfs("+i+");\" ";
-						listOfGeom += ">"+ resultElObj[l] +"</td>";
-					}
-				}	
-				listOfGeom += "\t</tr>\n"; 
-			}
-		}
-	}
-	listOfGeom += "</tbody></table></form>\n";
-	return listOfGeom; 
-}
-
-function getListTitle(){
-	var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
-	var labelArray = [];
-	for (var j = 0 ; j < wfsConf.element.length ; j++) {
-		if(wfsConf.element[j].f_show == 1 && wfsConf.element[j].f_label!=''){
-			var labelPos = wfsConf.element[j].f_respos;
-			labelArray[labelPos] = wfsConf.element[j].f_label;
-		}
-	}
-	return labelArray;
-}
-		
-function getListValues(geom){
-	var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
-	var resultArray = [];
-	for (var i = 0 ; i < wfsConf.element.length ; i++) {
-		if (wfsConf.element[i].f_show == 1 && geom.e.getElementValueByName(wfsConf.element[i].element_name) !=false) {
-			var pos = wfsConf.element[i].f_respos;
-			if(pos>0){
-				resultArray[pos] = geom.e.getElementValueByName(wfsConf.element[i].element_name);
-			}
-		}
-	}
-	return resultArray;
-}
-
-function showWfs(geometryIndex) {
-	var wfsConf = global_wfsConfObj[global_selectedWfsConfId];
-	var wfsElement = geomArray.get(geometryIndex).e;
-	var showDetailsObj = [];
-	var details = 0;
-	for (var i = 0 ; i <wfsConf.element.length; i ++) {
-		if(wfsConf.element[i].f_show_detail == 1 && wfsElement.getElementValueByName(wfsConf.element[i].element_name)!=''){
-			var elPos = wfsConf.element[i].f_detailpos;
-			if(elPos>0){
-				var currentObj = {};
-//				showDetailsObj[elPos] = {};
-				currentObj.elPos = elPos;
-				currentObj.data = {};
-				//var elementVal = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
-				//showDetailsObj[elPos][wfsConf.element[i].f_label] = elementVal;
-				if(wfsConf.element[i].f_form_element_html.indexOf("href")!=-1){
-					var newPath = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
-					var setUrl = wfsConf.element[i].f_form_element_html.replace(/href\s*=\s*['|"]\s*['|"]/, "href='"+newPath+"' target='_blank'");
-					if(setUrl.match(/><\/a>/)){
-						var newLink	=	setUrl.replace(/><\/a>/, ">"+wfsElement.getElementValueByName(wfsConf.element[i].element_name)+"</a>");
-					}
-					else{
-						var newLink = setUrl;
-					}
-					if(openLinkFromSearch=='1'){
-						window.open(elementVal, elementVal,"width=500, height=400,left=100,top=100,scrollbars=yes");
-					}
-//					showDetailsObj[elPos][wfsConf.element[i].f_label] =  newLink;
-					currentObj.data[wfsConf.element[i].f_label] = newLink;
-				}
-				else{
-//					showDetailsObj[elPos][wfsConf.element[i].f_label] = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
-					currentObj.data[wfsConf.element[i].f_label] = wfsElement.getElementValueByName(wfsConf.element[i].element_name);
-				}
-				showDetailsObj.push(currentObj);
-			}
-		}
-	}
-	var resultHtml = "";
-	resultHtml += "<table style='background-color:#EEEEEE;'>\n";
-
-	showDetailsObj.sort(showDetailObjSort);
-	for (var i=0; i < showDetailsObj.length; i++) {
-//		var currentDetail = showDetailsObj[elPos];
-		var currentDetail = showDetailsObj[i].data;
-		for(var key in currentDetail){
-			var currentDetailName = key;
-			var currentDetailValue = currentDetail[key];
-			resultHtml +="<tr><td>\n"; 
-			resultHtml += currentDetailName;
-			resultHtml +="</td>\n"; 
-			resultHtml += "<td>\n";
-			resultHtml += currentDetailValue;
-			resultHtml += "</td></tr>\n";
-		}
-	}
-	resultHtml += "</table>\n";
-	if(showResultInPopup==1 && showDetailsObj.length > 0){
-		if (typeof(wfsPopup) == "undefined") {
-			wfsPopup = new parent.mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
-		}
-		else {
-			wfsPopup.destroy();
-			wfsPopup = new parent.mb_popup(detailPopupTitle,resultHtml,detailPopupWidth,detailPopupHeight,detailPopupX,detailPopupY);
-		}
-		wfsPopup.show();
-	}
-}
-
-function showDetailObjSort (a, b) {
-	return (parseInt(a.elPos) - parseInt(b.elPos));
-}
-
-/*
-* event -> {over || out || click}
-* geom -> commaseparated coordinates x1,y1,x2,y2 ...
-*/
-function setResult(event, index){
-	var currentGeom = geomArray.get(index);
-	if (maxHighlightedPoints > 0 && currentGeom.getTotalPointCount() > maxHighlightedPoints) {
-		currentGeom = currentGeom.getBBox4();
-	}
-	if (event == "over") {
-		global_resultHighlight.add(currentGeom, generalHighlightColor);
-		global_resultHighlight.paint();
-	}
-	else if (event == "out"){
-		global_resultHighlight.del(currentGeom, generalHighlightColor);
-		global_resultHighlight.paint();
-	}
-	else if (event == "click"){
-		global_resultHighlight.del(currentGeom, generalHighlightColor);
-		var bbox = currentGeom.getBBox();
-		var bufferFloat = parseFloat(global_wfsConfObj[global_selectedWfsConfId].g_buffer);
-		var buffer = new parent.Point(bufferFloat,bufferFloat);
-		bbox[0] = bbox[0].minus(buffer);
-		bbox[1] = bbox[1].plus(buffer);
-		parent.mb_calculateExtent(targetArray[0], bbox[0].x, bbox[0].y, bbox[1].x, bbox[1].y);
-		parent.zoom(targetArray[0], 'true', 1.0);
-		global_resultHighlight.add(currentGeom, generalHighlightColor);
-		global_resultHighlight.paint();
-	}
-	return true;
-}
 function callPick(obj){
 	dTarget = obj;
 	var dp = window.open('../tools/datepicker/datepicker.php?m=Jan_Feb_Mar_Apr_May_June_July_Aug_Sept_Oct_Nov_Dec&d=Mon_Tue_Wed_Thu_Fri_Sat_Sun&t=today','dp','left=200,top=200,width=230,height=210,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0');
@@ -1447,31 +1222,6 @@
 }
 
 </script>
-<script src="../extensions/jquery-1.3.2.min.js"></script>
-<script src="../plugins/jq_upload.js"></script>
-<script type="text/javascript">
-$(document).ready(function(){
-	$('#uploader').upload({callback: function(result,stat,msg){
-		var resulturl = "../tmp/"+result;
-		$.get( resulturl, function(result, textMessage){
-			var geoObj = eval('(' + result + ')');	
-			geomArray.importGeoJSON(geoObj);
-			document.getElementById("res").innerHTML = '';
-			//parent.Mapbender.modules.gazetteerWFS.receiveFeatureCollection.trigger(geoObj);
-			parent.Mapbender.modules.resultList.clear();
-			parent.Mapbender.modules.resultList.setWFSconf(global_wfsConfObj[global_selectedWfsConfId]);
-			parent.Mapbender.modules.resultList.addFeatureCollection(geoObj);
-			var popup = function(feature){
-				 alert(feature.e.getElementValueByName('firstname'))
-			 };
-			parent.Mapbender.modules.resultList.addPopupButton({"title":"CLICKME", "callback":popup});
-			parent.Mapbender.modules.resultList.addRowButton({"title":"ImAButton", "callback":popup, "index":-1});
-			parent.Mapbender.modules.resultList.show(); 
-		
-		 })
-	}})
-})
-</script>
 </head>
 <body>
 <form name='selectWfsConfForm' id='selectWfsConfForm'></form>



More information about the Mapbender_commits mailing list