[Mapbender-commits] r4850 - in branches/astroidex_25/http: . css
specials specials/gazetteer
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Oct 22 16:53:56 EDT 2009
Author: astrid_emde
Date: 2009-10-22 16:53:55 -0400 (Thu, 22 Oct 2009)
New Revision: 4850
Added:
branches/astroidex_25/http/css/gazetteer.css
branches/astroidex_25/http/specials/
branches/astroidex_25/http/specials/gazetteer/
branches/astroidex_25/http/specials/gazetteer/blank.html
branches/astroidex_25/http/specials/gazetteer/gazetteer.php
branches/astroidex_25/http/specials/gazetteer/gazetteerFrame.php
Log:
gazetteer with prepaired statements using ./conf/gazetteerSQL.conf
INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('gui1','gazetteer',3,1,'gazetteer basierend auf SQL-Suche','','iframe','../specials/gazetteer/gazetteerFrame.php?sessionID&','frameborder = "0" ',1,500,214,154,5,'visibility:visible','','iframe','','','mapframe1,overview','','');
Added: branches/astroidex_25/http/css/gazetteer.css
===================================================================
--- branches/astroidex_25/http/css/gazetteer.css (rev 0)
+++ branches/astroidex_25/http/css/gazetteer.css 2009-10-22 20:53:55 UTC (rev 4850)
@@ -0,0 +1,133 @@
+body{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ font-size : 11px;
+ color: #000000;
+}
+
+div{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ font-size : 11px;
+ color: #000000;
+}
+
+
+input:text{
+ font-size: 9px;
+ size: 20px;
+}
+
+a:link{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ text-decoration : none;
+ color: #000000;
+ font-size : 11px;
+
+}
+a:visited{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ text-decoration : none;
+ color: #000000;
+ font-size : 11px;
+}
+a:hover{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ color: #D65A00;
+ text-decoration : none;
+
+}
+a:active{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ color: #D65A00;
+ text-decoration : none;
+}
+.textfield{
+ border : 1 solid #990000;
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ font-size : 11px;
+ height: 20px;
+ color: #000000;
+ background: #FFFFFF;
+}
+
+.strinput{
+ border : 1 solid #990000;
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ font-size : 9px;
+ height: 20px;
+ size : 13;
+ color: #000000;
+ background: #FFFFFF;
+}
+
+.inputreadonly{
+ border: none;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9px;
+ height: 20px;
+ size: 13;
+ color: Gray;
+ background: #FFFFFF;
+}
+
+.sbutton{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ font-size : 11px;
+ font-weight: normal;
+ border : solid thin;
+ width: 20px;
+ height: 22px;
+ background: #c0c0c0;
+}
+
+.okbutton{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ font-weight: bold;
+ border: medium solid Red;
+ width: 27px;
+ height: 23px;
+ background: White;
+ color: blue;
+}
+
+.ibutton{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ font-size : 10px;
+ font-weight: normal;
+ border : solid thin;
+ width: 64px;
+ height: 22px;
+ background: #c0c0c0;
+}
+
+.bigbutton{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+ font-size : 10px;
+ font-weight: normal;
+ border : solid thin;
+ width: 100px;
+ height: 22px;
+ background: #c0c0c0;
+}
+
+.resultFrame{
+ width: 185px;
+ height: 240px;
+ border: 1px;
+ overflow-x : hidden;
+}
+.letter{
+ cursor: pointer;
+ font-weight : bold;
+}
+.cityText{
+ color : #D65A00;
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+}
+.streetText{
+ color: #D65A00;
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+}
+.city{
+ font-family : Verdana, Arial, Helvetica, sans-serif;
+}
\ No newline at end of file
Added: branches/astroidex_25/http/specials/gazetteer/blank.html
===================================================================
--- branches/astroidex_25/http/specials/gazetteer/blank.html (rev 0)
+++ branches/astroidex_25/http/specials/gazetteer/blank.html 2009-10-22 20:53:55 UTC (rev 4850)
@@ -0,0 +1,4 @@
+<html>
+<head></head>
+<body></body>
+</html>
\ No newline at end of file
Added: branches/astroidex_25/http/specials/gazetteer/gazetteer.php
===================================================================
--- branches/astroidex_25/http/specials/gazetteer/gazetteer.php (rev 0)
+++ branches/astroidex_25/http/specials/gazetteer/gazetteer.php 2009-10-22 20:53:55 UTC (rev 4850)
@@ -0,0 +1,144 @@
+<?php
+#require_once(dirname(__FILE__)."/../../php/mb_validateSession.php");
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<meta name="author-mail" content="info at wheregroup.com">
+<meta name="author" content="U. Rothstein">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="DC.Rights" content="WhereGroup GmbH, Bonn">
+<title>Suche</title>
+<link rel="stylesheet" type="text/css" href="../../css/gazetteer.css" />
+</head>
+<body leftmargin="2" topmargin="0">
+<?php
+include("../../../conf/gazetteerSQL.conf");
+import_request_variables("PG");
+
+$con = pg_connect ($connstring) or die ("Error while connecting database $dbname");
+
+$scale_str = 5000;
+$scale_hn = 2000;
+
+#echo $gemeinde."<br>";
+#echo $street."<br>";
+#echo $strschl."<br>";
+
+function getStreetsByName(){
+ global $con, $street, $gemeinde, $scale_str, $str_schl;
+ preg_match("/^(\D+)(\d*)(\D*)/",$street,$matches); # 4 matches name/nr/zusatz echo "match: ".$matches[1].",".$matches[2].",".$matches[3];
+
+
+ #$sql = "SELECT x(the_geom),y(the_geom),strkey, strname,ortsteil,gemkey FROM _strassen WHERE strname ILIKE ";
+
+ $sql = "SELECT x(the_geom),y(the_geom),str_schl, strasse,strasse as ortsteil ,gid FROM strassen WHERE strasse ILIKE ";
+
+ $matches[1] = preg_replace("/strasse/i","str", $matches[1]);
+ $matches[1] = preg_replace("/str\./i","str", $matches[1]);
+
+ if(preg_match("/\*/",$matches[1])){
+ $name = trim(preg_replace("/\*/i","%", strtoupper($matches[1])));
+ $sql .= "$1";
+ }
+ else{
+ $name = trim($matches[1])."%";
+ $sql .= "$1";
+ }
+ #$sql .= ' ORDER BY strname';
+ $sql .= ' ORDER BY strasse';
+
+ $v = array($name);
+
+ #$res = pg_query($con, $sql);
+ $res = pg_prepare("", $sql);
+ $res = pg_execute("", $v);
+ #echo $sql;
+
+ $str = "";
+ $cnt = 0;
+ while(pg_fetch_row($res)){
+ $str .= "<a href='javascript:parent.hideHighlight();parent.parent.mb_repaintScale(\"mapframe1\",";
+ $str .= pg_fetch_result($res,$cnt,0).",".pg_fetch_result($res,$cnt,1).",".$scale_str."); document.location.href=\"gazetteer.php?str_schl=".pg_fetch_result($res,$cnt,2)."&gemeinde=".pg_fetch_result($res,$cnt,5)."\"' ";
+ $str .= "onmouseover='parent.showHighlight(" .pg_fetch_result($res,$cnt,0). "," .pg_fetch_result($res,$cnt,1). ")' ";
+ $str .= "onmouseout='parent.hideHighlight()'><nobr>".pg_fetch_result($res,$cnt,3)." (".pg_fetch_result($res,$cnt,4).")"."<nobr></a><br>";
+ $cnt++;
+ }
+ if($cnt == 0){ $str = "Kein Ergebnis.";}
+ if($cnt == 1){
+ $str = "";
+ $str_schl = pg_fetch_result($res,0,2);
+ }
+ return $str;
+}
+function getStreetByKey(){
+ global $con, $str_schl, $gemeinde, $scale_hn, $scale_str;
+ #$sql = "SELECT DISTINCT x(the_geom),y(the_geom),strname,ortsteil FROM hsnrn WHERE strkey = '".$str_schl."' AND gemkey = ".$gemeinde.";";
+ $sql = "SELECT DISTINCT x(the_geom),y(the_geom),str_schl,strasse FROM strassen WHERE ";
+ $sql .= "str_schl = $1 AND gid = $2 ;";
+
+
+ #$res = pg_query($con,$sql);
+ $v = array($str_schl,$gemeinde);
+ $res = pg_prepare("", $sql);
+ $res = pg_execute("", $v);
+
+
+ $str = "";
+ if(pg_fetch_row($res)){
+ $str .= "<a href='#' onclick='parent.parent.mb_repaintScale(\"mapframe1\",".pg_fetch_result($res,0,0).",".pg_fetch_result($res,0,1).",$scale_str)'";
+ $str .= " onmouseover='parent.parent.mb_showHighlight(\"mapframe1\"," .pg_fetch_result($res,0,0). "," .pg_fetch_result($res,0,1). ");";
+ $str .= " parent.parent.mb_showHighlight(\"overview\"," .pg_fetch_result($res,0,0). "," .pg_fetch_result($res,0,1). ")' ";
+ $str .= "onmouseout='parent.parent.mb_hideHighlight(\"mapframe1\");parent.parent.mb_hideHighlight(\"overview\")'>".pg_fetch_result($res,0,2)." (".pg_fetch_result($res,0,3).")"."</a><br>";
+ }
+
+ $str .= "<script language='JavaScript'>parent.parent.mb_repaintScale(\"mapframe1\",".pg_fetch_result($res,0,0).",".pg_fetch_result($res,0,1).",".$scale_str.")</script>";
+
+ #$sql = "SELECT DISTINCT hsnrzus,x(the_geom),y(the_geom), strname , hsnrzahl FROM sis_hsnrn WHERE strkey = '".$str_schl."' AND gemkey = ".$gemeinde;
+ #$sql .= " ORDER BY hsnrzahl,hsnrzus DESC";
+
+ #$sql = "SELECT DISTINCT hsnrzus,x(the_geom),y(the_geom), strname , hsnrzahl FROM sis_hsnrn ";
+ #$sql .= "WHERE strkey = '".$str_schl."' AND gemkey = ".$gemeinde;
+ #$sql .= " ORDER BY hsnrzahl,hsnrzus DESC";
+
+ $sql = "SELECT DISTINCT str_schl ,x(the_geom),y(the_geom), strasse , str_schl FROM strassen ";
+ $sql .= "WHERE str_schl = $1 AND gid = $2";
+ $sql .= " ORDER BY strasse, str_schl DESC";
+
+ #$res = pg_query($con, $sql);
+ $v = array($str_schl,$gemeinde);
+ $res = pg_prepare("", $sql);
+ $res = pg_execute("", $v);
+
+ $cnt = 0;
+ $count = 0;
+ $str .= "<table cellspacing='0' cellpadding='1'>";
+ while(pg_fetch_row($res)){
+ if($count == 0){$str .= "<tr>";}
+ $str .= "<td align='center'><a href='javascript:parent.parent.mb_repaintScale(\"mapframe1\",".pg_fetch_result($res,$cnt,1).",".pg_fetch_result($res,$cnt,2).",".$scale_hn."); ";
+ $str .= "parent.hideHighlight();' onmouseover='parent.showHighlight(" . pg_fetch_result($res,$cnt,1). "," .pg_fetch_result($res,$cnt,2). ")' ";
+ $str .= "onmouseout='parent.hideHighlight()'>".pg_fetch_result($res,$cnt,4).pg_fetch_result($res,$cnt,0)."</a><td>";
+ $cnt++;
+ $count++;
+ if($count == 6){$str .= "</tr>"; $count = 0;}
+ }
+ $str .= "</table>";
+ return $str;
+}
+
+if(isset($street)){
+ $str = getStreetsByName();
+ echo $str;
+}
+if(isset($str_schl)){
+ $str = getStreetByKey();
+ echo $str;
+}
+?>
+</body>
+</html>
Added: branches/astroidex_25/http/specials/gazetteer/gazetteerFrame.php
===================================================================
--- branches/astroidex_25/http/specials/gazetteer/gazetteerFrame.php (rev 0)
+++ branches/astroidex_25/http/specials/gazetteer/gazetteerFrame.php 2009-10-22 20:53:55 UTC (rev 4850)
@@ -0,0 +1,70 @@
+<?php
+# License:
+# Copyright (c) 2009, Open Source Geospatial Foundation
+# This program is dual licensed under the GNU General Public License
+# and Simplified BSD license.
+# http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+
+require_once(dirname(__FILE__)."/../../../core/globalSettings.php");
+?>
+
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="../../css/gazetteer.css" />
+<script language="JavaScript">
+function showHighlight(x,y){
+ parent.mb_showHighlight("mapframe1",x,y);
+ parent.mb_showHighlight("overview",x,y);
+}
+function hideHighlight(){
+ parent.mb_hideHighlight("mapframe1");
+ parent.mb_hideHighlight("overview");
+}
+function validate(){
+ if(document.forms[0].street.value.length < 1){
+ return false;
+ }
+ else{
+ return true;
+ }
+}
+</script>
+</head>
+<body topmargin="2" lefmargin="0">
+<form name="formGazetteerFrame" onsubmit='return validate()' target="StreetResultFrame" action="gazetteer.php?<?php echo SID; ?>">
+<input class='textfield' name='gemeinde' type='hidden'>
+<div class='streetText'>Straße:</div>
+<input class='textfield' name='street' type='text'>
+<input class='sbutton' type='submit' value='ok'>
+
+<br>
+<span class="letter" onclick="document.forms[0].street.value='A'; document.forms[0].submit(); document.forms[0].street.value='';">A</span>
+<span class="letter" onclick="document.forms[0].street.value='B'; document.forms[0].submit(); document.forms[0].street.value='';">B</span>
+<span class="letter" onclick="document.forms[0].street.value='C'; document.forms[0].submit(); document.forms[0].street.value='';">C</span>
+<span class="letter" onclick="document.forms[0].street.value='D'; document.forms[0].submit(); document.forms[0].street.value='';">D</span>
+<span class="letter" onclick="document.forms[0].street.value='E'; document.forms[0].submit(); document.forms[0].street.value='';">E</span>
+<span class="letter" onclick="document.forms[0].street.value='F'; document.forms[0].submit(); document.forms[0].street.value='';">F</span>
+<span class="letter" onclick="document.forms[0].street.value='G'; document.forms[0].submit(); document.forms[0].street.value='';">G</span>
+<span class="letter" onclick="document.forms[0].street.value='H'; document.forms[0].submit(); document.forms[0].street.value='';">H</span>
+<span class="letter" onclick="document.forms[0].street.value='I'; document.forms[0].submit(); document.forms[0].street.value='';">I</span>
+<span class="letter" onclick="document.forms[0].street.value='J'; document.forms[0].submit(); document.forms[0].street.value='';">J</span>
+<span class="letter" onclick="document.forms[0].street.value='K'; document.forms[0].submit(); document.forms[0].street.value='';">K</span>
+<span class="letter" onclick="document.forms[0].street.value='L'; document.forms[0].submit(); document.forms[0].street.value='';">L</span>
+<span class="letter" onclick="document.forms[0].street.value='M'; document.forms[0].submit(); document.forms[0].street.value='';">M</span><br>
+<span class="letter" onclick="document.forms[0].street.value='N'; document.forms[0].submit(); document.forms[0].street.value='';">N</span>
+<span class="letter" onclick="document.forms[0].street.value='O'; document.forms[0].submit(); document.forms[0].street.value='';">O</span>
+<span class="letter" onclick="document.forms[0].street.value='P'; document.forms[0].submit(); document.forms[0].street.value='';">P</span>
+<span class="letter" onclick="document.forms[0].street.value='Q'; document.forms[0].submit(); document.forms[0].street.value='';">Q</span>
+<span class="letter" onclick="document.forms[0].street.value='R'; document.forms[0].submit(); document.forms[0].street.value='';">R</span>
+<span class="letter" onclick="document.forms[0].street.value='S'; document.forms[0].submit(); document.forms[0].street.value='';">S</span>
+<span class="letter" onclick="document.forms[0].street.value='T'; document.forms[0].submit(); document.forms[0].street.value='';">T</span>
+<span class="letter" onclick="document.forms[0].street.value='U'; document.forms[0].submit(); document.forms[0].street.value='';">U</span>
+<span class="letter" onclick="document.forms[0].street.value='V'; document.forms[0].submit(); document.forms[0].street.value='';">V</span>
+<span class="letter" onclick="document.forms[0].street.value='W'; document.forms[0].submit(); document.forms[0].street.value='';">W</span>
+<span class="letter" onclick="document.forms[0].street.value='X'; document.forms[0].submit(); document.forms[0].street.value='';">X</span>
+<span class="letter" onclick="document.forms[0].street.value='Y'; document.forms[0].submit(); document.forms[0].street.value='';">Y</span>
+<span class="letter" onclick="document.forms[0].street.value='Z'; document.forms[0].submit(); document.forms[0].street.value='';">Z</span>
+</form>
+<iframe frameborder="0" name="StreetResultFrame" src="blank.html" class='resultFrame' scrolling="auto"></iframe>
+<body>
+</html>
\ No newline at end of file
More information about the Mapbender_commits
mailing list