Inhalt Zurueck Weiter

Anhang B: Quelltexte

Benutzeranwendung Linkdb

build.bat

..\..\..\bin\https\lwcomp -v -o linkdb.web links.html home.html start.html staedte.html stadtlinks.html linksplz.html firmen.html displayLinks.js formular.html

displayLinks.js

// *** Hyperlinks darstellen ***

// links muß database.cursor-Objekt sein
// mit den DB-Spalten url, name, beschreibung

function displayLinks (links) {
    var anzahl=0;
    write('<table border=0 cellpadding=10><tr><td><ul>\n');
    while (links.next()) {
        anzahl++;
        write('<li> <a href="', links.url, '">', links.name, '</a>');
        write(' <img src="images/sprache', links.sprache, '.gif"><br>\n');
        if (links.beschreibung != null)
            write(links.beschreibung, '\n');
    }
    links.close();
    write('</ul></td></tr></table>\n');
    if (anzahl==0)
        return false;
    else
        return true;
}

// Korrigiert eingebaute JavaScript-Funktion toUpperCase
// (Umwandlung auch der dt. Umlaute)

function toUpperCaseDt(upstring) {
    var i = 0;
    upstring = upstring.toUpperCase();
    while ((i=upstring.indexOf("ä")) != -1) {
        a = upstring.substring(0, i);
        b = upstring.substring(i+1, upstring.length);
        upstring = "" + a + "Ä" + b;
    }
    while ((i=upstring.indexOf("ö")) != -1) {
        a = upstring.substring(0, i);
        b = upstring.substring(i+1, upstring.length);
        upstring = "" + a + "Ö" + b;
    }
    while ((i=upstring.indexOf("ü")) != -1) {
        a = upstring.substring(0, i);
        b = upstring.substring(i+1, upstring.length);
        upstring = "" + a + "Ü" + b;
    }
    return(upstring);
}

// Liefert "checked" oder einen Leerstring für die
// Darstellung der Checkboxen im Rechercheformular
// Parameter: Request-Objekt dieser Checkbox aus voriger Abfrage

function isChecked (requestobj) {
    if (requestobj=="on" || request.sb==null) 
        return "checked";
    else
        return "";
}


firmen.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Linkdatenbank - Unternehmen alphabetisch</title>

<server>
    // Unternehmen selektieren und alphabetisch sortieren
    links = database.cursor("SELECT links.* FROM links, themen WHERE (links.thema=themen.tid AND themen.sortierung LIKE 'Unternehmen%') ORDER BY links.name");

    // Der String in der LIKE-Klausel entspricht einem Thema der ersten Ebene, 
    // welches die Unternehmen aufnimmt. Wird dieses geändert, muß der String
    // hier entsprechend angepaßt werden.
</server>

</head>

<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" ALINK="#FF0000">

<p align=center><b><font size=6 color="#0000AA">A</font><font size=5 color="#0000AA">LTERNATIV</font><font size=5 color="#00B900">EN</font> 
<font size=6 color="#0000AA">S</font><font size=5 color="#0000AA">UCHEN</font></b>

<br><font size=-1>
<a href="formular.html">Formularrecherche & Stichwortsuche</a> | Top Ten</a> | Neuen 
Link hinzufügen</a> | Hilfe</a>
</font></p>

<br>
<p><b><a href="home.html">Homepage</a> : Unternehmen alphabetisch</b></p>

<SERVER>
    displayLinks (links);
</SERVER>

</body>
</html>


formular.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Linkdatenbank - Formularrecherche</title>

<server>
var sb="";
if (request.sb!=null) {

    sb="'%'";
    if (request.sb != "")
        sb = "'%" + toUpperCaseDt(request.sb) + "%'";

    // Kategorien-SELECT-String zusammenbauen
    var selectkat = "";
    var anzahl = 0;
    if (request.katinfos == "on") {
        selectkat += "themen.sortierung LIKE 'Themen%'";
        anzahl++;
    }
    if (request.katorgas == "on") {
        if (anzahl++ > 0)
            selectkat += " OR ";
        selectkat += "themen.sortierung LIKE 'Organisationen%'";
    }
    if (request.katinfos == "on") {
        if (anzahl++ > 0)
            selectkat += " OR ";
        selectkat += "themen.sortierung LIKE 'Unternehmen%'";
    }
    if (anzahl == 3) // In allen Kategorien suchen
        selectkat = "";
    else
        selectkat = " AND (" + selectkat + ")";

    // Land/Region-SELECT-String zusammenbauen
    var selectland = "";
    if (request.landd == "on") {
        selectland += "(staedte.land=1 AND staedte.region BETWEEN " + request.von + " AND " + request.bis + ")";
    }
    if (request.landau == "on") {
        if (anzahl++ > 0)
            selectland += " OR ";
        selectland += "staedte.land=2";
    }
    if (request.landch == "on") {
        if (anzahl++ > 0)
            selectland += " OR ";
        selectland += "staedte.land=3";
    }
    if (request.landint == "on") {
        if (anzahl++ > 0)
            selectland += " OR ";
        selectland += "staedte.land>3";
    }
    selectland = " AND (" + selectland + ")";

    // Sprache-SELECT-String zusammenbauen
    var selectsprache = "";
    anzahl = 0;
    if (request.spd == "on") {
        selectsprache += "1, 3, 5, 7";
        anzahl++;
    }
    if (request.spe == "on") {
        if (anzahl++ > 0)
            selectsprache += ", ";
        selectsprache+= "2, 3, 6, 7";
        anzahl++;
    }
    if (request.sps == "on") {
        if (anzahl++ > 0)
            selectsprache += ", ";
        selectsprache += "4, 5, 6, 7";
        anzahl++;
    }
    if (anzahl == 3) // In allen Sprachen suchen
        selectsprache = "";
    else
        selectsprache = " AND links.sprache in (" + selectsprache + ")";

    themen = database.cursor("SELECT themen.* FROM themen WHERE UPPER(themen.name) LIKE " + sb + selectkat);

    links = database.cursor("SELECT links.hlid, links.url, links.name, links.sprache, links.beschreibung FROM links, staedte, themen WHERE links.thema=themen.tid AND links.stadt=staedte.stid AND (UPPER(links.name) LIKE " + sb + " OR UPPER(links.url) LIKE " + sb + " OR UPPER(links.beschreibung) LIKE " + sb + ")" + selectland + selectsprache + selectkat + " ORDER BY links.name");

    // sb für Formularvorbelegung wieder auf Eingabewert setzen
    sb = request.sb;
}

</server>

</head>

<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" ALINK="#FF0000">

<p align=center><b><font size=6 color="#0000AA">A</font><font size=5 color="#0000AA">LTERNATIV</font><font size=5 color="#00B900">EN</font> 
<font size=6 color="#0000AA">S</font><font size=5 color="#0000AA">UCHEN</font></b>

<br><font size=-1>
Formularrecherche & Stichwortsuche</a> | Top Ten</a> | Neuen 
Link hinzufügen</a> | Hilfe</a>
</font></p>

<br>
<p><b><a href="home.html">Homepage</a> : Formularrecherche</b></p>


<!-- SUCHERGEBNISSE -->

<SERVER>
if (request.sb != null) {
    if (request.sb != "") { // Wenn Suchstring leer, keine Kategorien anzeigen
        write('<br><font size=+1><b>Gefundene Kategorien:</b></font>')
        write('<table border=0 cellpadding=10><tr><td><ul>\n');
        anzahl=0;
        while (themen.next()) {
            write("<li> <a href=links.html?id=", themen.qid, ">", themen.sortierung, "</a>\n");
            anzahl++;
        }
        themen.close();
        write('</ul></td></tr></table>');
        if (anzahl==0)
            write("keine Kategorieen gefunden<br>\n");
    }

    write('<br><font size=+1><b>Gefundene Eintr&auml;ge:</b></font>');

    if (!displayLinks(links))
        write("keine Eintr&auml;ge gefunden<br>\n");
}
</SERVER>

<hr>

<!-- FORMULAR -->

<table border=0 cellspacing=7 cellpadding=3>
<form action="formular.html" method="POST">
<tr>
    <td valign=baseline><b>Suchbegriff</b></td>
    <td bgcolor="#00B900" width=400><input type=text name=sb value=`sb` size=30 maxlength=50></td>
    <td width=150><font size=-1><i>Nach Sites und Kategorien suchen.</i></font></td>
</tr>
<tr>
    <td valign=baseline><b>Land</b></td>
    <td bgcolor="#CCDDBC">
        <input type=checkbox name=landd `isChecked(request.landd)`>
        Deutschland &nbsp; &nbsp; <b>PLZ-Bereich</b> von <select name=von>
<SERVER>
        for (i=0; i<10; i++) {
            write('<option value=', i*10);
            if ((i==0 && request.sb==null) || (request.von!=null && parseInt(request.von)==(i*10))) 
                write(' selected');
            write('>', i, '0\n'); 
        }
        write('</select> &nbsp; bis <select name=bis>\n');
        for (i=1; i<=10; i++) {
            write('<option value=', i*10-1);
            if ((i==10 && request.sb==null) || (request.bis!=null && parseInt(request.bis))==i*10-1) 
                write(' selected');
            write('>', i-1, '9\n'); 
        }
</SERVER> 
            </select><br>
        <input type=checkbox name=landau `isChecked(request.landau)`> &Ouml;sterreich &nbsp;
        <input type=checkbox name=landch `isChecked(request.landch)`> Schweiz &nbsp;
        <input type=checkbox name=landint `isChecked(request.landint)`> International</td>
    <td rowspan=3 valign=top width=150><font size=-1><i>PLZ-Bereich gilt nur f&uuml;r Deutschland.<br>
        Lassen Sie den hellgr&uuml;nen Bereich unver&auml;ndert,
        wenn Sie ohne weitere Einschr&auml;nkungen nach einem Begriff suchen.
        Wenn kein Suchstring angegeben wird, werden nur Sites und keine
        Kategorien angezeigt.</i></font></td>
</tr>
<tr>
    <td valign=baseline><b>Sprache</b></td>
    <td bgcolor="#CCDDBC">
        <input type=checkbox name=spd `isChecked(request.spd)`> deutsch &nbsp;
        <input type=checkbox name=spe `isChecked(request.spe)`> englisch &nbsp;
        <input type=checkbox name=sps `isChecked(request.sps)`> sonstiges</td>
</tr>
<tr>
    <td valign=baseline><b>Kategorien</b></td>
    <td bgcolor="#CCDDBC">
        <input type=checkbox name=katinfos `isChecked(request.katinfos)`> 
        Themen, Informationen und Datenquellen<br>
        <input type=checkbox name=katorgas `isChecked(request.katorgas)`> 
        Organisationen<br>
        <input type=checkbox name=katfirmen `isChecked(request.katfirmen)`> 
        Unternehmen<br></td>
</tr>
<tr>
    <td></td>
    <td><input type=submit value="Anfrage starten"></td>
</tr>
</form>
</table>

</body>
</html>

home.html

<HTML>
<HEAD>
<TITLE>Hyperlinkdatenbank</TITLE>

<server>
if(!database.connected())
    redirect("start.html");
</server>

</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" ALINK="#FF0000">

<p align=center><b><font size=5 color="#0000AA"><font size=6>A</font>LTERNATIV<font color="#00B900">EN</font> 
<font size=6>S</font>UCHEN</font></b>

<br><font size=-1><a href="formular.html">Formularrecherche & Stichwortsuche</a>
| Top Ten</a> | Neuen Link hinzufügen</a> | Hilfe</a>
</font></p>

<br>
<center><table border=0>
<tr><th width=47%></th><th width=6%></th><th width=47%></th></tr>
<tr>
<td valign=top><img src=images/globe15p.gif border=0 hspace=5> <b><font SIZE=+1><a href="links.html?id=171">Themen, Informationen und Datenquellen</a></font></b>
<ul><b>
<li> <a href="links.html?id=155">Umweltschutz</a>
<li> <a href="links.html?id=156">Tier- und Artenschutz</a>
<li> <a href="links.html?id=157">Entwicklung/"Dritte Welt"</a>
<li> <a href="links.html?id=158">Menschenrechte</a>
<li> <a href="links.html?id=159">Sustainability</a>
<li> <a href="links.html?id=160">Gesundheit</a>
<li> <a href="links.html?id=161">Allgemeines und Sonstiges</a>
</b></ul>
</td>

<td></td>
<td valign=top><img src=images/globe15p.gif border=0 hspace=5> <b><font SIZE=+1><a href="links.html?id=172">Organisationen</a></font></b>
<ul><b>
<li> <a href="links.html?id=163">Verb&auml;nde und Vereine</a>
<li> <a href="links.html?id=164">Behörden und Ämter</a>
<li> <a href="links.html?id=165">Stiftungen</a>
<li> <a href="links.html?id=166">Initiativen</a>
<li> <a href="links.html?id=167">Forschungs- und Bildungseinrichtungen</a>
<li> <a href="links.html?id=168">Parteien</a>
<li> <a href="links.html?id=169">Vereinte Nationen</a>
<li> <a href="links.html?id=170">Internationale Organisationen</a>
</b></ul>
</td></tr>

<tr><td valign=top><img src=images/globe15p.gif border=0 hspace=5> 
<b><font SIZE=+1>Grüne Seiten (Unternehmen)</font></b>
<ul><b>
<li> <a href="links.html?id=1">Nach Branchen sortiert</a>
<li> <a href="firmen.html">Alphabetisch sortiert</a>
</b></ul>
</td>

<td></td>
<td valign=top><img src=images/globe15p.gif border=0 hspace=5> <b><font SIZE=+1>Regionales</font></b>
<ul><b>
<li> <a href="staedte.html">St&auml;dte</a>
<li> <a href="linksplz.html?von=-1">Postleitzahlenbereich</a>
</b></ul>
</td></tr>
</table></center>


</body>
</html>

links.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Linkdatenbank</title>

<server>
    // Überschrift selektieren
    ueberschrift = database.cursor("SELECT name, ueberschrift FROM Themen WHERE tid=" + request.id);

    // Unterthemen selektieren
    themen = database.cursor("SELECT qid, name FROM Themen WHERE refid=" + request.id + " ORDER BY name");
    anzahl = database.cursor("SELECT COUNT(*) AS themen FROM Themen WHERE refid=" + request.id);

    // Links zu diesem Thema selektieren
    links = database.cursor("SELECT url, name, sprache, beschreibung FROM Links WHERE thema=" + request.id + " ORDER BY name");
</server>

</head>

<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" ALINK="#FF0000">

<p align=center><b><font size=6 color="#0000AA">A</font><font size=5 color="#0000AA">LTERNATIV</font><font size=5 color="#00B900">EN</font> 
<font size=6 color="#0000AA">S</font><font size=5 color="#0000AA">UCHEN</font></b>

<br><font size=-1>
<a href="formular.html">Formularrecherche & Stichwortsuche</a> | Top Ten</a> | Neuen 
Link hinzufügen</a> | Hilfe</a>
</font></p>
<br>
<p><b><a href="home.html">Homepage</a> : 
<SERVER>
    ueberschrift.next();
    if (ueberschrift.ueberschrift != null)
        write(ueberschrift.ueberschrift, " ");
    write(ueberschrift.name);
    ueberschrift.close();
</SERVER></b></p>

<table border=0 cellpadding=10><tr><td valign="top" width="50%"><ul>
<SERVER>
    anzahl.next();
    var anzhalbe = Math.round(anzahl.themen/2);
    var i = 0;
    if (anzahl.themen < 6)
        while (themen.next()) 
            write("<li> <a href=links.html?id=", themen.qid, ">", themen.name, "</a>\n");
    else {
        while (themen.next()) {
            write("<li> <a href=links.html?id=", themen.qid, ">", themen.name, "</a>\n");
            if (++i == anzhalbe)
                write('</ul></td><td valign="top" width="50%"><ul>\n');
        }
    }
    themen.close();
    anzahl.close();
</SERVER>
</ul></td></tr></table>

<SERVER>
    displayLinks (links);
</SERVER>

</body>
</html>

linksplz.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Linkdatenbank - Auswahl nach PLZ-Bereich</title>

<server>
var von=parseInt(request.von);
var bis=parseInt(request.bis);
var fehler=false;

if (request.von == null) { // Erster Aufruf von Homepage
    request.von = "";
    request.bis = "";
} 

else { // Links selektieren

    // Auf Serverseite Gültigkeit der Parameter (von, bis) überprüfen
    if (von==0 || bis==0)
        fehler = true;
    else {
        // Links in diesem PLZ-Bereich selektieren, 
        links = database.cursor("SELECT DISTINCT links.hlid, links.url, links.name, links.sprache, links.beschreibung FROM links, staedte WHERE links.stadt=staedte.stid AND staedte.region BETWEEN " + von + " AND " + bis + " AND staedte.region<>0 ORDER BY links.name"); 
    }
}
</server>

</head>

<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" ALINK="#FF0000">

<p align=center><b><font size=6 color="#0000AA">A</font><font size=5 color="#0000AA">LTERNATIV</font><font size=5 color="#00B900">EN</font> 
<font size=6 color="#0000AA">S</font><font size=5 color="#0000AA">UCHEN</font></b>

<br><font size=-1>
<a href="formular.html">Formularrecherche & Stichwortsuche</a> | Top Ten</a> | Neuen 
Link hinzufügen</a> | Hilfe</a>
</font></p>

<br>
<p><b><a href="home.html">Homepage</a> : Regionales : Postleitzahlenbereich</b></p>

<form action="linksplz.html" method="POST">
Bitte w&auml;hlen Sie den Postleitzahlenbereich (die ersten zwei Ziffern)<br>
aus, für den Sie sich interessieren:<br>

<SERVER>
write('von <input type=input name=von value="' + request.von + '" size=2 maxlength=2>');
write(' &nbsp; bis <input type=input name=bis value="' + request.bis + '" size=2 maxlength=2>');
</SERVER>

<input type=submit value="Anfrage starten">
</form>

<SERVER>
    if (fehler)
        write('<p><b><i>Sie haben ung&uuml;ltige Werte eingegeben. F&uuml;r den PLZ-Bereich sind nur Werte zwischen 01 und 99 g&uuml;ltig!<br>Bitte korrigieren Sie Ihre Eingaben und wiederholen die Anfrage.</i></b></p>');
    else
        displayLinks(links);
</SERVER>

</body>
</html>

stadtlinks.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Linkdatenbank</title>

<server>
    // Überschrift selektieren
    stadt = database.cursor("SELECT laender.lkz, staedte.name, staedte.region FROM staedte, laender WHERE staedte.land=laender.lid AND stid=" + request.id);

    // Links aus dieser Stadt selektieren
    links = database.cursor("SELECT url, name, sprache, beschreibung FROM Links WHERE stadt=" + request.id + " ORDER BY name");
</server>

</head>
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" ALINK="#FF0000">

<p align=center><b><font size=6 color="#0000AA">A</font><font size=5 color="#0000AA">LTERNATIV</font><font size=5 color="#00B900">EN</font> 
<font size=6 color="#0000AA">S</font><font size=5 color="#0000AA">UCHEN</font></b>

<br><font size=-1>
<a href="formular.html">Formularrecherche & Stichwortsuche</a> | Top Ten</a> | Neuen 
Link hinzufügen</a> | Hilfe</a>
</font></p>
<br>
<p><b><a href="home.html">Homepage</a> : Regionales : <a href="staedte.html">St&auml;dte</a> :
<SERVER>
    stadt.next();
    write(stadt.lkz, " - ", stadt.name, " (", stadt.region, ")");
    stadt.close();
    write("</b></p>");

    displayLinks (links);
</SERVER>
</body>
</html>

staedte.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Linkdatenbank - Auswahl nach Stadt</title>

<server>
    // Städte mit Linkeinträgen selektieren
    staedte = database.cursor("SELECT DISTINCT staedte.*, laender.lkz FROM staedte, laender, links WHERE staedte.stid = links.stadt AND staedte.land = laender.lid ORDER BY staedte.land, staedte.name, staedte.region");
</server>

</head>

<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" ALINK="#FF0000">

<p align=center><b><font size=6 color="#0000AA">A</font><font size=5 color="#0000AA">LTERNATIV</font><font size=5 color="#00B900">EN</font> 
<font size=6 color="#0000AA">S</font><font size=5 color="#0000AA">UCHEN</font></b>

<br><font size=-1>
<a href="formular.html">Formularrecherche & Stichwortsuche</a> | Top Ten</a> | Neuen 
Link hinzufügen</a> | Hilfe</a>
</font></p>

<br>
<p><b><a href="home.html">Homepage</a> : Regionales : St&auml;dte</b></p>

<table border=0><tr><td valign="top" width="50%"><ul>
<SERVER>
    while (staedte.next())
        write("<li> <a href=stadtlinks.html?id=", staedte.stid, ">", staedte.lkz, " - ", staedte.name, " (", staedte.region, ")</a>\n");
    staedte.close();
</SERVER>
</ul></td></tr></table>

</body>
</html>

start.html

<html>
<head>
<title> Start Linkdatenbank </title>
</head>
<body>
<!-- This is the first page accessed by the Linkdatenbank application. 
It is used to set up the connection to our database. At the
end of the page, we redirect the user to the home page, "home.htm"
so the user will never know that this page has been executed.
-->

<server>
if (!database.connected())
    database.connect("ORACLE","","linkdb","dito","wgs_pc-ibe-inet-srv_ORCL");

if (!database.connected())
    write("Fehler: Datenbank kann nicht konnektiert werden.")
else 
    redirect("home.html")
</server>

</body>
</html>

Seitenanfang

Inhalt Zurueck Weiter