[Mapbender-commits] r9667 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 23 10:55:00 PST 2017


Author: armin11
Date: 2017-01-23 10:55:00 -0800 (Mon, 23 Jan 2017)
New Revision: 9667

Modified:
   trunk/mapbender/http/plugins/mb_metadata_manager_select.js
   trunk/mapbender/http/plugins/mb_metadata_manager_server.php
Log:
New possibility to do a serverside filtering of metadata editor list (actual for datatables 1.9)

Modified: trunk/mapbender/http/plugins/mb_metadata_manager_select.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_manager_select.js	2017-01-23 17:09:56 UTC (rev 9666)
+++ trunk/mapbender/http/plugins/mb_metadata_manager_select.js	2017-01-23 18:55:00 UTC (rev 9667)
@@ -20,12 +20,19 @@
  */
 
 var $metadataManagerSelect = $(this);
-$metadataManagerSelect.prepend("<img src='../img/indicator_wheel.gif'>");
+//$metadataManagerSelect.prepend("<img src='../img/indicator_wheel.gif'>");
 
 var MetadataManagerSelectApi = function (o) {
 	var table = null;
+        var mainDivContainer;
+	var tableContainer;
+        var dataTable;
+	var confirmSearchabilityMessage;
+	var confirmExportMessage;
+	var confirmDeleteMessage;
 	var that = this;
 	var dataToEdit;
+	
 	var fnGetSelected = function (oTableLocal){
 		var aReturn = [];
 		var aTrs = oTableLocal.fnGetNodes();
@@ -36,33 +43,11 @@
 		}
 		return aReturn;
 	};
-	
-	this.getUserMetadata = function () {
-		var req = new Mapbender.Ajax.Request({
-			url: "../plugins/mb_metadata_manager_server.php",
-			method: "getUserMetadata",
-			parameters: {},
-			callback: function (obj, result, message) {
-				if (!result) {
-					return;
-				}
-				$("#manager_metadata").empty();
-				var emptyOption = '<option value="">---</option>';
-				$("#manager_metadata").append(emptyOption);
-				for ( var i=0 ; i<obj.length ; i++ ) {
-					var optionVal = obj[i].metadataId;
-	                		var optionName = obj[i].metadataId + " : " + obj[i].metadataTitle;
-	                		var optionHtml = "<option value='" + optionVal + "'>" + optionName + "</option>";
-	                		$("#manager_metadata").append(optionHtml);
-				}
-			}
-		});
-		req.send();
-	};
 
 	//function to delete metadata from cache
 	this.deleteMetadata = function(id) {
-		var checkDelete = confirm("Do you really want to delete this entry?");
+		//var checkDelete = confirm("Do you really want to delete this entry?");
+		var checkDelete = confirm(that.confirmDeleteMessage);
 		if(checkDelete) {
 			var req = new Mapbender.Ajax.Request({
 				url: "../plugins/mb_metadata_manager_server.php",
@@ -75,8 +60,7 @@
 					$("<div></div>").text(message).dialog({
 						modal: true
 					});
-					
-					that.reloadTable();
+					that.initTable();
 				}
 			});
 			req.send();
@@ -85,7 +69,8 @@
 
 	//function to toggle the searchability of metadata in mapbender catalogue
 	this.toggleSearchability = function(id) {
-		var checkToggle = confirm("Do you really want to change the searchability?");
+		//var checkToggle = confirm("Do you really want to change the searchability?");
+		var checkToggle = confirm(that.confirmSearchabilityMessage);
 		if(checkToggle) {
 			var req = new Mapbender.Ajax.Request({
 				url: "../plugins/mb_metadata_manager_server.php",
@@ -98,8 +83,8 @@
 					$("<div></div>").text(message).dialog({
 						modal: true
 					});
-					
-					that.reloadTable();
+					that.initTable();
+					//as from datatables 1.10 it will be easier - new function: .ajax.reload()
 				}
 			});
 			req.send();
@@ -108,7 +93,8 @@
 
 	//function to toggle the export of metadata from mapbender catalogue to external catalogues
 	this.toggleExport = function(id) {
-		var checkToggle = confirm("Do you really want to change the export handling for this metadata?");
+		//var checkToggle = confirm("Do you really want to change the export handling for this metadata?");
+		var checkToggle = confirm(that.confirmExportMessage);
 		if(checkToggle) {
 			var req = new Mapbender.Ajax.Request({
 				url: "../plugins/mb_metadata_manager_server.php",
@@ -117,133 +103,147 @@
 					"id": id
 				},
 				callback: function (obj, result, message) {
-			
 					$("<div></div>").text(message).dialog({
 						modal: true
 					});
-					
-					that.reloadTable();
+					that.initTable();
 				}
 			});
 			req.send();
 		}
 	};
 
-	this.reloadTable = function () {
+	/**
+ 	* @see http://stackoverflow.com/q/7616461/940217
+	 * @return {number}
+ 	*/
+	String.prototype.hashCode = function(){
+  	  if (Array.prototype.reduce){
+     	   return this.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0);              
+   	 } 
+   	 var hash = 0;
+   	 if (this.length === 0) return hash;
+   	 for (var i = 0; i < this.length; i++) {
+   	     var character  = this.charCodeAt(i);
+      	  hash  = ((hash<<5)-hash)+character;
+      	  hash = hash & hash; // Convert to 32bit integer
+   	 }
+   	 return hash;
+	}
+
+	this.generateUUID = function() {
+    		var d = new Date().getTime();
+    		if(window.performance && typeof window.performance.now === "function"){
+       		 d += performance.now(); //use high-precision timer if available
+    		}
+    		var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+       		 var r = (d + Math.random()*16)%16 | 0;
+        		d = Math.floor(d/16);
+        		return (c=='x' ? r : (r&0x3|0x8)).toString(16);
+    		});
+    		return uuid;
+	};
+
+	this.initTable = function() {
+		//initialize table object with jquery from ajax call to serverside script with translated headers!
+		mainDivContainer = $("#mb_metadata_manager_select");
+		//get attribute from object?
+		mainDivContainer.empty();
+		tableContainer = $(document.createElement('table'));
+		tableHeaderContainer = $(document.createElement('thead'));
+		tableHeaderRowContainer = $(document.createElement('tr'));
+		tableContainer.attr({'id':'metadataTable'});
+		mainDivContainer.append(tableContainer);
+		//call translations
 		var req = new Mapbender.Ajax.Request({
 			url: "../plugins/mb_metadata_manager_server.php",
-			method: "getUserMetadata",
+			method: "getHeader",
+			async: false,
 			parameters: {
+				"lang": "de"
 			},
 			callback: function (obj, result, message) {
-				if (!result) {
-					return;
-				}
-				//delete old entries
-				table.fnClearTable();
-
-				var aoColumns = [];
-				for (var i in obj.header) {
-					if (obj.header[i] === "Metadata ID") {
-						continue;
+				if (result) {
+					for (var i in obj.header) { 
+						content = '<td>' + obj.header[i] + '</td>';
+						tableHeaderRowContainer.append(content);
 					}
-					aoColumns.push({"sTitle": obj.header[i]});
+					tableContainer.append(tableHeaderContainer.append(tableHeaderRowContainer));
+					//initialize table
+					//define translations for confirm messages
+					$.each(obj.translation, function(k, v) {
+						that[k] = v;
+					});
+				} else {
+					$("<div></div>").text(message).dialog({
+						modal: true
+					});
 				}
 				
-				// add rows
-				for (var j in obj.data) {
-					var data = obj.data[j];
-					var metadataId = data[0];
-					data.shift();
-					var index = table.fnAddData(data);
-					var rowNode = table.fnGetNodes(index[0]);
-					$(rowNode).data("metadataId", metadataId);
-				}
-				
-				
-				
-				// add functionality to delete button
-				$(".deleteImg").click(function (e) {
-					var id = $(this).parents("tr").data("metadataId");
-					that.deleteMetadata(id);
-					return false;
-				});
-				// add functionality to toogle export button
-				$(".toggleExport").click(function (e) {
-					var id = $(this).parents("tr").data("metadataId");
-					that.toggleExport(id);
-					return false;
-				});
-				// add functionality to toogle search button
-				$(".toggleSearchability").click(function (e) {
-					var id = $(this).parents("tr").data("metadataId");
-					that.toggleSearchability(id);
-					return false;
-				});
-
-				//add functionality to show metadata links in a modal dialog
-				/*$(".modalDialog").click(function (e) {
-					//alert($(this).attribute("url"));
-					//alert("test");
-					//var id = $(this).parents("tr").data("schedulerId");
-					return false;
-				});*/
 			}
 		});
 		req.send();
-	};
-
-	this.getData = function () {
-		var req = new Mapbender.Ajax.Request({
-			url: "../plugins/mb_metadata_manager_server.php",
-			method: "getUserMetadata",
-			parameters: {
+		//fill table with incremental serverside selects
+		var ReqId = new String(this.generateUUID()).hashCode();
+    		dataTable = $('#metadataTable').dataTable( {
+                        "bProcessing": true,
+        		"bServerSide": true,
+			"bOrdering": false,
+			"columnDefs": [ {
+				"targets": [0,1,2,3],
+				"orderable": false
+			} ],
+			/*"columnDefs": [
+    				{ "orderable": false },
+				{ "orderable": false },
+				{ "orderable": false },
+				{ "orderable": false, "targets": 3 },
+				{ "orderable": false, "targets": 4 },
+				{ "orderable": false, "targets": 5 },
+				{ "orderable": false, "targets": 6 },
+				{ "orderable": false, "targets": 7 },
+				{ "orderable": false, "targets": 8 },
+				{ "orderable": false, "targets": 9 }
+  			],*/
+			"fnServerParams": function ( aoData ) {
+				var params = {}; //JSON.stringify(aoData);
+				for(var i in aoData) {
+					if (aoData[i].name == 'sEcho') {
+						params[aoData[i].name] =  String(aoData[i].value);
+					} else {
+						params[aoData[i].name] =  aoData[i].value;
+					}
+				}				
+      				aoData.push( { "name": "method", "value": "loadTableIncremental"} );
+				aoData.push( { "name": "id", "value": ReqId} );
+				//not nice but usefull for mapbenders ajax handler
+				aoData.push( { "name": "params", "value": JSON.stringify(params)} );
+    			},
+        		"sAjaxSource": "../plugins/mb_metadata_manager_server.php",
+			"sAjaxDataProp": "result.data.aaData",
+			"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
+      				oSettings.jqXHR = $.ajax( {
+        				"dataType": 'json',
+        				"type": "POST",
+        				"url": sSource,
+        				"data": aoData,
+					"success": fnCallback
+      				} );
 			},
-			callback: function (obj, result, message) {
-				if (!result) {
-					return;
-				}
-				$metadataManagerSelect.find("img").remove();
-				
-				var aoColumns = [];
-				for (var i in obj.header) {
-					if (obj.header[i] === "Metadata ID") {
-						continue;
-					}
-					aoColumns.push({"sTitle": obj.header[i]});
-				}
-
-				// initialize datatables
-				table = $metadataManagerSelect.find("table").dataTable({
-					//oLanguage: {
-        				//	sProcessing: "<img src='../img/indicator_wheel.gif'>"
-    					//},
-    					bProcessing : true,
-					"aoColumns": aoColumns,
-					"bJQueryUI": true
-				});
-				
-				//add button to add new entries to dataTables
-
-				//$("#mb_metadata_manager_select").append("<input type='button' id='newScheduleEntry' value='New entry'>");
-				//$("#newScheduleEntry").click(that.addWmsSchedule);
-				
-				// add rows
-				for (var j in obj.data) {
-					var data = obj.data[j];
-					var metadataId = data[0];
-					data.shift();
-					var index = table.fnAddData(data);
-					var rowNode = table.fnGetNodes(index[0]);
-					$(rowNode).data("metadataId", metadataId);
-				}
-							
+			"fnCreatedRow": function( nRow, aData, iDataIndex ) {
+      				// define a metadataId to row
+				var metadataId = aData[0];
+				//data.shift();
+				//var rowNode = table.fnGetNodes(iDataIndex);
+				$(nRow).data("metadataId", metadataId);
+    			},
+			"fnDrawCallback": function( oSettings ) {
 				// add functionality to delete button
 				$(".deleteImg").click(function (e) {
 					var id = $(this).parents("tr").data("metadataId");
 					that.deleteMetadata(id);
 					return false;
-				});			
+				});
 				// add functionality to toogle export button
 				$(".toggleExport").click(function (e) {
 					var id = $(this).parents("tr").data("metadataId");
@@ -256,11 +256,11 @@
 					that.toggleSearchability(id);
 					return false;
 				});
-			}
-		});
-		req.send();
+    			},
+			"bJQueryUI": true
+    		} );
 	};
-	
+
 	this.events = {
 		selected: new Mapbender.Event()
 	};
@@ -268,4 +268,4 @@
 
 $metadataManagerSelect.mapbender(new MetadataManagerSelectApi(options));
 
-$metadataManagerSelect.mapbender("getData");
+$metadataManagerSelect.mapbender("initTable");

Modified: trunk/mapbender/http/plugins/mb_metadata_manager_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_manager_server.php	2017-01-23 17:09:56 UTC (rev 9666)
+++ trunk/mapbender/http/plugins/mb_metadata_manager_server.php	2017-01-23 18:55:00 UTC (rev 9667)
@@ -13,6 +13,87 @@
 	die();
 };
 
+function validateType($variable, $value) {
+	$startString = substr($variable, 0, 1);
+	switch ($startString) {
+		case "s":
+			if (is_string($value)) {
+				return true;
+			} else {
+				return false;
+			}
+			break;
+		case "i":
+			if (is_int($value)) {
+				return true;
+			} else {
+				return false;
+			}
+			break;
+		case "b":
+			if ($value == true || $value == false) {
+				return true;
+			} else {
+				return false;
+			}
+			break;
+		default: 
+			return false;
+			break;
+	}
+};
+
+//parse row (array) from database to new array - change some of the values and add some further
+function parseMetadataRow($row, $withOutFirstColumn = false) {
+	//convert NULL to '', NULL values cause datatables to crash
+	$walk = array_walk($row, create_function('&$s', '$s=strval($s);'));
+	//preview with uuid
+	$row[0] = $row[0];
+	$row[1] = $row[1];
+	$row[2] = "<a class='modalDialog' target='_blank' id='metadata_".$row[0]."' href='../php/mod_exportIso19139.php?url=".urlencode(MAPBENDER_PATH."/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row[2])."'>".$row[2]."</a>";
+	$row[3] = $row[3];
+	$row[4] = $row[4];
+	$coupledResourceRow = 5;
+	$coupledResources = json_decode($row[$coupledResourceRow]);
+	$row[$coupledResourceRow] = "";
+	//get layer list
+	$numberLayers = 0;
+	foreach ($coupledResources->coupledResources->layerIds as $layerId) {
+		$row[$coupledResourceRow] .= "<a class='modalDialog' target='_blank' id='layer_".$row[0]."_".$numberLayers."' href='../php/mod_showMetadata.php?languageCode=de&resource=layer&id=".$layerId."'>".$layerId."</a>".", ";
+		$numberLayers++;
+	}
+	$row[$coupledResourceRow] = rtrim($row[$coupledResourceRow], ', ');
+	//generate column for featuretypes - problem: row has to be inserted after !!!!
+	//#6
+	array_splice($row, $coupledResourceRow+1, 0, "");
+	$row[$coupledResourceRow+1] = "";
+	//get featuretype list
+	$numberFeaturetypes = 0;
+	foreach ($coupledResources->coupledResources->featuretypeIds as $featuretypeId) {
+		$row[$coupledResourceRow+1] .= "<a class='modalDialog'  target='_blank' id='featuretype_".$row[0]."_".$numberFeaturetypes."' href='../php/mod_showMetadata.php?languageCode=de&resource=featuretype&id=".$featuretypeId."'>".$featuretypeId."</a>".", ";
+		$numberFeaturetypes++;
+	}
+	$row[$coupledResourceRow+1] = rtrim($row[$coupledResourceRow+1], ', ');
+	//add column for defining searchability
+	if ($row[7] == "t") {
+		$row[7] = "<input style='cursor:pointer;' class='toggleSearchability' title='"._mb("Toggle searchability")."' type='checkbox' checked/>";
+	} else {
+		$row[7] = "<input style='cursor:pointer;' class='toggleSearchability' title='"._mb("Toggle searchability")."' type='checkbox'/>";
+	}
+	if ($row[8] == "t") {
+		$row[8] = "<input style='cursor:pointer;' class='toggleExport' title='"._mb("Toggle catalogue export")."' type='checkbox' checked/>";
+	} else {
+		$row[8] = "<input style='cursor:pointer;' class='toggleExport' title='"._mb("Toggle catalogue export")."' type='checkbox'/>";
+	}
+	//add column for deleting metadata
+	$row[] = "<img style='cursor:pointer;' class='deleteImg' title='"._mb("Delete")."' src='../img/cross.png' />";
+	if ($withOutFirstColumn == true) {
+		$newRow = array($row[1],$row[2],$row[3],$row[4],$row[5],$row[6],$row[7],$row[8],$row[9]);
+		$row = $newRow;
+	}
+	return $row;
+}
+
 function getMetadata ($metadataId = null) {
 	$user = new User(Mapbender::session()->get("mb_user_id"));
 	$metadataIdArray = $user->getOwnedMetadata();
@@ -26,6 +107,7 @@
 
 $user = new User(Mapbender::session()->get("mb_user_id"));
 
+//$e = new mb_exception("method param: ".$ajaxResponse->getMethod());
 switch ($ajaxResponse->getMethod()) {	
 	case "toggleSearchability" :
 		$id = $ajaxResponse->getParameter("id");
@@ -179,78 +261,103 @@
 		$ajaxResponse->setMessage(_mb("Metadata deleted!"));
 		$ajaxResponse->setSuccess(true);
 		break;
-	case "getUserMetadata" :
-		//TODO: why double???
-		$metadataIdArray = getMetadata();		
+	case "getHeader" :
+		$header = array(
+			_mb("ID"),
+			_mb("UUID"),
+			_mb("Title"),
+			_mb("Last changed"),
+			_mb("Layers"),
+			_mb("Featuretypes"),
+			_mb("Searchability"),
+			_mb("Catalogue export"),
+			_mb("Delete")
+		);
+		$translation = array(
+			"confirmSearchabilityMessage" => _mb('Do you really want to change the searchability?'),
+			"confirmExportMessage" => _mb('Do you really want to change the export handling for this metadata?'),
+			"confirmDeleteMessage" => _mb('Do you really want to delete this entry?')
+		);
+		$resultObj['header'] = $header;
+		$resultObj['translation'] = $translation;
+		$ajaxResponse->setResult($resultObj);
+		$ajaxResponse->setSuccess(true);
+		
+		break;
+	case "loadTableIncremental": 
+		//defaults to server side handling
+		//use datatables serverside api: http://legacy.datatables.net/usage/server-side (version <= 1.9!!!)
+		//parse relevant ajax variables (they also available in params var - cause mapbenders ajax class demand this):
+		$ajaxVariables = array("sEcho","iDisplayLength","iDisplayStart","iColumns","sSearch","sSearch_1","bSortable_1","iSortingCols","iSortCol_1","sSortDir_1","sEcho");
+		foreach($ajaxVariables as $variable) {
+			//validate type
+			if (validateType($variable, $ajaxResponse->getParameter($variable)) == true) {
+				${$variable} = $ajaxResponse->getParameter($variable);
+			}
+		}
+		//first count all records for this user
+		$metadataIdArray = getMetadata();
+		$highLevelObj["iTotalRecords"] = count($metadataIdArray);	
+		$highLevelObj["iTotalDisplayRecords"] = count($metadataIdArray);	
+		$highLevelObj["sEcho"] = $sEcho;
+		//do the sql with limit and offset
 		$metadataList = implode(",", $metadataIdArray);
-	
-$sql = <<<SQL
+		//initialize parameter arrays
+		$v = array();
+		$t = array();
+		$vCount = array();
+		$tCount = array();
+		$numberOfVariables = 0;
+$sqlCount = <<<SQL
 
-	SELECT metadata_id, metadata_id as id, uuid, title, lastchanged, f_get_coupled_resources(metadata_id), searchable, export2csw FROM mb_metadata WHERE mb_metadata.metadata_id IN ($metadataList) ORDER BY metadata_id;
+	SELECT count(metadata_id) FROM mb_metadata WHERE (mb_metadata.metadata_id IN ($metadataList)
 
 SQL;
-		$res = db_query($sql);
-		$resultObj = array(
-			"header" => array(
-				_mb("Metadata ID"),
-				_mb("ID"),
-				_mb("UUID"),
-				_mb("Title"),
-				_mb("Last changed"),
-				_mb("Layers"),
-				_mb("Featuretypes"),
-				_mb("Searchability"),
-				_mb("Catalogue export"),
-				_mb("Delete")
-			), 
-			"data" => array()
-		);
+
+$sqlAll = <<<SQL
+
+	SELECT metadata_id as metadata_id, metadata_id as id, uuid, title, lastchanged, f_get_coupled_resources(metadata_id), searchable, export2csw FROM mb_metadata WHERE  (mb_metadata.metadata_id IN ($metadataList)
+
+SQL;
+		if (isset($sSearch)) {
+			$sSearch = "%".$sSearch."%";
+			$numberOfVariables++;
+			//$e = new mb_exception("search: ".$sSearch." - type: ".gettype($sSearch));
+			$v[] = $sSearch;
+			$vCount[] = $sSearch;
+			$t[] = 's';
+			$tCount[] = 's';
+			$sqlCount .= "AND title LIKE $".$numberOfVariables;
+			$sqlAll .= "AND title LIKE $".$numberOfVariables;
+		}
+		$sqlCount .= ")";
+		$sqlAll .= ") ORDER BY lastchanged DESC";
+		if (isset($iDisplayLength)) {
+			$numberOfVariables++;
+			//$e = new mb_exception("length: ".$iDisplayLength);
+			$v[] = $iDisplayLength;
+			$t[] = 'i';
+			$sqlAll .= " LIMIT $".$numberOfVariables;
+			
+		}
+		if (isset($iDisplayStart)) {
+			$numberOfVariables++;
+			//$e = new mb_exception("start: ".$iDisplayStart);
+			$v[] = $iDisplayStart;
+			$t[] = 'i';
+			$sqlAll .= " OFFSET $".$numberOfVariables;
+		}
+		//do count after filtering
+		$res = db_prep_query($sqlCount, $vCount, $tCount);
+		$row = db_fetch_assoc($res);
+		$highLevelObj["iTotalDisplayRecords"] = (integer)$row['count'];  
+		$res = db_prep_query($sqlAll, $v, $t);
+		$withOutFirstColumn = true;
 		while ($row = db_fetch_row($res)) {
-		    	//convert NULL to '', NULL values cause datatables to crash
-			$walk = array_walk($row, create_function('&$s', '$s=strval($s);'));
-			//preview with uuid
-			$row[0] = $row[0];
-			$row[1] = $row[1];
-			$row[2] = "<a class='modalDialog' target='_blank' id='metadata_".$row[0]."' href='../php/mod_exportIso19139.php?url=".urlencode(MAPBENDER_PATH."/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row[2])."'>".$row[2]."</a>";
-			$row[3] = $row[3];
-			$row[4] = $row[4];
-			$coupledResourceRow = 5;
-			$coupledResources = json_decode($row[$coupledResourceRow]);
-			$row[$coupledResourceRow] = "";
-			//get layer list
-			$numberLayers = 0;
-			foreach ($coupledResources->coupledResources->layerIds as $layerId) {
-				$row[$coupledResourceRow] .= "<a class='modalDialog' target='_blank' id='layer_".$row[0]."_".$numberLayers."' href='../php/mod_showMetadata.php?languageCode=de&resource=layer&id=".$layerId."'>".$layerId."</a>".",";
-				$numberLayers++;
-			}
-			$row[$coupledResourceRow] = rtrim($row[$coupledResourceRow], ',');
-			//generate column for featuretypes - problem: row has to be inserted after !!!!
-			//#6
-			array_splice($row, $coupledResourceRow+1, 0, "");
-			$row[$coupledResourceRow+1] = "";
-			//get featuretype list
-			$numberFeaturetypes = 0;
-			foreach ($coupledResources->coupledResources->featuretypeIds as $featuretypeId) {
-				$row[$coupledResourceRow+1] .= "<a class='modalDialog'  target='_blank' id='featuretype_".$row[0]."_".$numberFeaturetypes."' href='../php/mod_showMetadata.php?languageCode=de&resource=featuretype&id=".$featuretypeId."'>".$featuretypeId."</a>".",";
-				$numberFeaturetypes++;
-			}
-			$row[$coupledResourceRow+1] = rtrim($row[$coupledResourceRow+1], ',');
-			//add column for defining searchability
-			if ($row[7] == "t") {
-				$row[7] = "<input style='cursor:pointer;' class='toggleSearchability' title='"._mb("Toggle searchability")."' type='checkbox' checked/>";
-			} else {
-				$row[7] = "<input style='cursor:pointer;' class='toggleSearchability' title='"._mb("Toggle searchability")."' type='checkbox'/>";
-			}
-			if ($row[8] == "t") {
-				$row[8] = "<input style='cursor:pointer;' class='toggleExport' title='"._mb("Toggle catalogue export")."' type='checkbox' checked/>";
-			} else {
-				$row[8] = "<input style='cursor:pointer;' class='toggleExport' title='"._mb("Toggle catalogue export")."' type='checkbox'/>";
-			}
-			//add column for deleting metadata
-			$row[] = "<img style='cursor:pointer;' class='deleteImg' title='"._mb("Delete")."' src='../img/cross.png' />";
-			$resultObj["data"][]= $row;
+			$resultObj["aaData"][] = parseMetadataRow($row, $withOutFirstColumn);
 		}
-        	$ajaxResponse->setResult($resultObj);
+		$ajaxResponse->setResult($resultObj);
+		$ajaxResponse->setHighLevelAttributes($highLevelObj);
 		$ajaxResponse->setSuccess(true);
 		break;
 	default: 



More information about the Mapbender_commits mailing list