[Mapbender-commits] r9224 - trunk/mapbender/http/geoportal

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jun 22 12:08:26 PDT 2015


Author: armin11
Date: 2015-06-22 12:08:26 -0700 (Mon, 22 Jun 2015)
New Revision: 9224

Added:
   trunk/mapbender/http/geoportal/search_functions_dienste.php
   trunk/mapbender/http/geoportal/start_search.php
Log:
tests for cms coupling

Added: trunk/mapbender/http/geoportal/search_functions_dienste.php
===================================================================
--- trunk/mapbender/http/geoportal/search_functions_dienste.php	                        (rev 0)
+++ trunk/mapbender/http/geoportal/search_functions_dienste.php	2015-06-22 19:08:26 UTC (rev 9224)
@@ -0,0 +1,663 @@
+<?php
+function Dienste($file, $max=0) {
+	global $out, $name, $startpage, $L, $page, $items_page, $ServiceCat;
+	global $unique;
+	global $OrigURL;
+	global $counter;
+	global $searchResources;
+	global $filterResources;
+	global $Wappen;
+	global $LinkURL;
+	global $admin;
+
+	$Wappen=array(
+		'DE',
+		'DE-RP',
+		'DE-BE',
+		'DE-BR',
+		'DE-BW',
+		'DE-BY',
+		'DE-HB',
+		'DE-HE',
+		'DE-HH',
+		'DE-MV',
+		'DE-NI',
+		'DE-NW',
+		'DE-SH',
+		'DE-SL',
+		'DE-SN',
+		'DE-ST',
+		'DE-TH',
+	);
+
+	if(!$startpage) {
+		$out[$name].='
+		<form action="'.$L['KarteURL'].'" method="get" name="formmaps">
+			<fieldset class="hidden">
+				<input name="zoomToLayer" type="hidden" value="0" />
+			</fieldset>
+		';
+	}
+
+	$url=$LinkURL.'?searchid='.$_REQUEST['searchid'].'&selectsearch='.intval($_REQUEST['selectsearch']).'&uid='.$_REQUEST['uid'];
+
+	$catpages=explode('|',$page);
+	for($i=0;$i<count($searchResources);$i++) {
+		$catpages[$i]=intval($catpages[$i]);
+	}
+
+	$ready=1;
+	$allcounter=0;
+
+	if(count($filterResources)==0)
+		getSearchFilter(str_replace('###SERVICE###','_filter',$file));
+
+	$numRessource=0;
+
+	foreach($filterResources as $resource=>$resourceTitle) {
+
+		$currentpage=$catpages[$numRessource];
+		$numRessource++;
+		$counter=0;
+
+		$filename=str_replace('###SERVICE###','_'.$resource.'_'.($currentpage+1),$file);
+
+		$tagcloudfilename=str_replace('###SERVICE###','_'.$resource.'_keywords',$file);
+		//getFromStorage($filename, $cacheType)
+		//$admin = new administration();
+		$fileExists = $admin->getFromStorage($filename, TMP_SEARCH_RESULT_STORAGE);
+		if ($fileExists == false) {
+			parse_str($OrigURL,$URLParts);
+			$URLParts['searchResources']=$resource;
+			$URLParts['searchPages']=$currentpage+1;
+			$URLParts['hostName']=$_SERVER['HTTP_HOST'];
+			$SearchParams=http_build_query($URLParts);
+			file_get_contents('http://localhost/mapbender/php/mod_callMetadata.php?'.$SearchParams);
+
+			// Warten nach der ersten Suche
+			$microsPerSecond = 1000000;
+			usleep(($microsPerSecond/5));
+
+		}
+		if($fileExists !== false) {
+			$DATA=json_decode($fileExists);
+			if($DATA) {
+				foreach($DATA as $class=>$ClassData) {
+					$Info=$ClassData->md;
+					$allcounter+=$Info->nresults;
+					if(!$startpage) {
+
+						$out[$name].='
+							<div class="search-cat '.((isset($_REQUEST['pos']) && $_REQUEST['pos']==$numRessource-1)?'opened':'closed').'">
+							<div class="search-header" onclick="openclose2(this);">
+								<img class="icon" src="fileadmin/design/s_'.$class.'.png">
+								<h2>'.$resourceTitle.'</h2>
+								<p>('.$Info->nresults.' '.$L['Trefferkurz'].' in '.round($Info->genTime,2).' '.$L['Sekunden'].')</p>
+								<div class="clr"></div>
+							</div>';
+
+						getServiceTagCloud($tagcloudfilename);
+
+						$out[$name].=PageCounter($Info->nresults, $Info->rpp, $url, $name, count($searchResources), $numRessource-1);
+
+						foreach($ClassData->srv as $Service) {
+							#$out[$name].=print_r($Service, true);
+							switch($class) {
+								case "wms":
+									getServiceWMS($Service,$Service);
+									break;
+								case "wfs":
+									getServiceWFS($Service);
+									break;
+								case "wmc":
+									getServiceWMC($Service);
+									break;
+							}
+						}
+
+						if($class=="wms") $out[$name].='<fieldset class="search-dienste"><input type="submit" value="'.$L['In Karte aufnehmen'].'" /></fieldset><div class="clearer"></div>';
+						$out[$name].=PageCounter($Info->nresults, $Info->rpp, $url, $name, count($searchResources), $numRessource-1);
+
+
+						$out[$name].='
+							</div>';
+					}
+				}
+
+			} else {
+				$ready=0;
+			}
+		} else {
+			$ready=0;
+		}
+	}
+	$ServiceCat=array();
+	if($ready==1) {
+		foreach($filterResources as $resource=>$resourceTitle) {
+		$filename=str_replace('###SERVICE###','_'.$resource.'_cat',$file);
+			$fileExists = $admin->getFromStorage($filename, TMP_SEARCH_RESULT_STORAGE);
+			if ($fileExists !== false) {
+			//if(file_exists($filename) && filesize($filename)>0) {
+				$DATA=json_decode($fileExists);
+				if($DATA) {
+					$ServiceCat[]=$DATA;
+				} else {
+					$ready=0;
+				}
+			} else {
+				$ready=0;
+			}
+		}
+	}
+	if($ready==0) $ServiceCat=array();
+
+	if(!$startpage) {
+		if($counter!=0) {
+			$out[$name].='
+				<fieldset class="search-dienste"><input type="submit" value="'.$L['In Karte aufnehmen'].'" /></fieldset>
+				<br class="clr" />
+			';
+		}
+
+		$out[$name].='
+			</form>
+		';
+	} else {
+		if($ready==1) {
+			if($allcounter==0) {
+				$out[$name].='<p>'.$L['kein Ergbnis'].'</p>';
+			} else {
+				$out[$name].='<p>'.$allcounter.' '.$L['Trefferkurz'].'</p>';
+			}
+		}
+	}
+
+
+	return $ready;
+
+}
+
+
+// WMS-Struktur parsen
+function getServiceWMS($Service, $ParentLayer, $depth=0) {
+	global $out, $name, $startpage, $L, $page, $Wappen;
+	global $counter;
+
+
+	if($depth==0) {
+		$out[$name].='<ul class="search-tree">';
+	} else {
+		$out[$name].='<ul class="search-tree" style="display:block">';
+	}
+
+	foreach($ParentLayer->layer as $Layer) {
+
+		$counter++;
+
+		$HasSub=(count($Layer->layer)>0);
+
+		$out[$name].='<li class="search-item">';
+
+		getServiceDetails($Service,$Layer,'layer',$HasSub);
+
+		if($HasSub)
+			getServiceWMS($Service,$Layer, $depth+1);
+
+		$out[$name].='</li>';
+
+	}
+
+	$out[$name].='</ul>';
+
+}
+
+// WMC-Struktur parsen
+function getServiceWMC($Service) {
+	global $out, $name, $startpage, $L, $page, $Wappen;
+	global $counter;
+
+	$out[$name].='<ul class="search-tree">';
+		$out[$name].='<li class="search-item">';
+		getServiceDetails($Service,$Service,'wmc',0);
+		$out[$name].='</li>';
+	$out[$name].='</ul>';
+}
+
+// WFS-Struktur parsen
+function getServiceWFS($Service) {
+	global $out, $name, $startpage, $L, $page, $Wappen;
+	global $counter;
+
+	$out[$name].='<ul class="search-tree">';
+
+	foreach($Service->ftype as $FType) {
+
+		$counter++;
+
+		$HasSub=is_array($FType->modul);
+
+		$out[$name].='<li class="search-item">';
+
+		getServiceDetails($Service,$FType,'ftype',$HasSub);
+
+		if($HasSub) {
+
+			$out[$name].='<ul class="search-tree" style="display:block">';
+
+			foreach($FType->modul as $Modul) {
+
+				$counter++;
+
+				$out[$name].='<li class="search-item">';
+
+				getServiceDetails($Service,$Modul,'module',$HasSub);
+
+				$out[$name].='</li>';
+			}
+
+			$out[$name].='</ul>';
+
+		}
+
+		$out[$name].='</li>';
+
+	}
+
+	$out[$name].='</ul>';
+}
+
+// Infos ausgeben
+function getServiceDetails($Service,$Layer,$Class,$HasSub) {
+	global $out, $name, $startpage, $L, $Lang, $page, $Wappen;
+	global $counter;
+
+	switch($Class) {
+		case 'layer':
+			$parameter_name='LAYER';
+			$id_field='id';
+			$Type='wms';
+			break;
+
+		case 'module':
+		case 'ftype':
+			$parameter_name='FEATURETYPE';
+			$id_field='wfs_conf_id';
+			$Type='wfs';
+			break;
+		case 'wmc':
+			$parameter_name='WMC';
+			$id_field='wmc_id';
+			$Type='wmc';
+			break;		
+	}
+
+	$out[$name].='
+	<div>
+		<div class="search-titleicons">
+			<div class="search-checkbox">';
+
+	// Schloss-Symbol oder Checkbox
+	if($Class=="ftype" or $Class=='wmc') {
+		if($Class=="ftype") {
+			$out[$name].='<img src="fileadmin/design/clear.png" />';
+		}
+		if($Class=="wmc") {
+			$out[$name].='<img src="fileadmin/design/Mapset.png" />';
+		}
+	} else {
+		if($Layer->permission!='true') {
+			if($_SESSION['mb_user_id']==2) {
+				$out[$name].='<img src="fileadmin/design/icn_encrypted.png" alt="'.$L['Schloss'].'" title="'.$L['DiensteBerechtigung'].'" />';
+			} else {
+				$values='ID='.$Layer->id.'ÿTITLE='.$Layer->title.'ÿTYPE='.$Type.'ÿTO='.$Layer->permission.'ÿlang='.$Lang;
+				$code=CodeParameter($values);
+				$out[$name].='<a href="fileadmin/scripts/register_service.php?service='.$code.'" target="_blank" onclick="openwindow(this.href); return false"><img src="fileadmin/design/icn_encrypted_mail.png" alt="'.$L['Schloss'].'" title="'.$L['DiensteBerechtigung'].'" /></a>';
+			}
+		} else {
+			if($Service->hasConstraints=='1') {
+				$values='id='.$Service->id.'ÿel='.$Type.$counter.'ÿtype='.$Type.'ÿlang='.$Lang;
+				$code=CodeParameter($values);
+				$out[$name].='<input name="'.$parameter_name.'[]" value="'.$Layer->id.'" id="'.$Type.$counter.'" type="checkbox" onclick="return tou(this,'.$Service->id.',\''.$Type.'\',\''.$code.'\');"/>';
+			} else {
+				$out[$name].='<input name="'.$parameter_name.'[]" value="'.$Layer->id.'" id="'.$Type.$counter.'" type="checkbox" />';
+			}
+		}
+	}
+	$out[$name].='</div>';
+
+	// Icon mit Klapp-Funktion
+	switch($Class) {
+
+		// wms-Layer
+		case 'layer':
+			if($Layer->isRoot) {
+				if($HasSub) {
+					$out[$name].='<img onclick="openclose3(this);" src="fileadmin/design/icn_wms2.png" alt="WMS" title="'.$L['WMSKartenwerk'].'" />';
+				} else {
+					$out[$name].='<img src="fileadmin/design/icn_wms.png" alt="WMS" title="'.$L['WMSKartenwerk'].'" />';
+				}
+			} else {
+				if($HasSub) {
+					$out[$name].='<img onclick="openclose3(this);" src="fileadmin/design/icn_layer2.png" alt="Layer" />';
+				} else {
+					$out[$name].='<img src="fileadmin/design/icn_layer.png" alt="Layer" />';
+				}
+			}
+			break;
+
+		// wfs-FeatureType
+		case 'ftype':
+			if($HasSub) {
+				$out[$name].='<img onclick="openclose3(this);" src="fileadmin/design/icn_wfs2.png" alt="WFS" title="'.$L['WFSKartenwerk'].'" />';
+			} else {
+				$out[$name].='<img src="fileadmin/design/icn_wfs.png" alt="WFS" title="'.$L['WFSKartenwerk'].'" />';
+			}
+			break;
+
+		// wfs-Module (abfrage/suche)
+		case 'module':
+			switch($Layer->type) {
+				case 0:
+					$out[$name].='<img onclick="openclose3(this);" src="fileadmin/design/icn_abfragemodul.png" alt="WFS" title="'.$L['WFSKartenwerk'].'" />';
+					break;
+				case 1:
+					$out[$name].='<img onclick="openclose3(this);" src="fileadmin/design/icn_suchmodul.png" alt="WFS" title="'.$L['WFSKartenwerk'].'" />';
+					break;
+			}
+			break;
+	}
+	$out[$name].='</div>';
+
+	// Titel
+	$out[$name].='<div class="search-title"><a href="'.$Layer->mdLink.'" target="_blank" onclick="metadataWindow = window.open(this.href,\'width=400,height=250,left=50,top=50,scrollbars=yes\');metadataWindow.focus(); return false">'.$Layer->title.'</a>';
+	// Download option (armin 2014-07-30)
+	//$out[$name] .= " - ".json_encode($Layer->downloadOptions);
+	$out[$name].='</div>';
+
+
+	// Icons
+	$out[$name].='
+		<br class="clr" />
+		<div class="search-icons">';
+
+	//Preview
+	if($Layer->previewURL!='') {
+		$out[$name].='
+			<img class="search-icons-preview" src="'.$Layer->previewURL.'" title="Vorschau" alt="Fehler in Vorschau">';
+	}
+
+	// Logo armin 2010.09.07
+	if($Service->logoUrl!='') {
+		$out[$name].='<img src="'.$Service->logoUrl.'" title="'.$Service->respOrg.'" height="40"/>';
+	} 
+	/*else {
+		$out[$name].='<img src="fileadmin/design/icn_wappen_grau.png" title="'.$Service->respOrg.'" />';
+	}*/
+	// Wappen
+	if($Service->iso3166!='' && in_array($Service->iso3166,$Wappen) || !isset($Service->iso3166)) {
+		$out[$name].='<img src="fileadmin/design/wappen_'.$Service->iso3166.'.png" title="'.$L[$Service->iso3166].'" />';
+	} else {
+		$out[$name].='<img src="fileadmin/design/icn_wappen_grau.png" title="Länderkennung fehlt" />';
+	}
+	// Inspire
+	if($Layer->inspire==1) {
+		$out[$name].='<img src="fileadmin/design/icn_inspire.png" title="Inspire" />';
+	}
+
+	// AccessConstraints/TermsOfUse
+	if($Service->hasConstraints=='1') {
+		$values='id='.$Service->id.'ÿtype='.$Type.'ÿlang='.$Lang;
+		$code=CodeParameter($values);
+		$out[$name].='<a href="javascript:opentou(\''.$code.'\');"><img src="'.$Service->symbolLink.'" title="'.$L['TermsOfUse'].'" /></a>';
+	} else {
+		$out[$name].='<img src="'.$Service->symbolLink.'" title="'.$L['TermsOfUseOK'].'" />';
+	}
+	//openData
+	if($Service->isopen==1) {
+		$out[$name].='<a target="_blank" href="http://www.opendefinition.org"><img src="fileadmin/design/od_80x15_blue.png" title="'.$L['OpenData'].'" /></a>';
+	}
+	// Costs
+	if($Service->price>0) {
+		$out[$name].='<img src="fileadmin/design/icn_euro.png" title="Costs" />';
+	}
+
+	// Logging
+	if($Service->logged==1) {
+		$out[$name].='<img src="fileadmin/design/icn_logging.png" title="Logged" />';
+	}
+
+	// Network Restrictions
+	if($Service->nwaccess==1) {
+		$out[$name].='<img src="fileadmin/design/icn_eingeschraenketes_netz.png" title="Network Restrictions" />';
+	}
+
+	// Status
+	switch($Service->status) {
+		case '1':
+			$out[$name].='<img src="fileadmin/design/icn_go.png" title="'.$L['Monitoring1'].'" />';
+			break;
+		case '0':
+			$out[$name].='<img src="fileadmin/design/icn_wait.png" title="'.$L['Monitoring0'].'" />';
+			break;
+		case '-1':
+			$out[$name].='<img src="fileadmin/design/icn_stop.png" title="'.$L['Monitoring-1'].'" />';
+			break;
+		case '-2':
+			$out[$name].='<img src="fileadmin/design/icn_refresh.png" title="'.$L['Monitoring-2'].'" />';
+			break;
+		case '-3':
+			$out[$name].='<img src="fileadmin/design/icn_warning.png" title="'.$L['Monitoring-3'].'" />';
+			break;
+		default:
+			if ($Class != 'wmc') {
+				$out[$name].='<img src="fileadmin/design/icn_ampel_grau.png" title="Monitoring nicht aktiv" />';
+			}
+			break;
+	}
+
+	// Availability
+	if ($Class != 'wmc') {
+		if($Service->avail=='') {
+			$out[$name].='<span class="search-icons-availabilty"><span title="Monitoring nicht aktiv">? %</span></span>';
+		} else {
+			$out[$name].='<span class="search-icons-availabilty">'.$Service->avail.' %</span>';
+		}
+	}
+	//Geometrietyp
+	if($Type=='wfs') {
+		switch($Layer->geomtype) {
+			case 'PointPropertyType':
+				$out[$name].='<img src="fileadmin/design/icn_pkt.png" title="Punktgeometrie" />';
+				break;
+			case 'GeometryPropertyType':
+				$out[$name].='<img src="fileadmin/design/icn_geo_unbekannt.png" title="Geometrietyp unbekannt" />';
+				break;
+			case 'PolygonPropertyType':
+				$out[$name].='<img src="fileadmin/design/icn_poly.png" title="Flächengeometrie" />';
+				break;
+			case 'LinePropertyType':
+				$out[$name].='<img src="fileadmin/design/icn_line.png" title="Liniengeometrie" />';
+				break;
+			default:
+				$out[$name].='<img src="fileadmin/design/icn_geo_unbekannt.png" title="Geometrietyp unbekannt" />';
+				break;
+		}
+	}
+
+	//Queryable
+	if($Type=='wms') {
+		if($Layer->queryable=='true') {
+			$out[$name].='<img src="fileadmin/design/icn_info.png" title="'.$L['Queryable'].'" />';
+		} else {
+			$out[$name].='<img src="fileadmin/design/icn_info_grau.png" title="'.$L['NotQueryable'].'" />';
+		}
+	}
+
+
+	// EPSG
+	if ($Class != 'wmc') {
+		if($Layer->srsProblem=='false') {
+			$out[$name].='<img src="fileadmin/design/icn_epsg.png" title="'.$L['NotEPSG'].'" />';
+		} else {
+			$out[$name].='<img src="fileadmin/design/icn_epsg_grau.png" title="'.$L['EPSG'].'" />';
+		}
+	}
+	$out[$name].='</div>';
+
+	$out[$name].='<div class="search-mapicons">';
+	if($Layer->permission=='true') {
+		if($Type=='wms') {
+			if ($Layer->downloadOptions == null) {
+				//$out[$name] .= " - download not possible";
+			} else {
+				$idList = "";
+				foreach ($Layer->downloadOptions as $uuid) {
+					$idList .= $uuid->uuid.",";
+				}
+				$idList = rtrim($idList,',');
+				//get list of ids
+				
+				$out[$name] .= '<a href="../../mapbender/php/mod_getDownloadOptions.php?id='.$idList.'&outputFormat=html&languageCode='.$Lang.'" target="_blank" onclick="downloadWindow = window.open(this.href,\'downloadWindow\',\'width=600,height=400,left=100,top=100,scrollbars=yes,menubar=yes,toolbar=yes\');downloadWindow.focus(); return false"><img width=24,height=24 src="../../mapbender/img/gnome/document-save.png" title="Download" /></a>';
+				//$out[$name] .= " - " . json_encode($Layer->downloadOptions);
+			}
+			if($Service->hasConstraints=='1') {
+				$values='id='.$Service->id.'ÿel='.$Type.$counter.'ÿtype='.$Type.'ÿlang='.$Lang.'ÿurl='.$L['KarteURL'].'?LAYER[zoom]=1&'.$parameter_name.'[id]='.$Layer->id;
+				$code=CodeParameter($values);
+				$out[$name].='<a onclick="return tou2(this,document.getElementById(\''.$Type.$counter.'\'),'.$Service->id.',\''.$Type.'\',\''.$code.'\');" href="'.$L['KarteURL'].'?LAYER[zoom]=1&'.$parameter_name.'[id]='.$Layer->id.'"><img src="fileadmin/design/icn_zoommap.png" title="Auf Ebenenausdehnung zoomen" /></a>';
+			} else {
+				$out[$name].='<a href="'.$L['KarteURL'].'?LAYER[zoom]=1&'.$parameter_name.'[id]='.$Layer->id.'"><img src="fileadmin/design/icn_zoommap.png" title="Auf Ebenenausdehnung zoomen" /></a>';
+			}
+		}
+
+		switch($Type) {
+			case 'wms':
+				$image='map';
+				break;
+			case 'wmc':
+				$image='map';
+				break;
+			
+			case 'wfs':
+				switch($Layer->type) {
+					case 0:
+						$image='download';
+						break;
+					case 1:
+						$image='suche';
+						break;
+				}
+				break;
+		}
+
+/*
+		if($Service->hasConstraints=='1') {
+			$values='id='.$Service->id.'ÿel='.$Type.$counter.'ÿtype='.$Type.'ÿlang='.$Lang;
+			$code=CodeParameter($values);
+			$out[$name].='<input type="image" onclick="return tou3(this,document.getElementById(\''.$Type.$counter.'\'),'.$Service->id.',\''.$Type.'\',\''.$code.'\');" src="fileadmin/design/icn_'.$image.'.png" title="'.$L['In Karte aufnehmen'].'" />';
+		} else {
+			$out[$name].='<input type="image" onclick="document.getElementById(\'c'.$counter.'\').checked=true;" src="fileadmin/design/icn_'.$image.'.png" title="'.$L['In Karte aufnehmen'].'" />';
+		}
+*/
+		if($Service->hasConstraints=='1') {
+			$values='id='.$Service->id.'ÿel='.$Type.$counter.'ÿtype='.$Type.'ÿlang='.$Lang.'ÿurl='.$L['KarteURL'].'?'.$parameter_name.'[id]='.$Layer->id;
+			$code=CodeParameter($values);
+			$out[$name].='<a onclick="return tou2(this,document.getElementById(\''.$Type.$counter.'\'),'.$Service->id.',\''.$Type.'\',\''.$code.'\');" href="'.$L['KarteURL'].'?'.$parameter_name.'[id]='.$Layer->id.'"><img src="fileadmin/design/icn_'.$image.'.png" title="'.$L['In Karte aufnehmen'].'" /></a>';
+		} else {
+			$out[$name].='<a href="'.$L['KarteURL'].'?'.$parameter_name.'[id]='.$Layer->id.'"><img src="fileadmin/design/icn_'.$image.'.png" title="'.$L['In Karte aufnehmen'].'" /></a>';
+		}
+
+	}
+	if($Type=='wmc') { //always show map symbol
+		if($Service->hasConstraints=='1') {
+			/*$values='id='.$Service->id.'ÿel='.$Type.$counter.'ÿtype='.$Type.'ÿlang='.$Lang.'ÿurl='.$L['KarteURL'].'?LAYER[zoom]=1&'.$parameter_name.'[id]='.$Layer->id;
+			$code=CodeParameter($values);
+			$out[$name].='<a onclick="return tou2(this,document.getElementById(\''.$Type.$counter.'\'),'.$Service->id.',\''.$Type.'\',\''.$code.'\');" href="'.$L['KarteURL'].'?LAYER[zoom]=1&'.$parameter_name.'[id]='.$Layer->id.'"><img src="fileadmin/design/icn_zoommap.png" title="Auf Ebenenausdehnung zoomen" /></a>';*/
+		} else {
+			$out[$name].='<a href="'.$L['KarteURL'].'?'.$parameter_name."=".$Layer->id.'"><img src="fileadmin/design/icn_map.png" title="" /></a>';
+		}
+	}
+
+
+
+
+
+	$out[$name].='</div><br class="clr" />';
+
+
+	// Beschreibung
+	$out[$name].='
+		<div class="search-info-dep"><b>'.$Service->respOrg.'</b></div>
+		<div class="search-info">'.$Service->date.'</div>
+		<div class="search-text">'.textcut2($Layer->abstract,200).'</div>
+	</div>
+	';
+}
+
+function getServiceTagCloud($filename) {
+	global $out, $name;
+	global $LinkURL;
+	global $admin;
+	$url=$LinkURL.'?cat='.$_REQUEST['cat'].'&searchfilter=';
+
+	$fileExists = $admin->getFromStorage($filename, TMP_SEARCH_RESULT_STORAGE);
+        if ($fileExists !== false) {
+		$DATA=json_decode($fileExists);
+	}
+	//$DATA=json_decode(file_get_contents($filename));
+	if($DATA) {
+		$out[$name].='
+		<div class="tagcloud">
+			<h3 onclick="jQuery(this).toggleClass(\'open\').next().toggle();">'.$DATA->tagCloud->title.'</h3>
+			<div class="cloud" style="display:none">';
+		if(is_array($DATA->tagCloud->tags)) {
+			foreach($DATA->tagCloud->tags as $tag) {
+				global $LinkURL;
+				$out[$name].='
+				<a href="'.$url.urlencode($tag->url).'" title="'.$tag->title.'" style="font-size:'.$tag->weight.'px">'.$tag->title.'</a>';
+			}
+		}
+		$out[$name].='
+			</div>
+		</div>';
+	}
+}
+
+function CountDienste($file) {
+	global $out, $name, $L;
+	global $filterResources;
+	global $admin;
+	$ready=1;
+	$allcounter=0;
+	$numRessource=0;
+
+	if(count($filterResources)==0)
+		getSearchFilter(str_replace('###SERVICE###','_filter',$file));
+
+	foreach($filterResources as $resource=>$resourceTitle) {
+
+		$numRessource++;
+		$counter=0;
+
+		$filename=str_replace('###SERVICE###','_'.$resource.'_1',$file);
+		$fileExists = $admin->getFromStorage($filename, TMP_SEARCH_RESULT_STORAGE);
+		if ($fileExists !== false) {
+		//if(file_exists($filename) && filesize($filename)>0) {
+			$DATA=json_decode($fileExists);
+			if($DATA) {
+				foreach($DATA as $class=>$ClassData) {
+					$Info=$ClassData->md;
+					$allcounter+=$Info->nresults;
+				}
+			} else {
+				$ready=0;
+			}
+		} else {
+			$ready=0;
+		}
+	}
+
+	return array("ready"=>$ready,"count"=>$allcounter);
+}
+
+
+?>

Added: trunk/mapbender/http/geoportal/start_search.php
===================================================================
--- trunk/mapbender/http/geoportal/start_search.php	                        (rev 0)
+++ trunk/mapbender/http/geoportal/start_search.php	2015-06-22 19:08:26 UTC (rev 9224)
@@ -0,0 +1,794 @@
+<?php
+require_once("/data/mapbender/core/globalSettings.php");
+require_once("/data/mapbender/http/classes/class_administration.php");
+
+global $admin;
+$admin = new administration();
+
+include_once(dirname(__FILE__).'/../../../../fileadmin/function/config.php');
+include_once(dirname(__FILE__).'/../../../../fileadmin/function/util.php');
+include_once(dirname(__FILE__).'/../../../../fileadmin/function/function.php');
+include_once(dirname(__FILE__).'/../../../../fileadmin/function/crypt.php');
+
+GLOBAL $output, $out, $name, $data, $counter, $unique, $startpage, $count, $page, $items_page, $in_ajax;
+GLOBAL $GUESTID, $Language, $Lang, $L;
+GLOBAL $check_array, $unique;
+global $LinkURL;
+
+include_once('search_functions.php');
+
+$_REQUEST['uid']=($_REQUEST['uid']=='')?CreateUUID():$_REQUEST['uid'];
+
+$NewSearch=false;
+
+if($_REQUEST['searchfilter']!='') {
+	parse_str($_REQUEST['searchfilter'],$URLParts);
+	unset($URLParts['searchId']);
+	$URLParts['hostName']=$_SERVER['HTTP_HOST'];
+	$_REQUEST['searchfilter']=http_build_query($URLParts);
+	$_REQUEST['searchtext']=str_replace(',',' ',$URLParts['searchText']);
+	$_REQUEST['act']='search';
+	$_REQUEST['selectsearch']=0;
+	foreach($URLParts as $key=>$value) {
+		$_REQUEST[$key]=$value;
+	}
+	$_REQUEST['searchText']=str_replace(',',' ',$URLParts['searchText']);
+}
+
+if($_REQUEST['act']=='change') $NewSearch=SearchChange();
+$unique=$_REQUEST['uid'];
+
+$searchtext=$_REQUEST['searchtext']=SearchText();
+
+if($searchtext == ''){
+	$searchtext ='*';
+}
+
+if($_REQUEST['searchid']!='') $searchtext=$_REQUEST['searchtext']=addslashes($searchtext);
+
+$cat=$_REQUEST['cat'];
+
+$items_page=10;
+$page=$_REQUEST['page'];
+if(!$page) { $_REQUEST['page']=$page=0; }
+
+$in_ajax=$ajax;
+if(!$ajax) {
+    if(t3lib_div::GPvar('L')==1) {
+        $Lang='en';
+    } else {
+        $Lang='de';
+    }
+    $L=$Language[$Lang];
+    $_SESSION["mb_user_spatial_suggest"] = ($_REQUEST['spatial']=='ja')?'ja':'nein';
+}
+
+if (!$ajax && $_REQUEST['spatial']=='ja') {
+    $searchparts = preg_split('/( )+/', $searchtext);
+    if(count($searchparts)>0) {
+        foreach($searchparts as $key=>$part) {
+            if(mb_strtolower($part, 'UTF-8')=='in') continue;
+            $params = array(
+                'outputFormat' => 'json',
+                'resultTarget' => 'web',
+                'searchEPSG' => 4326, //geographische Koordinaten
+                'maxResults' => 15,
+                'maxRows' => 15,
+                'searchText' => $part,
+            );
+            try{
+                $data[$key]=(array)json_decode(file_get_contents('http://localhost/mapbender/geoportal/gaz_geom_mobile.php?'.http_build_query($params)));
+            }catch(Exception $e) {
+            }
+        }
+        $vorschlag=array();
+        foreach($searchparts as $i=>$part) {
+            if(count($data[$i][geonames])>0) {
+                $option='';
+                foreach($searchparts as $k=>$wort) {
+                    if(mb_strtolower($wort, 'UTF-8')=='in') continue;
+                    if($i!=$k) {
+                        $option.=' '.$wort;
+                    }
+                }
+                $option=trim($option);
+                foreach($data[$i][geonames] as $ort) {
+                    $vorschlag[]=array(
+                        'title' => '<i>'.((empty($option))?$L['allData']:$option).'</i> in <b>'.$ort->title.'</b>',
+                        'size' => ($ort->maxx-$ort->minx) * ($ort->maxy-$ort->miny),
+                        'searchtext' => $option,
+                        'bbox' => urlencode(implode(',', array(
+                            $ort->minx,
+                            $ort->miny,
+                            $ort->maxx,
+                            $ort->maxy,
+                        )))
+                    );
+                }
+            }
+        }
+        usort($vorschlag,'sortBySize');
+
+        $LinkURL=$L['SuchURL'];
+        $LinkURLErw=$L['ErwSuchURL'];
+        $output='<h2>'.$L['SearchSuggestion'].'</h2>';
+
+        if(count($vorschlag)>0) {
+            $output.='<ul class="searchsuggestion">';
+            foreach($vorschlag as $tip) {
+                $output.='<li><a href="'.$LinkURLErw.'?searchText='.$tip['searchtext'].'&searchBbox='.$tip['bbox'].'&searchTypeBbox=intersects">'.$tip['title'].'</a></li>';
+            }
+            $output.='</ul>';
+        } else {
+            $output.='<p>'.$L['noSearchSuggestion'].'</p>';
+            $output.='<p><a href="'.$LinkURL.'?searchtext='.urlencode($searchtext).'&act=search">'.$searchtext.'</a></p>';
+        }
+    }
+
+} elseif(!$ajax) { // Normale Suche
+	$filterfile = '/data/mapbender/http/tmp/'.md5($unique).'_filter.json';
+	$dienstefile = '/data/mapbender/http/tmp/'.md5($unique).'###SERVICE###.json';
+	$adressfile = '/data/mapbender/http/tmp/'.$unique.'_geom.xml';
+	$typo3file = dirname(__FILE__).'/temp/'.$unique.'.typo3.xml';
+	$metafile = '/data/mapbender/http/tmp/'.$unique.'_os.xml';
+	$wikifile = '/data/mapbender/http/tmp/'.$unique.'_wiki.xml';
+
+/*
+	$filterfile = dirname(__FILE__).'/temp/627bff9db837eb099b64f9dcde83f270_filter.json';
+	$dienstefile = dirname(__FILE__).'/temp/627bff9db837eb099b64f9dcde83f270###SERVICE###.json';
+	$adressfile = dirname(__FILE__).'/temp/__.geom.xml';
+	$typo3file = dirname(__FILE__).'/temp/'.$unique.'.typo3.xml';
+	$metafile = dirname(__FILE__).'/temp/__os.xml';
+	$wikifile = dirname(__FILE__).'/temp/__.wiki.xml';
+*/
+	if(t3lib_div::GPvar('L')==1) {
+		$Lang='en';
+	} else {
+		$Lang='de';
+	}
+	$L=$Language[$Lang];
+	$LinkURL=$L['SuchURL'];
+
+	if (($_REQUEST['act']=='search' && $searchtext!='') || ($NewSearch && $searchtext!='')) {
+		if($_REQUEST['searchfilter']=='') {
+			$_REQUEST['searchfilter']='searchText='.str_replace(' ',',',$searchtext).'&languageCode='.$Lang.'&searchEPSG='.$_SESSION['epsg'].'&userId='.$_SESSION['mb_user_id'].'&resultTarget=file&outputFormat=json&hostName='.$_SERVER['HTTP_HOST'];
+		}
+		
+		// Scriptparameter
+		$shplus='';
+		foreach(array(
+		          'registratingDepartments',
+		          'isoCategories',
+		          'regTimeBegin',
+		          'regTimeEnd',
+		          'searchBbox',
+		          'searchTypeBbox',
+		          'searchResources',
+		          'timeBegin',
+		          'timeEnd',
+		         ) as $key) {
+			$shplus.='"'.(($_REQUEST[$key]!='')?$_REQUEST[$key]:'false').'" ';
+		}
+
+		exec('php5 '.dirname(__FILE__).'/search.php "'.$unique.'" "'.$searchtext.'" "'.(int)t3lib_div::GPvar('L').'" "0" >/dev/null 2>&1 &');
+#		exec("php5 ".dirname(__FILE__)."/search.php \"".$unique."\" \"".$searchtext."\" \"".(int)t3lib_div::GPvar('L')."\" \"1\" >/dev/null 2>&1 &");
+		exec('php5 /data/mapbender/http/geoportal/gaz.php "'.$_SESSION['mb_user_id'].'" "'.$unique.'" "'.$searchtext.'" "'.$_SESSION['epsg'].'" '.$shplus.' >/dev/null 2>&1 &');
+#		exec("php5 /data/mapbender/http/geoportal/gaz.php \"".$_SESSION["mb_user_id"]."\" \"".$unique."\" \"".$searchtext."\" \"".$_SESSION["epsg"]."\" \"".$_SESSION["SID"]."\">/dev/null 2>&1 &");
+#		print "---"."php5 /data/mapbender/http/geoportal/gaz.php \"2\" \"".$unique."\" \"".$searchtext."\" >/dev/null 2>&1 &"."---";
+		file_get_contents('http://localhost/mapbender/php/mod_callMetadata.php?searchId='.$unique.'&'.$_REQUEST['searchfilter']);
+
+// Abspeichern als letzte Suche ä
+		$_REQUEST['searchid']=WriteLastSearch();
+
+// Warten nach der ersten Suche
+		$microsPerSecond = 250000;
+		usleep(($microsPerSecond/2));
+	}
+
+	if($_REQUEST['act']=='save' && $_SESSION['mb_user_id']!=$GUESTID) {
+		SearchSave();
+	}
+	if($_REQUEST['act']=='delete' && $_REQUEST['ok']=='1' && $_SESSION['mb_user_id']!=$GUESTID) {
+		$_REQUEST['searchid']=SearchDelete();
+	}
+
+	$timer=false;
+
+	$url=SearchURL();
+	
+	$name="filter";
+	$ready[$name]=Filter($filterfile);
+	if($ready[$name]==0) {
+		$timer=true;
+	}
+	$output.='<div class="search-filter">
+	'.$out[$name].'
+	<div class="clr"></div>
+	</div>';
+			
+	$output.='<ul class="search-cat">';
+
+// Gesamt
+	$output.=($cat=='')?'<li class="active">':'<li>';
+	$output.='<a href="'.$url.'">'.$L['Gesamt'].'</a></li>';
+
+// Adressen
+	$content=$i='';
+	$count=0;
+	if(file_exists($adressfile)) {
+		$content=file_get_contents($adressfile);
+		$count=substr_count($content,'<member ');
+		$i=$count;
+	}
+	$i='<span id="search-count-adressen">'.$i.'</span>';
+	if(strpos($content,'<ready>true</ready>')===false && $searchtext!='') {
+		$i.='<span id="search-indicator-adressen">'.$indicator.'</span>';
+		$timer=true;
+	}
+	$output.=($cat=='adressen')?'<li class="active">':'<li>';
+	$output.='<a href="'.$url.'&cat=adressen">'.$L['Adressen'].$i.'</a></li>';
+
+// Dienste
+	$content=$i='';
+	$Counter=CountDienste($dienstefile);
+	$i=$Counter['count'];
+	if($Counter['ready']==0 && $searchtext!='') {
+		$i='<span id="search-count-dienste"></span><span id="search-indicator-dienste">'.$indicator.'</span>';
+		$timer=true;
+	} else {
+		$i='<span id="search-count-dienste">'.$i.'</span>';
+	}
+	$output.=($cat=='dienste')?'<li class="active">':'<li>';
+	$output.='<a href="'.$url.'&cat=dienste">'.$L['Dienste'].$i.'</a></li>';
+
+// Info
+	$wcontent=$content=$i='';
+	$count=0;
+	if(file_exists($typo3file)) {
+		$content=file_get_contents($typo3file);
+		$count=substr_count($content,'<content>');
+		$i=$count;
+	}
+	if(file_exists($wikifile)) {
+		$wcontent=file_get_contents($wikifile);
+		$count=substr_count($wcontent,'<member>');
+		$i+=$count;
+	}
+	$i='<span id="search-count-info">'.$i.'</span>';
+	if(strpos($content,'</searchresult>')===false && strpos($wcontent,'<ready>true</ready>')===false && $searchtext!='') {
+		$i.='<span id="search-indicator-info">'.$indicator.'</span>';
+		$timer=true;
+	}
+	$output.=($cat=='info')?'<li class="active">':'<li>';
+	$output.='<a href="'.$url.'&cat=info">'.$L['Info'].$i.'</a></li>';
+
+// Meta
+	$i='';
+	$count=$count_meta=0;
+
+	if($searchtext!='') {
+		$allready=0;
+		if(file_exists($metafile) && filesize($metafile)>0) {
+			$indexfile = file($metafile);
+			$allready=1;
+			$key=0;
+			foreach($indexfile as $folder) {
+				if(preg_match('/<opensearchinterface>(.+)<\/opensearchinterface>/',$folder,$matches)==0 || trim($matches[1])=='') continue;
+				$key++;
+				$count_meta++;
+				$parts=split('\.',$metafile);
+				$filename='';
+				for($j=0;$j<count($parts)-1;$j++) {
+					if($j>0) $filename.='.';
+					$filename.=$parts[$j];
+				}
+				$filename.=$key.'_1.'.$parts[$j];
+				if(file_exists($filename)) {
+					$content=file_get_contents($filename);
+					if(preg_match('/<totalresults>(.+)<\/totalresults>/',$content,$matches)!=0)
+						$count+=$matches[1];
+					if(strpos($content,'</resultlist>')===false) {
+						$allready=0;
+					}
+				} else {
+					$allready=0;
+				}
+			}
+		}
+	} else {
+		$allready=1;
+	}
+	if($count!=0) $i=$count;
+	$i='<span id="search-count-meta">'.$i.'</span>';
+	if($allready==0) {
+		$i.='<span id="search-indicator-meta">'.$indicator.'</span>';
+		$timer=true;
+	}
+	$output.=($cat=='meta')?'<li class="active">':'<li>';
+	$output.='<a href="'.$url.'&cat=meta">'.$L['Metadaten'].$i.'</a></li>
+	         ';
+
+	$output.='</ul>';
+
+	$output.='<div class="search-container">
+	         ';
+	if($searchtext=='') { // Kein Suchbegriff eingetragen
+		$output.='<p>'.$L['kein Ergbnis'].'</p></div>
+		          <br class="clr" />
+		         ';
+		return;
+	}
+
+	switch($cat) {
+		case '':
+			$startpage=true;
+
+// Adressen
+			$name='adressen';
+			$ready[$name]=Adressen($adressfile,5);
+			if($ready[$name]==0) {
+				$i='<span id="search-header-indicator-adressen">'.$indicator.'</span>';
+				$timer=true;
+			} else {
+				$i='';
+			}
+			$output.='<div class="search-block">
+				<img class="icon" src="fileadmin/design/s_ortssuche.png">
+				<h2><a href="'.$url.'&cat=adressen" title="'.str_replace('###AREA###',$L['Adressen'],$L['alleErgebnisse']).'">'.$i.''.$L['Adressen'].'</a></h2>
+				<div id="search-container-'.$name.'">
+				'.$out[$name].'
+				</div>
+				<div class="clr"></div></div>';
+
+// Dienste
+			$name='dienste';
+			$ready[$name]=Dienste($dienstefile,5);
+			if($ready[$name]==0) {
+				$i='<span id="search-header-indicator-dienste">'.$indicator.'</span>';
+				$timer=true;
+			} else {
+				$i='';
+			}
+			$output.='<div class="search-block">
+				<img class="icon" src="fileadmin/design/s_interaktivedaten.png">
+				<h2><a href="'.$url.'&cat=dienste" title="'.str_replace('###AREA###',$L['Dienste'],$L['alleErgebnisse']).'">'.$i.''.$L['Dienste'].'</a></h2>
+				<div id="search-container-'.$name.'">
+				'.$out[$name].'
+				</div>
+				<div class="clr"></div></div>';
+
+// Info
+			$name='info';
+			$ready[$name]=Info($typo3file,$wikifile,5);
+			if($ready[$name]==0) {
+				$i='<span id="search-header-indicator-info">'.$indicator.'</span>';
+				$timer=true;
+			} else {
+				$i='';
+			}
+			$output.='<div class="search-block">
+				<img class="icon" src="fileadmin/design/s_info.png">
+				<h2><a href="'.$url.'&cat=info" title="'.str_replace('###AREA###',$L['Info'],$L['alleErgebnisse']).'">'.$i.''.$L['Info'].'</a></h2>
+				<div id="search-container-'.$name.'">
+				'.$out[$name].'
+				</div>
+				<div class="clr"></div></div>';
+
+// Metadaten
+			$name='meta';
+			$ready[$name]=Meta($metafile,5);
+			if($ready[$name]==0) {
+				$i='<span id="search-header-indicator-meta">'.$indicator.'</span>';
+				$timer=true;
+			} else {
+				$i='';
+			}
+			$output.='<div class="search-block">
+				<img class="icon" src="fileadmin/design/s_metadaten.png">
+				<h2><a href="'.$url.'&cat=meta" title="'.str_replace('###AREA###',$L['Metadaten'],$L['alleErgebnisse']).'">'.$i.''.$L['Metadaten'].'</a></h2>
+				<div id="search-container-'.$name.'">
+				'.$out[$name].'
+				</div>
+				<div class="clr"></div></div>';
+
+			break;
+		case 'dienste':
+			$startpage=false;
+
+			$name='dienste';
+			$ready[$name]=Dienste($dienstefile);
+			if($ready[$name]==0) $timer=true;
+			$output.='
+				<div id="search-container-'.$name.'">
+				'.$out[$name].'
+				</div>';
+
+			break;
+		case 'adressen':
+			$startpage=false;
+
+			$name='adressen';
+			$ready[$name]=Adressen($adressfile);
+			if($ready[$name]==0) $timer=true;
+			$output.='
+				<div id="search-container-'.$name.'">
+				'.$out[$name].'
+				</div>';
+
+			break;
+		case 'info':
+			$startpage=false;
+
+			$name='info';
+			$ready[$name]=Info($typo3file,$wikifile);
+			if($ready[$name]==0) $timer=true;
+			$output.='
+				<div id="search-container-'.$name.'">
+				'.$out[$name].'
+				</div>';
+			break;
+
+		case 'meta':
+			$startpage=false;
+
+			$name='meta';
+			$ready[$name]=Meta($metafile);
+			if($ready[$name]==0) $timer=true;
+
+			for($i=0;$i<$count_meta;$i++) {
+				$output.='<div id="metastyles'.$i.'" style="display:none">
+									<style type="text/css">
+									  .meta-search-container'.$i.' .search-header{background:url(fileadmin/design/search-header-plus.png) top right no-repeat;cursor:pointer;padding-right:25px !important}
+									  .meta-search-container'.$i.' .search-item{display:none}
+									  .meta-search-container'.$i.' .search-pagecounter-container{display:none}
+									</style>
+									</div>
+									';
+			}
+
+			$output.='
+				<div id="search-container-'.$name.'">
+				'.$out[$name].'
+				</div>';
+			break;
+	}
+	$output.='</div>
+	          <br class="clr" />
+						<div id="searchresults"></div>
+					';
+
+	if($cat=='meta') {
+		$jsoutput='
+			window.onload=start;
+			function start() {
+				opencat=get_cookie("opencat");
+				if(opencat!=null) {
+					cats=opencat.split("|");
+					for(i=0;i<cats.length;i++) {
+						if(cats[i]=="open") openclose(i.toString());
+					}
+				}
+			}
+		';		
+	} else {
+		$jsoutput='';
+	}
+
+	$SCRIPTDIR='/portal';
+
+	$output.='
+		<script type="text/javascript">
+
+		var cat=new Array();
+		'.$jsoutput.'
+		function openclose(id) {
+			if(typeof cat[id]=="undefined" || cat[id]=="close") {
+				cat[id]="open";
+				var cssStr = ".meta-search-container"+id+" .search-header{background:url(fileadmin/design/search-header-minus.png) top right no-repeat;cursor:pointer;padding-right:25px !important} .meta-search-container"+id+" .search-item{display:block} .meta-search-container"+id+" .search-pagecounter-container{display:block}";
+			} else {
+				cat[id]="close";
+				var cssStr = ".meta-search-container"+id+" .search-header{background:url(fileadmin/design/search-header-plus.png) top right no-repeat;cursor:pointer;padding-right:25px !important} .meta-search-container"+id+" .search-item{display:none} .meta-search-container"+id+" .search-pagecounter-container{display:none}";
+			}
+			set_cookie("opencat",cat.join("|"));
+			var style = document.createElement("style");
+			style.setAttribute("type", "text/css");
+
+			if(style.styleSheet) { // IE
+				style.styleSheet.cssText = cssStr;
+			} else { // w3c
+				var cssText = document.createTextNode(cssStr);
+				style.appendChild(cssText);
+			}
+
+			document.getElementById("metastyles"+id).innerHTML="";
+			document.getElementById("metastyles"+id).appendChild(style);
+		}
+
+		function openclose2(e) {
+			ziel=e.parentNode;
+			klasse=ziel.className;
+			if(klasse=="search-cat closed") {
+				ziel.className="search-cat opened";
+			} else {
+				ziel.className="search-cat closed";
+			}
+		}
+
+		function openclose3(e) {
+			img="";
+			node=e;
+			for(i=0;i<10;i++) {
+				if(node.nodeName.toLowerCase()=="img" && img=="") {
+					img=node;
+				}
+				node=node.parentNode;
+				if(node.nodeName.toLowerCase()=="li") {
+					for(j=0;j<node.childNodes.length;j++) {
+						if(node.childNodes[j].nodeName.toLowerCase()=="ul") {
+							if(node.childNodes[j].style.display=="none") {
+								node.childNodes[j].style.display="block";
+								if(img.src.indexOf("icn_wms_plus")!=-1) img.src="fileadmin/design/icn_wms2.png";
+								if(img.src.indexOf("icn_wfs_plus")!=-1) img.src="fileadmin/design/icn_wfs2.png";
+								if(img.src.indexOf("icn_layer_plus")!=-1) img.src="fileadmin/design/icn_layer2.png";
+							} else {
+								node.childNodes[j].style.display="none";
+								if(img.src.indexOf("icn_wms2")!=-1) img.src="fileadmin/design/icn_wms_plus.png";
+								if(img.src.indexOf("icn_wfs2")!=-1) img.src="fileadmin/design/icn_wfs_plus.png";
+								if(img.src.indexOf("icn_layer2")!=-1) img.src="fileadmin/design/icn_layer_plus.png";
+							}
+						}
+					}
+					break;
+				}
+			}
+		}
+
+		function openwindow(Adresse) {
+  		Fenster1 = window.open(Adresse, "Informationen", "width=500,height=600,left=100,top=100,scrollbars=yes,resizable=no");
+  		Fenster1.focus();
+		}
+
+
+		function set_cookie(name,value,path) {
+		  var cookie_string = name + "=" + escape(value);
+		  if(path) { 
+		  	cookie_string += "; path=" + escape(path);
+		  }
+		  document.cookie = cookie_string;
+		}		
+
+		function get_cookie(cookie_name) {
+		  var results = document.cookie.match ( cookie_name + \'=(.*?)(;|$)\' );
+		  if ( results ) {
+		    return(unescape(results[1]));
+		  } else {
+		    return null;
+		  }
+		}		
+		
+		function tou(elem,id,type,tou) {
+			if(elem.checked) {
+				elem.checked=false;
+				jQuery.post(
+					"/mapbender/php/mod_acceptedTou_server.php",
+					{
+						method:"checkAcceptedTou",
+						id:1,
+						params: "{\"serviceType\":\""+type+"\",\"serviceId\":"+id+"}"
+					},
+					function(data) {
+						if(data.result.success) {
+							if(data.result.data==1) {
+								elem.checked=true;
+							} else {
+								fenster=window.open("'.$SCRIPTDIR.'/fileadmin/scripts/termsofuse.php?tou="+tou, "TermsOfUse", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+								fenster.focus();
+							}
+						}
+					}
+				);
+				return false;
+			}
+			return true;
+		}
+
+		function tou2(thiselem,elem,id,type,tou) {
+			if(elem.checked) {
+				return true;
+			}
+
+			jQuery.post(
+				"/mapbender/php/mod_acceptedTou_server.php",
+				{
+					method:"checkAcceptedTou",
+					id:1,
+					params: "{\"serviceType\":\""+type+"\",\"serviceId\":"+id+"}"
+				},
+				function(data) {
+					if(data.result.success==true) {
+						if(data.result.data==1) {
+							window.location.href=thiselem.href;
+						} else {
+							fenster=window.open("'.$SCRIPTDIR.'/fileadmin/scripts/termsofuse.php?link=1&tou="+tou, "TermsOfUse", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+							fenster.focus();
+						}
+					}
+				}
+			);
+
+			return false;
+		}
+
+		function tou3(thiselem,elem,id,type,tou) {
+			if(elem.checked) {
+				return true;
+			}
+
+			jQuery.post(
+				"/mapbender/php/mod_acceptedTou_server.php",
+				{
+					method:"checkAcceptedTou",
+					id:1,
+					params: "{\"serviceType\":\""+type+"\",\"serviceId\":"+id+"}"
+				},
+				function(data) {
+					if(data.result.success==true) {
+						if(data.result.data==1) {
+							elem.checked=true;
+							thiselem.form.submit();
+							found=true;
+						} else {
+							fenster=window.open("'.$SCRIPTDIR.'/fileadmin/scripts/termsofuse.php?link=2&tou="+tou, "TermsOfUse", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+							fenster.focus();
+						}
+					}
+				}
+			);
+			return false;
+		}
+
+		function touokdirect(elemid,id,type) {
+			document.getElementById(elemid).checked=true;
+			jQuery.post(
+				"/mapbender/php/mod_acceptedTou_server.php",
+				{
+					method:"setAcceptedTou",
+					id:1,
+					params: "{\"serviceType\":\""+type+"\",\"serviceId\":"+id+"}"
+				}
+			);
+			document.formmaps.submit()
+		}
+
+		function touoklink(url,id,type) { 
+			jQuery.post(
+				"/mapbender/php/mod_acceptedTou_server.php",
+				{
+					method:"setAcceptedTou",
+					id:1,
+					params: "{\"serviceType\":\""+type+"\",\"serviceId\":"+id+"}"
+				}
+			);
+			window.location.href=url;
+		}
+
+		function touok(elemid,id,type) {
+			document.getElementById(elemid).checked=true;
+			jQuery.post(
+				"/mapbender/php/mod_acceptedTou_server.php",
+				{
+					method:"setAcceptedTou",
+					id:1,
+					params: "{\"serviceType\":\""+type+"\",\"serviceId\":"+id+"}"
+				}
+			);
+		}
+
+		function opentou(tou) {
+			fenster=window.open("'.$SCRIPTDIR.'/fileadmin/scripts/termsofuse.php?tou="+tou, "TermsOfUse", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+			fenster.focus();
+		}
+
+		</script>';
+
+	if($timer) {
+		$output.='
+		<script type="text/javascript">
+			var search_filter="'.$ready['filter'].'";
+			var search_info="'.$ready['info'].'";
+			var search_meta="'.$ready['meta'].'";
+			var search_dienste="'.$ready['dienste'].'";
+			var search_adressen="'.$ready['adressen'].'";
+
+			function AjaxSearch () {
+				xajax_search("'.$unique.'","'.$_REQUEST['searchid'].'", "'.$cat.'", "'.$page.'", "'.$_SESSION['mb_user_id'].'", "'.t3lib_div::GPvar('L').'", search_info,search_meta,search_dienste,search_adressen,search_filter);
+			}
+			
+			window.setTimeout("AjaxSearch()", 500);
+		</script>
+		';
+	}
+} else {
+	$typo3file = dirname(__FILE__).'/temp/'.$unique.'.typo3.xml';
+	$filterfile = '/data/mapbender/http/tmp/'.md5($unique).'_filter.json';
+	$dienstefile = '/data/mapbender/http/tmp/'.md5($unique).'###SERVICE###.json';
+	$adressfile = '/data/mapbender/http/tmp/'.$unique.'_geom.xml';
+	$metafile = '/data/mapbender/http/tmp/'.$unique.'_os.xml';
+	$wikifile = '/data/mapbender/http/tmp/'.$unique.'_wiki.xml';
+
+/*
+	$filterfile = dirname(__FILE__).'/temp/627bff9db837eb099b64f9dcde83f270_filter.json';
+	$dienstefile = dirname(__FILE__).'/temp/627bff9db837eb099b64f9dcde83f270###SERVICE###.json';
+	$adressfile = dirname(__FILE__).'/temp/__.geom.xml';
+	$typo3file = dirname(__FILE__).'/temp/'.$unique.'.typo3.xml';
+	$metafile = dirname(__FILE__).'/temp/__os.xml';
+	$wikifile = dirname(__FILE__).'/temp/__.wiki.xml';
+*/
+
+	if($language==1) $L=$Language['en'];
+	else $L=$Language['de'];
+	$LinkURL=$L['SuchURL'];
+
+	$ready['filter']=1;
+	if($search_filter==0) {
+		$name='filter';
+		$ready[$name]=Filter($filterfile);
+	}
+
+	switch($cat) {
+		case '':
+			$startpage=true;
+
+			$ready['adressen']=1;
+			if($search_adressen==0) {
+				$name='adressen';
+				$ready[$name]=Adressen($adressfile,5);
+				if($ready[$name]) $out["adressen-filter"]=getAdrCat();
+			}
+
+			$ready['dienste']=1;
+			if($search_dienste==0) {
+				$name='dienste';
+				$ready[$name]=Dienste($dienstefile,5);
+				if($ready[$name]) $out["service-filter"]=getServiceCat();
+			}
+
+			$ready['info']=1;
+			if($search_info==0) {
+				$name='info';
+				$ready[$name]=Info($typo3file,$wikifile,5);
+			}
+
+			$ready['meta']=1;
+			if($search_meta==0) {
+				$name='meta';
+				$ready[$name]=Meta($metafile,5);
+			}
+
+			break;
+		case 'adressen':
+			$startpage=false;
+			$name='adressen';
+			$ready[$name]=Adressen($adressfile);
+			if($ready[$name]) $out["adressen-filter"]=getAdrCat();
+			break;
+		case 'dienste':
+			$startpage=false;
+			$name='dienste';
+			$ready[$name]=Dienste($dienstefile);
+			if($ready[$name]) $out["service-filter"]=getServiceCat();
+			break;
+		case 'info':
+			$startpage=false;
+			$name='info';
+			$ready[$name]=Info($typo3file,$wikifile);
+			break;
+		case 'meta':
+			$startpage=false;
+			$name='meta';
+			$ready[$name]=Meta($metafile);
+			break;
+	}
+}
+
+?>



More information about the Mapbender_commits mailing list