This commit is contained in:
Andreas Österreicher
2007-07-12 15:20:55 +00:00
parent 4cc162b710
commit d2fec05d54
4 changed files with 219 additions and 23 deletions
+85 -1
View File
@@ -87,8 +87,10 @@ function AdresseInit(adresse_id, person_id)
document.getElementById('adresse-textbox-name').value=name;
document.getElementById('adresse-textbox-strasse').value=strasse;
document.getElementById('adresse-textbox-plz').value=plz;
document.getElementById('adresse-textbox-ort').value=ort;
AdresseLoadGemeinde(true);
document.getElementById('adresse-textbox-gemeinde').value=gemeinde;
AdresseLoadOrtschaft(true);
document.getElementById('adresse-textbox-ort').value=ort;
document.getElementById('adresse-menulist-nation').value=nation;
document.getElementById('adresse-menulist-typ').value=typ;
if(heimatadresse=='Ja')
@@ -110,4 +112,86 @@ function AdresseSpeichern()
{
if(window.opener.KontaktAdresseSpeichern(document))
window.close();
else
this.focus();
}
// ****
// * Laedt die Gemeinden zur eingegebenen Postleitzahl
// ****
function AdresseLoadGemeinde(blocking)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
menulist_gemeinde = document.getElementById('adresse-textbox-gemeinde');
if(document.getElementById('adresse-menulist-nation').value=='A')
{
menulist_gemeinde.value='';
document.getElementById('adresse-textbox-ort').value='';
}
plz = document.getElementById('adresse-textbox-plz').value;
if(plz.length>3)
{
var url = '<?php echo APP_ROOT; ?>rdf/gemeinde.rdf.php?plz='+plz+'&'+gettimestamp();
var oldDatasources = menulist_gemeinde.database.GetDataSources();
while(oldDatasources.hasMoreElements())
{
menulist_gemeinde.database.RemoveDataSource(oldDatasources.getNext());
}
//Refresh damit die entfernten DS auch wirklich entfernt werden
menulist_gemeinde.builder.rebuild();
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
if(blocking)
var datasource = rdfService.GetDataSourceBlocking(url);
else
var datasource = rdfService.GetDataSource(url);
datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
datasource.QueryInterface(Components.interfaces.nsIRDFXMLSink);
menulist_gemeinde.database.AddDataSource(datasource);
menulist_gemeinde.builder.rebuild();
}
}
// ****
// * Laedt die Ortschaften zu Plz und Gemeinde
// ****
function AdresseLoadOrtschaft(blocking)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
gemeinde = document.getElementById('adresse-textbox-gemeinde').value;
menulist_ort = document.getElementById('adresse-textbox-ort');
if(document.getElementById('adresse-menulist-nation').value=='A')
{
menulist_ort.value='';
}
plz = document.getElementById('adresse-textbox-plz').value;
if(plz.length>3 && gemeinde!='')
{
var url = '<?php echo APP_ROOT; ?>rdf/gemeinde.rdf.php?plz='+plz+'&gemeinde='+encodeURIComponent(gemeinde)+'&'+gettimestamp();
var oldDatasources = menulist_ort.database.GetDataSources();
while(oldDatasources.hasMoreElements())
{
menulist_ort.database.RemoveDataSource(oldDatasources.getNext());
}
//Refresh damit die entfernten DS auch wirklich entfernt werden
menulist_ort.builder.rebuild();
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
if(blocking)
var datasource1 = rdfService.GetDataSourceBlocking(url);
else
var datasource1 = rdfService.GetDataSource(url);
datasource1.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
datasource1.QueryInterface(Components.interfaces.nsIRDFXMLSink);
menulist_ort.database.AddDataSource(datasource1);
menulist_ort.builder.rebuild();
}
}
+48 -21
View File
@@ -82,27 +82,6 @@ else
</hbox>
</row>
<row>
<label value="Plz" control="adresse-textbox-plz"/>
<hbox>
<textbox id="adresse-textbox-plz" maxlength="16" size="5"/>
<spacer flex="1" />
</hbox>
</row>
<row>
<label value="Ort" control="adresse-textbox-ort"/>
<hbox>
<textbox id="adresse-textbox-ort" maxlength="256" size="30"/>
<spacer flex="1" />
</hbox>
</row>
<row>
<label value="Gemeinde" />
<hbox>
<textbox id="adresse-textbox-gemeinde" maxlength="256" size="30" />
<spacer flex="1" />
</hbox>
</row>
<row>
<label value="Nation" control="adresse-menulist-nation"/>
<menulist id="adresse-menulist-nation"
datasources="<?php echo APP_ROOT ?>rdf/nation.rdf.php" flex="1"
@@ -116,6 +95,54 @@ else
</template>
</menulist>
</row>
<row>
<label value="Plz" control="adresse-textbox-plz"/>
<hbox>
<textbox id="adresse-textbox-plz" maxlength="16" size="5" oninput="AdresseLoadGemeinde(false)"/>
<spacer flex="1" />
</hbox>
</row>
<row>
<label value="Gemeinde" />
<!--<hbox>
<textbox id="adresse-textbox-gemeinde" maxlength="256" size="30" />
<spacer flex="1" />
</hbox>-->
<menulist id="adresse-textbox-gemeinde"
editable="true"
datasources="rdf:null" flex="1"
ref="http://www.technikum-wien.at/gemeinde/liste"
oncommand="AdresseLoadOrtschaft(false)"
>
<template>
<menupopup>
<menuitem value="rdf:http://www.technikum-wien.at/gemeinde/rdf#name"
label="rdf:http://www.technikum-wien.at/gemeinde/rdf#name"
uri="rdf:*"/>
</menupopup>
</template>
</menulist>
</row>
<row>
<label value="Ortschaft" control="adresse-textbox-ort"/>
<!--<hbox>
<textbox id="adresse-textbox-ort" maxlength="256" size="30"/>
<spacer flex="1" />
</hbox>-->
<menulist id="adresse-textbox-ort"
editable="true"
datasources="rdf:null" flex="1"
ref="http://www.technikum-wien.at/gemeinde/liste"
>
<template>
<menupopup>
<menuitem value="rdf:http://www.technikum-wien.at/gemeinde/rdf#ortschaftsname"
label="rdf:http://www.technikum-wien.at/gemeinde/rdf#ortschaftsname"
uri="rdf:*"/>
</menupopup>
</template>
</menulist>
</row>
<row>
<label value="Typ" control="adresse-menulist-typ"/>
<menulist id="adresse-menulist-typ"
+1 -1
View File
@@ -99,7 +99,7 @@ if(!$error)
//Wenn die Nation Oesterreich ist, dann muss die Gemeinde in der Tabelle Gemeinde vorkommen
if($_POST['nation']=='A')
{
$qry = "SELECT * FROM bis.tbl_gemeinde WHERE lower(name)=lower('".addslashes($_POST['gemeinde'])."')";
$qry = "SELECT * FROM bis.tbl_gemeinde WHERE lower(name)=lower('".addslashes($_POST['gemeinde'])."') AND plz='".addslashes($_POST['plz'])."'";
if($result = pg_query($conn, $qry))
{
if($row = pg_fetch_object($result))
+85
View File
@@ -0,0 +1,85 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
*/
// header für no cache
header("Cache-Control: no-cache");
header("Cache-Control: post-check=0, pre-check=0",false);
header("Expires Mon, 26 Jul 1997 05:00:00 GMT");
header("Pragma: no-cache");
// content type setzen
header("Content-type: application/xhtml+xml");
// xml
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
// DAO
require_once('../vilesci/config.inc.php');
// Datenbank Verbindung
if (!$conn = pg_pconnect(CONN_STRING))
die('Es konnte keine Verbindung zum Server aufgebaut werden!');
if(isset($_GET['plz']))
{
$plz = $_GET['plz'];
}
else
die('Plz muss uebergeben werden');
$gemeinde = isset($_GET['gemeinde'])?utf8_decode($_GET['gemeinde']):'';
$rdf_url='http://www.technikum-wien.at/gemeinde';
echo '
<RDF:RDF
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:GEMEINDE="'.$rdf_url.'/rdf#"
>
<RDF:Seq about="'.$rdf_url.'/liste">
';
if($gemeinde=='')
$qry = "SET CLIENT_ENCODING TO 'UNICODE'; SELECT distinct on (name) * FROM bis.tbl_gemeinde WHERE plz='".addslashes($plz)."' ORDER BY name";
else
$qry = "SET CLIENT_ENCODING TO 'UNICODE'; SELECT * FROM bis.tbl_gemeinde WHERE plz='".addslashes($plz)."' AND name='".addslashes($gemeinde)."' ORDER BY name";
if($result = pg_query($conn, $qry))
{
while($row = pg_fetch_object($result))
{
echo '
<RDF:li>
<RDF:Description id="'.$row->gemeinde_id.'" about="'.$rdf_url.'/'.$row->gemeinde_id.'" >
<GEMEINDE:gemeinde_id><![CDATA['.$row->gemeinde_id.']]></GEMEINDE:gemeinde_id>
<GEMEINDE:plz><![CDATA['.$row->plz.']]></GEMEINDE:plz>
<GEMEINDE:name><![CDATA['.$row->name.']]></GEMEINDE:name>
<GEMEINDE:ortschaftskennziffer><![CDATA['.$row->ortschaftskennziffer.']]></GEMEINDE:ortschaftskennziffer>
<GEMEINDE:ortschaftsname><![CDATA['.$row->ortschaftsname.']]></GEMEINDE:ortschaftsname>
<GEMEINDE:bulacode><![CDATA['.$row->bulacode.']]></GEMEINDE:bulacode>
<GEMEINDE:bulabez><![CDATA['.$row->bulabez.']]></GEMEINDE:bulabez>
<GEMEINDE:kennziffer><![CDATA['.$row->kennziffer.']]></GEMEINDE:kennziffer>
</RDF:Description>
</RDF:li>
';
}
}
?>
</RDF:Seq>
</RDF:RDF>