You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(132) |
Jul
(50) |
Aug
(172) |
Sep
(87) |
Oct
|
Nov
(1) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(39) |
Oct
(2) |
Nov
|
Dec
|
2004 |
Jan
(47) |
Feb
|
Mar
(11) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(9) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Geert J. <gj...@us...> - 2002-09-03 19:40:55
|
Update of /cvsroot/woc/woc/src/woc/src/lire In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/src/lire Added Files: Makefile.am report.pl report.pl.in Log Message: --- NEW FILE: Makefile.am --- bindir=${prefix}/bin/lire bin_SCRIPTS = \ report.pl CLEANFILES = $(bin_SCRIPTS) --- NEW FILE: report.pl --- #! /usr/bin/perl -w use strict; use diagnostics; # these parameters can be customized #my $EMAIL = "woc\@sci.kun.nl"; my $EMAIL = "egonw\@sci.kun.nl"; my $TMPLOG = "/tmp/woc/woc.log"; my $WOCLOG = "/tmp/woc/woc"; my $LIRE = "no"; my $LIRE2 = "no"; my $WEESLOG = "/vol/www/wees/httpd/logs"; if ($LIRE eq "") { print "System is lacking a working Lire system\n"; exit(1); } my @reports = (); my @titles = (); push(@reports, "grep woc"); push(@titles, "Complete file"); # BELOW IS NOT WORKING PROPERLY #push(@reports, "grep items/"); #push(@titles, "item/*.shtml only"); #push(@reports, "grep cgi-bin-woc | sed -e 's/\?[^\s\"]*//g'"); #push(@titles, "cgi-bin scripts only"); #push(@reports, "grep translation"); #push(@titles, "translation/ only"); print "Extracting information on /woc server...$/"; `/usr/local/gnu/bin/gunzip -c $WEESLOG/access_log.?.gz 2> /tmp/woc/run.log | grep "woc" | cut -f 1,3- -d' ' > $TMPLOG`; my $titel = "WOC Week Statistieken"; if (-r $TMPLOG) { for (my $i=1; $i<=scalar(@reports); $i++) { print "Compiling report $WOCLOG$i.txt (with $reports[$i-1])...\n"; my $command = "cat $TMPLOG | $reports[$i-1] | $LIRE $LIRE2 www combined > $WOCLOG$i.txt"; print "$command\n"; `$command`; if (-r "$WOCLOG$i.txt") { `cat $WOCLOG$i.txt | /usr/ucb/mail -s '$titel $titles[$i-1]' $EMAIL`; } } `rm $TMPLOG`; `rm $WOCLOG*`; } else { print "Cannot find ${TMPLOG}!"; exit(1); } --- NEW FILE: report.pl.in --- #! @PATHTOPERL@ -w use strict; use diagnostics; # these parameters can be customized #my $EMAIL = "woc\@sci.kun.nl"; my $EMAIL = "egonw\@sci.kun.nl"; my $TMPLOG = "/tmp/woc/woc.log"; my $WOCLOG = "/tmp/woc/woc"; my $LIRE = "@PATHTOLIRERUN@"; my $LIRE2 = "@PATHTOLIREL2R@"; my $WEESLOG = "/vol/www/wees/httpd/logs"; if ($LIRE eq "") { print "System is lacking a working Lire system\n"; exit(1); } my @reports = (); my @titles = (); push(@reports, "grep woc"); push(@titles, "Complete file"); # BELOW IS NOT WORKING PROPERLY #push(@reports, "grep items/"); #push(@titles, "item/*.shtml only"); #push(@reports, "grep cgi-bin-woc | sed -e 's/\?[^\s\"]*//g'"); #push(@titles, "cgi-bin scripts only"); #push(@reports, "grep translation"); #push(@titles, "translation/ only"); print "Extracting information on /woc server...$/"; `/usr/local/gnu/bin/gunzip -c $WEESLOG/access_log.?.gz 2> /tmp/woc/run.log | grep "woc" | cut -f 1,3- -d' ' > $TMPLOG`; my $titel = "WOC Week Statistieken"; if (-r $TMPLOG) { for (my $i=1; $i<=scalar(@reports); $i++) { print "Compiling report $WOCLOG$i.txt (with $reports[$i-1])...\n"; my $command = "cat $TMPLOG | $reports[$i-1] | $LIRE $LIRE2 www combined > $WOCLOG$i.txt"; print "$command\n"; `$command`; if (-r "$WOCLOG$i.txt") { `cat $WOCLOG$i.txt | /usr/ucb/mail -s '$titel $titles[$i-1]' $EMAIL`; } } `rm $TMPLOG`; `rm $WOCLOG*`; } else { print "Cannot find ${TMPLOG}!"; exit(1); } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:55
|
Update of /cvsroot/woc/woc/src/woc/src/news In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/src/news Added Files: news.dtd news.xml news.xsl news_bu_20010118.xml news_latest.xsl Log Message: --- NEW FILE: news.dtd --- <!ENTITY Aring "Å"> <!ENTITY Eacute "é"> <!ENTITY eacute "é"> <!ENTITY auml "ä"> <!ENTITY euml "ë"> <!ENTITY iuml "ï"> <!ENTITY ouml "ö"> <!ENTITY uuml "ü"> <!ENTITY alpha "α"> <!ENTITY beta "β"> <!ENTITY micro "µ"> <!ELEMENT BOEKENLIJST (VAK*)> <!ELEMENT VAK (INFO, BOEK)> <!ELEMENT INFO (NAAM, DOCENT+)> <!ELEMENT NAAM (#PCDATA)> <!ELEMENT DOCENT (#PCDATA)> <!ELEMENT BOEK (TITEL, AUTEUR+, UITGEVER?, DATUM?, ED?, PRIJS?)> <!ELEMENT TITEL (#PCDATA)> <!ELEMENT AUTEUR (#PCDATA)> <!ELEMENT UITGEVER (#PCDATA)> <!ELEMENT DATUM (#PCDATA)> <!ELEMENT ED (#PCDATA)> <!ELEMENT ISBN (#PCDATA)> <!ELEMENT PRIJS (#PCDATA)> <!ATTLIST BOEK ISBN CDATA #REQUIRED TYPE (Verplicht|Niet-Verplicht) "Niet-Verplicht"> --- NEW FILE: news.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE ITEM SYSTEM "news.dtd"> <NEWS> <ITEM ID="20020606"> <DATUM>6 juni 2002</DATUM> <TEKST> Na zeer lange tijd van afwezigheid is het forum weer beschikbaar. Daar kunnen vragen gesteld worden aan andere bezoekers van het website. Klik in de linker blauwe menulijst op "Stel Vragen". </TEKST> </ITEM> <ITEM ID="20020414"> <DATUM>14 april 2002</DATUM> <TEKST> De animaties (2 op dit moment) in het WOC zijn nu via een webpagina te bekijken. Ga hiervoor naar de <a href="/gui/anim/">animatiepagina</a>. </TEKST> </ITEM> <ITEM ID="20020124"> <DATUM>24 januari 2002</DATUM> <TEKST> De link naar de ChemFinder database is bijgewerkt, zodat als u de ChemFinder link in de database voor de chemische verbindingen aanklikt, daadwerkelijk weer informatie krijgt over die stof. </TEKST> </ITEM> <ITEM ID="20011115"> <DATUM>15 november 2001</DATUM> <TEKST> Een door onze ISP onaangekondigde wijziging van de infrastructuur heeft er voor gezorgd dat een groot deel van onze website tijdelijk onbruikbaar is. Alle dynamische inhoud is op dit moment niet leesbaar. Hiervoor onze excuses. </TEKST> </ITEM> <ITEM ID="20010916"> <DATUM>16 september 2001</DATUM> <TEKST> Het project is in het bezit gekomen van een woordenlijst Nederlands-Fries, die is samengesteld door dhr. R. de Haan van het Frysje Akademy in Leeuwarden. De vertalingen worden opgenomen in het WOC. De Delftse Universitaire Pers heeft een uitgave "Lijst met vertalingen van chemische namen" door dhr. L. Maat en anderen te koop. </TEKST> </ITEM> <ITEM ID="20010901"> <DATUM>1 september 2001</DATUM> <TEKST> Het papieren Woordenboek Organische Chemie is een feit. Het bestaat uit 71 pagina's, en het woordenboek bevat vier tabellen en een afkortingenlijst. Meer informatie is <a href="/woc/gui/verkoop/boek.html">hier</a> te vinden. </TEKST> </ITEM> <ITEM ID="20010815"> <DATUM>15 augustus 2001</DATUM> <TEKST> Een papieren Woordenboek Organische Chemie is in de maak. Op het komende KNCV Zomercongres zal de eerste versie gepresenteerd worden. </TEKST> </ITEM> <ITEM ID="20010810"> <DATUM>10 augustus 2001</DATUM> <TEKST> Het Woordenboek Organische Chemie zal op donderdag de 30ste aanwezig zijn op het <a href="http://www.kncv.nl/activiteiten/zc01/ZC01.html">KNCV Zomercongres</a>. Kom langs!<br/> </TEKST> </ITEM> <ITEM ID="20010710"> <DATUM>10 juli 2001</DATUM> <TEKST> En net als je vakantie hebt, wordt er op de computer ingebroken. Hierdoor is het nieuwsberichten-systeem tijdelijk onbruikbaar. Ook het forum is onbruikbaar, en vele andere diensten. De komende week zal hier een overzicht van gemaakt moeten worden. Voorals nog onze excuses voor het ongemak. </TEKST> </ITEM> <ITEM ID="20010610"> <DATUM>10 juni 2001</DATUM> <TEKST> Melde ik vorige maand nog dat het WOC project een nieuw fax-nummer heeft. Inmiddels is dit niet langer waar. Xoip is geld voor de dienst gaan vragen en het WOC project heeft op dit moment geen sponsoren. </TEKST> </ITEM> <ITEM ID="20010513"> <DATUM>13 mei 2001</DATUM> <TEKST> Het WOC project heeft een nieuw fax nummer: +31 84 8820236. <b>(Update 10 juni 2001: dit fax nummer kan niet meer gebruikt worden.)</b> </TEKST> </ITEM> <ITEM ID="20010401"> <DATUM>1 april 2001</DATUM> <TEKST> De afgelopen week is er een foutje geslopen in het systeem waarmee de A-Z index gemaakt werd. Daardoor verwezen bijna alle links naar een afkorting van Celcius. Deze fout is nu hersteld. Met dank aan de mensen die ons op de fout wezen. </TEKST> </ITEM> <ITEM ID="20010327"> <DATUM>27 maart 2001</DATUM> <TEKST> Reclame: de WOC-redactie onderhoudt sinds twee weken een zogenaamde link lijst. Hij is vergelijkbaar met <a href="http://chemie.pagina.nl">C3's link lijst</a>, maar onze insteek is anders. Op basis van onze ervaring met het WOC, geeft onze <a href="http://chemie.boogolinks.nl/">BoogoLinks link lijst</a> informatie op chemische onderwerpen. Aanvullingen op de lijst kunnen gestuurd worden naar <a href="mailto:ch...@bo...">ch...@bo...</a>. </TEKST> </ITEM> <ITEM ID="20010321"> <DATUM>21 maart 2001</DATUM> <TEKST> Gisteren heeft de 100.000 bezoeker om 17 minuten over 12 onze pagina aangedaan. </TEKST> </ITEM> <ITEM ID="20010319"> <DATUM>19 maart 2001</DATUM> <TEKST> Nadat vorige week de 16 miljoenste Nederlander genoteerd werd, verwachten wij morgen (dinsdag) de 100.000 bezoeker sinds najaar 1998. Merk op dat het gros hiervan het afgelopen jaar de site bezocht heeft. <a href="wo...@sc...">Stuur ons</a> een printscreen (Postscript) als jij de gelukkige bent (of bijna). </TEKST> </ITEM> <ITEM ID="20010319"> <DATUM>19 maart 2001</DATUM> <TEKST> Vorige week heeft de redactie weer een vergadering gehad. Daarna is een verdere optimalisatie uitgevoerd. Dit heeft tot gevolg dat er rechtsboven geen melding meer is op welke pagina u bent, maar maakt het systeem weer iets sneller. </TEKST> </ITEM> <ITEM ID="20010227"> <DATUM>27 februari 2001</DATUM> <TEKST> Er zijn meer dan 300 nieuwe 3D structuren toegevoegd. Ook maakt de viewer nu niet meer gebruik van ChemSymphony, maar van de OpenSource <a href="http://www.openscience.org/jmol/">Jmol Applet</a>. Hiermee kunnen ook bindingen getoond worden. </TEKST> </ITEM> <ITEM ID="20010224"> <DATUM>24 februari 2001</DATUM> <TEKST> Zoals ik eind vorige maand al opmerkte, gaf het hoge (maar nooit hoog genoeg) bezoekersaantal problemen met de huidige webserver. Als tijdelijke oplossing werd de fuzzy zoekmachine afgezet, zodat spelfouten niet meer gecorrigeerd werden. Inmiddels, is een andere zware belasting van de webserver in een andere vorm gegoten: de lijst met databases. Deze wordt nu niet meer aangemaakt als u de webpagina opvraagt, maar wanneer de aangemaakt wordt. Dit heeft als nadeel dat de informatie minder actueel is, maar als groot voordeel dat de server minder belast wordt en de pagina veel sneller getoond kan worden. Doordat de server nu minder belast is, is de fuzzy zoekmachine ook weer in ere hersteld! U kunt weer met een gerust hart typefouten maken. </TEKST> </ITEM> <ITEM ID="20010127"> <DATUM>27 januari 2001</DATUM> <TEKST> Door de steeds verder toenemende bezoekersaantal en het gebruik van het WOC, waar wij overigens zeer blij mee zijn, komt het project nu in een fase waar de snelheid van de software achter de website mee gaat tellen. Op korte termijn betekent dit dat we de zoekmachine in functionaliteit hebben moeten beperken (tijdelijk). Spelfouten die in het verleden toch resultaten gaven, doen dit nu niet meer. Maar dit is maar tijdelijk. Totdat we snellere software geschreven hebben. </TEKST> </ITEM> <ITEM ID="20010118"> <DATUM>18 januari</DATUM> <TEKST> Enkele dagen geleden is er op de webserver van de beta-faculteit van de Universiteit van Nijmegen ingebroken. Reactie van de systeembeheerders was dan ook elke toegang tot de machine van buiten de universiteit totdat de veiligheidsgaten hersteld waren, onmogelijk te maken. Hierdoor was de WOC website ook twee dagen niet bereikbaar, maar we zijn terug. </TEKST> </ITEM> <ITEM ID="20010107"> <DATUM>7 januari</DATUM> <TEKST> Verbindingen met een E-nummer (additieven) hebben nu een link naar de database <a href="http://www.voedsel.net/">Voedsel.net</a> die Nederlandstalige informatie bevat over deze verbindingen. </TEKST> </ITEM> <ITEM ID="20001207"> <DATUM>7 december</DATUM> <TEKST> Sinterklaas is net voorbij en de kerstman komt er weer aan. De redactie heeft pas een nieuwe vergadering achter de rug. Maar interessanter is <a href="http://jchempaint.sourceforge.net/images/cen.gif">dit stukje</a> uit de Chemistry & Engeneering News van de American Chemical Society (ACS). Ja, inderdaad de genoemde Dictionary is dit woordenboek! </TEKST> </ITEM> <ITEM ID="20001124"> <DATUM>24 november</DATUM> <TEKST> Problemen met de webserver hebben er de afgelopen week voor gezorgd dat korte en langere tijd delen van onze website niet werkte. Inmiddels lijken de problemen zich opgelost te hebben. </TEKST> </ITEM> <ITEM ID="20001103"> <DATUM>3 november</DATUM> <TEKST> Een <a href="/woc/gui/tabellen/periodieksysteem.html">periodiek systeem</a> is toegevoegd aan het WOC. Er is ook een <a href="/woc/gui/tabellen/periodieksysteem_java.html">Java versie</a> beschikbaar. </TEKST> </ITEM> <ITEM ID="20001019"> <DATUM>19 oktober</DATUM> <TEKST> Zeer binnenkort zal er een nieuw <a href="/woc/gui/forum.html">Forum</a> in gebruik genomen gaan worden. Vragen zullen op dit forum veel sneller beantwoord worden, omdat de discussiegroep landelijk gebruikt wordt. Op dit moment wordt het nieuwe systeem uitvoerig getest, maar neem gerust alvast een kijkje (en laat ons <a href="mailto:wo...@sc...">weten</a> wat je ervan vindt). </TEKST> </ITEM> <ITEM ID="20001010"> <DATUM>10 oktober</DATUM> <TEKST> De Nobelprijs voor de Chemie is dit jaar <a href="http://www.nobel.se/announcement/2000/chemistry.html">toegekend</a> aan de ontdekkers van <a href="gui/items/geleidende_polymeren.shtml">geleidende polymeren</a>. </TEKST> </ITEM> <ITEM ID="20001010"> <DATUM>10 oktober</DATUM> <TEKST> De <a href="http://www2.ccc.uni-erlangen.de/ncidb/frame.html">NCI Database</a> is toegevoegd aan de lijst met databases. In deze database zijn meer dan 200.000 stoffen doorzoekbaar. Via het WOC kan een uitgebreide webpagina, de SMILES structuur en de NSC code automatisch opgezocht worden. </TEKST> </ITEM> <ITEM ID="20001010"> <DATUM>10 oktober</DATUM> <TEKST> De lijst me databases wordt vanwege de snelheid in een cache bewaard. Hierdoor is de lijst maximaal 4 dagen oud. Hoewel dit in de meeste gevallen geen verschillen geeft, kan de lijst nu handmatig ververst worden. Het tonen van de lijst duurt dan wel een stuk langer. </TEKST> </ITEM> <ITEM ID="20000925"> <DATUM>25 september</DATUM> <TEKST> Live from the <a href="http://www.chemint.com">ChemInt 2000</a> congres in Washington D.C.: "Het WOC project is goed ontvangen. Met name het nieuwe TopicMap onderdeel trekt aandacht.", aldus Egon Willighagen. </TEKST> </ITEM> <ITEM ID="20000829"> <DATUM>29 augustus</DATUM> <TEKST> Donderdag en vrijdag is het jaarlijkse <a href="http://www.kncv.nl/">KNCV</a> Zomercongres, dat dit jaar het onderwerp "Onderwijs voor Morgen" heeft. Hopelijk komt het WOC naar voren als project in dit kader. </TEKST> </ITEM> <ITEM ID="20000829"> <DATUM>29 augustus</DATUM> <TEKST> Twee nieuwe indices zijn toegevoegd aan het blauwe menu links: <a href="gui/index/index.enum.html">E-Nummers</a> en <a href="gui/index/index.vnnum.html">VN-Nummers</a>. </TEKST> </ITEM> <ITEM ID="20000818"> <DATUM>18 augustus</DATUM> <TEKST> Afgelopen nacht is het tweeduizendste woord in het WOC ingevoerd. Hoewel niet bekend welk woord het precies was, is wel bekend dat het een <a href="gui/groups/zuurbaseindicatoren.html">zuur-base-indicator</a> is geweest. </TEKST> </ITEM> <ITEM ID="20000817"> <DATUM>17 augustus</DATUM> <TEKST> Tijdens het invoeren van een groot deel van het periodiek systeem, werd het duidelijk dat het Latijn als taal toegevoegd moest worden. De afkortingen van bijvoorbeeld <a href="gui/items/zilver.shtml">zilver</a>, <a href="gui/items/goud.shtml">goud</a> en <a href="gui/items/lood.shtml">lood</a> worden dan een stuk duidelijker. </TEKST> </ITEM> <ITEM ID="20000721"> <DATUM>21 juli</DATUM> <TEKST> De zoekmachine accepteert vanaf vandaag ook spelfouten. Zoeken op <a href="/cgi-bin-woc/search/sa.pl?text=amfiviel">amfiviel</a> zal ook amfifiel vinden. </TEKST> </ITEM> <ITEM ID="20000712"> <DATUM>12 juli</DATUM> <TEKST> Vandaag zal de 45.000 bezoeker het WOC geteld worden. Ben jij het? Laat dan een berichtje achter op het Forum. </TEKST> </ITEM> <ITEM ID="20000708"> <DATUM>8 juli</DATUM> <TEKST> Vandaag is het TopicMap systeem ingevoerd. Deze nieuwe XML technologie maakt kennismanagement beter mogelijk. Hoewel de software al geschreven is, moet de informatie nog ingevoerd worden. Een voorproefje kan genomen worden bij <a href="/woc/gui/items/azijnzuur.shtml">azijnzuur</a>, <a href="/woc/gui/items/butaan.shtml">butaan</a> en <a href="/woc/gui/items/polyvinylchloride.shtml">PVC</a>. </TEKST> </ITEM> <ITEM ID="20000629"> <DATUM>29 juni</DATUM> <TEKST> Nu de redactie op een laag pitje staat, en de hoofdredacteur druk bezig is met het upgraden van de software, gebeurd er aan de website minder. Forum vragen beantwoorden gaat gewoon door. Hulp kan altijd gebruikt worden, dus als je iets wilt doen, stuur dan een <a href="mailto:wo...@sc...">emailtje</a>. </TEKST> </ITEM> <ITEM ID="20000417"> <DATUM>17 april</DATUM> <TEKST> Omdat <a href="http://www.w3c.org/TR/1998/REC-xml-19980210" target="xhtml">XML</a> hoog bij ons op het prioriteitenlijstje staat, zijn we begonnen onze site conform XHTML te maken. Dit is de meest recente HTML standaard. Onze startpagina is dat inmiddels (de rest volgt snel): <p align="center"> <a href="http://validator.w3.org/check/referer" target="xhtml"><img src="http://validator.w3.org/images/vxhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a> </p> </TEKST> </ITEM> <ITEM ID="20000412"> <DATUM>12 april</DATUM> <TEKST> Op dit moment wordt hard gewerkt aan een demo voor de KNCV commissie voor de IUPAC Nomenclatuur. Afgelopen week zijn drie nieuwe technieken in het systeem ingevoerd. Hiermee kan ondermeer informatie in het WOC opgesplitst kan worden naar copyright. Zo hebben we nu de WOC bronnen en de IUPAC bronnen waarvan de copyright bij de eerder genoemde commissie ligt. De langverwachte Engelstalige versie komt nu dicht in de buurt. </TEKST> </ITEM> <ITEM ID="20000410"> <DATUM>10 april</DATUM> <TEKST> De tweede toegevoegde animatie is een leuke: de polymerisatie van <a href="gui/items/etheen.shtml">etheen</a> tot <a href="gui/items/polyetheen.shtml">polyethyleen</a> (PE). De <a href="gui/items/additiepolymerisatie.shtml">animatie</a> is in meerdere stappen gemaakt en overgenomen van een CD die het <a href="http://www.cmbi.nl/" target="cmbiwindow">Centrum voor Moleculaire en Biomoleculaire Informatica</a> (CMBI) vanaf morgen op de <a href="http://www.cmbi.kun.nl/wetche/vwo/" target="cmbiwindow">Studiedag voor Scheikunde Docenten</a> uitgeeft. </TEKST> </ITEM> </NEWS> --- NEW FILE: news.xsl --- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/NEWS"> <table> <xsl:apply-templates/> </table> </xsl:template> <xsl:template match="//TEKST"> <tr><td><p> <xsl:apply-templates/> </p></td></tr> </xsl:template> <xsl:template match="//DATUM"> <tr><td border="1" bgcolor="navy"><font color="white"><b> <xsl:apply-templates/> </b></font></td></tr> </xsl:template> <xsl:template match="//ITEM"> <xsl:variable name="pos" select="position()"/> <xsl:choose> <xsl:when test="$pos=2"> <tr><td border="1" bgcolor="navy"><font color="white"><b>Laatste verandering</b></font></td></tr> <xsl:apply-templates select="TEKST"/> </xsl:when> <!-- xsl:when test="$pos>6"/ --> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//a"> <xsl:choose> <xsl:when test="./@target='_top'"> <a href="{@href}" target="{@target}"> <xsl:apply-templates/> </a> </xsl:when> <xsl:otherwise> <a href="{@href}"> <xsl:apply-templates/> </a> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//img"> <img src="{@src}" width="{@width}" border="{@border}" alt="{@alt}"/> </xsl:template> <xsl:template match="//p"> <p align="{@align}"> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="//br"> <br /> </xsl:template> </xsl:stylesheet> --- NEW FILE: news_bu_20010118.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE ITEM SYSTEM "news.dtd"> <NEWS> <ITEM ID="20010107"> <DATUM>7 januari</DATUM> <TEKST> Verbindingen met een E-nummer (additieven) hebben nu een link naar de database <a href="http://www.voedsel.net/">Voedsel.net</a> die Nederlandstalige informatie bevat over deze verbindingen. </TEKST> </ITEM> <ITEM ID="20001207"> <DATUM>7 december</DATUM> <TEKST> Sinterklaas is net voorbij en de kerstman komt er weer aan. De redactie heeft pas een nieuwe vergadering achter de rug. Maar interessanter is <a href="http://jchempaint.sourceforge.net/images/cen.gif">dit stukje</a> uit de Chemistry & Engeneering News van de American Chemical Society (ACS). Ja, inderdaad de genoemde Dictionary is dit woordenboek! </TEKST> </ITEM> <ITEM ID="20001124"> <DATUM>24 november</DATUM> <TEKST> Problemen met de webserver hebben er de afgelopen week voor gezorgd dat korte en langere tijd delen van onze website niet werkte. Inmiddels lijken de problemen zich opgelost te hebben. </TEKST> </ITEM> <ITEM ID="20001103"> <DATUM>3 november</DATUM> <TEKST> Een <a href="/woc/gui/tabellen/periodieksysteem.html">periodiek systeem</a> is toegevoegd aan het WOC. Er is ook een <a href="/woc/gui/tabellen/periodieksysteem_java.html">Java versie</a> beschikbaar. </TEKST> </ITEM> <ITEM ID="20001019"> <DATUM>19 oktober</DATUM> <TEKST> Zeer binnenkort zal er een nieuw <a href="/woc/gui/forum.html">Forum</a> in gebruik genomen gaan worden. Vragen zullen op dit forum veel sneller beantwoord worden, omdat de discussiegroep landelijk gebruikt wordt. Op dit moment wordt het nieuwe systeem uitvoerig getest, maar neem gerust alvast een kijkje (en laat ons <a href="mailto:wo...@sc...">weten</a> wat je ervan vindt). </TEKST> </ITEM> <ITEM ID="20001010"> <DATUM>10 oktober</DATUM> <TEKST> De Nobelprijs voor de Chemie is dit jaar <a href="http://www.nobel.se/announcement/2000/chemistry.html">toegekend</a> aan de ontdekkers van <a href="gui/items/geleidende_polymeren.shtml">geleidende polymeren</a>. </TEKST> </ITEM> <ITEM ID="20001010"> <DATUM>10 oktober</DATUM> <TEKST> De <a href="http://www2.ccc.uni-erlangen.de/ncidb/frame.html">NCI Database</a> is toegevoegd aan de lijst met databases. In deze database zijn meer dan 200.000 stoffen doorzoekbaar. Via het WOC kan een uitgebreide webpagina, de SMILES structuur en de NSC code automatisch opgezocht worden. </TEKST> </ITEM> <ITEM ID="20001010"> <DATUM>10 oktober</DATUM> <TEKST> De lijst me databases wordt vanwege de snelheid in een cache bewaard. Hierdoor is de lijst maximaal 4 dagen oud. Hoewel dit in de meeste gevallen geen verschillen geeft, kan de lijst nu handmatig ververst worden. Het tonen van de lijst duurt dan wel een stuk langer. </TEKST> </ITEM> <ITEM ID="20000925"> <DATUM>25 september</DATUM> <TEKST> Live from the <a href="http://www.chemint.com">ChemInt 2000</a> congres in Washington D.C.: "Het WOC project is goed ontvangen. Met name het nieuwe TopicMap onderdeel trekt aandacht.", aldus Egon Willighagen. </TEKST> </ITEM> <ITEM ID="20000829"> <DATUM>29 augustus</DATUM> <TEKST> Donderdag en vrijdag is het jaarlijkse <a href="http://www.kncv.nl/">KNCV</a> Zomercongres, dat dit jaar het onderwerp "Onderwijs voor Morgen" heeft. Hopelijk komt het WOC naar voren als project in dit kader. </TEKST> </ITEM> <ITEM ID="20000829"> <DATUM>29 augustus</DATUM> <TEKST> Twee nieuwe indices zijn toegevoegd aan het blauwe menu links: <a href="gui/index/index.enum.html">E-Nummers</a> en <a href="gui/index/index.vnnum.html">VN-Nummers</a>. </TEKST> </ITEM> <ITEM ID="20000818"> <DATUM>18 augustus</DATUM> <TEKST> Afgelopen nacht is het tweeduizendste woord in het WOC ingevoerd. Hoewel niet bekend welk woord het precies was, is wel bekend dat het een <a href="gui/groups/zuurbaseindicatoren.html">zuur-base-indicator</a> is geweest. </TEKST> </ITEM> <ITEM ID="20000817"> <DATUM>17 augustus</DATUM> <TEKST> Tijdens het invoeren van een groot deel van het periodiek systeem, werd het duidelijk dat het Latijn als taal toegevoegd moest worden. De afkortingen van bijvoorbeeld <a href="gui/items/zilver.shtml">zilver</a>, <a href="gui/items/goud.shtml">goud</a> en <a href="gui/items/lood.shtml">lood</a> worden dan een stuk duidelijker. </TEKST> </ITEM> <ITEM ID="20000721"> <DATUM>21 juli</DATUM> <TEKST> De zoekmachine accepteert vanaf vandaag ook spelfouten. Zoeken op <a href="/cgi-bin-woc/search/sa.pl?text=amfiviel">amfiviel</a> zal ook amfifiel vinden. </TEKST> </ITEM> <ITEM ID="20000712"> <DATUM>12 juli</DATUM> <TEKST> Vandaag zal de 45.000 bezoeker het WOC geteld worden. Ben jij het? Laat dan een berichtje achter op het Forum. </TEKST> </ITEM> <ITEM ID="20000708"> <DATUM>8 juli</DATUM> <TEKST> Vandaag is het TopicMap systeem ingevoerd. Deze nieuwe XML technologie maakt kennismanagement beter mogelijk. Hoewel de software al geschreven is, moet de informatie nog ingevoerd worden. Een voorproefje kan genomen worden bij <a href="/woc/gui/items/azijnzuur.shtml">azijnzuur</a>, <a href="/woc/gui/items/butaan.shtml">butaan</a> en <a href="/woc/gui/items/polyvinylchloride.shtml">PVC</a>. </TEKST> </ITEM> <ITEM ID="20000629"> <DATUM>29 juni</DATUM> <TEKST> Nu de redactie op een laag pitje staat, en de hoofdredacteur druk bezig is met het upgraden van de software, gebeurd er aan de website minder. Forum vragen beantwoorden gaat gewoon door. Hulp kan altijd gebruikt worden, dus als je iets wilt doen, stuur dan een <a href="mailto:wo...@sc...">emailtje</a>. </TEKST> </ITEM> <ITEM ID="20000417"> <DATUM>17 april</DATUM> <TEKST> Omdat <a href="http://www.w3c.org/TR/1998/REC-xml-19980210" target="xhtml">XML</a> hoog bij ons op het prioriteitenlijstje staat, zijn we begonnen onze site conform XHTML te maken. Dit is de meest recente HTML standaard. Onze startpagina is dat inmiddels (de rest volgt snel): <p align="center"> <a href="http://validator.w3.org/check/referer" target="xhtml"><img src="http://validator.w3.org/images/vxhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a> </p> </TEKST> </ITEM> <ITEM ID="20000412"> <DATUM>12 april</DATUM> <TEKST> Op dit moment wordt hard gewerkt aan een demo voor de KNCV commissie voor de IUPAC Nomenclatuur. Afgelopen week zijn drie nieuwe technieken in het systeem ingevoerd. Hiermee kan ondermeer informatie in het WOC opgesplitst kan worden naar copyright. Zo hebben we nu de WOC bronnen en de IUPAC bronnen waarvan de copyright bij de eerder genoemde commissie ligt. De langverwachte Engelstalige versie komt nu dicht in de buurt. </TEKST> </ITEM> <ITEM ID="20000410"> <DATUM>10 april</DATUM> <TEKST> De tweede toegevoegde animatie is een leuke: de polymerisatie van <a href="gui/items/etheen.shtml">etheen</a> tot <a href="gui/items/polyetheen.shtml">polyethyleen</a> (PE). De <a href="gui/items/additiepolymerisatie.shtml">animatie</a> is in meerdere stappen gemaakt en overgenomen van een CD die het <a href="http://www.cmbi.nl/" target="cmbiwindow">Centrum voor Moleculaire en Biomoleculaire Informatica</a> (CMBI) vanaf morgen op de <a href="http://www.cmbi.kun.nl/wetche/vwo/" target="cmbiwindow">Studiedag voor Scheikunde Docenten</a> uitgeeft. </TEKST> </ITEM> <ITEM ID="20000328"> <DATUM>28 maart</DATUM> <TEKST> De eerste toegevoegde animatie is een rotatie van de C-C binding van ethaan die laat zien hoe de conformeren van ethaan in elkaar overgaan. Hij is over te halen bij <a href="gui/items/conformatie.shtml">conformatie</a>. </TEKST> </ITEM> <ITEM ID="20000328"> <DATUM>28 maart</DATUM> <TEKST> Nu er software beschikbaar is die op alle platformen draait en animaties kan laten zien (<a href="http://www.openscience.org/jmol/">Jmol</a>), en we bovendien eenvoudig animaties kunnen genereren (<a href="http://www.cmbi.nl/wetche/organic/">Mol4D</a>) gaan we animaties toevoegen aan het WOC. Op dit moment moeten de animaties nog gedownload worden en daarna bekeken worden met Jmol, maar in de toekomst kunt u Jmol als externe viewer installeren of de animaties via een applet bekijken. </TEKST> </ITEM> <ITEM ID="20000325"> <DATUM>25 maart</DATUM> <TEKST> Vandaag is een cache toegevoegd aan het WOC systeem, zodat het opvragen van veel gevraagde informatie een stuk sneller zal gaan, vooral tijdens de drukke uurtjes op het internet. Als gebruiker zult u hier weinig van merken, behalve dat de pagina sneller getoond wordt. </TEKST> </ITEM> <ITEM ID="20000221"> <DATUM>21 februari</DATUM> <TEKST> Tot mijn spijt is dit weekend de harde schijf van het WOC volgelopen. Hierdoor is het Forum gereset: alle berichten die geplaatst zijn na 25 januari zijn hierbij verloren geraakt. Mijn excuses hiervoor. (Dit herinnert mij eraan dat we heel hard op zoek zijn naar financiële ondersteuning.) <b>Inmiddels is een recentere versie (18 feb.) teruggezet, zodat bijna alle berichten weer herstelt zijn.</b> </TEKST> </ITEM> <ITEM ID="20000216"> <DATUM>16 februari</DATUM> <TEKST> Afgelopen maandag zijn we de 25.000 bezoekers gepasseerd in 15 maanden tijd. Elke gebruiker vraagt meer dan vier woorden op, zodat er ruim over de 100.000 woorden in het WOC zijn opgevraagd. Gemiddeld is elk woord in het WOC dus vijf keer opgevraagd. </TEKST> </ITEM> <ITEM ID="20000210"> <DATUM>10 februari</DATUM> <TEKST> <a href="http://www.chemfinder.com/">Chemfinder</a> lijkt weer helemaal tip-top in orde. Nieuwe functionaliteit in hun database is het gemakkelijker herhaaldelijk zoeken en een duidelijk betere indeling van hun lijst met databases. <b>Merk op</b> dat bijna alle verbindingen in het WOC een verwijzing hebben naar de Chemfinder pagina over die verbinding! </TEKST> </ITEM> <ITEM ID="20000208"> <DATUM>8 februari</DATUM> <TEKST> Ook de lijst met <a href="gui/index/index.bruto.html">bruto formules</a> is nu weer foutloos. </TEKST> </ITEM> <ITEM ID="20000203"> <DATUM>3 februari</DATUM> <TEKST> <a href="http://www.webmolecules.com/">WebMolecules </a> is eindelijk toegevoegd aan de lijst met verwijzingen naar andere databases. Deze site heeft lang op mijn verlanglijstje gestaan omdat 3D modellen daar in VRML over te halen zijn. Echter een automatische koppeling was tot voor kort niet mogelijk. </TEKST> </ITEM> <ITEM ID="20000128"> <DATUM>28 januari</DATUM> <TEKST> CambridgeSoft Inc. is druk bezig hun <a href="http://www.chemfinder.com/">Chemfinder</a> systeem te verbeteren. Het is niet duidelijk wat dit gaat betekenen, maar zoals een lezer al opmerkte betekent het in ieder geval, dat hun diensten zeer moeilijk of zelfs niet te bereiken zijn. Het WOC uiteraard wel. </TEKST> </ITEM> <ITEM ID="20000113"> <DATUM>13 januari</DATUM> <TEKST> Bug #19 is nu ook opgelost. Alle niet-afkortingen zijn uit de lijst met afkortingen verwijderd en de lijst is netjes gesorteerd. </TEKST> </ITEM> <ITEM ID="20000112"> <DATUM>12 januari</DATUM> <TEKST> In het begin van dit nieuwe jaar is het tijd voor een grote schoonmaak. Dit betekent voor ons dat we eens goed gaan kijken naar het WOC. Het aantal gevonden bugs is al aardig opgelopen. Daarom dat we afgelopen avond hebben zitten zoeken naar die ellendige beestjes. En dat gaf resultaat: de vervelende bug die in de Engels-Nederlandse en Duits-Nederlandse vertalingenlijsten zat is verdwenen. </TEKST> </ITEM> <ITEM ID="19991225"> <DATUM>25 december</DATUM> <TEKST> Gelukkig Kerstfeest en een spetterend Nieuw-jaar! </TEKST> </ITEM> <ITEM ID="19991216"> <DATUM>16 december</DATUM> <TEKST> Vanaf begin volgend jaar zal in deze nieuwskatern enkele "Molecule of the Month" sites in de gaten gehouden worden. Deze sites belichten elke maand een chemische verbinding op hun werking of voorkomen in de natuur. Een zo'n site is te vinden bij <a target="_top" href="http://www.bris.ac.uk/Depts/Chemistry/MOTM/motm.htm">Bristol University</a>. Deze maand is hun "Molecuul van de Maand" <a href="/woc/gui/items/tamoxifen.shtml">tamoxifen</a>. </TEKST> </ITEM> <ITEM ID="19991215"> <DATUM>15 december</DATUM> <TEKST> Onze database is bijgewerkt met fysische gegevens voor veel verbindingen. Er zijn nu meer dan 350 verbindingen waarvoor zulke gegevens in het WOC zijn opgenomen. Ook werken we aan een database met fysische gegevens voor meer dan 10.000 verbindingen. Hiervoor zal een speciaal project opgezet worden (CML Server). </TEKST> </ITEM> <ITEM ID="19991209"> <DATUM>9 december</DATUM> <TEKST> Om het bladeren door het woordenboek gemakkelijker te maken is bovenin in letterfile extra informatie toegevoegd. Bijvoorbeeld voor de letter Z waar elke pagina (nu 4) een regel heeft als [ <a href="/woc/gui/letters/z1.html">1</a> <a href="/woc/gui/letters/z2.html">2</a> <a href="/woc/gui/letters/z3.html">3</a> <a href="/woc/gui/letters/z4.html">4</a> ]. Hierdoor kan gelijk de laatste pagina gekozen worden, zonder onnodig veel bladeren. </TEKST> </ITEM> <ITEM ID="19991207"> <DATUM>7 december</DATUM> <TEKST> Het systeem voor het tonen van deze nieuwsberichten is geautomatiseerd. Deze start pagina laat nu geheel automatisch de laatste drie berichten zien. De <a href="/woc/gui/editor/nieuws.shtml">Oud en Nieuws</a> pagina laat alle nieuws berichten zien. </TEKST> </ITEM> <ITEM ID="19991207"> <DATUM>7 december</DATUM> <TEKST> Het aantal bezoekers heeft gisteren op de verjaardag van Sinterklaas (6 december) te 20.000 overschreden. Een mooier sinterklaarkadootje hadden we ons niet kunnen wensen. En we gaan dan ook hard door met het verbeteren van het WOC en het invoeren van meer informatie. Het aantal items heeft dan ook reeds de 1500 ruim achter zich gelaten. </TEKST> </ITEM> <ITEM ID="19991122"> <DATUM>22 november</DATUM> <TEKST> De zoekmachine ondersteund nu ook het gebruik van de asterix (*) en het vraagteken (?). Een voorbeeld is <a href="/cgi-bin-woc/search/sa.pl?text=amino*zuur">amino*zuur</a>. </TEKST> </ITEM> <ITEM ID="19991109"> <DATUM>9 november</DATUM> <TEKST> Onder de rode MSDS (=veiligheidsinfo) knoppen (bv. bij <a href="gui/items/hexaan.shtml">hexaan</a>) kon u in het verre verleden een lijst met links naar MSDS sites vinden. Ofwel sites waar ze weten hoe giftig verbindingen zijn en wat andere gevaren zijn (en hoe je die vermijdt). Na een jaar van ontbreken van deze functionaliteit is hij weer helemaal terug. Met twee drukken op de knop kent u dus weer de gevaren van vele chemicaliën. </TEKST> </ITEM> <ITEM ID="19991109"> <DATUM>9 november</DATUM> <TEKST> Zoals u wellicht is opgevallen hebben meerdere woorden (bv. <a href="gui/items/alkanen.shtml">alkanen</a>) een gele map rechtsbovenin staan. Als u hierop klikt krijgt u een boomstructuur met alle woorden die tot deze groep horen. Zo leert u snel welke items allemaal alkanen zijn. Zo zijn cyclohexaan en cyclopentaan cycloalkanen en daarom ook alkanen. De nieuwe versie is meer dan tien keer zo snel als de oude. Probeert u maar eens. </TEKST> </ITEM> <ITEM ID="19991011"> <DATUM>11 oktober</DATUM> <TEKST> De interface wordt langzaam uitgebreid. Het kunnen instellen van voorkeuren en het bekijken van een persoonlijke history komt nog dit jaar. Pas veranderd is de zoekmachine. Mocht er maar een zoekresultaat gevonden zijn, dan wordt deze direct getoond (Probeer eens: <a href="/cgi-bin-woc/search/sa.pl?text=Diels">Diels</a>). Andere wensen voor de gebruikersinterface kunnen op het Forum achter gelaten worden onder de kop Verbeteringen. </TEKST> </ITEM> <ITEM ID="19990802"> <DATUM>2 augustus</DATUM> <TEKST> Er is een serieus begin gemaakt met het opnemen van 3D plaatjes van de HOMO (highest occupied molecular orbital) van verbindingen. Deze plaatjes zijn gemaakt met <a href="http://www.chemoffice.com/">ChemOffice Ultra 5.0</a>, dat ons door CambridgeSoft ter beschikking is gesteld. <p align="center"><a href="gui/items/acepentaleen.shtml"><img src="data/pictures/homos/WOC-4-00-2.gif" border="0" alt="HOMO orbitaal van acepentaleen"/></a><br/> <i>HOMO orbitaal van acepentaleen</i>.</p> </TEKST> </ITEM> <ITEM ID="19990722"> <DATUM>22 juli</DATUM> <TEKST> De fysische gegevens uit dit woordenboek zijn nu ook via de databases-lijst onderaan bij chemische verbindingen, te bekijken. Hiervoor wordt gebruik gemaakt van geavanceerde webtechieken zoals XML en XSL. De browser IE 5.0 is prima in staat deze documenten te tonen. Ook <a href="http://www.xml-cml.org/">Jumbo</a> kan dit. </TEKST> </ITEM> </NEWS> --- NEW FILE: news_latest.xsl --- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/NEWS"> <table> <xsl:apply-templates/> </table> </xsl:template> <xsl:template match="//TEKST"> <tr><td><p> <xsl:apply-templates/> </p></td></tr> </xsl:template> <xsl:template match="//DATUM"> <tr><td border="1" bgcolor="navy"><font color="white"><b> <xsl:apply-templates/> </b></font></td></tr> </xsl:template> <xsl:template match="//ITEM"> <xsl:variable name="pos" select="position()"/> <xsl:choose> <xsl:when test="$pos=2"> <tr><td border="1" bgcolor="navy"><font color="white"><b>Laatste verandering (<xsl:value-of select="DATUM"/>)</b></font></td></tr> <xsl:apply-templates select="TEKST"/> </xsl:when> <xsl:when test="$pos>6"/> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//a"> <xsl:choose> <xsl:when test="@target"> <a href="{@href}" target="{@target}"> <xsl:apply-templates/> </a> </xsl:when> <xsl:otherwise> <a href="{@href}"> <xsl:apply-templates/> </a> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//img"> <img src="{@src}" width="{@width}" border="{@border}" alt="{@alt}"/> </xsl:template> <xsl:template match="//p"> <p align="{@align}"> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="//br"> <br /> </xsl:template> </xsl:stylesheet> |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:55
|
Update of /cvsroot/woc/woc/src/woc/src/topic In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/src/topic Added Files: make_associations_index.pl make_shtmlfiles_index.pl make_xmlfiles_index.pl topic2html.pl update.sh Log Message: --- NEW FILE: make_associations_index.pl --- #!/usr/local/bin/perl -w use strict; use diagnostics; if (!-e "associaties.xml") { print "The file associaties.xml does not exist!$/"; exit(0); } open(SOURCE, "<associaties.xml"); my @source = <SOURCE>; close(SOURCE); open(TARGET, ">associations_index"); while (@source) { while (@source && $source[0] !~ /<topic/i) { shift @source; } my $at = ""; $at = $1 if (@source && $source[0] =~ /id="(.*?)"/i); my $name = ""; while (@source && !($source[0] =~ /<\/topic/i || $source[0] =~ /<topic.*?\/>/i)) { $name = $1 if ($source[0] =~ /<basename>(.*?)<\/basename>/i); $name =~ s/<woctm:assocrl\senum="(.*?)"\/>/\$$1\$/g; $name =~ s/<woctm:assocrl\senum="/\$/g; shift @source; } print TARGET "$at $name\n" if ($at && $name); shift @source; } close(TARGET); --- NEW FILE: make_shtmlfiles_index.pl --- #!/usr/local/bin/perl -w use strict; my $wmldir = "/vol/www/woc/web-docs/gui/items"; my @files = `ls -1 $wmldir/*.shtml`;#<$wmldir/*.shtml>; my $filename = ""; my @file = (); my $itemname = ""; open(TARGET, ">shtmlfiles_index"); foreach $filename (@files) { chomp ($filename); open(FILE, "<$filename"); @file = <FILE>; while (@file && $file[0] !~ /<a class="item" name=/i) { shift @file; } $itemname = ""; $itemname = $1 if (@file && $file[0] =~ />([^>]*?)<\/B><\/a>/i); print TARGET "$filename $itemname\n" if ($itemname); } --- NEW FILE: make_xmlfiles_index.pl --- #!/usr/local/bin/perl -w use strict; my $wmldir = "/vol/www/woc/data/wml"; my @files = <$wmldir/*.xml>; my $filename = ""; my @file = (); my $itemname = ""; open(TARGET, ">associations_index"); foreach $filename (@files) { open(FILE, "<$filename"); @file = <FILE>; while (@file && $file[0] !~ /<ITEM/i) { shift @file; } $itemname = ""; $itemname = $1 if (@file && $file[0] =~ /NAME="(.*?)"/i); print "$filename $itemname\n" if ($itemname); } --- NEW FILE: topic2html.pl --- #!/usr/local/bin/perl -w use strict; ## global vars ## my $associations_indexfile = "associations_index"; my $xmlfiles_indexfile = "xmlfiles_index"; my $shtmlfiles_indexfile = "shtmlfiles_index"; my $wmldir = "/vol/www/woc/data/wml"; my $verbose = ""; # False my $debug = ""; # False ### MAIN ### print "Content-type: text/plain\n\n\n"; my $associations_index = {()}; my $xmlfiles_index = {()}; my $shtmlfiles_index = {()}; if (@ARGV) { while ($ARGV[0] =~ /^\-/) { if ($ARGV[0] =~ /^\-d/i) { $debug = "Active"; shift @ARGV; } if ($ARGV[0] =~ /^\-v/i) { $verbose = "Active"; shift @ARGV; } } $associations_index = &get_associations_index ($associations_indexfile); $xmlfiles_index = &get_xmlfiles_index ($xmlfiles_indexfile); $shtmlfiles_index = &get_shtmlfiles_index ($shtmlfiles_indexfile); foreach my $file (@ARGV) { &process_file ("$wmldir/$file", $associations_index, $xmlfiles_index, $shtmlfiles_index); } } else { die "Usage: $0 [-v[erbose]] [-d[ebug]] <xml-files>\n"; } ### END of MAIN ### sub get_associations_index { my %associations_index = (); if (open (INDEXFILE, $_[0])) { my @indexfile = <INDEXFILE>; foreach my $line (@indexfile) { my ($assoc, @line) = split (/\s+/, $line); $associations_index{$assoc} = join (" ", @line); } } else { warn "The associations indexfile $_[0] cannot be read!\n"; } return \%associations_index; } sub get_xmlfiles_index { my %xmlfiles_index = (); if (open (INDEXFILE, $_[0])) { my @indexfile = <INDEXFILE>; foreach my $line (@indexfile) { my ($xmlfile, @name) = split (/\s+/, $line); $xmlfiles_index{join (" ", @name)} = $xmlfile; } } else { warn "The xmlfiles indexfile $_[0] cannot be read!\n"; } return \%xmlfiles_index; } sub get_shtmlfiles_index { my %shtmlfiles_index = (); if (open (INDEXFILE, $_[0])) { my @indexfile = <INDEXFILE>; foreach my $line (@indexfile) { my ($shtmlfile, @name) = split (/\s+/, $line); $shtmlfiles_index{join (" ", @name)} = $shtmlfile; } } else { warn "The shtmlfiles indexfile $_[0] cannot be read!\n"; } return \%shtmlfiles_index; } sub process_file { my ($file, $associations_index, $xmlfiles_index, $shtmlfiles_index) = @_; ## get topicname and associations ## my $topicname = ""; my $associations = []; if (open (XMLFILE, $_[0])) { my @xmlfile = <XMLFILE>; while (@xmlfile && $xmlfile[0] !~ /<ITEM/i) { shift @xmlfile; print "current line=$xmlfile[0]" if $debug; } $topicname = $1 if (@xmlfile && $xmlfile[0] =~ /NAME="(.+?)"/i); while (@xmlfile) { while (@xmlfile && $xmlfile[0] !~ /<tm:assoc\s/i) { shift @xmlfile; print "current line=$xmlfile[0]" if $debug && @xmlfile; } my $assoc = ""; if (@xmlfile && $xmlfile[0] =~ /id="(.+?)"/i) { $assoc = $1; print "Found association=$1\n" if $verbose; } shift @xmlfile if @xmlfile; print "current line=$xmlfile[0]" if $debug && @xmlfile; ## get all associated files! ## my @assocrl = (); while (@xmlfile && $xmlfile[0] !~ /<\/tm:assoc>/i) { while (@xmlfile && $xmlfile[0] !~ /<\/tm:assoc>/i && $xmlfile[0] !~ /<tm:assocrl\s/i) { shift @xmlfile; print "current line=$xmlfile[0]" if $debug; } if (@xmlfile && $xmlfile[0] =~ /xlink:href="(.+?)"/i) { push (@assocrl, $1); print "Found assoclink=$1\n" if $verbose; } else { print "No assoclink??\n" if $verbose && @xmlfile; } if (@xmlfile && $xmlfile[0] !~ /<\/tm:assoc>/i){ shift @xmlfile; print "current line=$xmlfile[0]" if $debug; } } if ($assoc && @assocrl) { push (@$associations, [$assoc, \@assocrl]); print "Pussing assoc=$assoc @assocrl\n" if $verbose; } else { print "Was last association\n" if $verbose && !@xmlfile; } } } else { warn "The xmlfile $_[0] cannot be read!\n"; } ## turn associations into HTML ## my @result = (); foreach my $assoc (@$associations) { my $association = ($$associations_index{$$assoc[0]} || ""); print "Assoc: $association$/" if $debug; if ($association =~ /\$.*?\$/) { my @related_topics = @{$$assoc[1]}; my @related_files = (); foreach my $related_topic (@related_topics) { if (exists $$shtmlfiles_index{$related_topic}) { push (@related_files, $$shtmlfiles_index{$related_topic}); } else { push (@related_files, ""); } } $association =~ s/\$0\$/<I>$topicname<\/I>/g; if ($association =~ /\$\*\$/) { print "Substitute \*...$/" if $verbose; while (@related_files) { my $related_file = shift @related_files; my $related_topic = shift @related_topics; my $delim = ","; $delim = " en" if (scalar @related_files == 1); $delim = "" if (scalar @related_files == 0); if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; $association =~ s/\$\*\$/ <A HREF=\"\/cgi-bin-woc\/topiclink\/link.pl?$related_file+$$assoc[0]\"><I>$related_topic<\/I><\/A>$delim\$\*\$/g; } else { # don't link # $association =~ s/\$\*\$/ <I>$related_topic<\/I>\$\*\$/g; } } print "New Assoc: $association$/" if $verbose; } $association =~ s/\$\*\$//g; my $i = 1; while ($association =~ /\$$i\$/) { my $related_file = shift @related_files; my $related_topic = shift @related_topics; if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; $association =~ s/\$$i\$/<A HREF=\"\/cgi-bin-woc\/topiclink\/link.pl?$related_file\+$$assoc[0]\"><I>$related_topic<\/I><\/A>/g; } else { # don't link # $association =~ s/\$$i\$/<I>$related_topic<\/I>/g; } $association =~ s/\$$i\$/<I>$topicname<\I>/g; $i++ } push (@result, "$association<BR />\n"); } elsif ($association) { my @related_topics = @{$$assoc[1]}; my @related_files = (); foreach my $related_topic (@related_topics) { if (exists $$shtmlfiles_index{$related_topic}) { push (@related_files, $$shtmlfiles_index{$related_topic}); } else { push (@related_files, ""); } } push (@result, "<I>$topicname</I> $association"); my $related_file = shift @related_files; my $related_topic = shift @related_topics; if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; push (@result, " <A HREF=\"/cgi-bin-woc/topiclink/link.pl?$related_file\+$$assoc[0]\"><I>$related_topic</I></A>"); } else { # don't link # push (@result, " <I>$related_topic</I>"); } while (@related_files) { my $related_file = shift @related_files; my $related_topic = shift @related_topics; if (@related_files > 0) { if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; push (@result, ", <A HREF=\"\/cgi-bin-woc\/topiclink\/link.pl?$related_file\+$$assoc[0]\"><I>$related_topic</I></A>"); } else { # don't link # push (@result, ", <I>$related_topic</I>"); } } elsif (@related_files == 0) { if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; push (@result, " en <A HREF=\"\/cgi-bin-woc\/topiclink\/link.pl?$related_file\+$$assoc[0]\"><I>$related_topic</I></A>"); } else { # don't link # push (@result, " en <I>$related_topic</I>"); } } } push (@result, "<BR />\n"); } } foreach (@result) { print; } } --- NEW FILE: update.sh --- ./make_xmlfiles_index.pl > xmlfiles_index ./make_shtmlfiles_index.pl ./make_associations_index.pl |
Update of /cvsroot/woc/woc/src/woc/src/download In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/src/download Added Files: Makefile.am download_pdb_from_NCI.pl download_pdb_from_NCI.pl.in download_xyz_from_NCI.pl download_xyz_from_NCI.pl.in Log Message: --- NEW FILE: Makefile.am --- bindir=${prefix}/bin/download bin_SCRIPTS = \ download_pdb_from_NCI.pl \ download_xyz_from_NCI.pl CLEANFILES = $(bin_SCRIPTS) --- NEW FILE: download_pdb_from_NCI.pl --- #! /usr/bin/perl -w use diagnostics; use strict; use LWP; use LWP::Simple; use XML::XPath; my $root = "../../data/dadml/3d/pdb"; my $urlbase = "http://131.188.127.153/cgi-bin/services/ncidb/ncidb2.tcl"; # Check command line options if (@ARGV == 0) { print "Usage: $0 <xml-files>$/"; exit; } # Global variables my $nr_downloaded_PDBs = 0; my $nr_PDB_in_NCI = 0; my $nr_PDB_already_done = 0; my $nr_CAS_found = 0; my $nr_files = scalar @ARGV; # Loop over all files my $cas = ""; foreach my $arg (@ARGV) { print "Checking $arg...$/"; my $xp = XML::XPath->new(filename => $arg); my $cas = $xp->findvalue('/ITEM/INDEX[@CLASS="CAS-NUMBER"]'); if ($cas ne "" && (!-e "$root/$cas.pdb")) { $nr_CAS_found++; my $url = "$urlbase?op1=cas&data1=$cas&op2=cas&data2=&op3=inclformula&data3=&op4=fse&data4=&dohighlight=1&andor=and&maxhits=100&timeout=90&output=pdb&sort=nsc"; print "URL: $url\n"; my $browser = LWP::UserAgent->new(); $browser->agent("WOC Downloader"); my $request = HTTP::Request->new(GET => $url); print STDERR " ...trying to download PDB for $cas"; my $foo = $browser->request($request); if ($foo->is_success) { my $content = $foo->content || ""; if ($content ne "" && !($content =~ /HTML/i)) { print " ... and saving$/"; open (PDBFILE, ">$root/$cas.pdb"); print PDBFILE $content; $nr_downloaded_PDBs++; } else { print " ... no PDB file found$/"; $nr_PDB_in_NCI++; } } else { print " ... unexpected error has occured\n"; } } else { if ($cas eq "") { print " ... no CAS number$/"; } else { print " ...$cas.pdb already present!$/"; $nr_PDB_already_done++; } } } # Print statistics print " ----------------------------$/"; print "Files checked : $nr_files$/"; print " CAS number found : $nr_CAS_found$/"; print " PDB files downloaded : $nr_downloaded_PDBs$/"; print " PDB files not in NCI : $nr_PDB_in_NCI$/"; print " PDB already done : $nr_PDB_already_done$/"; --- NEW FILE: download_pdb_from_NCI.pl.in --- #! @PATHTOPERL@ -w use diagnostics; use strict; use LWP; use LWP::Simple; use XML::XPath; my $root = "../../data/dadml/3d/pdb"; my $urlbase = "http://131.188.127.153/cgi-bin/services/ncidb/ncidb2.tcl"; # Check command line options if (@ARGV == 0) { print "Usage: $0 <xml-files>$/"; exit; } # Global variables my $nr_downloaded_PDBs = 0; my $nr_PDB_in_NCI = 0; my $nr_PDB_already_done = 0; my $nr_CAS_found = 0; my $nr_files = scalar @ARGV; # Loop over all files my $cas = ""; foreach my $arg (@ARGV) { print "Checking $arg...$/"; my $xp = XML::XPath->new(filename => $arg); my $cas = $xp->findvalue('/ITEM/INDEX[@CLASS="CAS-NUMBER"]'); if ($cas ne "" && (!-e "$root/$cas.pdb")) { $nr_CAS_found++; my $url = "$urlbase?op1=cas&data1=$cas&op2=cas&data2=&op3=inclformula&data3=&op4=fse&data4=&dohighlight=1&andor=and&maxhits=100&timeout=90&output=pdb&sort=nsc"; print "URL: $url\n"; my $browser = LWP::UserAgent->new(); $browser->agent("WOC Downloader"); my $request = HTTP::Request->new(GET => $url); print STDERR " ...trying to download PDB for $cas"; my $foo = $browser->request($request); if ($foo->is_success) { my $content = $foo->content || ""; if ($content ne "" && !($content =~ /HTML/i)) { print " ... and saving$/"; open (PDBFILE, ">$root/$cas.pdb"); print PDBFILE $content; $nr_downloaded_PDBs++; } else { print " ... no PDB file found$/"; $nr_PDB_in_NCI++; } } else { print " ... unexpected error has occured\n"; } } else { if ($cas eq "") { print " ... no CAS number$/"; } else { print " ...$cas.pdb already present!$/"; $nr_PDB_already_done++; } } } # Print statistics print " ----------------------------$/"; print "Files checked : $nr_files$/"; print " CAS number found : $nr_CAS_found$/"; print " PDB files downloaded : $nr_downloaded_PDBs$/"; print " PDB files not in NCI : $nr_PDB_in_NCI$/"; print " PDB already done : $nr_PDB_already_done$/"; --- NEW FILE: download_xyz_from_NCI.pl --- #! /usr/bin/perl -w use diagnostics; use strict; use LWP; use LWP::Simple; my $root = "../../data/dadml/3d/xyz"; my $urlbase = "http://131.188.127.153/cgi-bin/services/ncidb/ncidb2.tcl"; # Check command line options if (@ARGV == 0) { print "Usage: $0 <xml-files>$/"; exit; } # Global variables my $no_downloaded_XYZs = 0; my $no_XYZ_in_NCI = 0; my $no_XYZ_already_done = 0; my $no_CAS_found = 0; my $no_files = scalar @ARGV; # Loop over all files my $cas = ""; foreach my $arg (@ARGV) { print "Checking $arg...$/"; open (FILEHANDLE, "<$arg"); $cas = ""; while (<FILEHANDLE>) { if (/CAS-NUMBER/i && /\>(.+?)\</) { $cas = $1; } }; if ($cas ne "" && (!-e "$root/$cas.xyz")) { $no_CAS_found++; my $url = "$urlbase?op1=cas&data1=$cas&op2=cas&data2=&op3=inclformula&data3=&op4=fse&data4=&dohighlight=1&andor=and&maxhits=100&timeout=90&output=xyz&sort=nsc"; my $browser = LWP::UserAgent->new(); $browser->agent("WOC Downloader"); my $request = HTTP::Request->new(GET => $url); print STDERR " ...downloading XYZ for $cas"; my $foo = $browser->request($request); if ($foo->is_success) { my $content = $foo->content || ""; if ($content ne "" && !($content =~ /HTML/i)) { print " ... and saving$/"; open (XYZFILE, ">$root/$cas.xyz"); print XYZFILE $content; $no_downloaded_XYZs++; } else { print " ... no XYZ file found$/"; $no_XYZ_in_NCI++; } } } else { if ($cas eq "") { print " ... no CAS number$/"; } else { print " ...$cas.xyz already downloaded!$/"; $no_XYZ_already_done++; } } } # Print statistics print " ----------------------------$/"; print "Files checked : $no_files$/"; print " CAS number found : $no_CAS_found$/"; print " XYZ files downloaded : $no_downloaded_XYZs$/"; print " XYZ files not in NCI : $no_XYZ_in_NCI$/"; print " XYZ already done : $no_XYZ_already_done$/"; --- NEW FILE: download_xyz_from_NCI.pl.in --- #! @PATHTOPERL@ -w use diagnostics; use strict; use LWP; use LWP::Simple; my $root = "../../data/dadml/3d/xyz"; my $urlbase = "http://131.188.127.153/cgi-bin/services/ncidb/ncidb2.tcl"; # Check command line options if (@ARGV == 0) { print "Usage: $0 <xml-files>$/"; exit; } # Global variables my $no_downloaded_XYZs = 0; my $no_XYZ_in_NCI = 0; my $no_XYZ_already_done = 0; my $no_CAS_found = 0; my $no_files = scalar @ARGV; # Loop over all files my $cas = ""; foreach my $arg (@ARGV) { print "Checking $arg...$/"; open (FILEHANDLE, "<$arg"); $cas = ""; while (<FILEHANDLE>) { if (/CAS-NUMBER/i && /\>(.+?)\</) { $cas = $1; } }; if ($cas ne "" && (!-e "$root/$cas.xyz")) { $no_CAS_found++; my $url = "$urlbase?op1=cas&data1=$cas&op2=cas&data2=&op3=inclformula&data3=&op4=fse&data4=&dohighlight=1&andor=and&maxhits=100&timeout=90&output=xyz&sort=nsc"; my $browser = LWP::UserAgent->new(); $browser->agent("WOC Downloader"); my $request = HTTP::Request->new(GET => $url); print STDERR " ...downloading XYZ for $cas"; my $foo = $browser->request($request); if ($foo->is_success) { my $content = $foo->content || ""; if ($content ne "" && !($content =~ /HTML/i)) { print " ... and saving$/"; open (XYZFILE, ">$root/$cas.xyz"); print XYZFILE $content; $no_downloaded_XYZs++; } else { print " ... no XYZ file found$/"; $no_XYZ_in_NCI++; } } } else { if ($cas eq "") { print " ... no CAS number$/"; } else { print " ...$cas.xyz already downloaded!$/"; $no_XYZ_already_done++; } } } # Print statistics print " ----------------------------$/"; print "Files checked : $no_files$/"; print " CAS number found : $no_CAS_found$/"; print " XYZ files downloaded : $no_downloaded_XYZs$/"; print " XYZ files not in NCI : $no_XYZ_in_NCI$/"; print " XYZ already done : $no_XYZ_already_done$/"; |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:52
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/ir In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/ir Added Files: link.pl Log Message: --- NEW FILE: link.pl --- #!/usr/local/gnu/bin/perl -- -*-perl-*- # ------------------------------------------------------------ # ------------------------------------------------------------ # Print out what we need print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD>\n"; print " <title>Infrarood Spectrum</title>\n"; print "</HEAD>\n"; print "<BODY bgcolor=white>\n"; print "<CENTER><h1>Infrarood Spectrum</h1></center>\n"; print "<hr>"; print "<p>Er is gezocht op CAS NR <i>"; print @ARGV; print "</i> in:"; print "<h1><a href='http://webbook.nist.gov/'>NIST Chemitry Webbook</a></h1>\n"; print "<ul>\n"; print " <APPLET CODEBASE='http://webbook.nist.gov/classes/' CODE='JCAMP.class' WIDTH=100% HEIGHT=90%>\n"; print " <PARAM NAME='SRC' VALUE='http://webbook.nist.gov/cgi/cbook.exe?JCAMP=C"; print @ARGV; print "&Type=IR'>\n"; print " <P><BLOCKQUOTE>\n"; print " <STRONG>Notice:</STRONG> This spectrum may be better viewed with a Java capable browser.\n"; print " </BLOCKQUOTE></P>\n"; print " <IMG SRC='http://webbook.nist.gov//cgi/cbook.exe?Spec=C"; print @ARGV; print "&Type=IR' ALT='IR spectrum'>\n"; print " </TABLE>\n"; print " </APPLET\n>"; print "</ul>\n"; print "<hr>\n"; print "</BODY>\n</HTML>\n"; |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:52
|
Update of /cvsroot/woc/woc/src/woc/src In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/src Added Files: Makefile.am excluded-gifs excluded-gifs-backup excluded-pdbs Log Message: --- NEW FILE: Makefile.am --- PREFIX="@prefix@" SUBDIRS= cas check download index lire wml2html EXTRA_DIST= --- NEW FILE: excluded-gifs --- 7732-18-5 7664-93-9 7783-06-4 75-15-0 7789-20-0 7782-44-7 7647-01-0 71-52-3 506-87-6 10028-15-6 84-81-1 74-88-4 74-87-3 74-83-9 93-58-3 630-08-0 124-38-9 630-08-0 124-38-9 9005-32-7 9016-00-6 75-45-6 75-69-4 7446-09-5 505-60-2 7664-39-3 7727-37-9 --- NEW FILE: excluded-gifs-backup --- 7732-18-5 7664-93-9 7783-06-4 75-15-0 7789-20-0 7782-44-7 7647-01-0 71-52-3 506-87-6 10028-15-6 84-81-1 74-88-4 74-87-3 74-83-9 93-58-3 630-08-0 124-38-9 630-08-0 124-38-9 9005-32-7 9016-00-6 75-45-6 75-69-4 7446-09-5 --- NEW FILE: excluded-pdbs --- 7732-18-5 Vanzelfsprekend (Water) 7789-20-0 Vanzelfsprekend (Zwaar water) 7782-44-7 Vanzelfsprekend (Zuurstof) 144-55-8 Vanzelfsprekend (Zuiveringszout) 7647-01-0 Vanzelfsprekend (Zoutzuur) |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:52
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/usenet In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/usenet Added Files: Article.pm webinterface.pl Log Message: --- NEW FILE: Article.pm --- package Article; use strict; sub new { my $self = {}; $self->{NO} = undef; $self->{ID} = undef; $self->{SUBJECT} = undef; $self->{FROM} = undef; $self->{DATE} = undef; $self->{REFS} = undef; $self->{FUPS} = undef; $self->{THEME} = undef; $self->{BODY} = []; bless($self); return $self; } sub addFup { #my $self = shift; #my $fup = shift; $_[0]->{FUPS} .= " $_[1]"; } sub theme { #my $self = shift; if ($_[1]) { $_[0]->{THEME} = $_[1] }; #= shift }; return $_[0]->{THEME}; } sub fups { #my $self = shift; if ($_[1]) { $_[0]->{FUPS} = $_[1] }; #= shift }; return $_[0]->{FUPS}; } sub refs { #my $self = shift; if ($_[1]) { $_[0]->{REFS} = $_[1] }; #= shift }; return $_[0]->{REFS}; } sub body { my $self = shift; if (@_) { @{$self->{BODY}} = @_ }; return @{$self->{BODY}}; } sub from { #my $self = shift; if ($_[1]) { $_[0]->{FROM} = $_[1] }; #= shift }; return $_[0]->{FROM}; } sub no { #my $self = shift; if ($_[1]) { $_[0]->{NO} = $_[1] }; #= shift }; return $_[0]->{NO}; } sub date { #my $self = shift; if ($_[1]) { $_[0]->{DATE} = $_[1] }; #= shift }; return $_[0]->{DATE}; } sub id { #my $self = shift; if ($_[1]) { $_[0]->{ID} = $_[1] }; #= shift }; return $_[0]->{ID}; } sub subject { #my $self = shift; if ($_[1]) { $_[0]->{SUBJECT} = $_[1] }; #= shift }; return $_[0]->{SUBJECT}; } 1; --- NEW FILE: webinterface.pl --- #!/usr/local/bin/perl -w use strict; use diagnostics; use News::NNTPClient; use Article; use CGI; # consts my $url = "/cgi-bin-woc/usenet/webinterface.pl"; my $server = "nntp-srv.sci.kun.nl"; my $group = "nl.wetenschap"; my $cachedir = "/tmp/woc/usenet"; my @themes = ("chemische verbindingen", "meer info", "synthese", "chemische software", "anders"); # read params my $query = new CGI; my $message = int($query->param("message") || 0); my $command = $query->param("command") || "overzicht"; my $showheader = int($query->param("header") || undef); my $theme = $query->param("theme") || undef; my $tvalue = $query->param("threaded"); my $threaded = 1; $threaded = int($tvalue) if (defined $tvalue); # instantiate client my $client = new News::NNTPClient($server); my ($first, $last) = ($client->group($group)); my $status = ""; my $content = ""; my %articles = (); my %index = (); my %printed = (); my %fups = (); if ($command eq "search") { my $searched = $query->param("query") || ""; my $field = $query->param("field") || "alle"; if ($searched ne "") { # parse articles for (my $i = $first; $i <= $last; $i++) { my $art = getArticleByNo($i); if (defined $art) { $articles{$art->id()} = $art; $index{int($i)} = $art->id(); if (defined $art->refs()) { foreach my $ref (split(' ', $art->refs())) { my $nart = $articles{$ref}; if (defined $nart) { $nart->addFup($art->id()); } } } } } # do search $content .= "<h3>Gezocht naar: $searched</h3>$/<ul>$/"; foreach my $artid (reverse sort keys %index) { my $index = $index{int($artid)}; my $art = $articles{$index}; my $match = 0; if (($field eq "onderwerp" || $field eq "alle") && (defined (my $subject = $art->subject()))) { $match = 1 if ($subject =~ /$searched/ig); } if (!$match && ($field eq "schrijver" || $field eq "alle") && (defined (my $author = $art->from()))) { $match = 1 if ($author =~ /$searched/ig); } if (!$match && ($field eq "datum" || $field eq "alle") && (defined (my $date = $art->date()))) { $match = 1 if ($date =~ /$searched/ig); } if (!$match && ($field eq "bericht" || $field eq "alle") && (defined (my @text = $art->body()))) { foreach my $line (@text) { #$content .= $line; $match = 1 if ($line =~ /$searched/ig); } } if ($match == 1) { $content .= printArticle($index); } } $content .= "</ul>$/"; } else { $content .= "<H3>Zoeken:</h3>$/"; $content .= "<p><FORM METHOD=\"POST\" ACTION=\"$url\">$/$/"; $content .= " <INPUT TYPE=\"Hidden\" NAME=\"command\" VALUE=\"search\">$/"; $content .= " <TABLE width=\"100%\">$/"; $content .= " <TR>$/"; $content .= " <TD>Veld:</TD>$/"; $content .= " <TD><SELECT name=\"field\" size=\"1\">$/"; $content .= " <OPTION value=\"onderwerp\">onderwerp</OPTION>$/"; $content .= " <OPTION value=\"schrijver\">schrijver</OPTION>$/"; $content .= " <OPTION value=\"bericht\">bericht</OPTION>$/"; $content .= " <OPTION value=\"datum\">datum</OPTION>$/"; $content .= " <OPTION SELECTED value=\"alle\">alle</OPTION>$/"; $content .= " </SELECT></TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Zoekwoord:</TD>$/"; $content .= " <TD><INPUT TYPE=\"Text\" NAME=\"query\" SIZE=\"50\" VALUE=\"\"></TD>$/"; $content .= " </TR>$/"; $content .= " </TABLE>$/"; $content .= " <INPUT TYPE=\"Submit\" VALUE=\"Zoeken\">$/"; $content .= " </FORM>$/"; } $content .= "<center>"; $content .= "[<a href=\"$url\">overzicht</a>] $/"; $content .= "[<a href=\"$url?command=search\">zoeken</a>] $/" if ($searched ne ""); $content .= "</center>"; } elsif (($command eq "postquest") && $client->postok()) { my $name = $query->param("name") || ""; my $email = $query->param("email") || ""; my $qsubject = $query->param("qsubject") || ""; my $react = $query->param("content") || ""; my $theme = $query->param("theme") || "Anders"; # email should be checked! # post message my @header = ("Newsgroups: $group", "Subject: $qsubject", "From: $email", "X-Newsreader: \"WOC's UseNet WebInterface: http://www.sci.kun.nl/woc/\"", "X-WOC-Theme: $theme"); my @reactbody = ("$react"); my $status = $client->post(@header, "", @reactbody); # give response if ($status) { $content .= "<h3>Verstuurd:</h3>$/<P>$/"; $content .= " <TABLE width=\"100%\">$/"; $content .= " <TR>$/"; $content .= " <TD width=\"25%\">Naam:</TD>$/"; $content .= " <TD>$name</TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Email:</TD>$/"; $content .= " <TD>$email</TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Onderwerp:</TD>$/"; $content .= " <TD>$qsubject</TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Vraag:</TD>$/"; $content .= " <TD>$react</TD>$/"; $content .= " </TR>$/"; $content .= " </TABLE>$/"; } else { $content .= "<H3>Vraag niet verstuurd:</h3>$/"; $content .= "<p>" . $client->message() . "$/"; } $content .= "<center>"; $content .= "[<a href=\"$url\">overzicht</a>] $/"; $content .= "</center>"; } elsif (($command eq "postreact") && $message && $client->postok()) { my $art = getArticleByNo($message); my $name = $query->param("name") || ""; my $email = $query->param("email") || ""; my $react = $query->param("content") || ""; # email should be checked! # post message my @header = (); if (defined $art->theme()) { @header = ("Newsgroups: $group", "Subject: Re: " . $art->subject(), "From: $email ($name)", "X-Newsreader: \"WOC's UseNet WebInterface: http://www.sci.kun.nl/woc/\"", "References: " . $art->refs() . " " . $art->id(), "X-WOC-Theme: " . $art->theme()); } else { @header = ("Newsgroups: $group", "Subject: Re: " . $art->subject(), "From: $email ($name)", "X-Newsreader: \"WOC's UseNet WebInterface: http://www.sci.kun.nl/woc/\"", "References: " . $art->refs() . " " . $art->id()); } my @reactbody = ("$react"); my $status = $client->post(@header, "", @reactbody); # give response if ($status) { $content .= "<h3>Verstuurd:</h3>$/<P>$/"; $content .= " <TABLE width=\"100%\">$/"; $content .= " <TR>$/"; $content .= " <TD width=\"25%\">Naam:</TD>$/"; $content .= " <TD>$name</TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Email:</TD>$/"; $content .= " <TD>$email</TD>$/"; $content .= " </TR>$/"; if (defined $art->theme()) { $content .= " <TR>$/"; $content .= " <TD>Thema:</TD>$/"; $content .= " <TD>" . $art->theme() . "</TD>$/"; $content .= " </TR>$/"; } $content .= " <TR>$/"; $content .= " <TD>Onderwerp:</TD>$/"; $content .= " <TD>Re: " . $art->subject() . "</TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Reactie:</TD>$/"; $content .= " <TD>$react</TD>$/"; $content .= " </TR>$/"; $content .= " </TABLE>$/"; } else { $content .= "<H3>Bericht niet verstuurd:</h3>$/"; $content .= "<p>" . $client->message() . "$/"; } $content .= "<center>[<a href=\"$url\">overzicht</a>]</center>"; } elsif ($command eq "getquest") { $content .= "<h3>Post vraag:</h3>$/"; $content .= "<p><FORM METHOD=\"POST\" ACTION=\"$url\">$/$/"; $content .= " <INPUT TYPE=\"Hidden\" NAME=\"command\" VALUE=\"postquest\">$/"; $content .= " <TABLE width=\"100%\">$/"; $content .= " <TR>$/"; $content .= " <TD>Naam:</TD>$/"; $content .= " <TD><INPUT TYPE=\"Text\" NAME=\"name\" SIZE=\"50\" VALUE=\"\"></TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Email:</TD>$/"; $content .= " <TD><INPUT TYPE=\"Text\" NAME=\"email\" SIZE=\"50\" VALUE=\"\"></TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Thema:</TD>$/"; $content .= " <TD><SELECT name=\"theme\" size=\"1\">$/"; foreach my $atheme (@themes) { $content .= " <OPTION value=\"$atheme\">$atheme</OPTION>$/"; } $content .= " </SELECT></TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Onderwerp:</TD>$/"; $content .= " <TD><INPUT TYPE=\"Text\" NAME=\"qsubject\" SIZE=\"50\" VALUE=\"\"></TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Vraag:</TD>$/"; $content .= " <TD><TEXTAREA NAME=\"content\" COLS=\"50\" ROWS=\"10\"></TEXTAREA></TD>$/"; $content .= " </TR>$/"; $content .= " </TABLE>$/"; $content .= " <INPUT TYPE=\"Submit\" VALUE=\"Verstuur\">$/"; $content .= " <INPUT TYPE=\"Reset\" VALUE=\"Wis\">$/"; $content .= " </FORM>$/"; $content .= "<center>[<a href=\"$url\">overzicht</a>]</center>"; } elsif (($command eq "getreact") && $message) { my $art = getArticleByNo($message); $content .= "<h3>Reactie op: " . $art->subject() . "</h3>$/"; $content .= "<p>" . addBreaks($art->body()) . "</p><hr />$/"; $content .= "<h3>Reactie:</h3>$/"; $content .= "<p><FORM METHOD=\"POST\" ACTION=\"$url\">$/$/"; $content .= " <INPUT TYPE=\"Hidden\" NAME=\"command\" VALUE=\"postreact\">$/"; $content .= " <INPUT TYPE=\"Hidden\" NAME=\"message\" VALUE=\"$message\">$/"; $content .= " <TABLE width=\"100%\">$/"; $content .= " <TR>$/"; $content .= " <TD>Naam:</TD>$/"; $content .= " <TD><INPUT TYPE=\"Text\" NAME=\"name\" SIZE=\"50\" VALUE=\"\"></TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Email:</TD>$/"; $content .= " <TD><INPUT TYPE=\"Text\" NAME=\"email\" SIZE=\"50\" VALUE=\"\"></TD>$/"; $content .= " </TR>$/"; if (defined $art->theme()) { $content .= " <TR>$/"; $content .= " <TD>Thema:</TD>$/"; $content .= " <TD>" . $art->theme() . "</TD>$/"; $content .= " </TR>$/"; } $content .= " <TR>$/"; $content .= " <TD>Onderwerp:</TD>$/"; $content .= " <TD>Re: " . $art->subject() . "</TD>$/"; $content .= " </TR>$/"; $content .= " <TR>$/"; $content .= " <TD>Reactie:</TD>$/"; $content .= " <TD><TEXTAREA NAME=\"content\" COLS=\"50\" ROWS=\"10\"></TEXTAREA></TD>$/"; $content .= " </TR>$/"; $content .= " </TABLE>$/"; $content .= " <INPUT TYPE=\"Submit\" VALUE=\"Verstuur\">$/"; $content .= " <INPUT TYPE=\"Reset\" VALUE=\"Wis\">$/"; $content .= " </FORM>$/"; $content .= "<center>[<a href=\"$url\">overzicht</a>]</center>"; } elsif ($message) { my $art = getArticleByNo($message); $content .= "<h3>" . $art->subject() . "</h3>\n"; if ($showheader) { $content .= "<b>$/"; $content .= addBreaks($client->head($message)); $content .= "</b>$/"; } $content .= "<p>" . addBreaks($art->body()); $content .= "<center>[<a href=\"$url\">overzicht</a>] "; $content .= "[<a href=\"$url?command=search\">zoeken</a>] "; if ($showheader) { $content .= "[<a href=\"$url?message=$message\">geen header</a>] "; } else { $content .= "[<a href=\"$url?message=$message&header=1\">header</a>] "; } if ($client->postok()) { $content .= "[<a href=\"$url?command=getreact&message=$message\">reageer</a>]</center>"; } } else { my $max = $query->param("max") || ($last + 1); my $oldmax = $query->param("max") || 0; my $needed = 10; $needed = 20 if (!$threaded); my $counter = $needed; # parse articles my $i = $max - 1; while ($i > $first && $counter) { my $art = getArticleByNo($i); if (defined $art) { my $id = $art->id(); $articles{$id} = $art; $index{$i} = $id; if (defined $art->refs()) { foreach my $ref (split(' ', $art->refs())) { if ($fups{$ref}) { $fups{$ref} = "$id " . $fups{$ref}; } else { $fups{$ref} = $id; } } } else { if ($theme) { $counter-- if ($art->theme() eq $theme); } else { $counter--; } } } $i--; } # possibly show theme's my $link = ""; my $linktext = ""; if (defined $theme) { $content .= "<center>$/"; my $atheme = $theme; $atheme = "Alle" if ($theme eq "*"); $content .= "<h3>$atheme</h3>$/"; foreach my $atheme (@themes) { $link = "$url?command=overzicht&theme=$atheme"; $link =~ s/\ /\%20/g; if ($threaded) { $link .= "&threaded=1"; } else { $link .= "&threaded=0"; } $content .= "[<a href=\"$link\">$atheme</a>] "; } $content .= "[<a href=\"$url?command=overzicht&theme=*\">alle</a>] "; $content .= "</center><p>$/"; } # show last 15 articles $counter = $needed; $content .= "<ul>$/"; foreach my $artid (reverse sort keys %index) { if ($counter > 0) { my $index = $index{int($artid)}; my $art = $articles{$index}; my $print = 1; if (defined $theme) { $print = 0; if (defined (my $arttheme = $art->theme())) { if ($theme eq "*" || $theme eq $arttheme) { $print = 1; } } } if ($print) { if ($threaded && (!defined $art->refs())) { $content .= printThreadedArticle($index); $counter--; } elsif (!$threaded) { $content .= printArticle($index); $counter--; } } $max = $artid; } } $content .= "</ul>$/"; $content .= "<p><center>"; $content .= "[<a href=\"$url?command=getquest\">stel vraag</a>] "; $content .= "[<a href=\"$url?command=search\">zoeken</a>] "; $link = ""; if ($max > $first) { $link = "$url?command=overzicht&max=$max"; if ($threaded) { $link .= "&threaded=1"; } else { $link .= "&threaded=0"; } $content .= "[<a href=\"$link\">oudere berichten</a>] "; } $link = "$url?command=overzicht"; $linktext = "threading"; if ($threaded) { $linktext = "geen $linktext"; $link .= "&threaded=0"; } else { $link .= "&threaded=1"; } if ($theme) { $link .= "&theme=$theme"; } $link .= "&max=$oldmax" if ($oldmax); $content .= "[<a href=\"$link\">$linktext</a>] "; $link = "$url?command=overzicht"; if ($threaded) { $link .= "&threaded=1"; } else { $link .= "&threaded=0"; } if ($theme) { $linktext = "geen thema's"; } else { $linktext = "thema's"; $link .= "&theme=*"; } $content .= "[<a href=\"$link\">$linktext</a>] "; $content .= "</center>"; } # print output print <<END; Content-type: text/html <html> <head> <title>UseNet Interface: $group</title> </head> <body bgcolor="white"> <h1>UseNet Interface: $group</h1><hr /> $status <p>$content</p><hr /> </body> </html> END sub getArticleByNo() { my ($no) = shift @_; my $file = "$cachedir/$group.$no"; $status = "<!-- ? files in cache ($cachedir)-->" if ($status eq ""); my @article = (); if (-e $file) { open(CACHEFILE, "<$file"); @article = <CACHEFILE>; close(CACHEFILE); } else { @article = $client->article($no); return undef if (!@article); #test if cache exists `chmod 777 $cachedir`; mkdir $cachedir, 777 if (!-e $cachedir); #save to cache open(CACHEFILE, ">$file"); foreach my $line (@article) { print CACHEFILE $line; } close(CACHEFILE); } # parse article my $art = Article->new(); $art->no($no); my @body = (); my $isbody = 0; foreach my $line (@article) { if ($isbody) { push(@body, $line); } elsif ($line =~ /Subject:\s*(.*)/) { $art->subject($1); } elsif ($line =~ /Date:\s*(.*)/) { $art->date($1); } elsif ($line =~ /From:\s*(.*)/) { $art->from($1); } elsif ($line =~ /References:\s*(.*)/) { $art->refs($1); } elsif ($line =~ /Message-ID:\s*(.*)/) { $art->id($1); } elsif ($line =~ /X-WOC-Theme:\s*(.*)/) { $art->theme($1); } elsif ($line =~ /^(\n|\r)/) { $isbody = 1; } } $art->body(@body); return $art; } sub addBreaks() { my @body = @_; my $result = ""; foreach my $line (@body) { $line =~ s/\n/<br>/g; $result .= "$line\n"; } return $result; } sub printArticle() { my $artid = shift @_; my $art = $articles{$artid}; my $content = ""; if (!defined $printed{$artid} && (defined $art)) { $content .= "<li><a href=\"$url?message=" . $art->no() . "\">" . $art->subject() . "</a> " . $art->from() . " (<i>" . $art->date() . "</i>)$/"; $printed{$artid} = "yes"; }; return $content; } sub printThreadedArticle() { my $artid = shift @_; my $art = $articles{$artid}; my $content = ""; if (defined $art) { if (!defined $printed{$artid}) { $content .= "<li><a href=\"$url?message=" . $art->no() . "\">" . $art->subject() . "</a> " . $art->from() . " (<i>" . $art->date() . "</i>)$/"; $printed{$artid} = "yes"; if (defined $fups{$artid}) { $content .= "<ul>$/"; foreach my $fup (split(' ', $fups{$artid})) { $content .= printThreadedArticle($fup); } $content .= "</ul>$/"; } } } else { $content .= "<li>article (" . $artid. ") not found$/"; } return $content; } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:51
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir/woc In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir/woc Added Files: bericht.htpl berichtkop.htpl eindelijst.htpl incompleet.htpl nieuwelijst.htpl overigkop.htpl overzicht.htpl rubriek.htpl rubriekkop.htpl rubriektoc.htpl toevoegform.htpl vraagkop.htpl woc.htpl woc.pl Log Message: --- NEW FILE: bericht.htpl --- <CENTER> if $vraag <FONT SIZE=+1><B>Vraag of reactie over $subject</B></FONT><BR> if !$vraag <FONT SIZE=+1><B>Over $subject</B></FONT><BR> <I>(<A HREF="mailto:$email">$naam</A>, $stamp)</I> </CENTER> <P> <HR WIDTH=20%> <P> <UL> if $vraag <B>$inhoud</B> if !$vraag $inhoud <P> $reacties </UL> <P> <H3 ALIGN=Center> if $volgendelink [ <A HREF="$volgendelink">Volgende</A> ] if $vraag [ <A HREF="$voorgangerlink">Rubriek</A> ] if !$vraag [ <A HREF="$voorgangerlink">Voorganger</A> ] [ <A HREF="$reactielink">Reageren</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: berichtkop.htpl --- <LI><B>@subject</B> <A HREF="@berichtlink">@naam</A> <I>(@stamp)</I> --- NEW FILE: eindelijst.htpl --- </UL> --- NEW FILE: incompleet.htpl --- <CENTER> <BR><H1>Volledig Invullen A.U.B.</H1> <FORM METHOD=POST ACTION="$script+voegtoe+$niveau+$nummer"> <INPUT TYPE=Hidden NAME="datum" VALUE="$datum"> <INPUT TYPE=Hidden NAME="tijd" VALUE="$tijd"> <TABLE> <TR> <TD>Naam:</TD> <TD><INPUT TYPE=Text NAME="naam" SIZE=50 VALUE="$naam"></TD> </TR> <TR> <TD>E-Mail:</TD> <TD><INPUT TYPE=Text NAME="email" SIZE=50 VALUE="$email"></TD> </TR> <TR> <TD>Subject:</TD> <TD><INPUT TYPE=Text NAME="subject" SIZE=50 VALUE="$subject"></TD> </TR> <TR> <TD>Bericht:</TD> <TD><TextAREA COLS=55 ROWS=10 NAME="inhoud">$inhoud</TextAREA></TD> </TR> </TABLE> <INPUT TYPE=Submit VALUE="Voeg toe"> <INPUT TYPE=Reset VALUE="Opnieuw"> </FORM> </CENTER> --- NEW FILE: nieuwelijst.htpl --- <UL> --- NEW FILE: overigkop.htpl --- <LI><A HREF="@overiglink">@overiginhoud</A> (@overignaam) --- NEW FILE: overzicht.htpl --- <H2 ALIGN=Center>Alle vragen over en reacties op het WOC</H2> <UL> Kies een van de onderstaande rubrieken om antwoorden op je vraag te zoeken of vragen, antwoorden of commentaar toe te voegen: <P> <UL> $overzicht </UL> </UL> <H3 ALIGN=CENTER> [ <A HREF="$nieuwevraaglink">Nieuwe vraag of reactie</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: rubriek.htpl --- <A HREF="@rubrieklink"><FONT SIZE=+1><B>@subject</B></FONT></A> <I>(@numvraag vrg, @numant ant, @numcomm comm)</I> <P> @inhoud </P> --- NEW FILE: rubriekkop.htpl --- <P><FONT SIZE=+1><B>@rubrieksubject</B></FONT></P> --- NEW FILE: rubriektoc.htpl --- <H2 ALIGN=Center>$rubrieksubject</H2> <UL> $rubriekinhoud <P> <BR> Kies een van de onderstaande vragen of kies gelijk een van de antwoorden: $rubriektoc </UL> <BR> <H3 ALIGN=CENTER> [ <A HREF="$vraagtoevoeglink">Vraag of reactie toevoegen</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: toevoegform.htpl --- <CENTER> <BR><H1>$header</H1> <FORM METHOD=POST ACTION="$script+voegtoe+$niveau+$nummer"> <INPUT TYPE=Hidden NAME="datum" VALUE="$datum"> <INPUT TYPE=Hidden NAME="tijd" VALUE="$tijd"> <TABLE> <TR> <TD>Naam:</TD> <TD><INPUT TYPE=Text NAME="naam" SIZE=50 VALUE="$naam"></TD> </TR> <TR> <TD>E-Mail:</TD> <TD><INPUT TYPE=Text NAME="email" SIZE=50 VALUE="$email"></TD> </TR> <TR> <TD>Subject:</TD> <TD><INPUT TYPE=Text NAME="subject" SIZE=50 VALUE="$subject"></TD> </TR> <TR> <TD>Bericht:</TD> <TD><TextAREA COLS=50 ROWS=8 NAME="inhoud">$inhoud</TextAREA></TD> </TR> </TABLE> <INPUT TYPE=Submit VALUE="Voeg toe"> <INPUT TYPE=Reset VALUE="Opnieuw"> </FORM> </CENTER> --- NEW FILE: vraagkop.htpl --- <P> <LI><A HREF="@vraaglink"><B>@vraaginhoud</B></A> (@vraagnaam) <P> --- NEW FILE: woc.htpl --- Content-type: text/html <HTML> <HEAD> <META NAME="Author" CONTENT="Geert Josten, lid van de internetcommissie van VVCN Sigma"> <META NAME="Description" CONTENT="WOC Forum: Opmerkingen, reacties, vragen en antwoorden"> <META NAME="Generator" CONTENT="Perl-Sript: $0 $scriptage"> <META NAME="IsIndex" CONTENT="No"> <META NAME="Maintainer" CONTENT="$maintainer"> <META NAME="Review" CONTENT="$time"> <BASE href="http://www-woc.sci.kun.nl/" TARGET="pagina"> <TITLE>WOC Forum: $header </TITLE> <link rel="stylesheet" href="gui/styles/woc.css" type="text/css"> </HEAD> <BODY class="main"> <H1 ALIGN=Center>Vragen en Reacties: $header</H1> <HR> <BR> <BR> if $overzicht $overzicht.htpl if $rubriektoc $rubriektoc.htpl if $bericht $bericht.htpl if $toevoegform $toevoegform.htpl if $toevoegformincompleet $incompleet.htpl <P> <HR> <UL> <CENTER><I>De WOC-redactie behoudt het recht om naar eigen inzicht de toegevoegde vragen en antwoorden aan te passen en in te delen.</I></CENTER> </UL> </BODY> </HTML> --- NEW FILE: woc.pl --- $contentcheckers = "woc\@sci.kun.nl"; ## main ## ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; $datum = `date '+%m-%d-%y'`; $tijd = `date '+%H:%Mh'`; if ((@ARGV) && ($ARGV[0] =~ /^nieuw/i)) { shift (@ARGV); $niveau = shift (@ARGV); $nummer = shift (@ARGV); if ($niveau > 2) { $header = "Vul hier je reactie in..."; &maak_reactieform (); } else { $header = "Vul hier je vraag of reactie in..."; if ($nummer > 0) { &maak_reactieform (); } else { $subject = "Ongerubriceerd"; $nummer = @$refdata; } } $toevoegform = "true"; } elsif ((@ARGV) && ($ARGV[0] =~ /^voegtoe/i)) { shift (@ARGV); $niveau = shift (@ARGV); $nummer = shift (@ARGV); if (&voeg_nieuw_bericht_toe ()) { $reacties = ""; $nummer++; $header = "\$inhoud"; if ($niveau > 2) { $bericht = "overig"; } else { $bericht = "vraag"; $vraag = "true"; } &maak_bericht (); } else { $toevoegformincompleet = "true"; } } elsif ((@ARGV) && ($ARGV[0] =~ /^rubriek/i)) { $header = "Vragen Overzicht"; shift (@ARGV); $nummer = shift (@ARGV); $rubriektoc = " "; &maak_rubriek (); $vraagtoevoeglink = "$script+nieuw+2+$nummer"; } elsif ((@ARGV) && ($ARGV[0] =~ /^vraag/i)) { $header = "Antwoorden op vragen"; shift (@ARGV); $nummer = shift (@ARGV); $bericht = "vraag"; $vraag = "true"; &maak_bericht (); } elsif ((@ARGV) && ($ARGV[0] =~ /^\d+/i)) { $header = "Antwoord en commentaar"; $nummer = shift (@ARGV); $bericht = "overig"; &maak_bericht (); } else { $header = "Rubrieken Overzicht"; $overzicht = ""; &maak_overzicht (); $niveau = "1"; $nummer = @$refdata; $nieuwevraaglink = "$script+nieuw+2+0"; } $return = ""; sub maak_reactieform { $refsubject = &get (["subject"], [$$refdata[$nummer-1]], $grammar, ""); $subject = $$refsubject[0]; } sub maak_overzicht { $htmlrubriek = &readhtml ("rubriek.htpl"); $refsubject = &get (["subject"], $refdata, $grammar, ""); $refnaam = &get (["naam"], $refdata, $grammar, ""); $refemail = &get (["email"], $refdata, $grammar, ""); $refstamp = &get (["datum", "tijd"], $refdata, $grammar, ""); $refniveau = &get (["niveau"], $refdata, $grammar, ""); $refinhoud = &get (["inhoud"], $refdata, $grammar, ""); @i = (1..@$refdata); $numvraag = 0; $numant = 0; $numcomm = 0; foreach $i (@i) { $subject = shift @$refsubject; $naam = shift @$refnaam; $email = shift @$refemail; $email =~ s#\@#\\\@#ig; $stamp = shift @$refstamp; $stamp =~ s/#/, /i; $niv = shift @$refniveau; $inhoud = shift @$refinhoud; if ($niv == 1) { push (@rubrieklink, "$script+rubriek+$i"); push (@subject, "\u$subject"); push (@email, $email); push (@naam, "\u$naam"); push (@stamp, $stamp); push (@niveau, $niveau); push (@inhoud, "\u$inhoud"); ($numvraag = "geen") if ! $numvraag; ($numant = "geen") if ! $numant; ($numcomm = "geen") if ! $numcomm; push (@numvraag, $numvraag); push (@numant, $numant); push (@numcomm, $numcomm); $overzicht .= "$htmlrubriek"; $numvraag = 0; $numant = 0; $numcomm = 0; } else { if ($niv == 2) { $numvraag++; } elsif ($niv == 3) { $numant++; } elsif ($niv > 3) { $numcomm++; } } } ($numvraag = "geen") if ! $numvraag; ($numant = "geen") if ! $numant; ($numcomm = "geen") if ! $numcomm; push (@numvraag, $numvraag); push (@numant, $numant); push (@numcomm, $numcomm); shift (@numvraag); shift (@numant); shift (@numcomm); } sub maak_rubriek { $htmlnieuwelijst = &readhtml ("nieuwelijst.htpl"); $htmlrubriekkop = &readhtml ("rubriekkop.htpl"); $htmlvraagkop = &readhtml ("vraagkop.htpl"); $htmloverigkop = &readhtml ("overigkop.htpl"); $htmleindelijst = &readhtml ("eindelijst.htpl"); $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $niveau = $$refniveau[0]; while (($niveau > 1) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $niveau = $$refniveau[0]; } @i = (($nummer-1)..($last-1)); @data = @$refdata[@i]; $refsubject = &get (["subject"], \@data, $grammar, ""); $refnaam = &get (["naam"], \@data, $grammar, ""); $refemail = &get (["email"], \@data, $grammar, ""); $refstamp = &get (["datum", "tijd"], \@data, $grammar, ""); $refniveau = &get (["niveau"], \@data, $grammar, ""); $refinhoud = &get (["inhoud"], \@data, $grammar, ""); foreach $reactieinhoud (@overiginhoud) { $reactieinhoud = substr($reactieinhoud, 0, 40)."..."; } $niv = 1; @i = ($nummer..$last); foreach $i (@i) { $subject = shift @$refsubject; $naam = shift @$refnaam; $email = shift @$refemail; $email =~ s#\@#\\\@#ig; $stamp = shift @$refstamp; $stamp =~ s/#/, /i; $oldniv = $niv; $niv = shift @$refniveau; $inhoud = shift @$refinhoud; if ($niv < $oldniv) { $j = $niv; while ($j < $oldniv) { $rubriektoc .= "$htmleindelijst"; $j++; } } if ($niv > $oldniv) { $j = $oldniv; while ($j < $niv) { $rubriektoc .= "$htmlnieuwelijst"; $j++; } } if ($niv == 1) { $rubrieklink = "$script+rubriek+$i"; $rubrieksubject = "\u$subject"; $rubrieknaam = "\u$naam"; $rubriekinhoud = "\u$inhoud"; } elsif ($niv == 2) { push (@vraaglink, "$script+vraag+$i"); push (@vraagnaam, "\u$naam"); push (@vraaginhoud, "\u$inhoud"); $rubriektoc .= "$htmlvraagkop"; } else { push (@overiglink, "$script+$i"); push (@overignaam, "\u$naam"); $inhoud = substr($inhoud, 0, 40)."..."; push (@overiginhoud, "\u$inhoud"); $rubriektoc .= "$htmloverigkop"; } } $rubriektoc .= "$htmleindelijst"; $rubriektoc .= "$htmleindelijst"; } sub maak_bericht { $htmlnieuwelijst = &readhtml ("nieuwelijst.htpl"); $htmloverigkop = &readhtml ("overigkop.htpl"); $htmleindelijst = &readhtml ("eindelijst.htpl"); $refsubject = &get (["subject"], [$$refdata[$nummer-1]], $grammar, ""); $refnaam = &get (["naam"], [$$refdata[$nummer-1]], $grammar, ""); $refemail = &get (["email"], [$$refdata[$nummer-1]], $grammar, ""); $refstamp = &get (["datum", "tijd"], [$$refdata[$nummer-1]], $grammar, ""); $refniveau = &get (["niveau"], [$$refdata[$nummer-1]], $grammar, ""); $refinhoud = &get (["inhoud"], [$$refdata[$nummer-1]], $grammar, ""); $subject = $$refsubject[0]; $naam = $$refnaam[0]; $email = $$refemail[0]; $stamp = $$refstamp[0]; $niveau = $$refniveau[0]; $inhoud = $$refinhoud[0]; $stamp =~ s/#/ /i; $email =~ s#\@#\\\@#ig; $reactielink = "$script+nieuw+".($niveau+1)."+$nummer"; ### de 'parent', voorganger ### $prev = $nummer-2; $refniveau = &get (["niveau"], [$$refdata[$prev]], $grammar, ""); $prevniveau = $$refniveau[0]; while (($prevniveau >= $niveau) && ($prev > 0)) { $prev--; $refniveau = &get (["niveau"], [$$refdata[$prev]], $grammar, ""); $prevniveau = $$refniveau[0]; } if ($prevniveau < $niveau) { if ($prevniveau == 1) { $voorgangerlink = "$script+rubriek+".($prev+1); } elsif ($prevniveau == 2) { $voorgangerlink = "$script+vraag+".($prev+1); } else { $voorgangerlink = "$script+".($prev+1); } } ### de reacties en het eerst volgende broertje of zusje ### if ($nummer <= @$refdata) { $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; while (($lastniveau > $niveau) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; } if ($lastniveau == $niveau) { if ($lastniveau == 1) { $volgendelink = "$script+rubriek+".($last+1); } elsif ($lastniveau == 2) { $volgendelink = "$script+vraag+".($last+1); } else { $volgendelink = "$script+".($last+1); } } if ($last > $nummer) { @reacties = @$refdata[$nummer..$last-1]; $refsubject = &get (["subject"], \@reacties, $grammar, ""); $refnaam = &get (["naam"], \@reacties, $grammar, ""); $refemail = &get (["email"], \@reacties, $grammar, ""); $refstamp = &get (["datum", "tijd"], \@reacties, $grammar, ""); $refniveau = &get (["niveau"], \@reacties, $grammar, ""); $refinhoud = &get (["inhoud"], \@reacties, $grammar, ""); @overigsubject = @$refsubject; @overignaam = @$refnaam; @overigemail = @$refemail; @overigstamp = @$refstamp; @overigniveau = @$refniveau; @overiginhoud = @$refinhoud; @i = (1..@$refdata); foreach $i (@i) { push (@overiglink, "$script+".($i+$nummer)); } foreach $reactiestamp (@overigstamp) { $reactiestamp =~ s/#/ /i; } foreach $reactieinhoud (@overiginhoud) { $reactieinhoud = substr($reactieinhoud, 0, 40)."..."; } foreach $reactieemail (@overigemail) { $reactieemail =~ s#\@#\\\@#ig; } $reacties = ""; $refniveau = &get (["niveau"], \@reacties, $grammar, ""); $niv = $niveau; foreach $reactieniveau (@overigniveau) { if ($niv < $reactieniveau) { while ($niv < $reactieniveau) { $reacties .= " "x($niv-$niveau+2)."$htmlnieuwelijst"; $niv++; } } elsif ($niv > $reactieniveau) { while ($niv > $reactieniveau) { $reacties .= " "x($niv-$niveau+1)."$htmleindelijst"; $niv--; } } $reacties .= " "x($niv-$niveau+1)."$htmloverigkop"; } while ($niv > $niveau) { $reacties .= " "x($niv-$niveau+1)."$htmleindelijst"; $niv--; } } } } sub voeg_nieuw_bericht_toe { %pairs = &parse_form (); $compleet = "true"; foreach $key (keys(%pairs)) { if (! $pairs{$key}) { $compleet = ""; #false } } $subject = $pairs{"subject"} if (exists ($pairs{"subject"})); $naam = $pairs{"naam"} if (exists ($pairs{"naam"})); $email = $pairs{"email"} if (exists ($pairs{"email"})); $datum = $pairs{"datum"} if (exists ($pairs{"datum"})); $tijd = $pairs{"tijd"} if (exists ($pairs{"tijd"})); $inhoud = $pairs{"inhoud"} if (exists ($pairs{"inhoud"})); if ($compleet) { $bericht[$$reforder{"subject"}] = $subject; $bericht[$$reforder{"naam"}] = $naam; $bericht[$$reforder{"email"}] = $email; $bericht[$$reforder{"datum"}] = $datum; $bericht[$$reforder{"tijd"}] = $tijd; $bericht[$$reforder{"niveau"}] = $niveau; $bericht[$$reforder{"inhoud"}] = "(new) ".$inhoud; $bericht = join($datasep, @bericht); if ($nummer >= @$refdata) { $refdata = [@$refdata, $bericht]; } else { $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; while (($lastniveau >= $niveau) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; } $nummer = $last if ($last > $nummer); $refdata = [@$refdata[0..($nummer-1)], $bericht, @$refdata[($nummer)..(@$refdata-1)]]; } &save_data ($datafile, $refdata, $refcommenteddata, ""); open (MAIL, "|/usr/ucb/mail -s 'WOC Forum: nieuw bericht' ".$contentcheckers) || die "$!"; print MAIL &expand ($nummer+1, $refdata, $grammar); close (MAIL); } return $compleet; } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:51
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/popup In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/popup Added Files: anim.pl view.pl Log Message: --- NEW FILE: anim.pl --- #!/usr/local/bin/perl -w use strict; my $pictlink = "data/pictures"; my $iconlink = "gui/pictures"; my $flag = ""; my $item_id = ""; my $titel = ""; $flag = shift if @ARGV; $item_id = shift if @ARGV; $titel = " - $ARGV[0]" if @ARGV; # ------------------------------------------------------------ # Print out what we need if ($item_id && $flag =~ /^index/i) { print <<EOT; Content-type: text/html <HTML> <HEAD> <TITLE>WOC-anims$titel</TITLE> <BASE HREF="http://www.sci.kun.nl/woc/"> <LINK REL="stylesheet" HREF="gui/styles/mol4d.css" TYPE="text/css"> </HEAD> <FRAMESET ROWS="*,70" FRAMEBORDER="0" FRAMESPACING="0" BORDER="No"> <FRAME TITLE="Animatie-Venster" NAME="Anim" SRC="/cgi-bin-woc/popup/anim.pl?stop+$item_id"> <FRAME TITLE="Animatie-Buttons" NAME="AnimButtons" MARGINHEIGHT="0" SCROLLING="No" SRC="/cgi-bin-woc/popup/anim.pl?buttons+$item_id"> </FRAMESET> </HTML> EOT } elsif ($item_id && $flag =~ /^buttons/i) { print <<EOT; Content-type: text/html <HTML> <HEAD> <BASE HREF="http://www.sci.kun.nl/woc/"> <LINK REL="stylesheet" HREF="gui/styles/mol4d.css" TYPE="text/css"> </HEAD> <BODY BGCOLOR="#EEEEEE"> <TABLE WIDTH="100\%"> <TR><TD WIDTH="60\%" ALIGN="Center"> <A HREF="/cgi-bin-woc/popup/anim.pl?play+$item_id" TARGET="Anim"> <IMG SRC="$iconlink/play.gif" BORDER="0" VSPAC="0"></A> <A HREF="/cgi-bin-woc/popup/anim.pl?stop+$item_id" TARGET="Anim"> <IMG SRC="$iconlink/stop.gif" BORDER="0" VSPAC="0"></A> </TD><TD WIDTH="40\%" ALIGN="Center"> <FORM> <BR> <INPUT TYPE="Button" VALUE="Close" onClick="javascript:top.close()"> </FORM> </TD></TR> </TABLE> </BODY> </HTML> EOT } elsif ($item_id && $flag =~ /^play/i) { $item_id =~ s/^.*\///; print <<EOT; Content-type: text/html <HTML> <HEAD> <BASE HREF="http://www.sci.kun.nl/woc/"> <LINK REL="stylesheet" HREF="gui/styles/mol4d.css" TYPE="text/css"> </HEAD> <BODY> <TABLE WIDTH="100\%" HEIGHT="100\%"> <TR><TD WIDTH="100\%" HEIGHT="100\%" ALIGN="Center" VALIGN="Center"> <IMG SRC="$pictlink/anims/$item_id"> </TD></TR> </TABLE> </BODY> </HTML> EOT } elsif ($item_id && $flag =~ /^stop/i) { print <<EOT; Content-type: text/html <HTML> <HEAD> <BASE HREF="http://www.sci.kun.nl/woc/"> <LINK REL="stylesheet" HREF="gui/styles/mol4d.css" TYPE="text/css"> </HEAD> <BODY> <TABLE WIDTH="100\%" HEIGHT="100\%"> <TR><TD WIDTH="100\%" HEIGHT="100\%" ALIGN="Center" VALIGN="Center"> <IMG SRC="$pictlink/$item_id"> </TD></TR> </TABLE> </BODY> </HTML> EOT } else { print <<EOT; Content-type: text/html <HTML> <HEAD> <TITLE>Popup WOC-anims</TITLE> <BASE HREF="http://www.sci.kun.nl/woc/"> <LINK REL="stylesheet" HREF="gui/styles/mol4d.css" TYPE="text/css"> </HEAD> <BODY> <H1>Error</H1> </BODY> </HTML> EOT } # ------------------------------------------------------------ --- NEW FILE: view.pl --- #!/usr/local/gnu/bin/perl -w -- -*-perl-*- use strict; my $itemdir = "/vol/www/woc/web-docs/gui/items"; my @item; my $titel; # ------------------------------------------------------------ &get_item ($ARGV[0]); # Print out what we need print <<EOT; Content-type: text/html <HTML> <HEAD> <TITLE>Popup WOC-items</TITLE> <BASE HREF="http://www.sci.kun.nl/woc/"> <LINK REL="stylesheet" HREF="gui/styles/mol4d.css" TYPE="text/css"> </HEAD> <BODY> <TABLE BORDER="0" NOBORDER WIDTH="100\%" CELLSPACING="0" CELLPADDING="4"> <TR BGCOLOR="Black" ><TD> <A HREF="http://www.sci.kun.nl/woc/"> <IMG SRC="gui/pictures/static_azijnzuur.gif" HEIGHT="13" WIDTH="13" BORDER="0"></A> <FONT SIZE="2" FACE="Arial,Verdana,Helvetica" COLOR="White"> Woordenboek <I>Organische</I> Chemie </FONT> <!--WEBBOT bot="HTMLMarkup" Startspan ALT="Site Meter"--> <script language="JavaScript"> document.write("<a href=`http://www.sitemeter.com/"); document.write("stats.asp?site=woccounter` target=_top class=`button`>"); document.write("<img src=`http://www.sitemeter.com/"); document.write("meter.asp?site=woccounter"); document.write("&refer="+escape(document.referrer)); document.write("&hours="+(new Date()).getHours()); document.write("&minutes="+(new Date()).getMinutes()); document.write("` border=0 alt=`Site Meter`></a>"); </script> <!--WEBBOT bot="HTMLMarkup" Endspan--> </TD><TD> <FONT SIZE="2" FACE="Arial,Verdana,Helvetica" COLOR="Yellow"> <I>$ARGV[0]</I> </FONT> </TD></TR> </TABLE> <TABLE BORDER="0" NOBORDER HEIGHT="95\%" CELLSPACING="0" CELLPADDING="4"> <TR VALIGN="Top"><TD WIDTH="40" HEIGHT="100\%" ROWSPAN="2" BGCOLOR="navy"> </TD><TD> @item <FORM> <CENTER> <INPUT TYPE="Button" VALUE="Close" onClick="javascript:top.close()"> </CENTER> </FORM> </TD></TR> </TABLE> </BODY> </HTML> EOT # ------------------------------------------------------------ sub get_item { my $itemfile = shift; my @file = (); open (FILE, "$itemdir/$itemfile.shtml") || die "$itemdir/$itemfile.shtml: $!$/"; while (<FILE>) { push (@file, $_); } close (FILE) || die "$itemdir/$itemfile.shtml: $!$/"; my $inbody = ""; my $notwebbot = "True"; my $nr_hr = 0; while (@file) { $_ = shift (@file); $inbody = "" if /\<\/BODY.*?\>/i; $notwebbot = "" if /U bent bezoeker/i; if ($inbody && $notwebbot) { $nr_hr++ if /\<HR.*?\>/i; if ($nr_hr == 2) { push (@item, "</TD></TR><TR><TD VALIGN=Bottom>"); $nr_hr = 0; } s/Last update.*?\.//i; push (@item, $_); } $inbody = "True" if /\<BODY.*?\>/i; $notwebbot = "True" if /WEBBOT.*?Endspan/i; } } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:51
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/search In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/search Added Files: fuzzy.pl realsearch.pl sa.pl Log Message: --- NEW FILE: fuzzy.pl --- #!/usr/local/bin/perl -w push (@INC, "."); use LWP; use CGI qw(:standard); use WWW::Search; use String::Approx 'amatch'; # get the parameters from the stdin # my $zoekarg = param("query"); my $zoekorg = $zoekarg; my $text = param("text"); # aanpassen zoekarg my $pre_asterix = ""; my $pre_quest = ""; if ($zoekorg =~ s/^\*//) { $pre_asterix = "yes"; } if ($zoekorg =~ s/^\?//) { $pre_quest = "yes"; } $zoekarg =~ s/\./\\\./g; $zoekarg =~ s/\?/\./g; $zoekarg =~ s/\*/\(\\\w\|\\\-\|\\\(\|\\\)\)\+\?/g; # initialize dirs and files # my $foundfile = "arguments_found.txt"; my $notfoundfile = "arguments_notfound.txt"; my $root = "/vol/www/woc/web-docs"; my $datadir = "/vol/www/woc/data/wml"; my $destdir = "gui/items"; my $desturl = "http://www-woc.sci.kun.nl"; my $url = ""; my @files = <$datadir/*.xml>; my @foundfiles = (); # Mime-Type header line # needs to be placed elsewhere (bug #11) # print "Content-type: text/html\n\n"; #debug #print "-$zoekorg- -> -$zoekarg-\n"; if ($zoekarg eq "") { if ($text eq "") { print "Content-type: text/html\n\n"; open (FILE, "<$root/gui/search.html"); while (<FILE>) { print; }; close(FILE); } elsif ($text ne "") { #print "Text found!"; print "Content-type: text/html\n\n"; open (FILE, "<$root/gui/search.html"); while (<FILE>) { # note that \s+ was substituted by \s+, but that doesn't work... "\ " does! s/NAME="query"\s+VALUE=\"\"/NAME="query"\ VALUE=\"$text\"/; print; } close(FILE); } } else { $hit = ""; foreach $file (@files) { $file =~ s/.*?(\w*).xml/$1/; open (OPENFILE, "<$datadir/$file.xml") || next; #print "$file opened\n"; my $found = 0; my $titel = ""; my $code = ""; my $line = ""; while (defined ($line = <OPENFILE>) && !$found) { # prevent from crashing due to match in the first or second line (bug #29) if ($line =~ /<\?xml.*\?>/) { # skip line } elsif ($line =~ /DOCTYPE/) { # skip line } else { if ($line =~ /<ITEM/i) { if ($line =~ /NAME=\"(.*?)\"/i) { $title = $1; } if ($line =~ /CODE=\"(.*?)\"/i) { $code = $1; } } $_ = $line; #print "\$\_: $_"; if (amatch($zoekarg, ['i', 'S2']) && !$found) { print "fuzzy match: $title -> $_"; # match fuzzy if ( ! (-f "$root/$destdir/$file.shtml") ) { $file = $code; } if ( -f "$root/$destdir/$file.shtml" ) { push (@foundfiles, "$root/$destdir/$file.shtml"); $hit = "$root/$destdir/$file.shtml"; $url = "$desturl/$destdir/$file.shtml"; $htmlcode = "<dd><a href=\"$url\">$title</a> \n"; $yield = 50; #print "length: " . length($title) . "\n"; $yield = int((length $zoekorg) / (length($title)) * 50) if (length $title > 0); $_ = $title; if ( $title =~ /$zoekorg/i ) { $yield = $yield + 50; } $htmlcode .= "$yield\%<br>\n"; $key = $yield; if ($key < 100) { if ($key < 10) { $key = "0$key"; } $key = "0$key"; } if ($results{$key}) { while ($results{$key}) { $key = "$key.1"; } $results{$key} = $htmlcode; } else { $results{$key} = $htmlcode; } } $found = 1; } } } close (OPENFILE); } my $i = @foundfiles; #$print "tijdelijke debug info: $i\n"; if (@foundfiles == 1) { print "Location: $url\n"; print "Content-type: text/html\n\n"; open (FOUND, "$hit"); while (<FOUND>) { print; }; close (FOUND); } else { print "Content-type: text/html\n\n"; print "<html>\n"; print "<head>\n"; print " <title>Woordenboek Organische Chemie</title>\n"; print " <base href=\"http://www-woc.sci.kun.nl/\">\n"; print " <link rel=\"stylesheet\" href=\"gui/styles/woc.css\" type=\"text/css\">\n"; print " <script src=\"gui/javascript/isframe.js\"></script>\n"; print " <script src=\"gui/javascript/location.js\"></script>\n"; print " <script>\n"; print " <!--\n"; print " setLocation(\"Zoekresultaten\");\n"; print " // -->\n"; print " </script>\n"; print "</head>\n"; print "<body class=\"main\">\n"; print " <h1>Zoekresultaten (met fuzzy zoeken)</h1>\n<hr>\n"; print " Zoekargument is "; if ($pre_asterix) { print "*"; } elsif ($pre_quest) { print "?"; } print "$zoekorg.\n\n"; if (@foundfiles) { @keyz = reverse sort keys %results; foreach $key (@keyz) { # $intval = int $key; print "$results{$key}\n"; } if (open ARGFILE, ">>$foundfile") { print ARGFILE "$zoekarg\n"; close ARGFILE; } } else { print "\n<dd>Er is geen informatie gevonden.<br>\n"; print "<dd>U kunt vragen stellen \n"; print "via <a href=\"mailto:woc\@sci.kun.nl\">email</a> aan de WOC-redactie.\n"; if (open ARGFILE, ">>$notfoundfile") { print ARGFILE "$zoekarg\n"; close ARGFILE; } } print "</body>\n"; print "</html>\n"; } } --- NEW FILE: realsearch.pl --- #!/usr/local/bin/perl -w use diagnostics; use LWP; use XML::Parser; require WWW::Search; use CGI qw(:standard); my $script_title = "netsearch.pl"; my $searchengine = "AltaVista"; my $zoekarg = param("query"); my $lang = param("lang"); my @synoniemen = (); unless ($zoekarg) { $zoekarg = "azijnzuur"; }; unless ($lang) { $lang = "EN"; }; if ($zoekarg =~ /^WOC/) { # it is NT! it is a WOC number! my $line = `grep "$zoekarg" /vol/www/woc/data/wml/*.xml`; if ($line =~ /^.*\/(.*?)\.xml.*?NAME=\"(.*?)\">/) { $zoekarg = $1; } } my $fileurl = "file:///vol/www/woc/data/wml/$zoekarg.xml"; print "Content-type: text/html\n\n"; sub handle_start { my ($p, $data) = @_; $charstring = ""; $thisone = 0; if ($data eq "LANG") { shift; shift; while (@_) { my $att = shift; my $value = shift; if ($att eq "ID") { if ($value eq $lang) { $thisone = 1; } } } } } sub handle_end { my ($p, $data) = @_; if ($data eq "LANG") { if ($thisone) { push @synoniemen, $charstring; #print "$charstring\n"; } } } sub handle_char { my ($p, $data) = @_; $charstring = "$charstring$data"; } print "<html>\n"; print "<head>\n"; print " <title>Woordenboek Organische Chemie</title>\n"; print " <base href=\"http://www-woc.sci.kun.nl/\">\n"; print " <link rel=\"stylesheet\" href=\"gui/styles/woc.css\" type=\"text/css\">\n"; print " <script src=\"gui/javascript/isframe.js\"></script>\n"; print " <script src=\"gui/javascript/location.js\"></script>\n"; print " <script>\n"; print " <!--\n"; print " setLocation(\"Internet Zoekmachine\");\n"; print " // -->\n"; print " </script>\n"; print "</head>\n"; print "<body class=\"main\">\n"; print " <h1>Zoekresultaten Internet</h1>\n<hr>\n"; #maken lijst met synoniemen @synoniemen = (); my $browser = LWP::UserAgent->new(); $browser->agent($script_title); my $request = HTTP::Request->new(GET => $fileurl); my $foo = $browser->request($request); if ($foo->is_success) { $superxmlfile = $foo->content; } else { print " <ul>\n"; print " Er is onvoldoende informatie beschikbaar. Deze functie werkt\n"; print " voor dit woord niet. Er is hiervan melding gemaakt bij de\n"; print " redactie.\n"; print " </ul>\n"; print "</body>\n"; print "</html>\n"; open ARGFILE, ">>realsearch_errors.txt"; print ARGFILE "$zoekarg\n"; close ARGFILE; exit(1); } # Start parsing super.xml my $p1 = new XML::Parser(Handlers => {Start => \&handle_start, End => \&handle_end, Char => \&handle_char}); $p1->parse($superxmlfile); # maken zoekstring $aantal = scalar(@synoniemen); if ($aantal > 1) { $i = 1; $zoekstring = ""; while ($i <= $aantal) { if ($i > 1) { $zoekstring .= " OR "; }; if ($zoekstring) { $zoekstring .= "\"".$synoniemen[$i-1]."\""; } else { $zoekstring = "\"".$synoniemen[$i-1]."\""; } $i++; } } else { $synon = $synoniemen[0]; $zoekstring = "\"$synon\""; } print " Zoekargument is $zoekstring.\n\n"; my($search) = new WWW::Search($searchengine); $search->native_query(WWW::Search::escape_query($zoekstring)); $max = $search->maximum_to_retrieve(10); $max = 0; @results = $search->results(); print " <ul>\n"; if (scalar(@results) == 0) { print "Er is helaas geen informatie gevonden.\n"; } else { $i = 0; while ($i < 10) { $result = shift @results; if ($result) { $link = $result->url; print "<b>",++$i,"</b> <a href=\"",$link,"\">",$link,"</a><br>\n"; $lengte = ($result->size / 1024); $ua = new LWP::UserAgent; $ua->agent("WOC-SearchEngine/0.1 "); my $req = new HTTP::Request POST => $link; my $res = $ua->request($req); if ($res->is_success) { $doc = $res->content; $lengte = int ( (length($doc) / 1024 ) * 10) / 10; } print "<dd>lengte: $lengte kb<br>\n"; }; }; }; print " </ul>\n"; print "</body>\n"; print "</html>\n"; open ARGFILE, ">>realsearch_searched.txt"; print ARGFILE "$zoekarg\n"; close ARGFILE; --- NEW FILE: sa.pl --- #!/usr/local/bin/perl -w use strict; use LWP; use CGI qw(:standard); # get the parameters from the stdin # my $zoekarg = param("query"); my $zoekorg = $zoekarg; my $text = param("text"); my $CAS = param("CAS") || ""; # aanpassen zoekarg my $pre_asterix = ""; my $pre_quest = ""; if ($zoekorg =~ s/^\*//) { $pre_asterix = "yes"; } if ($zoekorg =~ s/^\?//) { $pre_quest = "yes"; } $zoekarg =~ s/\-/\\\-/g; $zoekarg =~ s/\./\\\./g; $zoekarg =~ s/\?/\./g; $zoekarg =~ s/\*/\(\\\w\|\\\-\|\\\(\|\\\)\)\+\?/g; # initialize dirs and files # my $foundfile = "arguments_found.txt"; my $notfoundfile = "arguments_notfound.txt"; my $root = "/vol/www/woc/web-docs"; my $datadir = "/vol/www/woc/data/wml"; my $destdir = "gui/items"; my $desturl = "http://www-woc.sci.kun.nl/"; my $url = ""; my @files = <$datadir/*.xml>; my @foundfiles = (); # Mime-Type header line # needs to be placed elsewhere (bug #11) # print "Content-type: text/html\n\n"; #debug #print "-$zoekorg- -> -$zoekarg-\n"; #print "-$CAS-\n"; if ($zoekarg eq "") { if ($text eq "") { print "Content-type: text/html\n\n"; open (FILE, "<$root/gui/search.html"); while (<FILE>) { print; }; close(FILE); } elsif ($text ne "") { #print "Text found!"; print "Content-type: text/html\n\n"; open (FILE, "<$root/gui/search.html"); while (<FILE>) { # note that \s+ was substituted by \s+, but that doesn't work... "\ " does! s/NAME="query"\s+VALUE=\"\"/NAME="query"\ VALUE=\"$text\"/; print; } close(FILE); } } else { my $hit = ""; my $url = ""; my %results; foreach my $file (@files) { $file =~ s/.*?(\w*).xml/$1/; open (OPENFILE, "<$datadir/$file.xml") || next; #print "$file opened\n"; my $found = 0; my $title = ""; my $code = ""; while ( <OPENFILE> ) { # prevent from crashing due to match in the first or second line (bug #29) if (m/<\?xml.*\?>/) { # skip line } elsif (m/DOCTYPE/) { # skip line } else { if (/<ITEM/i) { if (/NAME=\"(.*?)\"/i) { $title = $1; } if (/CODE=\"(.*?)\"/i) { $code = $1; } } elsif ( ( ( ($CAS ne "yes") && /$zoekarg/i) || ( ($CAS eq "yes") && /CAS-NUMBER.*$zoekarg/i) ) && !$found) { if ( ! (-r "$root/$destdir/$file.shtml") ) { $file = $code; } if ( -r "$root/$destdir/$file.shtml" ) { push (@foundfiles, "$root/$destdir/$file.shtml"); $hit = "$root/$destdir/$file.shtml"; $url = "$desturl/$destdir/$file.shtml"; my $htmlcode = "<dd><a href=\"$url\">$title</a> \n"; my $yield = 50; #print "length: " . length($title) . "\n"; $yield = int((length $zoekorg) / (length($title)) * 50) if (length $title > 0); $_ = $title; if ( $title =~ /$zoekorg/i ) { $yield = $yield + 50; } $htmlcode .= "$yield\%<br>\n"; my $key = $yield; if ($key < 100) { if ($key < 10) { $key = "0$key"; } $key = "0$key"; } if ($results{$key}) { while ($results{$key}) { $key = "$key.1"; } $results{$key} = $htmlcode; } else { $results{$key} = $htmlcode; } } $found = 1; } } } close (OPENFILE); } #my $i = $foundfiles; #$print "tijdelijke debug info: $i\n"; if (scalar(@foundfiles) == 1) { print "Location: $url\n"; print "Content-type: text/html\n\n"; open (FOUND, "$hit"); while (<FOUND>) { print; }; close (FOUND); } elsif (scalar(@foundfiles) > 1) { print "Content-type: text/html\n\n"; print "<html>\n"; print "<head>\n"; print " <title>Woordenboek Organische Chemie</title>\n"; print " <base href=\"http://www-woc.sci.kun.nl/\">\n"; print " <link rel=\"stylesheet\" href=\"gui/styles/woc.css\" type=\"text/css\">\n"; print " <script src=\"gui/javascript/isframe.js\"></script>\n"; print " <script src=\"gui/javascript/location.js\"></script>\n"; print " <script>\n"; print " <!--\n"; print " setLocation(\"Zoekresultaten\");\n"; print " // -->\n"; print " </script>\n"; print "</head>\n"; print "<body class=\"main\">\n"; print " <h1>Zoekresultaten</h1>\n<hr>\n"; if (@foundfiles) { print " Zoekargument is "; if ($pre_asterix) { print "*"; } elsif ($pre_quest) { print "?"; } print "$zoekorg.\n\n"; my @keyz = reverse sort keys %results; foreach my $key (@keyz) { # $intval = int $key; print "$results{$key}\n"; } } print "</body>\n"; print "</html>\n"; } else { $zoekorg =~ s/\*//g; $zoekorg =~ s/\?//g; # Omdat de fuzzy search functionaliteit te veel vraagt van de webserver # wordt deze off line gebracht (dd. 2001-01-28) # Inmiddels kan door het in ongebruik raken van het dadml.pl script, kan # de fuzzy zoekmachine weer gebruikt worden. (dd 2001-02-24) #open ARGFILE, ">>$notfoundfile"; #print ARGFILE "$zoekorg\n"; #close ARGFILE; if ($CAS ne "yes") { print "Location: http://www-woc.sci.kun.nl/cgi-bin/search/fuzzy.pl?query=$zoekorg\n"; print "Content-type: text/html\n\n"; } else { # de onderstaande code kwam voor de fuzzy search in de plaats print "Content-type: text/html\n\n"; print "<html>\n"; print "<head>\n"; print " <title>Woordenboek Organische Chemie</title>\n"; print " <base href=\"http://www-woc.sci.kun.nl/\">\n"; print " <link rel=\"stylesheet\" href=\"gui/styles/woc.css\" type=\"text/css\">\n"; print " <script src=\"gui/javascript/isframe.js\"></script>\n"; print " <script src=\"gui/javascript/location.js\"></script>\n"; print " <script>\n"; print " <!--\n"; print " setLocation(\"Zoekresultaten\");\n"; print " // -->\n"; print " </script>\n"; print "</head>\n"; print "<body class=\"main\">\n"; print " <h1>Zoekresultaten</h1>\n<hr>\n"; print " Helaas zijn er geen resultaten gevonden. Pas uw\n"; print " zoekvraag aan, of <a href=\"mailto:woc\@sci.kun.nl\">stuur een email</a>.\n"; print "</body>\n"; print "</html>\n"; if (open ARGFILE, ">>$notfoundfile") { print ARGFILE "$zoekorg\n"; close ARGFILE; } } } } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:51
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/tree In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/tree Added Files: tree.pl Log Message: --- NEW FILE: tree.pl --- #!/usr/local/bin/perl -w use strict; use diagnostics; use LWP; use CGI qw(:standard); print "Content-type: text/html$/$/"; my $zoekarg = param("query"); my $repos = param("repos"); my $root = "/vol/www/woc/web-docs/"; my $dir = "/vol/www/woc/data/wml/"; my $destdir = "gui/items/"; my $baseurl = "http://www-woc.sci.kun.nl/"; if ($repos eq "iupac") { $dir = "/vol/www/woc/web-docs/iupac/data/wml"; $destdir = "iupac/gui/items/"; $baseurl = "http://www-woc.sci.kun.nl/"; } my %hash; my %filenames; my %indices; my @files = <$dir/*.xml>; foreach my $file (@files) { $file =~ s/.*?([\w|\-|\_]*).xml/$1/; if (open (OPENFILE, "<$dir/$file.xml")) { my $itemname; my @groupnames; while ( <OPENFILE> ) { if (/<ITEM.*?>/) { /NAME=\"(.*?)\"/i; $itemname = $1; /CODE=\"(.*?)\"/i; $filenames{$itemname} = $1; /ID=\"(.*?)\"/; my $id = $1; $indices{$1} = $itemname; } if (/<GROUP.*?>(.*)<\/GROUP>/) { push (@groupnames, $1); # is er een groep? # zo ja, voeg $itemname toe aan array in hash } } foreach my $group (@groupnames) { if (exists $hash{$group}) { $hash{$group} = [@{$hash{$group}}, $itemname]; } else { $hash{$group} = [$itemname]; } } print "$/"; } #close (OPENFILE); } print "<html>\n"; print "<head>\n"; print " <title>Woordenboek Organische Chemie</title>\n"; print " <base href=\"$baseurl\">\n"; print " <link rel=\"stylesheet\" href=\"gui/styles/woc.css\" type=\"text/css\">\n"; print " <script src=\"gui/javascript/isframe.js\"></script>\n"; print " <script src=\"gui/javascript/location.js\"></script>\n"; print " <script>\n"; print " <!--\n"; print " setLocation(\"Zoekresultaten\");\n"; print " // -->\n"; print " </script>\n"; print "</head>\n"; print "<body class=\"main\">\n"; print " <h1>Onderwerpenboom</h1>\n<hr>\n"; if ($zoekarg =~ /^WOC/ || $zoekarg =~ /^IUPAC/) { # get real argument $zoekarg = $indices{$zoekarg}; } print "<b>$zoekarg</b>\n"; printBoom(0, $zoekarg, \%hash); print "</body>\n</html>\n"; sub printBoom { my ($indent, $key, $boom) = @_; print "<ul>\n"; foreach my $item (@{$$boom{$key}}) { my $file = $filenames{$item}; if (-f "$root$destdir$file.shtml") { print "<a href=\"$baseurl$destdir$file.shtml\">$item</a><br>\n"; } else { print "$item<br>\n"; } print "<!-- $file.shtml gezocht.. -->\n"; if (exists $$boom{$item} && $key ne $item) { printBoom($indent+2,$item, $boom); } } print "</ul>\n"; } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:51
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/massa In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/massa Added Files: link.pl Log Message: --- NEW FILE: link.pl --- #!/usr/local/gnu/bin/perl -- -*-perl-*- # ------------------------------------------------------------ # ------------------------------------------------------------ # Print out what we need print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD>\n"; print " <title>Massaspectrum</title>\n"; print "</HEAD>\n"; print "<BODY bgcolor=white>\n"; print "<CENTER><h1>Massapectrum</h1></center>\n"; print "<hr>"; print "<p>Er is gezocht op CAS NR <i>"; print @ARGV; print "</i> in:"; print "<h1><a href='http://webbook.nist.gov/'>NIST Chemitry Webbook</a></h1>\n"; print "<ul>\n"; print " <APPLET CODEBASE='http://webbook.nist.gov/classes/' CODE='JCAMP.class' WIDTH=100% HEIGHT=90%>\n"; print " <PARAM NAME='SRC' VALUE='http://webbook.nist.gov/cgi/cbook.exe?JCAMP=C"; print @ARGV; print "&Type=IR'>\n"; print " <P><BLOCKQUOTE>\n"; print " <STRONG>Notice:</STRONG> This spectrum may be better viewed with a Java capable browser.\n"; print " </BLOCKQUOTE></P>\n"; print " <IMG SRC='http://webbook.nist.gov//cgi/cbook.exe?Spec=C"; print @ARGV; print "&Type=IR' ALT='IR spectrum'>\n"; print " </TABLE>\n"; print " </APPLET\n>"; print "</ul>\n"; print "<hr>\n"; |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:51
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/stats In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/stats Added Files: README.STATS data-stats.pl page-stats-automatic.pl tm-stats.pl Log Message: --- NEW FILE: README.STATS --- This is the README belonging to 'page-stats', a Perl-program by Mark Koenen (ma...@sc...) that 'cleverly' checks how often a WWW-page has been accessed. How does it work? First 'page-stats' reads in a ident-file. After that it reads the logfile just once, counts the page-accesses and then produces the HTML- document, using a header- and footer-file. What does ident-file look like? In a ident-file you'll be able to give 'identifiers' for a certain page: one page can have more than one representatives in a log-file. Therefore the ident-file has the following structure: URL@DESCRIPTION@IDENT1@...@IDENTn Where: URL = The URL to the page you want to look at DESCRIPTION = The description of the page IDENT1, ..., IDENTn = A identifier of the page An example. When you want statistics of your homepage you might want to begin your ident-file with: /index.html@My Homepage@/@/index.html The header- and footer-files: Naming your ident-file 'foo.ident' you'll have to create 'foo.header' and 'foo.footer' too. foo.header will be prepended to the page- statistics and foo.footer will be appended to the page-statistics. The three variables: When creating foo.header and foo.footer you can use three variables: $firstrequest $lastrequest $date Where: $firstrequest = date + time of first request in logfile $lastrequest = date + time of last request in logfile $date = current date + time Calling page-stats: After having set up your ident-, header- and footer-file it's time to let page-stats do what it's supposed to do. You can use page-stats in the following way: page-stats.pl [-i <ident-file>] [-l <logfile>] Where: ident-file = name of your ident-file (default: 'page-stats.ident') logfile = name of your logfile (default: '/usr/local/httpd/logs/access_log') If everything works out fine you'll find a new file called 'foo.html' in your directory. Where can you get it? The latest version is on: http://www.sci.kun.nl/thalia/guide/ You can see a working script at: http://www.sci.kun.nl/thalia/page-stats/ Troubleshooting: If the program didn't do a damn thing you might want to check if the path to Perl is correct: by default it's set to '/usr/local/bin/perl'. You can find out if this is a correct path by typing 'which perl' at your UNIX-prompt. If if perl is in another directory than '/usr/local/bin/' you'll have to edit the first line of 'page-stats.pl' If it _still_ doesn't work: too bad, go find something else to do :-) --- NEW FILE: data-stats.pl --- #!/usr/local/bin/perl -w use strict; my $root = "../.."; my %numberof = (); $numberof{"items"} = int(`ls $root/web-docs/gui/items/*.shtml | wc -w`); $numberof{"chemicals"} = int(`grep -i CLASS=\\"CHEMICAL\\" $root/data/wml/*.xml | wc -l`); $numberof{"mixtures"} = int(`grep -i CLASS=\\"MIXTURE\\" $root/data/wml/*.xml | wc -l`); $numberof{"polymers"} = int(`grep -i CLASS=\\"POLYMER\\" $root/data/wml/*.xml | wc -l`); $numberof{"reactions"} = int(`grep -i CLASS=\\"REACTION\\" $root/data/wml/*.xml | wc -l`); $numberof{"groups"} = int(`grep -i CLASS=\\"GROUP\\" $root/data/wml/*.xml | wc -l`); $numberof{"nomenclatuur"} = int(`grep -i CLASS=\\"NOMENCLATURE\\" $root/data/wml/*.xml | wc -l`); $numberof{"overigen"} = $numberof{"items"}-$numberof{"chemicals"}-$numberof{"mixtures"}-$numberof{"polymers"}-$numberof{"reactions"}-$numberof{"groups"}-$numberof{"nomenclatuur"}; $numberof{"linguistisch"} = 0; $numberof{"afkortingen"} = int(`grep -i ABBREV $root/data/wml/*.xml | wc -l`); $numberof{"nederlands"} = int(`grep -i ID=\\"NL\\" $root/data/wml/*.xml | wc -l`); $numberof{"engels"} = int(`grep -i ID=\\"EN\\" $root/data/wml/*.xml | wc -l`); $numberof{"duits"} = int(`grep -i ID=\\"DE\\" $root/data/wml/*.xml | wc -l`); $numberof{"frans"} = int(`grep -i ID=\\"FR\\" $root/data/wml/*.xml | wc -l`); $numberof{"linguistisch"} = $numberof{"afkortingen"}+$numberof{"nederlands"}+$numberof{"engels"}+$numberof{"duits"}+$numberof{"frans"}; $numberof{"dadml"} = 0; $numberof{"2d"} = 0; $numberof{"2d-cml"} = int(`ls $root/data/dadml/2d/cml/*.cml | wc -w`); $numberof{"2d-gif"} = int(`ls $root/data/dadml/2d/gif/*.gif | wc -w`); $numberof{"2d-mol"} = int(`ls $root/data/dadml/2d/mol/*.mol | wc -w`); $numberof{"2d"} = $numberof{"2d-cml"}+$numberof{"2d-gif"}+$numberof{"2d-mol"}; $numberof{"3d"} = 0; $numberof{"3d-cml"} = int(`ls $root/data/dadml/3d/cml/*.cml | wc -w`); $numberof{"3d-mol"} = int(`ls $root/data/dadml/3d/mol/*.mol | wc -w`); $numberof{"3d-pdb"} = int(`ls $root/data/dadml/3d/pdb/*.pdb | wc -w`); $numberof{"3d-vrml"} = int(`ls $root/data/dadml/3d/vrml/*.vrml | wc -w`); $numberof{"3d-xyz"} = int(`ls $root/data/dadml/3d/xyz/*.xyz | wc -w`); $numberof{"3d"} = $numberof{"3d-cml"}+$numberof{"3d-mol"}+$numberof{"3d-pdb"}+$numberof{"3d-vrml"}+$numberof{"3d-xyz"}; $numberof{"fysisch"} = 0; $numberof{"fys-cml"} = int(`ls $root/data/dadml/fysisch/cml/*.xml | wc -w`); $numberof{"fysisch"} = $numberof{"fys-cml"}; $numberof{"dadml"} = $numberof{"2d"}+$numberof{"3d"}+$numberof{"fysisch"}; $numberof{"pictures"} = int(`find $root/data/pictures -name "*.gif" -print | wc -w`); $numberof{"pict-homos"} = int(`ls $root/data/pictures/homos/*.gif | wc -w`); $numberof{"pict-lumos"} = int(`ls $root/data/pictures/lumos/*.gif | wc -w`); $numberof{"database"} = 0; $numberof{"xml"} = int(`ls $root/data/wml/*.xml | wc -w`); $numberof{"cml-totaal"} = $numberof{"2d-cml"}+$numberof{"3d-cml"}+$numberof{"fys-cml"}; $numberof{"mol-totaal"} = $numberof{"2d-mol"}+$numberof{"3d-mol"}; $numberof{"gif-totaal"} = $numberof{"2d-gif"}+$numberof{"pictures"}; $numberof{"database"} = $numberof{"xml"}+$numberof{"dadml"}; print <<EOT; Content-type: text/html <HTML> <HEAD> <TITLE>Woordenboek Organische Chemie</TITLE> <BASE HREF="http://www-woc.sci.kun.nl/"> <LINK REL="stylesheet" href="gui/styles/woc.css" TYPE="text/css"> <SCRIPT SRC="gui/javascript/isframe.js"></SCRIPT> <SCRIPT SRC="gui/javascript/location.js"></SCRIPT> <SCRIPT> <!-- setLocation("Zoekresultaten"); // --> </SCRIPT> </HEAD> <BODY CLASS="main"> <H1>Data Statistieken</H1> <HR> <P>Dit woordenboek bevat... <UL> <P>$numberof{"items"} items : <UL> $numberof{"chemicals"} chemicaliën<BR> $numberof{"mixtures"} mengsels<BR> $numberof{"polymers"} polymeren<BR> $numberof{"reactions"} reacties<BR> $numberof{"groups"} groepen van woorden<BR> $numberof{"nomenclatuur"} nomenclatuur-regels<BR> $numberof{"overigen"} overigen </UL> <P>$numberof{"linguistisch"} woorden : <UL> $numberof{"afkortingen"} afkortingen<BR> $numberof{"nederlands"} Nederlandstalige woorden<BR> $numberof{"engels"} Engelstalige vertalingen<BR> $numberof{"duits"} Duitstalige vertalingen<BR> $numberof{"frans"} Franstalige vertalingen </UL> <P>$numberof{"database"} gegevensbestanden : <UL> <P><I>woorden :</I></P> $numberof{"xml"} XML-bestanden<BR> <P><I>2D-structuren :</I></P> $numberof{"2d-cml"} CML-bestanden<BR> $numberof{"2d-gif"} GIF-bestanden<BR> $numberof{"2d-mol"} (MDL) MOL-bestanden <P><I>3D-structuren :</I></P> $numberof{"3d-cml"} CML-bestanden<BR> $numberof{"3d-mol"} (MDL) MOL-bestanden<BR> $numberof{"3d-pdb"} PDB-bestanden<BR> $numberof{"3d-vrml"} VRML-bestanden<BR> $numberof{"3d-xyz"} XYZ-bestanden <P><I>fysische gegevensbestanden :</I></P> $numberof{"fys-cml"} CML-bestanden </UL> <!-- $numberof{"pictures"} plaatjes: <UL> $numberof{"pict-homos"} HOMO<BR> $numberof{"pict-lumos"} LUMO orbitalen </UL--> </UL> <P><HR> <CENTER> U bent de <!--WEBBOT bot="HTMLMarkup" startspan ALT="Site Meter" --> <script>var site="woccounter"</script> <script language="JavaScript1.2" src="http://www.sitemeter.com/js/counter.js?site=woccounter"> </script> <noscript> <a href="http://www.sitemeter.com/stats.asp?site=woccounter" target="_top"> <img src="http://www.sitemeter.com/meter.asp?site=woccounter" alt="Site Meter" nosave="" border="0" /></a> </noscript> <script>document.write("//"+"-"+"-"+">");</script> <!-- Copyright 1999 Site Meter --> <!--WEBBOT bot="HTMLMarkup" Endspan -->ste bezoeker. </CENTER> <hr /> <p> </BODY> </HTML> EOT --- NEW FILE: page-stats-automatic.pl --- #!/usr/local/bin/perl # # Just some defaults: $logfile = "/vol/www/sun4irc/logs/access/rest_log"; $weeklogfile = "/vol/www/sun4irc/httpd/logs/access_log"; $identfile = "data/woc.ident"; $sum = 0; # Process switches: if($ARGV[0] =~ /^week/i) { $logfile = $weeklogfile; } elsif ($ARGV[0] =~ /^-debug/i) { $debug = "True"; } if ( -r $logfile ) { if ( -r $identfile ) { # Well, the important files are there. Start generating the # HTML-file # Let's determine the other filenames: $strippedfile = substr($identfile, 0, rindex($identfile, ".")); $htmlfile = $strippedfile . ".html"; $headerfile = $strippedfile . ".header"; $footerfile = $strippedfile . ".footer"; # Calculate some variables: $firstrequest = `head -1 $logfile`; $firstrequest =~ s/^.*\[(\S*)\s.*$/$1/; chomp ($firstrequest); $lastrequest = `tail -1 $logfile`; $lastrequest =~ s/^.*\[(\S*)\s.*$/$1/; chomp ($lastrequest); $date = `/usr/bin/date '+\%H:\%Mh \%d-\%m-\%y'`; chomp ($date); # Write HEADER-file to HTML-file. I've put it here to show that the page is loading... print "Content-type: text/html\n\n"; if ( open (HEADER, $headerfile) ) { while (<HEADER>) { s/\$firstrequest/$firstrequest/gi; s/\$lastrequest/$lastrequest/gi; s/\$date/$date/gi; print( $_ ); } } else { print ( "<HTML>\n<HEAD>\n<TITLE>Page-statistics</TITLE>\n"); print ( "</HEAD>\n<BODY>\n"); } close (HEADER); # Read the identifiers-file: @identarray = (); open (IDENT, $identfile) || die $!; while (<IDENT>) { print "in:$_" if $debug; $identline = "0\@"; split("\@", $_); $identline .= shift(@_) . "\@" . shift(@_) . "\@"; while ( @_ != () ) { $_ = shift(@_); $_ =~ s/^\s*([\S_]*)\s*$/$1/; if ( $_ ne "") { $identline .= " " . $_ . " \@"; } } push (@identarray, $identline); print "half:$identline$/" if $debug; } close (IDENT) || die $!; # Read the logfile and check if the page is in the identarray open (LOG, $logfile) || die $!; while (<LOG>) { # get url from log-line s/^.*"(POST|GET)\s+([\S_?]+)\s+.*$/$2/i; # remove newline chomp($_); # remove spaces s/ //g; # remove tabs s/ //g; # if non-empty: check for presence in identarray if ( $_ ne "") { # Waarvoor dit is weet ik niet, maar daardoor worden de # argumenten van scripts niet geevalueerd... # Geert, 2 febr. 1999 if ( index($_, "+") != -1 ) { $_ = substr($_, 0, index($_,"+")+1); } $pageurl = " " . $_ . " "; foreach $identline (@identarray) { # if pageurl is in identarray then increase the counter if ( index($identline, $pageurl) != -1 ) { $len = index($identline, "\@"); $identline = ( substr($identline, 0, $len) + 1) . substr($identline, $len); } elsif (index($identline, "\*") != -1) { $_ = $identline; s/.*?\@.*?\@.*?\@(.*)\@/$1/; s/(.*)\*/$1/; while ( /\s/ ) { s/\s//; } if ( index($pageurl, $_) != -1 ) { $len = index($identline, "\@"); $identline = ( substr($identline, 0, $len) + 1) . substr($identline, $len); } } } } } close (LOG) || die $!; # Write page-stats to HTML-file print ( "<CENTER><TABLE>\n"); @content = (); ##added## $i = 0; ##added## foreach $identline (@identarray) { $content[$i] = "<TR>"; @splits = split ("\@", $identline); if ($splits[0] == 0) { $width = " 0"; } else { $width = int ($splits[0]); while (length ($width) < 5) { $width = " ".$width; } } $url = $splits[1]; $description = $splits[2]; $description =~ s/^\s*(.*)$/$1/; $content[$i] .= "<!-- $width -->"; $content[$i] .= "<TD ALIGN=Left><A HREF=\"$url\">$description</A></TD>"; $content[$i] .= "<TD>$splits[0]</TD>"; $content[$i] .= "<TD ALIGN=\"Left\"><IMG SRC=\"/sigma/gifs/icon/stats_bar.gif\""; $content[$i] .= " WIDTH=\"$width\" HEIGHT=\"10\"></TD>"; $content[$i] .= "</TR>\n"; $sum = $sum + $splits[0]; $i++; } ##and now print all sorted!!## @content = reverse (sort (@content)); foreach (@content) { if ( /\w*0 --/) { } else { print; } } print ( "</TABLE></CENTER><p>\n"); # Write FOOTER-file to HTML-file if ( open (FOOTER, $footerfile) ) { while (<FOOTER>) { s/\$sum/$sum/gi; s/\$firstrequest/$firstrequest/gi; s/\$lastrequest/$lastrequest/gi; s/\$date/$date/gi; print $_; } } else { print "<HR>\n<EM>Page was generated on $date</EM>\n"; print <<EOT; <CENTER> U bent de <!--WEBBOT bot="HTMLMarkup" startspan ALT="Site Meter" --> <script>var site="woccounter"</script> <script language="JavaScript1.2" src="http://www.sitemeter.com/js/counter.js?site=woccounter"> </script> <noscript> <a href="http://www.sitemeter.com/stats.asp?site=woccounter" target="_top"> <img src="http://www.sitemeter.com/meter.asp?site=woccounter" alt="Site Meter" nosave="" border="0! </noscript> <script>document.write("//"+"-"+"-"+">");</script> <!-- Copyright 1999 Site Meter --> <!--WEBBOT bot="HTMLMarkup" Endspan -->ste bezoeker. </CENTER> <hr /> EOT print "</BODY>\n</HTML>\n"; } close (FOOTER) || die $!; print "\n"; } } --- NEW FILE: tm-stats.pl --- #!/usr/local/bin/perl -w use strict; my $root = "../.."; my $topicmap = "$root/data/topicmap/associations.topicmap"; my %assocs = (); my %numberof = (); # read associations open(TOPICMAP, "<$topicmap"); my $id = ""; my $name = ""; while (my $line = <TOPICMAP>) { if ($line =~ /topic\s*id\=\"(.*)\"/i) { $id = $1; } elsif ($line =~ /basename\>(.*?)\<\/basename/i) { $name = $1; } if (($id ne "") && ($name ne "")) { $assocs{$id} = $name; $id = ""; $name = ""; } } close(TOPICMAP); # calc stats my $files = `find $root/data/wml -name \"*.xml\"`; $files =~ s/\n|\r/\ /g; $numberof{"topicmaps"} = int(`grep -i \"<tm:topic\" $files | wc -l`); $numberof{"assocs"} = int(`grep -i \"<tm:assoc\" $files | wc -l`); $numberof{"assoctypes"} = scalar keys %assocs; print <<EOT; Content-type: text/html <HTML> <HEAD> <TITLE>Woordenboek Organische Chemie</TITLE> <BASE HREF="http://www-woc.sci.kun.nl/"> <LINK REL="stylesheet" href="gui/styles/woc.css" TYPE="text/css"> <SCRIPT SRC="gui/javascript/isframe.js"></SCRIPT> <SCRIPT SRC="gui/javascript/location.js"></SCRIPT> <SCRIPT> <!-- setLocation("TopicMap Stats"); // --> </SCRIPT> </HEAD> <BODY CLASS="main"> <H1>Data Statistieken: Topic Map</H1> <HR> <P>Dit woordenboek bevat... <UL> <P>$numberof{"assoctypes"} topic maps gedefinieerd: <UL> <P><I>gebruikt:</I></P> <UL> $numberof{"topicmaps"} topic maps<BR> $numberof{"assocs"} associaties<BR> </UL> <P><I>naar associatie:</I></P> EOT foreach my $associd (keys %assocs) { my $aantal = int(`grep -i \"$associd" $files | wc -l`); if ($aantal > 0) { print " $aantal x $assocs{$associd}<BR>\n"; } } print <<EOT; <UL> </UL> </UL> </UL> <P><HR> <CENTER> U bent de <!--WEBBOT bot="HTMLMarkup" startspan ALT="Site Meter" --> <script>var site="woccounter"</script> <script language="JavaScript1.2" src="http://www.sitemeter.com/js/counter.js?site=woccounter"> </script> <noscript> <a href="http://www.sitemeter.com/stats.asp?site=woccounter" target="_top"> <img src="http://www.sitemeter.com/meter.asp?site=woccounter" alt="Site Meter" nosave="" border="0" /></a> </noscript> <script>document.write("//"+"-"+"-"+">");</script> <!-- Copyright 1999 Site Meter --> <!--WEBBOT bot="HTMLMarkup" Endspan -->ste bezoeker. </CENTER> <hr /> <p> </BODY> </HTML> EOT |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:51
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/ssi In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/ssi Added Files: laatste_tien.pl topicmap.pl Log Message: --- NEW FILE: laatste_tien.pl --- #!/usr/local/bin/perl -w # # Shows the last ten items that has been added or changed AND for which an *.shtml file # is available. # # updated: 25-11-99 -> use real names instead of filenames, uses NAME Like... # 07-04-01 -> use CODE instead of filenames # use strict; use diagnostics; print "Content-type: text/html\n\n"; my $root = "/vol/www/woc/web-docs"; my $dir = "/vol/www/woc/data/wml"; my @files = `ls -t1 $dir/*.xml`; my $titel; my $code; my $i = 0; while ( $i < 10) { my $file = shift @files; $file =~ s/.*?([\w|\-|\_]*).xml\n/$1/; if (-e "$dir/$file.xml" && -r "$dir/$file.xml") { open (FILE, "<$dir/$file.xml") || die "Error: $dir/$file.xml not found!"; $titel = ""; $code = ""; while (<FILE>) { my $line = $_; if ($line =~ m/ITEM.*NAME=\"(.*?)\"/i) { $titel = $1; } if ($line =~ m/ITEM.*CODE=\"(.*?)\"/i) { $code = $1; } } close(FILE); if ( $titel && -e "$root/gui/items/$code.shtml") { $i++; print "<a href=\"http://www-woc.sci.kun.nl/gui/items/$code.shtml\">$titel</a><br />$/"; } else { # print "<!-- not found $code (was $titel, $file.xml) -->$/"; } } else { # print "<!-- cannot read/open $file -->$/"; } } --- NEW FILE: topicmap.pl --- #!/usr/local/bin/perl -w use strict; ## global vars ## my $associations_indexfile = "../../bin/topic/associations_index"; my $xmlfiles_indexfile = "../../bin/topic/xmlfiles_index"; my $shtmlfiles_indexfile = "../../bin/topic/shtmlfiles_index"; my $wmldir = "../../data/wml"; my $verbose = ""; # False my $debug = ""; # False ### MAIN ### print "Content-type: text/plain\n\n\n"; my $associations_index = {()}; my $xmlfiles_index = {()}; my $shtmlfiles_index = {()}; if (@ARGV) { while ($ARGV[0] =~ /^\-/) { if ($ARGV[0] =~ /^\-d/i) { $debug = "Active"; shift @ARGV; } if ($ARGV[0] =~ /^\-v/i) { $verbose = "Active"; shift @ARGV; } } $associations_index = &get_associations_index ($associations_indexfile); $xmlfiles_index = &get_xmlfiles_index ($xmlfiles_indexfile); $shtmlfiles_index = &get_shtmlfiles_index ($shtmlfiles_indexfile); foreach my $file (@ARGV) { &process_file ("$wmldir/$file", $associations_index, $xmlfiles_index, $shtmlfiles_index); } } else { die "Usage: $0 [-v[erbose]] [-d[ebug]] <xml-files>\n"; } ### END of MAIN ### sub get_associations_index { my %associations_index = (); if (open (INDEXFILE, $_[0])) { my @indexfile = <INDEXFILE>; foreach my $line (@indexfile) { my ($assoc, @line) = split (/\s+/, $line); $associations_index{$assoc} = join (" ", @line); } } else { warn "The associations indexfile $_[0] cannot be read!\n"; } return \%associations_index; } sub get_xmlfiles_index { my %xmlfiles_index = (); if (open (INDEXFILE, $_[0])) { my @indexfile = <INDEXFILE>; foreach my $line (@indexfile) { my ($xmlfile, @name) = split (/\s+/, $line); $xmlfiles_index{join (" ", @name)} = $xmlfile; } } else { warn "The xmlfiles indexfile $_[0] cannot be read!\n"; } return \%xmlfiles_index; } sub get_shtmlfiles_index { my %shtmlfiles_index = (); if (open (INDEXFILE, $_[0])) { my @indexfile = <INDEXFILE>; foreach my $line (@indexfile) { my ($shtmlfile, @name) = split (/\s+/, $line); $shtmlfiles_index{join (" ", @name)} = $shtmlfile; } } else { warn "The shtmlfiles indexfile $_[0] cannot be read!\n"; } return \%shtmlfiles_index; } sub process_file { my ($file, $associations_index, $xmlfiles_index, $shtmlfiles_index) = @_; ## get topicname and associations ## my $topicname = ""; my $associations = []; if (open (XMLFILE, $_[0])) { my @xmlfile = <XMLFILE>; while (@xmlfile && $xmlfile[0] !~ /<ITEM/i) { shift @xmlfile; print "current line=$xmlfile[0]" if $debug; } $topicname = $1 if (@xmlfile && $xmlfile[0] =~ /NAME="(.+?)"/i); while (@xmlfile) { while (@xmlfile && $xmlfile[0] !~ /<tm:assoc\s/i) { shift @xmlfile; print "current line=$xmlfile[0]" if $debug && @xmlfile; } my $assoc = ""; if (@xmlfile && $xmlfile[0] =~ /id="(.+?)"/i) { $assoc = $1; print "Found association=$1\n" if $verbose; } shift @xmlfile if @xmlfile; print "current line=$xmlfile[0]" if $debug && @xmlfile; ## get all associated files! ## my @assocrl = (); while (@xmlfile && $xmlfile[0] !~ /<\/tm:assoc>/i) { while (@xmlfile && $xmlfile[0] !~ /<\/tm:assoc>/i && $xmlfile[0] !~ /<tm:assocrl\s/i) { shift @xmlfile; print "current line=$xmlfile[0]" if $debug; } if (@xmlfile && $xmlfile[0] =~ /xlink:href="(.+?)"/i) { push (@assocrl, $1); print "Found assoclink=$1\n" if $verbose; } else { print "No assoclink??\n" if $verbose && @xmlfile; } if (@xmlfile && $xmlfile[0] !~ /<\/tm:assoc>/i){ shift @xmlfile; print "current line=$xmlfile[0]" if $debug; } } if ($assoc && @assocrl) { push (@$associations, [$assoc, \@assocrl]); print "Pussing assoc=$assoc @assocrl\n" if $verbose; } else { print "Was last association\n" if $verbose && !@xmlfile; } } } else { warn "The xmlfile $_[0] cannot be read!\n"; } ## turn associations into HTML ## my @result = (); foreach my $assoc (@$associations) { my $association = ($$associations_index{$$assoc[0]} || ""); print "Assoc: $association$/" if $debug; if ($association =~ /\$.*?\$/) { my @related_topics = @{$$assoc[1]}; my @related_files = (); foreach my $related_topic (@related_topics) { if (exists $$shtmlfiles_index{$related_topic}) { push (@related_files, $$shtmlfiles_index{$related_topic}); } else { push (@related_files, ""); } } $association =~ s/\$0\$/<I>$topicname<\/I>/g; if ($association =~ /\$\*\$/) { print "Substitute \*...$/" if $verbose; while (@related_files) { my $related_file = shift @related_files; my $related_topic = shift @related_topics; my $delim = ","; $delim = " en" if (scalar @related_files == 1); $delim = "" if (scalar @related_files == 0); if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; $association =~ s/\$\*\$/ <A HREF=\"\/cgi-bin-woc\/topiclink\/link.pl?$related_file+$$assoc[0]\"><I>$related_topic<\/I><\/A>$delim\$\*\$/g; } else { # don't link # $association =~ s/\$\*\$/ <I>$related_topic<\/I>\$\*\$/g; } } print "New Assoc: $association$/" if $verbose; } $association =~ s/\$\*\$//g; my $i = 1; while ($association =~ /\$$i\$/) { my $related_file = shift @related_files; my $related_topic = shift @related_topics; if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; $association =~ s/\$$i\$/<A HREF=\"\/cgi-bin-woc\/topiclink\/link.pl?$related_file\+$$assoc[0]\"><I>$related_topic<\/I><\/A>/g; } else { # don't link # $association =~ s/\$$i\$/<I>$related_topic<\/I>/g; } $association =~ s/\$$i\$/<I>$topicname<\I>/g; $i++ } push (@result, "$association<BR />\n"); } elsif ($association) { my @related_topics = @{$$assoc[1]}; my @related_files = (); foreach my $related_topic (@related_topics) { if (exists $$shtmlfiles_index{$related_topic}) { push (@related_files, $$shtmlfiles_index{$related_topic}); } else { push (@related_files, ""); } } push (@result, "<I>$topicname</I> $association"); my $related_file = shift @related_files; my $related_topic = shift @related_topics; if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; push (@result, " <A HREF=\"/cgi-bin-woc/topiclink/link.pl?$related_file\+$$assoc[0]\"><I>$related_topic</I></A>"); } else { # don't link # push (@result, " <I>$related_topic</I>"); } while (@related_files) { my $related_file = shift @related_files; my $related_topic = shift @related_topics; if (@related_files > 0) { if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; push (@result, ", <A HREF=\"\/cgi-bin-woc\/topiclink\/link.pl?$related_file\+$$assoc[0]\"><I>$related_topic</I></A>"); } else { # don't link # push (@result, ", <I>$related_topic</I>"); } } elsif (@related_files == 0) { if ($related_file) { # add link # $related_file =~ s/\/vol\/www\/woc\/web-docs/\/woc/i; push (@result, " en <A HREF=\"\/cgi-bin-woc\/topiclink\/link.pl?$related_file\+$$assoc[0]\"><I>$related_topic</I></A>"); } else { # don't link # push (@result, " en <I>$related_topic</I>"); } } } push (@result, "<BR />\n"); } } foreach (@result) { print; } } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:50
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir/woc/wocdata In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir/woc/wocdata Added Files: editor woc.dat woc.grm woc.hlp Log Message: --- NEW FILE: editor --- #!/usr/bin/tcsh cd ../../editor Editor woc --- NEW FILE: woc.dat --- // subject#naam#email#datum#datum#tijd#niveau#inhoud Eindexamen#WOC-redactie#wo...@sc...#30 mei 2002#00:00h#1#Hier kunnen vragen gesteld worden over oude Eindexamens. Meer informatie#WOC-redactie#wo...@sc...#04-19-99#11:20h#1#In deze rubriek kunt U vragen stellen over informatie die niet in het WOC te vinden is. Meer informatie#Jean-Christophe Van nieuwenhuysen#jc...@ho...#06-03-02#21:27h#2#(new) ik moet voor mijn examen een werkje maken voor chemie over een bepaalde stof maar ik vind de naam niet van het product van de gegeven formule:<BR>CH3-CH2-CO-CH2-CH2Cl<BR>1-chloor-3-pentanon<BR>moest u mij kunnen helpen zou dit heel vriendelijk zijn! Dank u. Meer informatie#afafe Oubaibra #afafe.oubaibra#06-04-02#16:49h#2#(new) Geachte, <P>Momenteel ben ik bezig met het opstellen van een subsidieaanvraag voor eenbedrijf dat inkten produceert. <P>Echter ik zeijn een aantal woorden die ik noch terug vind in de woordenboek noch in de vertaalde lijst. <P>Ik hoop dat u mij kan verder helpen bij het verklare van onderstaande. <P>Deze zijn namelijk: <P>-Butyral ( base )<BR>-ADR and non-ADR goods (moet iets zijn met ontvlambaar)<BR>-Predispersed pigment preparation / dispersion<BR>-Grinding<BR>-Dispensing<BR>-cathodic corrosion<BR>-Helio Flexo<BR>-wat is nitreren van cellulose<P>- Voor wat staan de volgende codes (ruwe materialen)<P>R6121<BR>R6191<BR>B4001<BR>K4003<BR>R6262<P>Ik dank u voor de door u genomen moeite, <P>met vriendelijke groeten, <P>Afi dringend!!#Sofie#ann...@ho...#06-05-02#15:23h#2#(new) Hallo,<BR>Ik zoek de naam en de functie van deze verbinding:<BR>H2N - CH2<BR> |<BR>HO3S - CH2<P>Kan iemand mij helpen?<BR>Alvast bedankt<BR> Meer informatie#Peter van Haamsteden#sat...@ho...#06-06-02#11:06h#2#(new) Hallo,kunnen jullie mij helpen door een afbeelding van de molecuulstructuur van Deuterium te geven (op de site te zetten)??? Meer informatie#Vandemaele Gabriël#Gab...@pa...#06-13-02#22:02h#2#(new) Kunt u mij informeren waar meer gegevens te vinden zijn over:<BR>Dimethylethyleenamine of <BR>Dimethylethanolamine <BR>Is de afkorting hiervoor DMEA ? <P>Belangrijk is vooral de toxiciteit en welke beschermingsmaatregelen te nemen zijn ? <BR> Meer informatie#Peter Reinders#pjr...@wo...#06-17-02#17:53h#2#(new) Wat is het verschil tussen polystyreen en polypropyleen. Wat is het voordeel van de laatste tov de eerste in de verpakking van voedselproducten? Meer informatie#jan vandecasteele #jan...@pa...#07-31-02#12:00h#3#(new) polystyreen wordt gebruikt als isolatiemateriaal (piepschuim) Wat is ... ?#WOC-redactie#wo...@sc...#04-19-99#11:20h#1#In deze rubriek kunt U vragen stellen over termen (behalve chemische verbindingen). Hoe werkt dit of waarmee kan ik dat? Wat is pyrofosforolyse in relatie met ddNTP's of dNTP's??#Medine Nesil#ye...@ho...#06-05-02#14:23h#2#(new) Wat is pyrofosforolyse in relatie met ddNTP's of dNTP's? en informatie over PAP-techniek.<BR>Graag in Nederlands Wat is pyrofosforolyse in relatie met ddNTP's of dNTP's??#Medine Nesil#ye...@ho...#06-05-02#14:23h#2#(new) Wat is pyrofosforolyse in relatie met ddNTP's of dNTP's? en PAP-techniek??<BR> Wat is pyrofosforolyse in relatie met ddNTP's of dNTP's??#Medine Nesil#ye...@ho...#06-05-02#14:23h#2#(new) Wat is pyrofosforolyse in relatie met ddNTP's of dNTP's en PAP-techniek??<BR> wat is cr#krista#kri...@ms...#06-11-02#14:12h#2#(new) wat is cr ??<BR>is het chroom? en wat houd deze stof in??<P> Wat is ... ?#delfs yvan#del...@be...#06-12-02#10:22h#2#(new) wat is een edelgas?wat is extractie?wat is een atoom-element?wat is verbranding? Wat is ... ?#luc deschamps#luc...@az...#06-15-02#10:25h#2#(new) Wat betekent de term 'elueren' What is CH M1 - 745-2 ???#Gebbûh..#Ge...@ho...#06-20-02#19:53h#2#(new) What is CH M1 - 745-2 ??? I found some stuff in my brother's closet and I think he's on drugs<BR>this is what was on the bag it was in, it was a white powder so I think it's cocaine or something like that, PLEASE HELP ME !!!!!! Wat is ... ?#Fred Stork#f....@ch...#06-22-02#19:39h#2#(new) Voor de behandeling van een visziekte in mijn vijver heb ik Kaliumpermanganaat gekregen (te gebruiken 2 gram per 1000 liter water). Na de kuur dient een wit poeder toegedient te worden dat volgens de vissendokter wordt omschreven als "peroxide". Dit maakt na een dag het water glashelder. Wie weet welk soort peroxide dit kan zijn. Wat is ... ?#Fred Stork#f....@ch...#06-22-02#19:51h#2#(new) Weet iemand wat Flubandazol is ? Ik heb het gekregen ter bestrijding van huidwormen bij mijn vijvervissen. Weet iemand ook wat deze stof doet ? Wat is ... ?DEPRENYL#COUCKE JAN#jan.coucke.be#07-17-02#13:28h#2#(new) wat is deprenyl Wat is/doet deze verbinding?#WOC-redactie#wo...@sc...#04-19-99#11:20h#1#In deze rubriek kunt U vragen stellen over chemische verbindingen. Wat is/doet deze verbinding?#rudi#ec...@pa...#06-04-02#00:13h#2#(new) verschil tussen petroleum en brandstof diesel Wat is/doet deze verbinding?#maarten#ikm...@ho...#06-09-02#17:37h#2#(new) Kan iemand mij alsjeblieft evrtellen wat de reactieproducten als je citroenzuur met natronllog laat reagere. En in welke evrhouding reageren die?<BR>Help me !!! Wat is/doet deze verbinding?#Egon#wo...@sc...#06-11-02#15:37h#3#(new) Het lijkt mij dat ze 1:1 reageren en natriumcitraat vormen. Wat is/doet deze verbinding?#anke#ank...@ho...#06-15-02#18:20h#2#(new) Weet u soms de structuurformule van natriumascorbaat?<P>Dank u Wat is/doet deze verbinding?#Fred Stork#f....@ch...#06-22-02#19:33h#2#(new) Voor de behandeling van een visziekte in mijn vijver heb ik Kaliumpermanganaat gekregen (te gebruiken 2 gram per 1000 liter water). Na de kuur dient een wit poeder toegedient te worden dat volgens de vissendokter wordt omschreven als "peroxide". Dit maakt na een dag het water glashelder. Wie weet welk soort peroxide dit kan zijn. Wat is/doet deze verbinding?#liesbeth#smo...@ho...#07-02-02#15:07h#2#(new) bakpoeder: formule, systematische naam, vorming, soort stof,eigenschappen, gebruik, gevarensymbolen en de r en s zinnen Wat is/doet deze verbinding?#h mannessen#h.m...@ch...#07-14-02#20:24h#2#(new) wat gebeurt er met de stoffen NH3 en CO2 welke gebruikt worden in een koude proces als deze direkt met elkaar in contact komen. Ongerubriceerd#henk en jan#sny...@ho... en naa...@ho...#06-03-02#18:50h#2#(new) voor school moeten wij antwoord geven op de volgende vragen:<BR>1-met welke stoffen reageert het element zilver het best?<BR>2-wat zijn de eigenschappen van deze stoffen en de toepassingen (en waarvoor ze gebruikt worden)?<BR>3-en welke verbindingen worden toegepast/gebruikt rond je huis/omgeving?<BR>alvast bedankt voor de antwoorden en de moeite<BR>Henk en Jan 4C scheikunde#elide van klooster#klo...@ca...#06-05-02#01:28h#2#(new) Ik heb de volgende vraag:<BR>Ben op zoek naar een beschrijving van de alchemie<BR>gaarne hierop antwoord.<BR>ben een lerling van VMBO theoretische leerweg<BR>b.v.d.<BR>elis van klooster Magnesium#Niels Huismans#n_h...@ho...#06-05-02#10:00h#2#(new) Wat houd magnesium in?<P>Alvast bedankt, Niels Ongerubriceerd#chantal van hengstum#Cha...@ar...#06-06-02#08:39h#2#(new) Goedemorgen,<P>Waaruit bestaat Tempex? Welke dampen kunnen er vrij komen bij het verwarmen van dit materiaal (het snijden van tempex met hete metalen draden).<P> rookbom#ria verstraeten #ria verstraetan @belgacom.be#06-09-02#11:12h#2#(new) Hoe maak ik een rookbom van middelen die we hebben in het gewone leven ? poederof rookbom#ria verstraeten#ria verstraeten @skynet.be#06-09-02#11:15h#2#(new) Hoe maak ik een soort bom waardoor er rook vrij komt? Ongerubriceerd#Dominique Rigaux#dom...@si...#06-10-02#21:29h#2#(new) Ik ben op zoek naar een tabel waarin ik de chemische bestendigheid van bepaalde produkten zoals Kynar, Hypalon, viton, EPDM, RVS soorten ...etc tov produkten zoals FeCl3, H2SO4, HCl, ... etc kan vinden. Weet iemand waar ik zo'n tabel kan vinden? Bestaat dit ergens onder digitale vorm? Kan iemand mij de link hiervoor opgeven?<P>Alvast bedankt op voorhand. Chloor#irma melessen#sp...@ho...#06-13-02#13:18h#2#(new) hallo<BR>ik ben irma en 14 jaar ik zit in 3 VMBO.<BR>ik moet een werkstuk maken over chloor nu zit ik met een paar vragen --><BR>1.  Uiterlijk<BR> Kenmerken  smeltpunt  kookpunt<BR> Gevaarlijk  wat doet het<BR> Waar word het voor gebruikt<BR> Waar kom je het tegen<BR> alvast bedankt ik heb eigenlijk geen tijd en moet het morgen al inleveren <BR>maar toch bedankt<P>Groetjes Irma Aspirine#tessa ketel#tes...@ho...#06-17-02#10:11h#2#(new) Ik hoop dat u mij zou willen helpen met de volgende vraag: <BR> In de handel zijn hoofdpijntabletten te verkrijgen die, in een weinig water gebracht, onder gasontwikkeling een heldere oplossing geven. Het ontwijkende gas blijkt kalkwater troebel te maken . In zon bruistablet zit ondermeer acetylsalicylzuur (Aspirine®) en natrium-bicar-bonaat. Aspirine®, een organisch zuur mag geschreven worden als HA.<P><BR>a. Geef de vergelijking van de reactie waarbij het bedoelde gas ontwijkt. Acetylsalicylzuur is slecht oplosbaar in koud water. <P><P>b. Geef een verklaring voor het feit dat acetylsalicylzuur goed oplost in water in aanwezigheid van natriumbicarbonaat <P>Alvast heel erg bedankt, vriendelijke groetjes Tessa Ketel<P> Ongerubriceerd#carlien sierens#ca...@li...#06-21-02#11:01h#2#(new) Is het mogelijk op jullie website via ingave van het CAS-Nummer de formule te weten ?<P>Bijvoorbeeld : CAS-Nr. 103-23-1 welke samenstelling is dit ?<P>met dank bij voorbaat voor een antwoord.<P><BR>vriendelijke groeten,<BR>carlien sierens Kaliumpermanganaat#Fred Stork#f....@ch...#06-22-02#19:40h#2#(new) Wat de exacte werking van Kaliumpermanganaat in mijn vijver met koikarpers. Ik heb het via een vissendokter voorgeschreven gekregen ter behandeling tegen de parasieten Costia en Tichodina. Ontleden?#Avioire#Aj...@ho...#06-24-02#13:58h#2#(new) Beste mensen, ik zit met een groot probleem!<P>Ik heb vorige week een belangrijk contract gekregen van mijn baas en mijn zoontje heeft daar inkt op laten vallen, pure inkt!<BR>Een gedeelte van mijn contract zit helemaal onder en het is er helemaal in, ingetrokken.<BR>hoe kan ik het papier en het inkt van elkaar scheiden? Ongerubriceerd#Tineke Kievits#bo...@he...#06-24-02#20:31h#2#(new) Zou u zo vriendelijk willen zijn mij informatie te mailen betreffende de samenstelling en de geachte werking van Potassium?<P>Dank je wel.. en vriendelijk groetend.. <BR>Tineke Kievits Ongerubriceerd#Tineke Zwaan#tz...@ne...#06-28-02#10:17h#2#(new) is dichloormethaan een polaire of apolair oplosmiddel? Graag ontvang ik een overzicht van polaire en apolaire oplosmiddelen<BR> organische nomenclatuur#R. Smit#bl...@wa...#07-04-02#10:28h#2#(new) Weet iemand een Ned triviaalnaam voor<BR>-pamoic acid<BR>-estolic acid<BR>-embonic acid<P>dank<BR>rob --- NEW FILE: woc.grm --- volgorde: 7 subject naam email datum tijd niveau inhoud verdeling: 5 0 1, 3, 4 2 6 5 weergave: 5 subject: naam : email : inhoud : niveau : --- NEW FILE: woc.hlp --- // $mode.hlp - bestand met alle help gegevens // // De regels beginnend met / zijn commentaar, extra commentaar alleen tussen de arrays en // minimaal een regel commentaar ertussen is essentieel. // De andere regels gaan twee aan twee, het eerste bevat het item, de tweede de beschrijving // zorg dat in ieder geval de items met spaties worden aangevuld tot de lengte van de langste // uit het deellijstje... // Lengte van de deellijstjes onbegrensd // commando help /// ident /// hieronder een overzicht van alle beschikbare commando's: help deze uitleg usage geeft overzicht alle mogelijke parameters ? geeft alle (on)mogelijke afkortingen find zoeken op gegevens show weergeven studentgegevens del verwijderen van studenten edit wijzigen studentgegevens filter selectief verwijderen studenten new toevoegen studenten unfilter wijzigingen vanaf laatste filter teniet doen read (opnieuw) inlezen studentgegevens save opslaan wijzigingen quit afsluiten editor probeer eens usage of ? EOH commando usage /// ident /// hieronder per commando de mogelijke parameters: help usage ? find <gegeven> <zoekstring> [..] show [(<nr> [..] | alles)] (default = huidige) del [<nr> [..]] (default = huidige) edit [<nr>] (default = huidige) filter <gegeven> <zoekstring> [..] new (student | jaar)", unfilter read [<bestand>] (default = $datafile) save [<bestand>] (default = $newdatafile) quit probeer eens ? EOH commando afkort /// ident /// de tekens binnen [] zijn overbodig: d[el] sa[ve] e[dit] s[how] fil[ter] us[age] f[ind] u[nfilter] h[elp] q[uit] n[ew] ? r[ead] EOH edit help /// ident /// kies een van de volgende items om deze te wijzigen: probeer eens ? EOH edit afkort /// ident /// de tekens binnen [] zijn overbodig: EOH |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:50
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/topiclink In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/topiclink Added Files: link.pl Log Message: --- NEW FILE: link.pl --- #!/usr/local/bin/perl -w # # Records the items to which was linked with topic map links. # use strict; use diagnostics; my $logfile = "receivers"; my $item = shift @ARGV; my $assoc = shift @ARGV || "unknown"; #open ARGFILE, ">>$logfile"; my $date = `date`; $date =~ s/\n//g; my $client = $ENV{"REMOTE_ADDR"}; my $source = $ENV{"HTTP_REFERER"}; $source =~ s/http.*\/(.*).shtml/$1/; my $target = $item; $target =~ s/.*\/(.*).shtml/$1/; #print ARGFILE "$date, $client - $assoc: $source -> $target\n"; #close ARGFILE; print "Location: http://www.sci.kun.nl" . $item . "\n"; print "Content-type: text/html\n\n"; # do nothing more |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:49
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir/iupac-forum In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir/iupac-forum Added Files: bericht.htpl berichtkop.htpl eindelijst.htpl incompleet.htpl iupac-forum.htpl iupac-forum.pl nieuwelijst.htpl overigkop.htpl overzicht.htpl rubriek.htpl rubriekkop.htpl rubriektoc.htpl toevoegform.htpl vraagkop.htpl Log Message: --- NEW FILE: bericht.htpl --- <CENTER> if $vraag <FONT SIZE=+1><B>Vraag of reactie over $subject</B></FONT><BR> if !$vraag <FONT SIZE=+1><B>Over $subject</B></FONT><BR> <I>(<A HREF="mailto:$email">$naam</A>, $stamp)</I> </CENTER> <P> <HR WIDTH=20%> <P> <UL> if $vraag <B>$inhoud</B> if !$vraag $inhoud <P> $reacties </UL> <P> <H3 ALIGN=Center> if $volgendelink [ <A HREF="$volgendelink">Volgende</A> ] if $vraag [ <A HREF="$voorgangerlink">Rubriek</A> ] if !$vraag [ <A HREF="$voorgangerlink">Voorganger</A> ] [ <A HREF="$reactielink">Reageren</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: berichtkop.htpl --- <LI><B>@subject</B> <A HREF="@berichtlink">@naam</A> <I>(@stamp)</I> --- NEW FILE: eindelijst.htpl --- </UL> --- NEW FILE: incompleet.htpl --- <CENTER> <BR><H1>Volledig Invullen A.U.B.</H1> <FORM METHOD=POST ACTION="$script+voegtoe+$niveau+$nummer"> <INPUT TYPE=Hidden NAME="datum" VALUE="$datum"> <INPUT TYPE=Hidden NAME="tijd" VALUE="$tijd"> <TABLE> <TR> <TD>Naam:</TD> <TD><INPUT TYPE=Text NAME="naam" SIZE=50 VALUE="$naam"></TD> </TR> <TR> <TD>E-Mail:</TD> <TD><INPUT TYPE=Text NAME="email" SIZE=50 VALUE="$email"></TD> </TR> <TR> <TD>Subject:</TD> <TD><INPUT TYPE=Text NAME="subject" SIZE=50 VALUE="$subject"></TD> </TR> <TR> <TD>Bericht:</TD> <TD><TextAREA COLS=55 ROWS=10 NAME="inhoud">$inhoud</TextAREA></TD> </TR> </TABLE> <INPUT TYPE=Submit VALUE="Voeg toe"> <INPUT TYPE=Reset VALUE="Opnieuw"> </FORM> </CENTER> --- NEW FILE: iupac-forum.htpl --- Content-type: text/html <HTML> <HEAD> <META NAME="Author" CONTENT="Geert Josten, lid van de internetcommissie van VVCN Sigma"> <META NAME="Description" CONTENT="WOC-IUPAC Forum: Opmerkingen, reacties, vragen en antwoorden"> <META NAME="Generator" CONTENT="Perl-Sript: $0 $scriptage"> <META NAME="IsIndex" CONTENT="No"> <META NAME="Maintainer" CONTENT="$maintainer"> <META NAME="Review" CONTENT="$time"> <BASE href="http://www.sci.kun.nl/woc/iupac/" TARGET="pagina"> <TITLE>WOC-IUPAC Forum: $header </TITLE> <link rel="stylesheet" href="gui/styles/woc.css" type="text/css"> </HEAD> <BODY class="main"> <H1 ALIGN=Center>Vragen en Reacties: $header</H1> <HR> <BR> <BR> if $overzicht $overzicht.htpl if $rubriektoc $rubriektoc.htpl if $bericht $bericht.htpl if $toevoegform $toevoegform.htpl if $toevoegformincompleet $incompleet.htpl <P> <HR> <UL> <CENTER><I>De WOC-redactie behoudt het recht om naar eigen inzicht de toegevoegde vragen en antwoorden aan te passen en in te delen.</I></CENTER> </UL> </BODY> </HTML> --- NEW FILE: iupac-forum.pl --- $contentcheckers = "woc\@sci.kun.nl"; ## main ## ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; $datum = `date '+%m-%d-%y'`; $tijd = `date '+%H:%Mh'`; if ((@ARGV) && ($ARGV[0] =~ /^nieuw/i)) { shift (@ARGV); $niveau = shift (@ARGV); $nummer = shift (@ARGV); if ($niveau > 2) { $header = "Vul hier je reactie in..."; &maak_reactieform (); } else { $header = "Vul hier je vraag of reactie in..."; if ($nummer > 0) { &maak_reactieform (); } else { $subject = "Ongerubriceerd"; $nummer = @$refdata; } } $toevoegform = "true"; } elsif ((@ARGV) && ($ARGV[0] =~ /^voegtoe/i)) { shift (@ARGV); $niveau = shift (@ARGV); $nummer = shift (@ARGV); if (&voeg_nieuw_bericht_toe ()) { $reacties = ""; $nummer++; $header = "\$inhoud"; if ($niveau > 2) { $bericht = "overig"; } else { $bericht = "vraag"; $vraag = "true"; } &maak_bericht (); } else { $toevoegformincompleet = "true"; } } elsif ((@ARGV) && ($ARGV[0] =~ /^rubriek/i)) { $header = "Vragen Overzicht"; shift (@ARGV); $nummer = shift (@ARGV); $rubriektoc = " "; &maak_rubriek (); $vraagtoevoeglink = "$script+nieuw+2+$nummer"; } elsif ((@ARGV) && ($ARGV[0] =~ /^vraag/i)) { $header = "Antwoorden op vragen"; shift (@ARGV); $nummer = shift (@ARGV); $bericht = "vraag"; $vraag = "true"; &maak_bericht (); } elsif ((@ARGV) && ($ARGV[0] =~ /^\d+/i)) { $header = "Antwoord en commentaar"; $nummer = shift (@ARGV); $bericht = "overig"; &maak_bericht (); } else { $header = "Rubrieken Overzicht"; $overzicht = ""; &maak_overzicht (); $niveau = "1"; $nummer = @$refdata; $nieuwevraaglink = "$script+nieuw+2+0"; } $return = ""; sub maak_reactieform { $refsubject = &get (["subject"], [$$refdata[$nummer-1]], $grammar, ""); $subject = $$refsubject[0]; } sub maak_overzicht { $htmlrubriek = &readhtml ("rubriek.htpl"); $refsubject = &get (["subject"], $refdata, $grammar, ""); $refnaam = &get (["naam"], $refdata, $grammar, ""); $refemail = &get (["email"], $refdata, $grammar, ""); $refstamp = &get (["datum", "tijd"], $refdata, $grammar, ""); $refniveau = &get (["niveau"], $refdata, $grammar, ""); $refinhoud = &get (["inhoud"], $refdata, $grammar, ""); @i = (1..@$refdata); $numvraag = 0; $numant = 0; $numcomm = 0; foreach $i (@i) { $subject = shift @$refsubject; $naam = shift @$refnaam; $email = shift @$refemail; $email =~ s#\@#\\\@#ig; $stamp = shift @$refstamp; $stamp =~ s/#/, /i; $niv = shift @$refniveau; $inhoud = shift @$refinhoud; if ($niv == 1) { push (@rubrieklink, "$script+rubriek+$i"); push (@subject, "\u$subject"); push (@email, $email); push (@naam, "\u$naam"); push (@stamp, $stamp); push (@niveau, $niveau); push (@inhoud, "\u$inhoud"); ($numvraag = "geen") if ! $numvraag; ($numant = "geen") if ! $numant; ($numcomm = "geen") if ! $numcomm; push (@numvraag, $numvraag); push (@numant, $numant); push (@numcomm, $numcomm); $overzicht .= "$htmlrubriek"; $numvraag = 0; $numant = 0; $numcomm = 0; } else { if ($niv == 2) { $numvraag++; } elsif ($niv == 3) { $numant++; } elsif ($niv > 3) { $numcomm++; } } } ($numvraag = "geen") if ! $numvraag; ($numant = "geen") if ! $numant; ($numcomm = "geen") if ! $numcomm; push (@numvraag, $numvraag); push (@numant, $numant); push (@numcomm, $numcomm); shift (@numvraag); shift (@numant); shift (@numcomm); } sub maak_rubriek { $htmlnieuwelijst = &readhtml ("nieuwelijst.htpl"); $htmlrubriekkop = &readhtml ("rubriekkop.htpl"); $htmlvraagkop = &readhtml ("vraagkop.htpl"); $htmloverigkop = &readhtml ("overigkop.htpl"); $htmleindelijst = &readhtml ("eindelijst.htpl"); $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $niveau = $$refniveau[0]; while (($niveau > 1) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $niveau = $$refniveau[0]; } @i = (($nummer-1)..($last-1)); @data = @$refdata[@i]; $refsubject = &get (["subject"], \@data, $grammar, ""); $refnaam = &get (["naam"], \@data, $grammar, ""); $refemail = &get (["email"], \@data, $grammar, ""); $refstamp = &get (["datum", "tijd"], \@data, $grammar, ""); $refniveau = &get (["niveau"], \@data, $grammar, ""); $refinhoud = &get (["inhoud"], \@data, $grammar, ""); foreach $reactieinhoud (@overiginhoud) { $reactieinhoud = substr($reactieinhoud, 0, 40)."..."; } $niv = 1; @i = ($nummer..$last); foreach $i (@i) { $subject = shift @$refsubject; $naam = shift @$refnaam; $email = shift @$refemail; $email =~ s#\@#\\\@#ig; $stamp = shift @$refstamp; $stamp =~ s/#/, /i; $oldniv = $niv; $niv = shift @$refniveau; $inhoud = shift @$refinhoud; if ($niv < $oldniv) { $j = $niv; while ($j < $oldniv) { $rubriektoc .= "$htmleindelijst"; $j++; } } if ($niv > $oldniv) { $j = $oldniv; while ($j < $niv) { $rubriektoc .= "$htmlnieuwelijst"; $j++; } } if ($niv == 1) { $rubrieklink = "$script+rubriek+$i"; $rubrieksubject = "\u$subject"; $rubrieknaam = "\u$naam"; $rubriekinhoud = "\u$inhoud"; } elsif ($niv == 2) { push (@vraaglink, "$script+vraag+$i"); push (@vraagnaam, "\u$naam"); push (@vraaginhoud, "\u$inhoud"); $rubriektoc .= "$htmlvraagkop"; } else { push (@overiglink, "$script+$i"); push (@overignaam, "\u$naam"); $inhoud = substr($inhoud, 0, 40)."..."; push (@overiginhoud, "\u$inhoud"); $rubriektoc .= "$htmloverigkop"; } } $rubriektoc .= "$htmleindelijst"; $rubriektoc .= "$htmleindelijst"; } sub maak_bericht { $htmlnieuwelijst = &readhtml ("nieuwelijst.htpl"); $htmloverigkop = &readhtml ("overigkop.htpl"); $htmleindelijst = &readhtml ("eindelijst.htpl"); $refsubject = &get (["subject"], [$$refdata[$nummer-1]], $grammar, ""); $refnaam = &get (["naam"], [$$refdata[$nummer-1]], $grammar, ""); $refemail = &get (["email"], [$$refdata[$nummer-1]], $grammar, ""); $refstamp = &get (["datum", "tijd"], [$$refdata[$nummer-1]], $grammar, ""); $refniveau = &get (["niveau"], [$$refdata[$nummer-1]], $grammar, ""); $refinhoud = &get (["inhoud"], [$$refdata[$nummer-1]], $grammar, ""); $subject = $$refsubject[0]; $naam = $$refnaam[0]; $email = $$refemail[0]; $stamp = $$refstamp[0]; $niveau = $$refniveau[0]; $inhoud = $$refinhoud[0]; $stamp =~ s/#/ /i; $email =~ s#\@#\\\@#ig; $reactielink = "$script+nieuw+".($niveau+1)."+$nummer"; ### de 'parent', voorganger ### $prev = $nummer-2; $refniveau = &get (["niveau"], [$$refdata[$prev]], $grammar, ""); $prevniveau = $$refniveau[0]; while (($prevniveau >= $niveau) && ($prev > 0)) { $prev--; $refniveau = &get (["niveau"], [$$refdata[$prev]], $grammar, ""); $prevniveau = $$refniveau[0]; } if ($prevniveau < $niveau) { if ($prevniveau == 1) { $voorgangerlink = "$script+rubriek+".($prev+1); } elsif ($prevniveau == 2) { $voorgangerlink = "$script+vraag+".($prev+1); } else { $voorgangerlink = "$script+".($prev+1); } } ### de reacties en het eerst volgende broertje of zusje ### if ($nummer <= @$refdata) { $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; while (($lastniveau > $niveau) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; } if ($lastniveau == $niveau) { if ($lastniveau == 1) { $volgendelink = "$script+rubriek+".($last+1); } elsif ($lastniveau == 2) { $volgendelink = "$script+vraag+".($last+1); } else { $volgendelink = "$script+".($last+1); } } if ($last > $nummer) { @reacties = @$refdata[$nummer..$last-1]; $refsubject = &get (["subject"], \@reacties, $grammar, ""); $refnaam = &get (["naam"], \@reacties, $grammar, ""); $refemail = &get (["email"], \@reacties, $grammar, ""); $refstamp = &get (["datum", "tijd"], \@reacties, $grammar, ""); $refniveau = &get (["niveau"], \@reacties, $grammar, ""); $refinhoud = &get (["inhoud"], \@reacties, $grammar, ""); @overigsubject = @$refsubject; @overignaam = @$refnaam; @overigemail = @$refemail; @overigstamp = @$refstamp; @overigniveau = @$refniveau; @overiginhoud = @$refinhoud; @i = (1..@$refdata); foreach $i (@i) { push (@overiglink, "$script+".($i+$nummer)); } foreach $reactiestamp (@overigstamp) { $reactiestamp =~ s/#/ /i; } foreach $reactieinhoud (@overiginhoud) { $reactieinhoud = substr($reactieinhoud, 0, 40)."..."; } foreach $reactieemail (@overigemail) { $reactieemail =~ s#\@#\\\@#ig; } $reacties = ""; $refniveau = &get (["niveau"], \@reacties, $grammar, ""); $niv = $niveau; foreach $reactieniveau (@overigniveau) { if ($niv < $reactieniveau) { while ($niv < $reactieniveau) { $reacties .= " "x($niv-$niveau+2)."$htmlnieuwelijst"; $niv++; } } elsif ($niv > $reactieniveau) { while ($niv > $reactieniveau) { $reacties .= " "x($niv-$niveau+1)."$htmleindelijst"; $niv--; } } $reacties .= " "x($niv-$niveau+1)."$htmloverigkop"; } while ($niv > $niveau) { $reacties .= " "x($niv-$niveau+1)."$htmleindelijst"; $niv--; } } } } sub voeg_nieuw_bericht_toe { %pairs = &parse_form (); $compleet = "true"; foreach $key (keys(%pairs)) { if (! $pairs{$key}) { $compleet = ""; #false } } $subject = $pairs{"subject"} if (exists ($pairs{"subject"})); $naam = $pairs{"naam"} if (exists ($pairs{"naam"})); $email = $pairs{"email"} if (exists ($pairs{"email"})); $datum = $pairs{"datum"} if (exists ($pairs{"datum"})); $tijd = $pairs{"tijd"} if (exists ($pairs{"tijd"})); $inhoud = $pairs{"inhoud"} if (exists ($pairs{"inhoud"})); if ($compleet) { $bericht[$$reforder{"subject"}] = $subject; $bericht[$$reforder{"naam"}] = $naam; $bericht[$$reforder{"email"}] = $email; $bericht[$$reforder{"datum"}] = $datum; $bericht[$$reforder{"tijd"}] = $tijd; $bericht[$$reforder{"niveau"}] = $niveau; $bericht[$$reforder{"inhoud"}] = "(new) ".$inhoud; $bericht = join($datasep, @bericht); if ($nummer >= @$refdata) { $refdata = [@$refdata, $bericht]; } else { $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; while (($lastniveau >= $niveau) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; } $nummer = $last if ($last > $nummer); $refdata = [@$refdata[0..($nummer-1)], $bericht, @$refdata[($nummer)..(@$refdata-1)]]; } &save_data ($datafile, $refdata, $refcommenteddata, ""); open (MAIL, "|/usr/ucb/mail -s 'IUPAC Forum: nieuw bericht' ".$contentcheckers) || die "$!"; print MAIL &expand ($nummer+1, $refdata, $grammar); close (MAIL); } return $compleet; } --- NEW FILE: nieuwelijst.htpl --- <UL> --- NEW FILE: overigkop.htpl --- <LI><A HREF="@overiglink">@overiginhoud</A> (@overignaam) --- NEW FILE: overzicht.htpl --- <H2 ALIGN=Center>Alle vragen over en reacties op de WOC-IUPAC site</H2> <UL> Kies een van de onderstaande rubrieken om antwoorden op je vraag te zoeken of vragen, antwoorden of commentaar toe te voegen: <P> <UL> $overzicht </UL> </UL> <H3 ALIGN=CENTER> [ <A HREF="$nieuwevraaglink">Nieuwe vraag of reactie</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: rubriek.htpl --- <A HREF="@rubrieklink"><FONT SIZE=+1><B>@subject</B></FONT></A> <I>(@numvraag vrg, @numant ant, @numcomm comm)</I> <P> @inhoud </P> --- NEW FILE: rubriekkop.htpl --- <P><FONT SIZE=+1><B>@rubrieksubject</B></FONT></P> --- NEW FILE: rubriektoc.htpl --- <H2 ALIGN=Center>$rubrieksubject</H2> <UL> $rubriekinhoud <P> <BR> Kies een van de onderstaande vragen of kies gelijk een van de antwoorden: $rubriektoc </UL> <BR> <H3 ALIGN=CENTER> [ <A HREF="$vraagtoevoeglink">Vraag of reactie toevoegen</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: toevoegform.htpl --- <CENTER> <BR><H1>$header</H1> <FORM METHOD=POST ACTION="$script+voegtoe+$niveau+$nummer"> <INPUT TYPE=Hidden NAME="datum" VALUE="$datum"> <INPUT TYPE=Hidden NAME="tijd" VALUE="$tijd"> <TABLE> <TR> <TD>Naam:</TD> <TD><INPUT TYPE=Text NAME="naam" SIZE=50 VALUE="$naam"></TD> </TR> <TR> <TD>E-Mail:</TD> <TD><INPUT TYPE=Text NAME="email" SIZE=50 VALUE="$email"></TD> </TR> <TR> <TD>Subject:</TD> <TD><INPUT TYPE=Text NAME="subject" SIZE=50 VALUE="$subject"></TD> </TR> <TR> <TD>Bericht:</TD> <TD><TextAREA COLS=50 ROWS=8 NAME="inhoud">$inhoud</TextAREA></TD> </TR> </TABLE> <INPUT TYPE=Submit VALUE="Voeg toe"> <INPUT TYPE=Reset VALUE="Opnieuw"> </FORM> </CENTER> --- NEW FILE: vraagkop.htpl --- <P> <LI><A HREF="@vraaglink"><B>@vraaginhoud</B></A> (@vraagnaam) <P> |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:49
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir/iupac-forum/iupac-forumdata In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir/iupac-forum/iupac-forumdata Added Files: iupac-forum.dat iupac-forum.grm iupac-forum.hlp Log Message: --- NEW FILE: iupac-forum.dat --- // subject#naam#email#datum#datum#tijd#niveau#inhoud Verbeteringen?#WOC-redactie#wo...@sc...#11 december 1998#00:00h#1#De WOC-redactie krijgt graag reacties over mogelijke verbeteringen. Met name docenten aan het middelbaar onderwijs worden uitgenodigd om commentaar te geven, omdat de redactie graag zou zien dat de WOC-IUPAC ook een goed leermiddel is om grote verbanden te zien. Verbeteringen?#Geert Josten#gj...@sc...#04-19-00#09:43h#2#(new) De IUPAC-Forum is vanaf heden on-line!<P>Wil echter iemand de tekst bij de rubrieken<BR>aanpassen? Daar klopt nog maar weinig van...<P>Geert Software#WOC-redactie#wo...@sc...#04-19-99#11:20h#1#In deze rubriek kunt U vragen stellen over de software die u kunt gebruiken voor en bij dit Woordenboek. Hier kunt u bijvoorbeeld vragen welke software u kunt gebruiken om de 3D structuren te bekijken. Wat is ... ?#WOC-redactie#wo...@sc...#04-19-99#11:20h#1#In deze rubriek kunt U vragen stellen over termen (behalve chemische verbindingen). Hoe werkt dit of waarmee kan ik dat? Wat is/doet deze chemische verbinding?#WOC-redactie#wo...@sc...#04-19-99#11:20h#1#In deze rubriek kunt U vragen stellen over chemische verbindingen. Ongerubriceerd#WOC-redactie#wo...@sc...#11 december 1998#12:00h#1#Hier kunt U uw vragen over de WOC-IUPAC kwijt, die niet in een van de drie hierboven genoemde passen. Vragen kunnen later per onderwerp gesorteerd worden. --- NEW FILE: iupac-forum.grm --- volgorde: 7 subject naam email datum tijd niveau inhoud verdeling: 5 0 1, 3, 4 2 6 5 weergave: 5 subject: naam : email : inhoud : niveau : --- NEW FILE: iupac-forum.hlp --- // $mode.hlp - bestand met alle help gegevens // // De regels beginnend met / zijn commentaar, extra commentaar alleen tussen de arrays en // minimaal een regel commentaar ertussen is essentieel. // De andere regels gaan twee aan twee, het eerste bevat het item, de tweede de beschrijving // zorg dat in ieder geval de items met spaties worden aangevuld tot de lengte van de langste // uit het deellijstje... // Lengte van de deellijstjes onbegrensd // commando help /// ident /// hieronder een overzicht van alle beschikbare commando's: help deze uitleg usage geeft overzicht alle mogelijke parameters ? geeft alle (on)mogelijke afkortingen find zoeken op gegevens show weergeven studentgegevens del verwijderen van studenten edit wijzigen studentgegevens filter selectief verwijderen studenten new toevoegen studenten unfilter wijzigingen vanaf laatste filter teniet doen read (opnieuw) inlezen studentgegevens save opslaan wijzigingen quit afsluiten editor probeer eens usage of ? EOH commando usage /// ident /// hieronder per commando de mogelijke parameters: help usage ? find <gegeven> <zoekstring> [..] show [(<nr> [..] | alles)] (default = huidige) del [<nr> [..]] (default = huidige) edit [<nr>] (default = huidige) filter <gegeven> <zoekstring> [..] new (student | jaar)", unfilter read [<bestand>] (default = $datafile) save [<bestand>] (default = $newdatafile) quit probeer eens ? EOH commando afkort /// ident /// de tekens binnen [] zijn overbodig: d[el] sa[ve] e[dit] s[how] fil[ter] us[age] f[ind] u[nfilter] h[elp] q[uit] n[ew] ? r[ead] EOH edit help /// ident /// kies een van de volgende items om deze te wijzigen: probeer eens ? EOH edit afkort /// ident /// de tekens binnen [] zijn overbodig: EOH |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:46
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir/editor In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir/editor Added Files: Editor Grammar.pm Help.pm INSTALL README conv conv_syntax dataConv.pm dataEdit.pm dataFunc.pm dataIO.pm Log Message: --- NEW FILE: Editor --- #!/usr/local/bin/perl -w #package editor; # Polymorphic-data editing utility by G.P.H. Josten June, 1998 # # This Perl package file contains general functions for showing, searching and # editing data which is held in the @database list-variable. This variable, held # in the main module, contains 'records' which are represented as single lines # by separating the values by some string defined in $separator. The order of # the data is defined in the hash-variable %order. This also names the fields of # the records. Representation on screen is further defined in two hash-variables. # The first called %distribution defines on what line each field of a record # should be shown by giving per line all indexes in the right order. The second # hash-variable called %keynames defines with what string each of those lines # is preceded. This grammar is defined in a separate text-file and is read by the # read_grammar sub-function in this module. # # Example: # # We have data that looks like: # # e-mail#last name#city#first name # # The separator will be the guard ('#'). Then order will be: # # %order = # ("email", 0, # "lastname", 1, # "city", 2, # "firstname", 3) # # Using this hash and identifiers like "city", you can find the index for city # on a line of your data (@database). Likewise you define %distribution and # %keynames: # # %distribution = # (0, "3, 1", # 1, "0", # 2, "2") # # %keynames = # (0, "name: ", # 1, "mail: ", # 2, "city: ") # # This shows that each record will be shown on screen in three lines. The first # showing the name of a person, the second his or her e-mail address and the # third and last the city where he or she comes from. As can be seen from the # distribution hash-variable, the first line (indexed with 0) shows field three # first, followed by field one. So first the first name, then the last name. # # Note: # this is not the way you should put it in a grammar file. To make it easy for # you, you don't have to index the lines explicitely. This is automatically # derived from the precedence in the file. For the given example the file would # look like: # # dataseparator: # # # fieldseparator: # , # order: 4 # email # lastname # city # firstname # distribution: 3 # 3, 1 # 0 # 2 # keynames: 3 # name: # mail: # city: # # The string on the line below dataseparator is the separator for the fields # of one line of the database hash-variable. fieldseparator is used when # multiple fields are to be shown on one line on the screen, like first and # last name in the exaple. # # Final note: # this grammar file is quite spaces sensitive, so placing a space before or # behind a keyname will output one!! Moreover, spaces on the line below # dataseparator will require them exactly as separator of your fields in # the database... # #use strict; use dataConv; use dataEdit; use dataFunc; use dataIO; use Grammar; use Help; # # The single argument denotes what is to be processed. It is a string # with which the filenames are determined (just addition of .dat .grm # .hlp and .new). # my ($mode, $current); if (@ARGV) { $mode = $ARGV[0]; } else { $mode = "smoel"; } my ($datafile) = $mode."data/$mode.dat"; my ($grammarfile) = $mode."data/$mode.grm"; $script = $0; $script =~ s#.*\/##i; my ($defhelpfile) = "$script.hlp"; my ($helpfile) = $mode."data/$mode.hlp"; my ($newdatafile) = $mode."data/$mode.new"; #$dataseparator = "#"; #$fieldseparator = ", "; #$sep = "#";#old version #$expsep = ", ";#old version ## main ## print "$0 - \u$mode","Source Editor v2.0, Geert Josten, June 1998$/$/"; print "Reading data-grammar$/"; (*grammar) = &read_grammar ($grammarfile); print "Reading database$/"; (*database, *commented_data) = &read_data ($datafile, "verbose"); print "Reading default help texts$/"; (*help) = &read_help ($defhelpfile, \@grammar, $datafile, $newdatafile); if (-r $helpfile) { print "Reading additional help texts$/"; (*addhelp) = &read_help ($helpfile, \@grammar, $datafile, $newdatafile); %help = (%help, %addhelp); } print $/; #@oldstuds = @studenten; $current = 1; &show ([$current], \@database, \@grammar); print "\thelp\tgeeft beschrijving commando's$/$/"; &editor; print "Tot ziens!$/$/"; sub testje { return @_; } sub editor { local ($quit) = ""; #false local ($commando, @args); do { do { print "[$current] commando? "; chomp ($commando = <STDIN>); } until ($commando); @args = split (/ /, $commando); $commando = $args[0]; shift (@args); if ($commando =~ /^d/i) { # del @args = ($current) if (! @args); (*database) = &del (\@args, \@database, \@grammar, "verbose"); $current = 1; } elsif ($commando =~ /^e/i) { # edit @args = ($current) if (! @args); if ($args[0] =~ /\b\d+\b/) { &edit ($args[0], \@database, \@grammar, \%help); $current = $args[0]; } } elsif ($commando =~ /^fil/i) { # filter if (@args == 0) { &help (\%help, \@grammar, "search", "help"); } elsif ((@args % 2) == 0) { (*database) = &filter (\@args, \@database, \@grammar, "verbose"); $current = 1; } else { print "filter heeft een even aantal parameters nodig!$/"; } } elsif ($commando =~ /^f/i) { # find if (@args == 0) { &help (\%help, \@grammar, "search", "help"); } elsif ((@args % 2) == 0) { (*args) = &find (\@args, \@database, \@grammar, "verbose"); if (@args) { &show (\@args, \@database, \@grammar); print "gevonden: ", join (",", @args), $/; $current = $args[$#args]; } } else { print "find heeft een even aantal parameters nodig!$/"; } } elsif ($commando =~ /^h/i) { # help &help (\%help, \@grammar, "commando", "help"); } elsif ($commando =~ /^n/i) { # new $last = @database; (*database) = &new_record (\@database, \@grammar, \%help); $current = @database if ($last < @database); } elsif ($commando =~ /^r/i) { # read @args = ($datafile) if (! @args); (*database) = &read_data ($args[0], "verbose"); $current = 1; } elsif ($commando =~ /^sa/i) { # save @args = ($newdatafile) if (! @args); &save_data ($args[0], \@database, \@commented_data, "verbose"); } elsif ($commando =~ /^so/i) { # sort (*database) = &sort_data (\@database, "verbose"); $current = 1; } elsif ($commando =~ /^s/i) { # show @args = ($current) if (! @args); &show (\@args, \@database, \@grammar); $current = $args[0] if ($args[0] =~ /\b\d+\b/); } elsif ($commando =~ /^us/i) { # usage &help (\%help, \@grammar, "commando", "usage"); } elsif ($commando =~ /^u/i) { # unfilter # &unfilter (@args); print "niet beschikbaar$/"; } elsif ($commando =~ /^q/i) { # quit $quit = "true"; } elsif ($commando =~ /^\?/i) { # ? &help (\%help, \@grammar, "commando", "afkort"); } else { print "onbekend commando!$/"; } } until ($quit); } --- NEW FILE: Grammar.pm --- package Grammar; # Polymorphic-data-grammar reading by G.P.H. Josten June, 1998 # # This package contains the function to extract the data-grammar from a file. # use strict; require Exporter; @Grammar::ISA = qw(Exporter); @Grammar::EXPORT = qw(read_grammar); sub read_grammar ($) { # # read in the grammar of the data from a grammar file # # PRE: $source contains name of grammar file # POST: %order, %distribution and %keynames contain the information # necessary to retrieve fields from the data and show them on screen my ($source) = @_; my (%order, %distribution, %keynames, $regel, @regel, @lijst, $i); my ($dataseparator) = "#"; my ($fieldseparator) = ", "; open (SOURCE, $source) || die $!; # # first read the order into %order: # defined ($regel = <SOURCE>) || die $!; @regel = split (" ", $regel); $i=0; @lijst = (); while ($i < $regel[1] && defined ($regel = <SOURCE>)) { chomp($regel); push (@lijst, $regel, $i); $i++; } %order = @lijst; # # second the distribution along multiple lines: # defined ($regel = <SOURCE>) || die $!; @regel = split (" ", $regel); $i=0; @lijst = (); while ($i < $regel[1] && defined ($regel = <SOURCE>)) { chomp($regel); push (@lijst, $i, $regel); $i++; } %distribution = @lijst; # # last the names to show in front of each line: # defined ($regel = <SOURCE>) || die $!; @regel = split (" ", $regel); $i=0; @lijst = (); while ($i < $regel[1] && defined ($regel = <SOURCE>)) { chomp($regel); push (@lijst, $i, $regel); $i++; } push (@lijst, "comment", "/"); %keynames = @lijst; close (SOURCE) || die $!; # return the references only!! return [\%order, \%distribution, \%keynames, $dataseparator, $fieldseparator]; } --- NEW FILE: Help.pm --- package Help; # Help-interface command and edit help by G.P.H. Josten June, 1998 # # This package contains functions to open the help-files, get the help texts and # print the appropriate help on request. # use strict; require Exporter; @Help::ISA = qw(Exporter); @Help::EXPORT = qw(help read_help); sub help ($$$$) { # # show the requested help # # PRE: $refhelp is a reference to a double hash table which is # indexed with $function and $sublevel; $grammar is used to # extract the help text from the single line format my ($refhelp, $grammar, $function, $sublevel) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (@help); @help = split (/$datasep/, $$refhelp{$function}{$sublevel}); while (@help) { print shift (@help), "\t", shift (@help), $/; } print $/; } sub read_help ($$$$) { # # read in the help from a file # # PRE: $helpfile contains the name of the file to read, $grammar # some information for parsing the file and $datafile and # $newdatafile are used to substitute pseudo-variables with # actual values # POST: result is a reference to a double hash table with the help # texts compressed to single line format using $datasep from # $grammar my ($helpfile, $grammar, $datafile, $newdatafile) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my ($function, $sublevel, $regel, @help, %help); open (SOURCE, $helpfile) || die $!; # skip comment while (defined ($regel = <SOURCE>) && ($regel =~ /^$$refkeys{"comment"}/)) { } if (defined ($regel)) { do { chomp ($regel); ($function, $sublevel) = split (/\s/, $regel); while (defined ($regel = <SOURCE>) && ($regel !~ /^EOH/)) { chomp ($regel); $regel =~ s/\$datafile/$datafile/ig; $regel =~ s/\$newdatafile/$newdatafile/ig; push (@help, $regel); } $regel = join ($datasep, @help); $help{$function}{$sublevel} = $regel; @help = (); } while (defined ($regel = <SOURCE>)); } close (SOURCE) || die $!; return (\%help); } --- NEW FILE: INSTALL --- Editor Editor is a script to read, manipulate, search and save data. It is meant to be self-explanatory, so for the usage I refer to the program. Requirement on the data is, that it contains on each line one 'record' of which all have have an equal number of fields. The length may range from zero to some physical limit. Each field on such a line is separated from the others by some unique string (at the moment simply a guard '#'!). The order of the fields should be the same on all lines and this should be described in a separate file called the grammar file. If not all these, the program may get confused from time to time. System Requirements -Perl 5 should do, I guess. I used the script with versions 5.003 and 5.004. Perl 4 doesn't support certain constructs, but converting all my's to local's might make the script work under Perl 4 as well. -Although I mostly worked on a Unix environment (SunOS 4 and 5.3), it should work similarly on DOS, although you will probably have to do without long filenames. -Memory usage and file space aren't very relevant, although editing many megabytes of data might get you into trouble. There are no mem-checks for this script is probably far from efficient enough to edit that large quantaties. Installation The installation is fairly simple, but manual: -Copy the following files to some nice directory: Editor The main script Editor.hlp Standard help texts INSTALL This file README Text file with additional information about Editor Grammar.pm Module for reading and using the grammar of the data Help.pm Module for initialising and using the help functions dataConv.pm Module for conversion from record to basic representation dataFunc.pm Module for searching and filtering records dataEdit.pm Module for editing records dataIO.pm Module for reading, saving and printing data exampledata/ dir with example data exampledata/example.dat example data file exampledata/example.grm grammar file of example data exampledata/example.hlp additional help file for example data -All you need now is some data and its grammar. Some additional help could be useful too. Editor takes one argument and it uses it to identify what datafile you want to read, search and edit and where it can find it. This first argument is just a keyword. Editor takes this keyword and appends data. This identifies the subdirectory where the data file and the grammar file should be located. Editor then takes the keyword and appends .dat .grm and .hlp for respectively the data, the grammar and the additional help file. Look at the example data for how these three files are constructed... -A last hint: it is most convenient to put the Editor script and its modules somewhere in a bin (subdir editor orso) and make symbolic links to the datadirectories you want to be able to edit. You could even put handy scripts right next to the data, which changes the directory to the one that contains the Editor script and then executes Editor with the right keyword. Note: don't call that script edit, for that is probably an already existing command. Geert August, 1998 --- NEW FILE: README --- August 5th, 1998 Why Htplp and Editor Htplp and Editor are two Perl-scripts which were written to resolve problems concerning the representation of large quantities of data on WWW as HTML. Htplp is the Parser which generates the pages, Editor is the utility to edit the data. Where it all started The parent problem was a small already existing site of the student association V.V.C.N. Sigma (http://www.sci.kun.nl/sigma/) which contained almost all pictures of the Chemistry students at the University of Nijmegen (most of them member of Sigma). Each year new students arrived and the pages had to be updated (each year of students meant three pages of each a number of kilobytes). I took that job on me (don't ask me why, I can't remember) and did this for one new year of students. My conclusion was that it was an unflexible, easily out-of-date and time consuming way. Everything had to be done manually. Especially when I (yes, one of those great ideas to do some self-torture) came to the idea to improve the layout by using multi-column layout for the pictures, I got tired of it. With some cut and paste it could be done, but it was boring and specially suited for computers to do it for you. The first monster The problems weren't very important, as the pages didn't needed to be very up-to-date. Nevertheless, it is a good visit card to do have a site with accurate and usable information. Besides, it was an interesting challenge which could make things easy in future. With my fresh knowledge of Java ("C1", the introductory course to programming - in Java :-( - was one of the obligatory courses), I set off to build a database and an engine that could read the data and generate the pages for me. An immense monster resulted. It worked, but it was ill-programmed and unreadable, only I worked with it - with reason I presume :-P -, and most of all, it was unflexible and still unmaintainable. But, a database was generated, one of the biggest benefits, and the page generation was automated. The engines most worth, it proved to me with it's first use outside it's original purpose, a use for like-wise layout, not for WWW but for a booklet with information about Sigma. I used this monster more than a year I believe, it has shown it's purpose, but now fortunately it's obsolete. The data The data which was held by a number of files, had to be created and maintained. This was a second problem, because using a text-editor isn't the best way, for mistakes are very easily made. Leaving some special symbol out meant that half the data of one year wasn't read, but skipped. Searching these files and extracting the useful information was another problem. Busy with the data - I was probably adding a new year or updating some names - I came to the idea of writing an editor. Actually, the idea originated because I wanted to facilitate the extraction of information. I was busy typing all fields that represented a single student. Life happened to let me stumble over Perl, I was interested and asked a 'colleague' student - he studied Informatics, I Chemistry at that time, Informatical Chemistry presently - for some advise about books about Perl. I bought to his advice two and with "Learning Perl" in one hand and the data files in the other, I tried to get a better and moreover faster extraction going. But using Unix shell-script (find, grep, sort, etc.) and Unix shell commands within Perl scripts didn't work and typing all information didn't facilitate it very much either this way. Well, why not read it in with Perl, put it in some variables, let Perl do some sorting and voila, my first real useful Perl-script was born. But with that it didn't stop. Hacking around in Perl, I wrote not only a search utility, but also some conversion utilities and another page generating script. But again, they were ill-programmed, hardly better readable, still only I (could) work(ed) with them and they still didn't show very much flexibility. The data improved though, for I typed all data, got some real regularity in it and got fresh ideas about how to better deal with it. The new approach I realised that the power of Perl could be far better utilised for this matter than I did. I hardly did, so that isn't much of a surprise. One benefit of Perl is, that normally it doesn't make a difference between words and numbers. I mean that in Perl for example not only numbers could be used to index in an array of items, but words as well. The Perl hash-variable the best example of this power of Perl in which one value is used to extract another, one to one. Not vice versa by the way. My fantasy got almost wild with the only enlarging space in which I could invent options and ideas and problems and solutions. Meanwhile, I had been busy with some funny command interpreting script which could represent the fields of data of one student in some basic way, could edit them as well and after some trouble, could even search the big lot. Discovering more and more about Perl, I started extracting more and more of the determining values and putting them into handy variables I could initialize at start and manipulated mid-way if necessary. This process resulted in a separate file which contained the full typing of the data and even the representation in the basic way. This information is read in and put in a few variables. In the rest of the script only these variables are used and not their actual value. Comparing with the actual values of these typing variables is only done with user input!! This process plus the ability of recognizing shortened versions of the actual values made the Editor very powerful. The Editor evolved I continued this work and started working on a profound way. I grouped certain functions and made them complete and robust. Most of them had to be converted to my new ideas and this allowed me to reconsider the solutions and improve them to their present state. This makes the Editor a full grown script, with fairly balanced functions and a quite user-friendly user-interface. I already had build an almost complete version of the Editor which I had subjected to some beta-testing (another colleague student :-). The new version could be tested back to back with this one and most testing did I do between all the other programming activities (hint: try to always test an earlier programmed part before you need to use it!). And still my knowledge about Perl is increasing, but the usefulness has converged about now - after building Htplp and Editor -. The data structuring The data had changed a lot in the meantime. First more regularity, second the typing and third cenversion. Conversion from the multi-line format (quite similar to the basic representation) to a single line one. The first two steps had been time consuming and text editor usage intensive, but are worth it now. The integrity of the data has very much increased as well as the managebility, editibility and usability. It also allowed me to experiment a little with how to structure the data. This has resulted in the separate file with the typing and the single-line format, with all fields of data of one student on a single line. This was done deliberately with several thoughts, no particular order, in my mind. Difficult to handle are fields of data of undefined number of lines. As linefeeds and carriage returns are of no use in HTML (it's just treated as whitespace) it was the first I got rid of. I stuffed everything on a single line and separated it by some specific string. At the moment I have chosen for a single character, the guard '#'. In near future the choice will be put in the typing file as well. I call these typing information together the grammar of the data, just to give it a name. Putting everything on a single line, makes the data easily manageble by using a simple array. This can even be sorted without any special work (one single command). Using the Perl functions split and join, the fields can be separated and glued together (single lines again). With the grammar of the data you can find out where a certain field remains and this can be use to extract, compare, manipulate and store the value if wanted. It may sound a bit difficult but it is just short and highly generic all at the same time, flexible at last and powerful indeed. It's real power became clear to me when I tried the Editor on a different data-file. It took two minutes to define a grammar and invent four lines of data. I ran the Editor and it just worked! It really worked!! Not a single change to the Editor was necessary, only the grammar and the data. I had underestimated my own abilities and the power of Perl. What followed With building this Editor which needs only some final commenting, addition of one or two extra functions and documentation on usage and maintenance, I created a profound basis of functions I saw I could use for the parent problem where I started my story. I had deliberately put all the Editor functions grouped in separate files, which could be used as nicely shielded modules. You only need to call the Perl function use and the functions are all yours. I had data, I had grammar and I had a whole bunch of functions, all tested and commented too. I took the page generating script in Perl in front of me and almost paniced in horror. It was awfull, HTML and Perl stood right next to each other, it was one big mess and in this script I had used old copies of the functions I had nicely defined in modules now. To get this readable, I had to get rid of the HTML between the Perl in some or the other way. By this time, I happened to look in some existing Perl script which gives some statistics, but more important, it read a plain text file in and substituted variables it contained (just a dollar sign '$' followed by an identifier). Interesting!! I though and once more I set off. But hey, I might could do better, I might be able to write some script which not only reads in those plain text files and substitutes some variables, but do this for any file, identified by some argument or so. Not a bad idea, I thought, so I hacked a bit in Perl, read in a file and substituted variables and produced the result. Hmm, well, I had to do a lot more if I wanted ever to produce the picture pages of Sigma. It is a tree-like structure with a lot of hyperlink refering to each other. Besides I had to process a lot of information if necessary. But, no worry, I thought, let the parser recognize filenames as variables as well (just dollar sign '$' plus filename) and process these too, Perl scripts as well. So I did, but being busy and stumbling over several difficulties one becomes wiser and wiser. The Htpl parser After lots and lots of trial-and-error activities (regular expressions are very, very, very flexible in Perl :-P), this resulted in Htplp. The name is derived from HTml and PerL Parser, which is not completely accurate, but it will do. This script, or parser if you like to call it that way, starts with reading one argument. This argument determines what site it should parse and generate. From this argument some basic files are derived, a.o. the grammar file, the data file, the main Perl script needed too beside the parsing script and the main text file. The grammar and data are read, some default variables are set and next the main Perl script is executed. Actually, it is the only Perl script that is necessary for that particular site. This script is supposed to do something useful to every remaining argument the parser script received at start. With these arguments the script is given the opportunity to initialize, process and destroy variables which, and this is the trick, are automatically acessible from within the parsing script (they are just global variables, so it's no fancy trick at all and note that the parser script's variables are global too!!). Then the main text file is read in and the real parsing commences. This parsing is no real big deal, although it cost me a lot of fine tuning to get it working. How the parsing works This parsing means only that the parser tries to find a few posibilities and process accordingly. First, the parser could find the word "if" somewhere. If this "if" is followed by a variable ($varname), then it will try to determine wether this variable exists or not, if so, the following part remains, otherwise it is deleted. If it is followed in the same line by the word "fi", then everything in between might survive or not. No "fi", then if the variable isn't set by that site-specific script, than the full line is deleted. The if .. fi construction may be put halfway a line, if .... construction must commence at the beginning of a line. In both if constructions the variable may be directly preceded by an exclamation mark '!', which negates the required existence of the following variable. Other constructs are as mentioned previously, filenames ($filename), with the only restriction that the filename must end with dot plus "htpl" ("$filenaam.htpl"). This is merely a handy choice which I'm not about to change. Final possibilities are just variable substitutions, scalar variables ($varname) and array variables (@varname) as well. Scalar variables are just substituted by their content. Array variables are a bit trickier. I programmed the parser in such a way that it pops the first value (The Perl function shift), which is lost that way. I found it necessary to build in a last option, to not pop that first value, but look at it and possibly use it once again. For this, put a exclamation mark '!' directly behind the @ in @varname (e.g. @!varname). This ought to do the trick :-). After each substitution in a line, the parser tries again, untill it fully fails, then it produces that line. Going over each line exhaustively allows to parse highly nested structures as well (variable names in variable names in variable names in a filename in an array variable in an variable name in an if evaluation in...). This may sound like a lot of work, but Perl manages to do this for a small but difficult page, within 10 seconds (at our server at least, which is not the slowest around). Especially the variable substitutions, which are often the far most done, influence this time greatly. Try to keep the actions as minimal as possible, by presubstituting all those values if possible. This doesn't have to be done exhaustively, the script is fast enough (Perl is compiled before execution!!). If it takes too long, your page might be just too long or perhaps, the server is slow in executing scripts... Finally I hope that this Editor and Htpl Parser may find a lot of future applications and not only done by me. I build these to give them through to future members of the Internetcommittee of V.V.C.N. Sigma. For as long as I will still be around I will try to do some final modifications in order to make those future applications even more possible. Let me note, that the Editor script or some text file nearby that script will contain a more extensive explenation of the use of the grammar. The Editor itself contains a help function which should explain the Editor functions at least a little. The error messages should do the rest, I hope. Htplp should be installed by somebody with at least some Perl experience and he or she could take care of the main site scripts if they are needed. Any layouting can be done by somebody else, like some HTML wizard or so. Minimal knowledge of how to call the script with the right arguments and what variables are available in which situation is necessary though. A documenting file would be very helpfull I suppose. And now the really, really final note: I called the Parser HTml and PerL Parser, but, actually, the HTML part doesn't have to be HTML at all, anything based on plain text could do. LaTeX for example too. May you all have a pleasent exercise of mind with scripts, may they enlighten your life, may they relieve you of a lot of trouble and sorrow and sweat and pain. If they don't, I suggest: R.T.F.M.!!!!!!!! Signed, WoodWorm alias G.P.H. Josten student Informatical Chemistry at the University of Nijmegen member of student association Sigma at Nijmegen member of the internetcommittee of Sigma --- NEW FILE: conv --- #!/usr/local/bin/perl -w use strict; my ($SmoelenSource, $SortedSmoelen, $AccessSmoelen); $SmoelenSource = ($ARGV[0] || "SmoelenSource.Sm"); $SortedSmoelen = ($ARGV[2] || "SmoelenSource.sorted"); $AccessSmoelen = ($ARGV[1] || "SmoelenSource"); print "controleer $SmoelenSource:\n"; &controleer ($SmoelenSource); print "converteer $SmoelenSource naar $AccessSmoelen\n"; &Sm2Acc ($SmoelenSource, $AccessSmoelen); #print "controleer $SmoelenSource:\n"; #&controleer ($SmoelenSource); #print "sorteer $SmoelenSource tot $SortedSmoelen\n"; #&sorteer ($SmoelenSource, $SortedSmoelen); #print "controleer $SmoelenSource:\n"; #&controleer ($SmoelenSource); #print "controleer $SortedSmoelen:\n"; #&controleer ($SortedSmoelen); sub sorteer { my ($source, $target) = @_; my ($temp, $temp2); $temp = "/tmp/SPE.gjosten.presort.tmp"; $temp2 = "/tmp/SPE.gjosten.postsort.tmp"; &Sm2Acc ($source, $temp); !system ("sort $temp > $temp2") || die ("SPE kan sort niet aanroepen: $!"); &Acc2Sm ($temp2, $target); } sub Sm2Acc { my ($source, $target) = @_; my ($tabelregel, @tabelregels, $status, $voornaam, $achternaam, $spreuk, $anker, $plaatje, $i); my ($jaar, $stdnr, $email); open (SOURCE, $source) || die ("SPE kan $source niet openen: $!"); while (defined ($status = <SOURCE>)) { chomp ($status); while ($status =~ /^\/.*/) { #commentaar overslaan defined ($status = <SOURCE>) || die ("Onverwacht einde van $source: $!"); } defined ($voornaam = <SOURCE>) || die ("Onverwacht einde van $source: $!"); defined ($achternaam = <SOURCE>) || die ("Onverwacht einde van $source: $!"); defined ($spreuk = <SOURCE>) || die ("Onverwacht einde van $source: $!"); defined ($anker = <SOURCE>) || die ("Onverwacht einde van $source: $!"); defined ($plaatje = <SOURCE>) || die ("Onverwacht einde van $source: $!"); chomp ($status); $jaar = substr ($status, 1, 2); $stdnr = substr ($status, 4, 7); $status = substr ($status, 12); chomp ($voornaam); $voornaam = substr ($voornaam, 1); chomp ($achternaam); chomp ($spreuk); $spreuk = substr ($spreuk, 1); chomp ($anker); $anker = substr ($anker, 1); (($anker =~ /^@/i) && ($email = substr ($anker, 1))) || ($email = ""); chomp ($plaatje); ($plaatje =~ /stimpy\.gif/i) && ($plaatje = "stimpy.gif"); $tabelregels[@tabelregels] = join ("#", $jaar, $achternaam, $voornaam, $stdnr, $status, $spreuk, $anker, $email, $plaatje); } close (SOURCE) || die ("SPE kan $source niet sluiten: $!"); open (TARGET, ">$target") || die ("SPE kan $target niet openen: $!"); select (TARGET); for ($i = 0; $i < @tabelregels; $i++) { print ($tabelregels[$i]."\n") || die ("SPE kan gegevens niet naar $target schrijven: $!"); } select (STDOUT); close (TARGET) || die ("SPE kan $target niet sluiten: $!"); } sub Acc2Sm { my ($source, $target) = @_; my ($tabelregel, @tabelregels, $gegeven, $status, $voornaam, $achternaam, $spreuk, $anker, $plaatje, $i); open (SOURCE, $source) || die ("SPE kan $source niet openen: $!"); while (defined ($tabelregel = <SOURCE>)) { chomp ($tabelregel); $tabelregels[@tabelregels] = $tabelregel; } close (SOURCE) || die ("SPE kan $source niet sluiten: $!"); open (TARGET, ">$target") || die ("SPE kan $target niet openen: $!"); select (TARGET); print ("///// $target /////\n") || die ("SPE kan gegevens niet naar $target schrijven: $!"); for ($i = 0; $i < @tabelregels; $i++) { ($achternaam, $voornaam, $status, $spreuk, $anker, $plaatje) = split ("\\\\\\\\", $tabelregels[$i]); foreach $gegeven ("/// ".($i+1)." ///", $status, $voornaam, $achternaam, $spreuk, $anker, $plaatje) { (print $gegeven."\n") || die ("SPE kan gegevens niet naar $target schrijven: $!"); } } select (STDOUT); close (TARGET) || die ("SPE kan $target niet sluiten: $!"); } sub controleer { my ($source) = @_; my ($status, $voornaam, $achternaam, $spreuk, $anker, $plaatje, $regelnr, $prev, $next); open (SOURCE, $source) || die ("SPE kan $source niet openen: $!"); $regelnr = 0; while (defined ($status = <SOURCE>)) { $regelnr++; chomp ($status); while ($status =~ /^\/.*/) { #commentaar overslaan $prev = $status; $regelnr++; defined ($status = <SOURCE>) || die ("Onverwacht einde van $source regelnr $regelnr: $!"); chomp ($status); } if ($status =~ /^:..:.......:.*/) { #mooi! $regelnr++; defined ($voornaam = <SOURCE>) || die ("Onverwacht einde van $source $regelnr: $!"); chomp ($voornaam); }# else { #probeer resynchronisatie # if ($prev =~ /^:..:.......:.*/) { # print ("SPE $source: STAPJE TERUG"); # $status = $prev; # $voornaam = $status; # } else { # $regelnr++; # defined ($next = <SOURCE>) || die ("Onverwacht einde van $source $regelnr: $!"); # chomp ($next); # if ($next =~ /^:..:.......:.*/) { # print ("SPE $source: STAPJE NAAR VOREN"); # $status = $next; # $regelnr++; # defined ($voornaam = <SOURCE>) || die ("Onverwacht einde van $source $regelnr: $!"); # chomp ($voornaam); # } else { # print ("SPE $source: RESYNCHRONISATIE MISLUKT"); # print ("SPE $source: status syntaxfout op $regelnr\n"); # $voornaam = $next; # } # } # } $voornaam =~ /^~.*/ || print ("SPE $source: voornaam syntaxfout op $regelnr\n"); $regelnr++; defined ($achternaam = <SOURCE>) || die ("Onverwacht einde van $source $regelnr: $!"); $regelnr++; defined ($spreuk = <SOURCE>) || die ("Onverwacht einde van $source $regelnr: $!"); chomp ($spreuk); $spreuk =~ /^\#.*/ || print ("SPE $source: spreuk syntaxfout op $regelnr\n"); $regelnr++; defined ($anker = <SOURCE>) || die ("Onverwacht einde van $source $regelnr: $!"); chomp ($anker); $anker =~ /^\@.*/ || print ("SPE $source: anker syntaxfout op $regelnr\n"); $regelnr++; defined ($plaatje = <SOURCE>) || die ("Onverwacht einde van $source $regelnr: $!"); chomp ($plaatje); $plaatje =~ /^.*\.(gif|jpg).*/ || print ("SPE $source: status syntaxfout op $regelnr\n"); $prev = $plaatje; } close (SOURCE) || die ("SPE kan $source niet sluiten: $!"); } --- NEW FILE: conv_syntax --- #!/usr/local/bin/perl -w my ($source, $target) = ($ARGV[0], $ARGV[1]); my ($tabelregel, @tabelregels, $status, $voornaam, $achternaam, $spreuk, $anker, $plaatje, $i); $i = 0; open (SOURCE, $source) || die ("SPE kan $source niet openen: $!"); open (TARGET, ">$target") || die ("SPE kan $target niet openen: $!"); while (defined ($status = <SOURCE>)) { $i++; chomp ($status); while ($status =~ /^\/.*/) { #commentaar overslaan defined ($status = <SOURCE>) || die ("Onverwacht einde van $source: $!"); } defined ($voornaam = <SOURCE>) || die ("Onverwacht einde van $source: $!"); defined ($achternaam = <SOURCE>) || die ("Onverwacht einde van $source: $!"); defined ($spreuk = <SOURCE>) || die ("Onverwacht einde van $source: $!"); defined ($anker = <SOURCE>) || die ("Onverwacht einde van $source: $!"); defined ($plaatje = <SOURCE>) || die ("Onverwacht einde van $source: $!"); $status =~ s/^://; $status =~ s/:[^0-9]{7}:/,, /; $status =~ s/:/, /; $status =~ s/:/, /; chomp ($achternaam); $voornaam =~ s/^~//; $spreuk =~ s/^#//; $anker =~ s/^@//; print STDOUT "/// $i ///$/cd: ${status}nm: $achternaam, ${voornaam}sp: ${spreuk}an: ${anker}ft: $plaatje$/" || die ("SPE kan gegevens niet naar $target schrijven: $!"); } close (SOURCE) || die ("SPE kan $source niet sluiten: $!"); close (TARGET) || die ("SPE kan $target niet sluiten: $!"); --- NEW FILE: dataConv.pm --- package dataConv; # Polymorphic-data convert and show by G.P.H. Josten June, 1998 # # This package contains functions convert some database data from single line # format to multiple line format and show it this way on screen. # use strict; require Exporter; @dataConv::ISA = qw(Exporter); @dataConv::EXPORT = qw(compress expand show); sub by_number { # # function used by sort to sort numerical instead of alphanumerical # if ($a < $b) { return -1; } elsif ($b < $a) { return 1; } else { return 0; } } sub compress ($$) { # # compress data fields from over multi lines onto single lines # # PRE: $refdata, a reference to the data in multiline format to be # compressed, $reforder, $refdistr and $refkeys, references to # the hash variables that define how to translate from multi to # single line and $datasep and $fieldsep the strings that # separate the fields in the single resp. multi line format # POST: the data in single line format my ($refdata, $grammar) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (@result, $num_lines, $line, $i, @pos, @gegevens); $num_lines = scalar (keys (%$refdistr)); while (@$refdata) { do { $line = shift (@$refdata); } while ($line =~ /$$refkeys{"comment"}/i); for ($i = 0; $i < $num_lines; $i++) { $line =~ tr/^$$refkeys{$i}//; @pos = split(/$fieldsep/, $$refdistr{$i}); @gegevens[@pos] = split(/$fieldsep/, $line); } shift (@$refdata); # empty line push (@result, join ("$datasep", @gegevens)); } return \@result; } sub expand ($$$) { # # expand one single line of data to multiline format # # PRE: $refdata, a reference to the data in single line format from # which one record is to be expanded; $reforder, $refdistr and # $refkeys, references to the hash variables that define how to # translate from single to multi line format and $datasep and # $fieldsep the strings that separate the fields in the single # resp. multi line format # POST: one data record in multi line format my ($index, $refdata, $grammar) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (@data, @result, @lines, @fields) = ((), (), (), ()); my ($line); # show each of the list by expanding them one by one @data = split (/$datasep/, $$refdata[$index-1]); @lines = (0..(scalar (keys (%$refdistr)) - 1)); # add numbering of output push (@result, "/// ".$index." ///$/"); # add each line with the apropriate datafields foreach (@lines) { # which fields? @fields = split(/$fieldsep/, $$refdistr{$_}); # add line identifying string $line = $$refkeys{$_}; # add the fields $line .= join ("$fieldsep", @data[@fields]); push (@result, "$line$/"); } return @result; } sub show ($$$) { # # show a given number of record from the data # # PRE: $reflist, a reference to a list with all indices to the records # from the data to be shown; # $refdata, a reference to the data in single line format from # which one record is to be expanded; $reforder, $refdistr and # $refkeys, references to the hash variables that define how to # translate from single to multi line format and $datasep and # $fieldsep the strings that separate the fields in the single # resp. multi line format my ($reflist, $refdata, $grammar) = @_; my (@listtoshow) = @$reflist; # got a number? if (@listtoshow) { # show all? if ($listtoshow[0] =~ /^all/i) { @listtoshow = (1..@$refdata); } else { # else sort the received list @listtoshow = (sort by_number (@$reflist)); } # show each of the list by expanding them one by one foreach (@listtoshow) { print &expand ($_, $refdata, $grammar), $/; } } } --- NEW FILE: dataEdit.pm --- package dataEdit; # Polymorphic-data edit by G.P.H. Josten June, 1998 # # This package contains the function to access your data (@database) and # change any value you like. Includes help handling. # use strict; require Exporter; @dataEdit::ISA = qw(Exporter); @dataEdit::EXPORT = qw(edit); use dataConv; use Help; sub edit ($$$$) { # # show data and provide an interface to edit all fields # # PRE: # my ($nr, $refdata, $grammar, $refhelp) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (@gegevens) = split (/$datasep/, $$refdata[$nr-1]); my (@args, $gegeven, @known); my (@keynames) = sort (keys (%$reforder)); &show ([$nr], $refdata, $grammar); do { # get a user command print "[$nr] edit? "; chomp ($gegeven = <STDIN>); if ($gegeven) { # extract command from arguments ($gegeven, @args) = split (/\s/, $gegeven); if ($gegeven =~ /^h/i) { # help &help ($refhelp, $grammar, "edit", "help"); } elsif ($gegeven =~ /^\?/i) { # ? &help ($refhelp, $grammar, "edit", "afkort"); } elsif ($gegeven =~ /^q/i) { # quit $gegeven = ""; } else { # fieldname? # look how many fieldnames match the given description @known = grep {$_ =~ /^$gegeven/i} @keynames; if (@known > 1) { # more than one match print "meer mogelijkheden:$/@known$/"; } elsif (@known > 0) { # one match if (@args) { $gegevens[$$reforder{$known[0]}] = join (" ", @args); $$refdata[$nr-1] = join ("$datasep", @gegevens); } else { print $known[0],"? "; chomp ($gegevens[$$reforder{$known[0]}] = <STDIN>); $$refdata[$nr-1] = join ("$datasep", @gegevens); } &show ([$nr], $refdata, $grammar); } else { # no matches print "mogelijkheden:$/@keynames$/$/"; print "help\tgeeft beschrijving gegevens$/$/"; } } } } while ($gegeven); # quit or no command } --- NEW FILE: dataFunc.pm --- package dataFunc; # Polymorphic-data del, find, filter, get, new by G.P.H. Josten June, 1998 # # This package contains functions to delete, find records, filter them out or # build new ones. # use strict; require Exporter; @dataFunc::ISA = qw(Exporter); @dataFunc::EXPORT = qw(del filter find get new_record sort_data undo); use dataConv; sub by_number { # # function used by sort to sort numerical instead of alphanumerical # if ($a < $b) { return -1; } elsif ($b < $a) { return 1; } else { return 0; } } sub del ($$$$) { # # delete records from the database, given some indices # # PRE: $reflist is a reference to the list with indices to the # records that should be deleted, $refdata the reference to # the data list; if $verbose is set true, give some output # POST: reference to the updated data list my ($reflist, $refdata, $grammar, $verbose) = @_; my ($nr, $antwoord, $i, $j, @checked); foreach (sort by_number (@$reflist)) { &show ([$_], $refdata, $grammar); print "verwijderen? "; chomp ($antwoord = <STDIN>); if ($antwoord =~ /^(j|y)/i) { push (@checked, $_); } } my (@new) = (); $j = 1; foreach (@checked) { for ($i = $j; $i < $_; $i++) { push (@new, $$refdata[$i-1]); } $j = $_+1; } for ($i = $j; $i <= @$refdata; $i++) { push (@new, $$refdata[$i-1]); } print "verwijderd zijn: ", join (",", @checked), " overgebleven aantal: ", $#new+1, $/ if (@checked && $verbose); return (\@new); } sub filter ($$$$) { # # grep records out of the database given some criteria # # PRE: $reffilters is a reference to a number of pairs strings # of which the first identifies a unique field and the second # is used to match the value; $grammar is used to extract the # fields from the data, $verbose to show some output on screen # POST: reference to the remaining data my ($reffilters, $refdata, $grammar, $verbose) = @_; my ($reflist, $gedelete, $one, $other); my (@result) = (); ($reflist) = &find ($reffilters, $refdata, $grammar, $verbose); $one = 1; while (@$reflist) { if ($one < $$reflist[0]) { push (@result, $one); $one++; } else { shift @$reflist; $one++; } } while ($one <= @$refdata) { push (@result, $one); $one++; } @result = @$refdata[map {--$_} @result] if @result; $gedelete = @$refdata-@result; print "aantal weggefilterd: ", $gedelete, ", aantal overgebleven: ",$#result+1,$/ if (($gedelete > 0) && $verbose); return \@result; } sub find ($$$$) { # # find records given some criteria # # PRE: $reffilters is a reference to a number of pairs strings # of which the first identifies a unique field and the second # is used to match the value; $grammar is used to extract the # fields from the data, $verbose to show some output on screen # POST: reference to the list with found matches my ($reffilters, $refdata, $grammar, $verbose) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (%filters) = @$reffilters; my (@known, @filtered); my (@result) = (0..$#$refdata); my ($failure) = ""; my (@keynames) = sort (keys (%$reforder)); my ($gegeven, $string, $waarde, @gegevens); while (!$failure && (($gegeven, $string) = each (%filters))) { @filtered = (); # look how many fieldnames match the given description @known = grep {$_ =~ /^$gegeven/i} @keynames; if (@known > 1) { # more than one match print "meer mogelijkheden met $gegeven:$/@known$/" if $verbose; @result = (); $failure = "true"; } elsif (@known > 0) { # one match foreach (@result) { @gegevens = split (/$datasep/, $$refdata[$_]); # select the fieldname that matched the description ($waarde = $gegevens[$$reforder{$known[0]}]) || ($waarde = ""); # keep line if value contains string push (@filtered, $_) if ($waarde =~ /$string/i); } @result = @filtered; @filtered = (); } else { # no matches print "mogelijkheden:$/@keynames$/$/help\tgeeft beschrijving gegevens$/$/" if $verbose; $failure = "true"; @result = (); } } # add to all indices one to get a numbering from 1 to # data @result = map {++$_} @result; if (@result && $verbose) { print "gevonden zijn: ", join (",", @result), $/; } return \@result; } sub get ($$$$) { # # returns a list of all selected values # # PRE: $reflist is a reference to a list of all fieldnames of which # values must be returned, $refdata a reference to the data; # $grammar is used to extract the fields from the data, $verbose # to show some output on screen # POST: reference to the list with all matching values my ($reflist, $refdata, $grammar, $verbose) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (@fields) = @$reflist; my (@result) = (); my ($failure) = ""; my (@keynames) = sort (keys (%$reforder)); my ($field, @gegevens, @known); my (@positions) = (); if ($fields[0] =~ /^all/i) { @positions = sort (values (%$reforder)); } else { while (!$failure && ($field = shift (@fields))) { # look how many fieldnames match the given description @known = grep {$_ =~ /^$field/i} @keynames; if (@known > 1) { # more than one match print "meer mogelijkheden met $field:$/@known$/" if $verbose; @positions = (); $failure = "true"; } elsif (@known > 0) { # one match push (@positions, $$reforder{$known[0]}); } else { # no matches print "mogelijkheden:$/@keynames$/$/help\tgeeft beschrijving gegevens$/$/" if $verbose; $failure = "true"; @positions = (); } } } foreach (0..(@$refdata - 1)) { @gegevens = split (/$datasep/, $$refdata[$_]); push (@result, join ("$datasep", @gegevens[@positions])); } return \@result; } sub new_record ($$) { # # returns updated data # # PRE: $refdata is a reference to the datalist that should be sorted; # $grammar is used to extract the fields from the data, $verbose # to show some output on screen # POST: reference to the sorted datalist my ($refdata, $grammar, $refhelp) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (%invorder, $key, $aantal, $i, $notdone, $record, $value, $last, $newdata); foreach $key (keys(%$reforder)) { $invorder{$$reforder{$key}} = $key; } $last = @$refdata+1; $record = ""; $aantal = keys(%$reforder); $i = 0; $notdone = "true"; print "[$last] geef de waarden:$/"; while ($i < $aantal && $notdone) { print $invorder{$i},"? "; if (defined($value = <STDIN>)) { chomp ($value); $value = " " if !$value; $record .= $value; $record .= $datasep if ($i < $aantal-1); } else { $notdone = ""; } $i++; } if ($notdone) { $newdata = [@$refdata, $record]; $last = @$newdata; print $/; &show ([$last], $newdata, $grammar); print "toevoegen? "; defined ($value = <STDIN>) || ($value = "nee"); if ($value =~ /^(j|y)/i) { $refdata = $newdata; print "$/1 record toegevoegd...$/"; } else { print "$/geen wijzigingen aangebracht...$/"; } } else { print "$/geen wijzigingen aangebracht...$/"; } return $refdata; } sub sort_data ($$) { # # returns alphanumerically sorted data # # PRE: $refdata is a reference to the datalist that should be sorted; # $grammar is used to extract the fields from the data, $verbose # to show some output on screen # POST: reference to the sorted datalist my ($refdata, $verbose) = @_; (print (@$refdata+1," records alphanumeriek gesorteerd$/")) if ($verbose); return [sort (@$refdata)]; } #sub unfilter { # @studenten = @unfilter; #} --- NEW FILE: dataIO.pm --- package dataIO; # Polymorphic-data read, save and print by G.P.H. Josten June, 1998 # # This package contains functions to read, save and print the database data line # per line. # use strict; require Exporter; @dataIO::ISA = qw(Exporter); @dataIO::EXPORT = qw(read_data save_data print_data); @dataIO::EXPORT_OK = qw(read_data save_data print_data); sub read_data ($$){ # # read in data from a file # # PRE: $bron contains the name of the data file and $verbose is set to true # if the number of data read must be shown my ($bron, $verbose) = @_; my (@studenten, @commented_data, $regel, $comment); open (SOURCE, $bron) || die "$!: $bron"; @commented_data = (); @studenten = (); $comment = "\/\/"; while (defined ($regel = <SOURCE>)) { chomp ($regel); if ($regel =~ /^$comment/i) { push (@commented_data, $regel); } else { push (@studenten, $regel); } } close (SOURCE) || die "$!: $bron"; print $#studenten+1," studenten ingelezen uit $bron$/" if $verbose; return (\@studenten, \@commented_data); } sub save_data { # # save given data to a file # # PRE: $doel contains the name of the file to which the data must be saved # *studenten is a reference to a data list and $verbose determines # wether the number of lines written is shown my ($doel, $refstuds, $refcommentdata, $verbose) = @_; open (TARGET, ">$doel") || die "$!: $doel"; foreach (@$refcommentdata) { print TARGET $_,$/; } foreach (@$refstuds) { print TARGET $_,$/; } close (TARGET) || die "$!: $doel"; print @$#refstuds+1," studenten weggeschreven naar $doel$/" if $verbose; } sub print_data { print @_,$/; } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:46
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir/bugs/bugsdata In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir/bugs/bugsdata Added Files: bugs.dat bugs.grm bugs.hlp editor Log Message: --- NEW FILE: bugs.dat --- 0#Solved bugs#WOC-redactie#wo...@sc...#16 oktober 1999#00:00h#1#Fouten in zowel de layout en de data komen helaas voor. In deze rubriek staan bugs die ondertussen zijn verbeterd. 1#Solved bugs#Egon#eg...@sc...#11-14-99#16:07h#2#Niet alle afkortingen staan in de lijst. 1#Solved bugs#Egon#eg...@sc...#11-14-99#16:47h#3#Solved! 2#Solved bugs#Egon#eg...@sc...#11-16-99#13:04h#2#Zoekresultaten geven bestandsnaam ipv. echte naam.<BR>Bv. benzoeumlzuur ipv. benzoëzuur. 2#Solved bugs#Egon#eg...@sc...#11-18-99#18:33h#3#Solved! 3#Solved bugs#Egon#egon#11-16-99#14:35h#2#Als de zoekmachine direct doorlinkt naar een <BR>compound dan laat ie de SSI niet zien. 3#Solved bugs#Egon#eg...@sc...#11-19-99#17:43h#3#solved! NAMELikeToANCHORLike functie uit<BR>Convert.java overgenomen. 3#Solved bugs#Egon#eg...@sc...#11-26-99#00:20h#4#Dezelfde fout zat in de start.shtml, waar hij<BR>de laatste tien gewijzigde of toegevoegde<BR>items laat zien.<P>Ook dat is aangepast. 4#Solved bugs#Egon#eg...@sc...#11-17-99#19:45h#2#Mengsels hebben niet het chemicalie azijnzuur<BR>icoontje. 4#Solved bugs#Egon#eg...@sc...#11-18-99#18:34h#3#Polymeren ook niet. 4#Solved bugs#Egon#eg...@sc...#12-01-99#21:00h#3#Solved! 6#Solved bugs#Egon#eg...@sc...#11-26-99#00:21h#2#Bromo-, chloro- etc zijn foute namen voor<BR>broom- en chloor-. Deze voorvoegsels komen<BR>echter regelmatig voor in de data. Als deze<BR>nog aanwezig is moet die nog aangepast worden.<P>grep bromo * | grep NL<P>Werkt er goed. 6#Solved bugs#Geert#gj...@sc...#11-26-99#10:33h#3#Ik ben er voor om:<BR> 'grep bromo *.xml;grep chloro *.xml'<BR>te gebruiken, want anders vind je geen vervoegingen<BR>en woorden in comments...<P>Geert<BR> 6#Solved bugs#Egon#eg...@sc...#12-02-99#19:26h#3#Micha, is deze bug nog niet helemaal verwijdert? 6#Solved bugs#Egon#eg...@sc...#12-28-99#11:14h#3#Solved!<P>Maar let er wel op dat er geen nieuwe in komen! 7#Solved bugs#Geert#gj...@sc...#12-01-99#17:05h#2#Volgens mij werkt NAMELikeToANCHORLike nog steeds niet altijd, want o.a<BR> de link naar het IR spectrum van vitamine E1 klopt<BR> niet! Ik wordt verwezen naar vitamine en niet<BR> vitamine E1... (het zit het in de <sub> die je in<BR> de link krijgt, < en > paktie niet... 7#Solved bugs#Egon#eg...@sc...#12-02-99#00:37h#3#Nou, hij zou hier eigenlijk ook de naam moeten<BR>gebruiken en niet een anchor, omdat het de naam<BR>is waarmee hij op het scherm getoond word.<P>Wat er dus moet gebeuren is dat het perl script<BR>zelf de naam opzoekt en die toont, en dat op<BR>basis van een cas-nummer dat als *enige* param<BR>meegegeven wordt.<P> 7#Solved bugs#Egon#egonw.kun.nl#12-02-99#11:06h#3#Solved! 8#Solved bugs#Micha#woc#12-01-99#20:05h#2#bij de vertalingen laat hij alleen de laatste<BR>vertaling zien, en niet allemaal. 8#Solved bugs#Egon#eg...@sc...#01-12-00#18:54h#3#Bug is getraceerd tot XItem.java.<P>Maar er treedt een complicatie op: LessGermanWord<BR>verwacht 1 woord en ItemFile verwacht meerdere<BR>woorden in een string. 8#Solved bugs#Egon#eg...@sc...#01-12-00#23:28h#3#solved! 9#Solved bugs#Egon#eg...@sc...#12-02-99#13:12h#2#De brutoformule lijst is veel te kort. 9#Solved bugs#Egon#eg...@sc...#12-10-99#11:30h#3#Misschien kunnen we deze indices on-the-fly<BR>laten aanmaken? 9#Solved bugs#Egon#eg...@sc...#02-08-00#21:31h#3#Solved! Thanks to Geert. 10#Solved bugs#Egon#eg...@sc...#12-02-99#19:24h#2#Volgorde van woorden in de Duits-Nederlandse<BR>woordenlijst klopt voor geen meter. 10#Solved bugs#Egon#eg...@sc...#01-12-00#23:37h#3#solved! 11#Solved bugs#Egon#eg...@sc...#12-05-99#13:08h#2#Als de zoekmachine slechts een item gevonden<BR>heeft laat hij deze zien (dat is goed). Maar<BR>de SSI commando's worden dan niet uitgevoerd.<P>Dit moet *wel* gebeuren. Dus de zoekmachine<BR>moet ook instaat zijn SSI commando's uit te <BR>voeren. 11#Solved bugs#Egon#eg...@sc...#12-23-99#13:37h#3#Solved! Opgelost door gebruik te maken van het<BR>HTTP/1.x protocol. Net zoals je Content-type<BR>mee kan geven, kan je ook "Location: URL" meegeven, om aan te geven dat de URL verandert is.<P>En omdat het een cgi-bin script is, kan je deze<BR>HTTP code nog toevoegen. 12#Solved bugs#Egon#eg...@sc...#12-10-99#11:31h#2#De internet zoekmachine functioneert niet meer!<BR>Zeer hoge prioriteit! 12#Solved bugs#Egon#eg...@sc...#12-10-99#12:21h#3#Solved! <P>Nieuwe versie van de WWW::Search perl module <BR>geinstalleerd. Maar er blijken wel nog meer<BR>bugs aanwezig. Zie bugnr. 13. 17#Solved bugs#Egon#eg...@sc...#12-19-99#14:17h#2#De 'item pagina' van groepen heeft niet de link<BR>'Alle items' zodat er vanaf daar niet naar die<BR>pagina geklikt kan worden. 17#Solved bugs#Egon#eg...@sc...#12-28-99#11:21h#3#solved! 18#Solved bugs#Egon#eg...@sc...#01-02-00#11:18h#2#De lijst met "alkanen" bevat meerdere alkanen<BR>waarvoor de structuutformule niet goed weergegeven<BR>wordt; er missen haakjes om de centrale methyleen- <BR>groepen. 18#Solved bugs#Egon#eg...@sc...#01-14-00#01:17h#3#Solved!<P>Maar de code in Bruto.java is sowieso niet<BR>erg geweldig robuust. :)<P>Maar ach.. op naar de volgende bug. 19#Solved bugs#Egon#eg...@sc...#01-02-00#11:20h#2#Er komen veel niet-afkortingen voor in de lijst<BR>van afkortingen. 19#Solved bugs#Egon#eg...@sc...#01-13-00#12:53h#3#Solved!<P>Net zoals de Engels-Nederlandse en Duits-<BR>Nederlandse vertalingen wordt nu ook deze index <BR>via een perl script aangemaakt en via een XSLT <BR>stylesheet vertaald naar een webpagina. 20#Solved bugs#Egon#eg...@sc...#01-02-00#11:25h#2#De afweging of er in de 'letterfiles' via "Meer<BR>info" verwezen moet worden naar de 'itemfile'<BR>is niet volledig. Als er alleen vertalingen zijn,<BR>wordt er geen verwijzing gemaakt terwijl dit wel<BR>moet. 20#Solved bugs#Egon#eg...@sc...#01-14-00#00:45h#3#Solved! 22#Solved bugs#Joost#wo...@sc...#01-12-00#20:09h#2#Mkwml levert nog steeds XML files met encoding:"UTF-8"<BR>dit moet de ISO-8859-1 encoding zijn!<BR>Er zullen dus nog een groot aantal files zijn met de<BR>verkeerde encoding! 22#Solved bugs#Geert#gj...@sc...#01-17-00#11:54h#3#Solved!...<P>Graag echter wel alle bestanden open zetten, anders<BR>kan ik degenen met de verkeerde encoding niet<BR>corrigeren... 25#Solved bugs#Egon#eg...@sc...#01-30-00#16:23h#2#Het met de Java software converteren van de data<BR>geeft een "Connection timed out" error.<P>Bv. met "SimpleAddItem kaneelaldehyd.xml". 25#Solved bugs#Egon#eg...@sc...#01-31-00#20:37h#3#Workaround: vorm de http url om in een file url. 25#Solved bugs#Egon#eg...@sc...#01-31-00#21:22h#4#Nee, workaround werkt niet. Maar fout bleek na<BR>twee uur zoeken te liggen aan het feit dat de <BR>officiele CML site niet bereikbaar was. 25#Solved bugs#Egon#eg...@sc...#01-31-00#21:23h#5#Solved! door een locale copie van de cml.dtd<BR>te gebruiken. 26#Solved bugs#Egon#eg...@sc...#02-11-00#23:12h#2#mkwml voegt nieuwe items telkens met hetzelfde<BR>WOC nummer toe, waar hij het eerstvolgende moet<BR>nemen. 26#Solved bugs#Egon#eg...@sc...#02-11-00#23:16h#3#Solved! Mkwml zocht alleen naar "ITEM ID="<BR>terwijl het ID attribuut *niet* altijd het tweede<BR>attribuut is. 27#Solved bugs#Egon#eg...@sc...#02-13-00#10:48h#2#Huub Willems meldde dat de pagina met ChemSymphony<BR>niet werkte. 27#Solved bugs#Egon#eg...@sc...#02-13-00#10:49h#3#Solved!<P>De bug was snel terug te vinden: het script<BR>dat de pagina met de ChemSymphony 3D applet maakte<BR>gebruikte een oude directory en niet de dadml<BR>directory. Dit is aangepast. 28#Solved bugs#Huub Willems#ba...@tr...#03-16-00#23:17h#2#(new) Bug 27 is volgens mij nog steeds niet opgelost. Ik blijf problemen houden met chemlite bij bijvoorbeeld ethaan en butaan. Vreemd genoeg geeft 1-butanol wel een 3d plaatje. 0#Nieuwe bugs#WOC-redactie#wo...@sc...#16 oktober 1999#00:00h#1#Fouten in zowel de layout en de data komen helaas voor. Heeft u een nieuwe gevonden, meldt u die dan in deze rubriek. 5#Nieuwe bugs#Egon#eg...@sc...#11-26-99#00:19h#2#(new) De groepenlijst geeft problemen bij termen<BR>zoals "IUPAC nomenclatuur". Waarschijnlijk<BR>omdat daar een spatie in zit. 5#Nieuwe bugs#Egon#eg...@sc...#02-08-00#22:32h#3#(new) Workaround: zolang er een WOC nummer bekend is<BR>voor het item, wordt deze gebruikt om de naam<BR>op te zoeken. Hierdoor wordt het gebruik van <BR>spaties in de URL voorkomen. Maar veel groepen<BR>(zoals acyclische koolwaterstoffen) hebben geen<BR>eigen *.xml bestand en daarom geen WOC nummer.<P>Deze woorden blijven voorlopig *met* een spatie<BR>aangeroepen. Een workaround hiervoor is het <BR>toch aanmaken van een *.xml bestand met alleen<BR>de item element en naam (zie het net toegevoegde<BR>acyclischekoolwaterstoffen.xml). 13#Nieuwe bugs#Egon#eg...@sc...#12-10-99#12:23h#2#(new) De query die de letterfiles aan het 'wereldbolletje'<BR>doorgeven, klopt niet altijd. <P>Bv. kaneelaldehyde wordt als 'kaneelaldehyde' door<BR>gegeven en realsearch.pl (via netsearch.pl) kan <BR>vervolgens kaneelaldehyde.xmlniet vinden (want dat<BR>is kaneelaldehyd.xml).<P>En dit is bij meerdere woorden het geval. 14#Nieuwe bugs#Egon#eg...@sc...#12-14-99#19:25h#2#(new) Bij regel E-1.1 moeten list items van het type<BR>"a" gebruikt worden. Het attribuut type="a" is<BR>in de XML wel gegeven, maar wordt door de<BR>WocEngine niet doorgegeven.<P>Moet geklaard worden voordat de Demo geshowd<BR>wordt. 15#Nieuwe bugs#Egon#eg...@sc...#12-14-99#19:36h#2#(new) Weer regel E-1.1. Als er in EXAMPLE->P twee<BR>data geimporteerd wordt, wordt de tekst ertussen<BR>niet doorgegeven door de WocEngine. 15#Nieuwe bugs#Egon#eg...@sc...#12-14-99#20:51h#3#(new) Een workaround is het gebruik van een tabel.<BR>Hierdoor voorkom je de aanwezigheid van<BR>'mixed data' (of (#PCDATA|ELEMENT)* in de DTD).<P>Mogelijk dit dit 'mixed data' ook de oorzaak van<BR>de bug is. 16#Nieuwe bugs#Egon#eg...@sc...#12-15-99#17:13h#2#(new) Een lezer merkte op dat er PDB's zijn waar geen<BR>waterstofatomen bij zitten... Het is in principe<BR>de bedoeling dat die er wel bij zitten.<P>Het is onbekend hoeveel PDB's er 'corrupt' zijn. 21#Nieuwe bugs#Joost#Wo...@sc...#01-12-00#19:13h#2#(new) Als je op een bug (de link ervan) klikt krijg je niet <BR>die bug te zien, maar de bug die ervoor stond.<BR>Dus als ik bug 18 wil zien en erop klik, dan<BR>krijg ik bug 17 te zien!<BR> 21#Nieuwe bugs#Egon#eg...@sc...#01-14-00#00:44h#3#(new) Ik heb hem nog niet kunnen reproduceren. 21#Nieuwe bugs#Geert#gs...@sc...#01-17-00#11:52h#4#(new) Waarschijnlijk IS deze bug niet te reproduceren,<BR>want je moet gewoon niet de Back-button gebruiken,<BR>maar zo vaak mogelijk het script opnieuw aanroepen<BR>door de links op de pagina's zelf te gebruiken.<P>Mocht er dan iemand iets toevoegen terwijl iemand<BR>aan het bladeren is, blijft de verwarring beperkt.<BR> 23#Nieuwe bugs#Joost#wo...@sc...#01-12-00#20:38h#2#(new) de link bij Ladenburg, Albert naar Kekule <BR>(met accent) klopt niet. Dit is een software bug.<BR>Kekule staat wel degelijk in het woordenboek, maar <BR>blijkbaar is deze niet correct. Hier moet naar <BR>gekeken worden! Wat de oplossing hiervoor is weet <BR>ik niet hoor. 24#Nieuwe bugs#Joost#wo...@sc...#01-12-00#20:56h#2#(new) Er worden gebroken plaatjes weergegeven bij items <BR>met een CAS-nr, waar geen plaatje van is.<BR>Blijkbaar wordt er gekeken of er een CAS-nr is <BR>waarna een link aangemaakt wordt of er wel of geen<BR>plaatje aanwezig is. Het script negeert de excludes<BR>tag! 24#Nieuwe bugs#Joost#wo...@sc...#01-12-00#21:00h#3#(new) Een voorbeeld hiervan is water! 24#Nieuwe bugs#Geert#gj...@sc...#01-17-00#11:59h#4#(new) Correctie!<P>De link voor het plaatje wordt niet toegevoegd aan<BR>de WML-bestanden. Echter, het script voor het uitzoeken<BR>van de gif-link in de WML's let inderdaad niet op<BR>de EXCLUDED-tag in de WML's zelf. Maar daarnaast<BR>denk ik dat de parser voor de HTML-files van slag<BR>raakt van die EXCLUDED-tag, want die denk ineens<BR>wel dat er een plaatje is, terwijl de path<BR>/ITEM/WOC/MEDIA[@MIME='image/gif'] helemaal niet bestaat! 29#Nieuwe bugs#Egon#eg...@sc...#04-10-00#12:32h#2#(new) Zoeken op PE in de zoekmachine geeft een<BR>Internal Server Error! 29#Nieuwe bugs#Egon#eg...@sc...#04-10-00#13:43h#3#(new) Opgelost! <P>De oorzaak bleek een match in de DOCTYPE<BR>regel, waarna geprobeerd werd de $title attribuut<BR>te gebruiken, maar die was uiteraard nog niet<BR>gezet.<P>Bug fix: DOCTYPE en ?xml? regel niet laten matchen. 29#Nieuwe bugs#Egon#eg...@sc...#04-10-00#13:45h#3#(new) Constructiever is het programma alleen te laten<BR>matchen op data en niet op metadata...<P>zoeken op item zou anders veel hits geven :( 30#Nieuwe bugs#Egon#eg...@sc...#04-16-00#23:10h#2#(new) Hoewel in de indices, wordt benzoezuur in de B<BR>letterbestanden niet goed gesorteerd... dit komt<BR>waarschijnlijk omdat Java die e met umlaut niet<BR>als e herkent... :(<P>Geen idee hoe dat op te lossen is...<P> 31#Nieuwe bugs#Egon#eg...@sc...#08-17-00#10:32h#2#(new) De website werkt niet met Mozilla. Dit komt schijnbaar<BR>door een fout in de Javascript in de index.html.<BR>Hij geeft een "vier not defined" error... 32#Nieuwe bugs#David Lutje Hulsik#dlu...@cm...#10-09-00#17:51h#2#(new) "Rode knop" by cafeine verwijst niet goed;<BR> je krijgt info over formaldehyde. 32#Nieuwe bugs#Egon#eg...@sc...#10-10-00#13:07h#3#(new) Opgelost! <P>Het probleem was dat ie niet het CAS nummer doorgaf<BR>wat nodig is. Bovendien zat er ook nog een fout<BR>in het Perl script, en die is ook verwijdert. 33#Nieuwe bugs#Egon#eg...@sc...#10-10-00#17:21h#2#(new) Polybutadieen is geen polymeer van 13butadieen maar<BR>van 1,3-polybutadieen.<P>Dit is een fout in Geert's code voor het genereren<BR>van een volzin op basis van TopicMap code... 34#Nieuwe bugs#Egon#eg...@sc...#11-15-00#12:08h#2#(new) Het plaatje van nitroglycerine klopt niet.<BR>Het wordt automatisch toegevoegd en is dus een<BR>zeer kwalijke bug! 34#Nieuwe bugs#Egon#eg...@sc...#11-15-00#12:10h#3#(new) Plaatje in http://www.sci.kun.nl/woc/data/pictures/gifgalary/55-63-0.gif<BR>was fout en is verwijdert. (CAS klopt wel.)<P>Directory daarentegen is fout. Dit moet zijn<BR>data/dadml/2d/gif/...<BR> 35#Searchengine#Micha Fleuren#mi...@sc...#11-29-00#18:52h#2#(new) Search engine laat spaties aan het begin van<BR>een zoekopdracht staan. Hier wordt ook op gezocht.<BR>Deze kunnen dus verwijdert worden. 36#Nieuwe bugs#Egon#eg...@sc...#12-13-00#17:27h#2#(new) Als er topic maps voorkomen in een bestand<BR>kan de XSLT engine in combo met picture.xsl de<BR>plaatjes niet vinden, of geeft ie een foutmelding.<BR> 36#Nieuwe bugs#Egon#eg...@sc...#12-13-00#17:36h#3#(new) Dit wordt opgelost door de volgende namespace<BR>toe te voegen (zie butaan.xml):<P> xmlns:xlink="http://www.w3.org/1999/xlink"<P> --- NEW FILE: bugs.grm --- volgorde: 8 bugnummer subject naam email datum tijd niveau inhoud verdeling: 6 0 1 2, 4, 5 3 7 6 weergave: 6 bugnummer: subject : naam : email : inhoud : niveau : --- NEW FILE: bugs.hlp --- // $mode.hlp - bestand met alle help gegevens // // De regels beginnend met / zijn commentaar, extra commentaar alleen tussen de arrays en // minimaal een regel commentaar ertussen is essentieel. // De andere regels gaan twee aan twee, het eerste bevat het item, de tweede de beschrijving // zorg dat in ieder geval de items met spaties worden aangevuld tot de lengte van de langste // uit het deellijstje... // Lengte van de deellijstjes onbegrensd // commando help /// ident /// hieronder een overzicht van alle beschikbare commando's: help deze uitleg usage geeft overzicht alle mogelijke parameters ? geeft alle (on)mogelijke afkortingen find zoeken op gegevens show weergeven studentgegevens del verwijderen van studenten edit wijzigen studentgegevens filter selectief verwijderen studenten new toevoegen studenten unfilter wijzigingen vanaf laatste filter teniet doen read (opnieuw) inlezen studentgegevens save opslaan wijzigingen quit afsluiten editor probeer eens usage of ? EOH commando usage /// ident /// hieronder per commando de mogelijke parameters: help usage ? find <gegeven> <zoekstring> [..] show [(<nr> [..] | alles)] (default = huidige) del [<nr> [..]] (default = huidige) edit [<nr>] (default = huidige) filter <gegeven> <zoekstring> [..] new (student | jaar)", unfilter read [<bestand>] (default = $datafile) save [<bestand>] (default = $newdatafile) quit probeer eens ? EOH commando afkort /// ident /// de tekens binnen [] zijn overbodig: d[el] sa[ve] e[dit] s[how] fil[ter] us[age] f[ind] u[nfilter] h[elp] q[uit] n[ew] ? r[ead] EOH edit help /// ident /// kies een van de volgende items om deze te wijzigen: probeer eens ? EOH edit afkort /// ident /// de tekens binnen [] zijn overbodig: EOH --- NEW FILE: editor --- #!/usr/bin/tcsh cd /vol/www/sigma/bin/editor Editor woc |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:46
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir/data In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir/data Added Files: htplp.dat htplp.grm Log Message: --- NEW FILE: htplp.dat --- smoel#Smoelenboek jarenoverzicht#$jarenoverzicht#@jaar, @aantal#gebruik @!jaar om waarde nogmaals te kunnen gebruiken smoel+$jaar#Smoelenboek namenoverzicht#$namenoverzicht### --- NEW FILE: htplp.grm --- volgorde: 5 argumenten omschrijving variabelen arrays commentaar verdeling: 4 1 0 2, 3 4 weergave: 4 omsc: args: vars: comm: |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:45
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir/bugs In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir/bugs Added Files: bericht.htpl berichtkop.htpl bugs.htpl bugs.pl eindelijst.htpl incompleet.htpl nieuwelijst.htpl overigkop.htpl overzicht.htpl rubriek.htpl rubriekkop.htpl rubriektoc.htpl toevoegform.htpl vraagkop.htpl Log Message: --- NEW FILE: bericht.htpl --- <CENTER> if $vraag <FONT SIZE=+1><B>Bug of reactie</B></FONT><BR> if !$vraag <FONT SIZE=+1><B>Over $subject</B></FONT><BR> <I>(<A HREF="mailto:$email">$naam</A>, $stamp)</I> </CENTER> <P> <HR WIDTH=20%> <P> <UL> if $vraag (<i>bug #$bugnummer</i>) <B>$inhoud</B> if !$vraag $inhoud <P> $reacties </UL> <P> <H3 ALIGN=Center> if $volgendelink [ <A HREF="$volgendelink">Volgende</A> ] if $vraag [ <A HREF="$voorgangerlink">Rubriek</A> ] if !$vraag [ <A HREF="$voorgangerlink">Voorganger</A> ] [ <A HREF="$reactielink">Reageren</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: berichtkop.htpl --- <LI>@bugnummer: <B>@subject</B> <A HREF="@berichtlink">@naam</A> <I>(@stamp)</I> --- NEW FILE: bugs.htpl --- Content-type: text/html <HTML> <HEAD> <META NAME="Author" CONTENT="Geert Josten, reactielid WOC"> <META NAME="Description" CONTENT="WOC: Bugs en reacties"> <META NAME="Generator" CONTENT="Perl-Sript: $0 $scriptage"> <META NAME="IsIndex" CONTENT="No"> <META NAME="Maintainer" CONTENT="$maintainer"> <META NAME="Review" CONTENT="$time"> <BASE href="http://www.sci.kun.nl/woc/" TARGET="pagina"> <TITLE>FAQ: $header </TITLE> <link rel="stylesheet" href="gui/styles/woc.css" type="text/css"> </HEAD> <BODY class="main"> <H1 ALIGN=Center>Bugs en Reacties: $header</H1> <HR> <BR> <BR> if $overzicht $overzicht.htpl if $rubriektoc $rubriektoc.htpl if $bericht $bericht.htpl if $toevoegform $toevoegform.htpl if $toevoegformincompleet $incompleet.htpl <P> <HR> <UL> <CENTER><I>De WOC-redactie behoudt het recht om naar eigen inzicht de toegevoegde bugs al dan niet op te lossen :).</I></CENTER> </UL> </BODY> </HTML> --- NEW FILE: bugs.pl --- $contentcheckers = "woc\@sci.kun.nl"; ## main ## ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; $datum = `date '+%m-%d-%y'`; $tijd = `date '+%H:%Mh'`; if ((@ARGV) && ($ARGV[0] =~ /^nieuw/i)) { shift (@ARGV); $niveau = shift (@ARGV); $nummer = shift (@ARGV); if ($niveau > 2) { $header = "Vul hier je reactie in..."; &maak_reactieform (); } else { $header = "Vul hier je bug of reactie in..."; if ($nummer > 0) { &maak_reactieform (); } else { &maak_reactieform (); $subject = "Ongerubriceerd"; $nummer = @$refdata; } } $toevoegform = "true"; } elsif ((@ARGV) && ($ARGV[0] =~ /^voegtoe/i)) { shift (@ARGV); $niveau = shift (@ARGV); $nummer = shift (@ARGV); if (&voeg_nieuw_bericht_toe ()) { $reacties = ""; $nummer++; $header = "\$inhoud"; if ($niveau > 2) { $bericht = "overig"; } else { $bericht = "vraag"; $vraag = "true"; } &maak_bericht (); } else { $toevoegformincompleet = "true"; } } elsif ((@ARGV) && ($ARGV[0] =~ /^rubriek/i)) { $header = "Bugs Overzicht"; shift (@ARGV); $nummer = shift (@ARGV); $rubriektoc = " "; &maak_rubriek (); $vraagtoevoeglink = "$script+nieuw+2+$nummer"; } elsif ((@ARGV) && ($ARGV[0] =~ /^vraag/i)) { $header = "Antwoorden op bugs"; shift (@ARGV); $nummer = shift (@ARGV); $bericht = "vraag"; $vraag = "true"; &maak_bericht (); } elsif ((@ARGV) && ($ARGV[0] =~ /^\d+/i)) { $header = "Antwoord en commentaar"; $nummer = shift (@ARGV); $bericht = "overig"; &maak_bericht (); } else { $header = "Rubrieken Overzicht"; $overzicht = ""; &maak_overzicht (); $niveau = "1"; $nummer = @$refdata; $nieuwevraaglink = "$script+nieuw+2+0"; } $return = ""; sub maak_reactieform { my $refsubject = &get (["subject"], [$$refdata[$nummer-1]], $grammar, ""); if ($niveau <= 2) { # zoek hoogste bugnummer # my $refbugnummers = &get (["bugnummer"], $refdata, $grammar, ""); @$refbugnummers = sort by_number (@$refbugnummers); $bugnummer = @$refbugnummers[-1] + 1; # nieuwe bugnummer!! # } else { # pak bijbehorende bugnummer # my $refbugnummer = &get (["bugnummer"], [$$refdata[$nummer-1]], $grammar, ""); $bugnummer = $$refbugnummer[0]; } $subject = $$refsubject[0]; } sub by_number { if ($a < $b) { return -1; } elsif ($a > $b) { return 1; } else { return 0; } } sub maak_overzicht { $htmlrubriek = &readhtml ("rubriek.htpl"); $refbugnummer = &get (["bugnummer"], $refdata, $grammar, ""); $refsubject = &get (["subject"], $refdata, $grammar, ""); $refnaam = &get (["naam"], $refdata, $grammar, ""); $refemail = &get (["email"], $refdata, $grammar, ""); $refstamp = &get (["datum", "tijd"], $refdata, $grammar, ""); $refniveau = &get (["niveau"], $refdata, $grammar, ""); $refinhoud = &get (["inhoud"], $refdata, $grammar, ""); @i = (1..@$refdata); $numvraag = 0; $numant = 0; $numcomm = 0; foreach $i (@i) { $bugnummer = shift @$refbugnummer; $subject = shift @$refsubject; $naam = shift @$refnaam; $email = shift @$refemail; $email =~ s#\@#\\\@#ig; $stamp = shift @$refstamp; $stamp =~ s/#/, /i; $niv = shift @$refniveau; $inhoud = shift @$refinhoud; if ($niv == 1) { push (@rubrieklink, "$script+rubriek+$i"); push (@bugnummer, $bugnummer); push (@subject, "\u$subject"); push (@email, $email); push (@naam, "\u$naam"); push (@stamp, $stamp); push (@niveau, $niveau); push (@inhoud, "\u$inhoud"); ($numvraag = "geen") if ! $numvraag; ($numant = "geen") if ! $numant; ($numcomm = "geen") if ! $numcomm; push (@numvraag, $numvraag); push (@numant, $numant); push (@numcomm, $numcomm); $overzicht .= "$htmlrubriek"; $numvraag = 0; $numant = 0; $numcomm = 0; } else { if ($niv == 2) { $numvraag++; } elsif ($niv == 3) { $numant++; } elsif ($niv > 3) { $numcomm++; } } } ($numvraag = "geen") if ! $numvraag; ($numant = "geen") if ! $numant; ($numcomm = "geen") if ! $numcomm; push (@numvraag, $numvraag); push (@numant, $numant); push (@numcomm, $numcomm); shift (@numvraag); shift (@numant); shift (@numcomm); } sub maak_rubriek { $htmlnieuwelijst = &readhtml ("nieuwelijst.htpl"); $htmlrubriekkop = &readhtml ("rubriekkop.htpl"); $htmlvraagkop = &readhtml ("vraagkop.htpl"); $htmloverigkop = &readhtml ("overigkop.htpl"); $htmleindelijst = &readhtml ("eindelijst.htpl"); $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $niveau = $$refniveau[0]; while (($niveau > 1) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $niveau = $$refniveau[0]; } @i = (($nummer-1)..($last-1)); @data = @$refdata[@i]; $refbugnummer = &get (["bugnummer"], \@data, $grammar, ""); $refsubject = &get (["subject"], \@data, $grammar, ""); $refnaam = &get (["naam"], \@data, $grammar, ""); $refemail = &get (["email"], \@data, $grammar, ""); $refstamp = &get (["datum", "tijd"], \@data, $grammar, ""); $refniveau = &get (["niveau"], \@data, $grammar, ""); $refinhoud = &get (["inhoud"], \@data, $grammar, ""); foreach $reactieinhoud (@overiginhoud) { $reactieinhoud = substr($reactieinhoud, 0, 40)."..."; } $niv = 1; @i = ($nummer..$last); foreach $i (@i) { $bugnummer = shift @$refbugnummer; $subject = shift @$refsubject; $naam = shift @$refnaam; $email = shift @$refemail; $email =~ s#\@#\\\@#ig; $stamp = shift @$refstamp; $stamp =~ s/#/, /i; $oldniv = $niv; $niv = shift @$refniveau; $inhoud = shift @$refinhoud; if ($niv < $oldniv) { $j = $niv; while ($j < $oldniv) { $rubriektoc .= "$htmleindelijst"; $j++; } } if ($niv > $oldniv) { $j = $oldniv; while ($j < $niv) { $rubriektoc .= "$htmlnieuwelijst"; $j++; } } if ($niv == 1) { $rubrieklink = "$script+rubriek+$i"; $rubrieksubject = "\u$subject"; $rubrieknaam = "\u$naam"; $rubriekinhoud = "\u$inhoud"; } elsif ($niv == 2) { push (@bugnummer, $bugnummer); push (@vraaglink, "$script+vraag+$i"); push (@vraagnaam, "\u$naam"); push (@vraaginhoud, "\u$inhoud"); $rubriektoc .= "$htmlvraagkop"; } else { push (@overiglink, "$script+$i"); push (@overignaam, "\u$naam"); $inhoud = substr($inhoud, 0, 40)."..."; push (@overiginhoud, "\u$inhoud"); $rubriektoc .= "$htmloverigkop"; } } $rubriektoc .= "$htmleindelijst"; $rubriektoc .= "$htmleindelijst"; } sub maak_bericht { $htmlnieuwelijst = &readhtml ("nieuwelijst.htpl"); $htmloverigkop = &readhtml ("overigkop.htpl"); $htmleindelijst = &readhtml ("eindelijst.htpl"); $refbugnummer = &get (["bugnummer"], [$$refdata[$nummer-1]], $grammar, ""); $refsubject = &get (["subject"], [$$refdata[$nummer-1]], $grammar, ""); $refnaam = &get (["naam"], [$$refdata[$nummer-1]], $grammar, ""); $refemail = &get (["email"], [$$refdata[$nummer-1]], $grammar, ""); $refstamp = &get (["datum", "tijd"], [$$refdata[$nummer-1]], $grammar, ""); $refniveau = &get (["niveau"], [$$refdata[$nummer-1]], $grammar, ""); $refinhoud = &get (["inhoud"], [$$refdata[$nummer-1]], $grammar, ""); $bugnummer = $$refbugnummer[0]; $subject = $$refsubject[0]; $naam = $$refnaam[0]; $email = $$refemail[0]; $stamp = $$refstamp[0]; $niveau = $$refniveau[0]; $inhoud = $$refinhoud[0]; $stamp =~ s/#/ /i; $email =~ s#\@#\\\@#ig; $reactielink = "$script+nieuw+".($niveau+1)."+$nummer"; ### de 'parent', voorganger ### $prev = $nummer-2; $refniveau = &get (["niveau"], [$$refdata[$prev]], $grammar, ""); $prevniveau = $$refniveau[0]; while (($prevniveau >= $niveau) && ($prev > 0)) { $prev--; $refniveau = &get (["niveau"], [$$refdata[$prev]], $grammar, ""); $prevniveau = $$refniveau[0]; } if ($prevniveau < $niveau) { if ($prevniveau == 1) { $voorgangerlink = "$script+rubriek+".($prev+1); } elsif ($prevniveau == 2) { $voorgangerlink = "$script+vraag+".($prev+1); } else { $voorgangerlink = "$script+".($prev+1); } } ### de reacties en het eerst volgende broertje of zusje ### if ($nummer <= @$refdata) { $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; while (($lastniveau > $niveau) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; } if ($lastniveau == $niveau) { if ($lastniveau == 1) { $volgendelink = "$script+rubriek+".($last+1); } elsif ($lastniveau == 2) { $volgendelink = "$script+vraag+".($last+1); } else { $volgendelink = "$script+".($last+1); } } if ($last > $nummer) { @reacties = @$refdata[$nummer..$last-1]; $refbugnummer = &get (["bugnummer"], \@reacties, $grammar, ""); $refsubject = &get (["subject"], \@reacties, $grammar, ""); $refnaam = &get (["naam"], \@reacties, $grammar, ""); $refemail = &get (["email"], \@reacties, $grammar, ""); $refstamp = &get (["datum", "tijd"], \@reacties, $grammar, ""); $refniveau = &get (["niveau"], \@reacties, $grammar, ""); $refinhoud = &get (["inhoud"], \@reacties, $grammar, ""); @overigbugnummer = @$refbugnummer; @overigsubject = @$refsubject; @overignaam = @$refnaam; @overigemail = @$refemail; @overigstamp = @$refstamp; @overigniveau = @$refniveau; @overiginhoud = @$refinhoud; @i = (1..@$refdata); foreach $i (@i) { push (@overiglink, "$script+".($i+$nummer)); } foreach $reactiestamp (@overigstamp) { $reactiestamp =~ s/#/ /i; } foreach $reactieinhoud (@overiginhoud) { $reactieinhoud = substr($reactieinhoud, 0, 40)."..."; } foreach $reactieemail (@overigemail) { $reactieemail =~ s#\@#\\\@#ig; } $reacties = ""; $refniveau = &get (["niveau"], \@reacties, $grammar, ""); $niv = $niveau; foreach $reactieniveau (@overigniveau) { if ($niv < $reactieniveau) { while ($niv < $reactieniveau) { $reacties .= " "x($niv-$niveau+2)."$htmlnieuwelijst"; $niv++; } } elsif ($niv > $reactieniveau) { while ($niv > $reactieniveau) { $reacties .= " "x($niv-$niveau+1)."$htmleindelijst"; $niv--; } } $reacties .= " "x($niv-$niveau+1)."$htmloverigkop"; } while ($niv > $niveau) { $reacties .= " "x($niv-$niveau+1)."$htmleindelijst"; $niv--; } } } } sub voeg_nieuw_bericht_toe { %pairs = &parse_form (); $compleet = "true"; foreach $key (keys(%pairs)) { if (! $pairs{$key}) { $compleet = ""; #false } } $bugnummer = $pairs{"bugnummer"} if (exists ($pairs{"bugnummer"})); $subject = $pairs{"subject"} if (exists ($pairs{"subject"})); $naam = $pairs{"naam"} if (exists ($pairs{"naam"})); $email = $pairs{"email"} if (exists ($pairs{"email"})); $datum = $pairs{"datum"} if (exists ($pairs{"datum"})); $tijd = $pairs{"tijd"} if (exists ($pairs{"tijd"})); $inhoud = $pairs{"inhoud"} if (exists ($pairs{"inhoud"})); if ($compleet) { $bericht[$$reforder{"bugnummer"}] = $bugnummer; $bericht[$$reforder{"subject"}] = $subject; $bericht[$$reforder{"naam"}] = $naam; $bericht[$$reforder{"email"}] = $email; $bericht[$$reforder{"datum"}] = $datum; $bericht[$$reforder{"tijd"}] = $tijd; $bericht[$$reforder{"niveau"}] = $niveau; $bericht[$$reforder{"inhoud"}] = "(new) ".$inhoud; $bericht = join($datasep, @bericht); if ($nummer >= @$refdata) { $refdata = [@$refdata, $bericht]; } else { $last = $nummer; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; while (($lastniveau >= $niveau) && ($last < @$refdata)) { $last++; $refniveau = &get (["niveau"], [$$refdata[$last]], $grammar, ""); $lastniveau = $$refniveau[0]; } $nummer = $last if ($last > $nummer); $refdata = [@$refdata[0..($nummer-1)], $bericht, @$refdata[($nummer)..(@$refdata-1)]]; } &save_data ($datafile, $refdata, $refcommenteddata, ""); open (MAIL, "|/usr/ucb/mail -s 'WOC Bugs: nieuw bericht' ".$contentcheckers) || die "$!"; print MAIL &expand ($nummer+1, $refdata, $grammar); close (MAIL); } return $compleet; } --- NEW FILE: eindelijst.htpl --- </UL> --- NEW FILE: incompleet.htpl --- <CENTER> <BR><H1>Volledig Invullen A.U.B.</H1> <FORM METHOD=POST ACTION="$script+voegtoe+$niveau+$nummer"> <INPUT TYPE=Hidden NAME="datum" VALUE="$datum"> <INPUT TYPE=Hidden NAME="tijd" VALUE="$tijd"> <TABLE> <TR> <TD>Bugnummer:</TD> <TD><INPUT TYPE=Hidden NAME="bugnummer" SIZE=50 VALUE="$bugnummer">$bugnummer</TD> </TR> <TR> <TD>Naam:</TD> <TD><INPUT TYPE=Text NAME="naam" SIZE=50 VALUE="$naam"></TD> </TR> <TR> <TD>E-Mail:</TD> <TD><INPUT TYPE=Text NAME="email" SIZE=50 VALUE="$email"></TD> </TR> <TR> <TD>Subject:</TD> <TD><INPUT TYPE=Text NAME="subject" SIZE=50 VALUE="$subject"></TD> </TR> <TR> <TD>Bericht:</TD> <TD><TextAREA COLS=55 ROWS=10 NAME="inhoud">$inhoud</TextAREA></TD> </TR> </TABLE> <INPUT TYPE=Submit VALUE="Voeg toe"> <INPUT TYPE=Reset VALUE="Opnieuw"> </FORM> </CENTER> --- NEW FILE: nieuwelijst.htpl --- <UL> --- NEW FILE: overigkop.htpl --- <LI><A HREF="@overiglink">@overiginhoud</A> (@overignaam) --- NEW FILE: overzicht.htpl --- <H2 ALIGN=Center>Alle bekende bugs in het WOC</H2> <UL> Kies een van de onderstaande rubrieken om bugs te bekijken of bugs en commentaar toe te voegen: <P> <UL> $overzicht </UL> </UL> <H3 ALIGN=CENTER> [ <A HREF="$nieuwevraaglink">Nieuwe bug of reactie</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: rubriek.htpl --- <A HREF="@rubrieklink"><FONT SIZE=+1><B>@subject</B></FONT></A> <I>(@numvraag vrg, @numant ant, @numcomm comm)</I> <P> @inhoud </P> --- NEW FILE: rubriekkop.htpl --- <P><FONT SIZE=+1><B>@rubrieksubject</B></FONT></P> --- NEW FILE: rubriektoc.htpl --- <H2 ALIGN=Center>$rubrieksubject</H2> <UL> $rubriekinhoud <P> <BR> Kies een van de onderstaande bugs of kies gelijk een van de reacties: $rubriektoc </UL> <BR> <H3 ALIGN=CENTER> [ <A HREF="$vraagtoevoeglink">Bug of reactie toevoegen</A> ] [ <A HREF="$script">Rubrieken</A> ] </H3> --- NEW FILE: toevoegform.htpl --- <CENTER> <BR><H1>$header</H1> <FORM METHOD=POST ACTION="$script+voegtoe+$niveau+$nummer"> <INPUT TYPE=Hidden NAME="datum" VALUE="$datum"> <INPUT TYPE=Hidden NAME="tijd" VALUE="$tijd"> <INPUT TYPE=Hidden NAME="bugnummer" VALUE="$bugnummer"> <TABLE> <TR> <TD>Bugnummer:</TD> <TD> <B>$bugnummer</B></TD> </TR> <TR> <TD>Naam:</TD> <TD><INPUT TYPE=Text NAME="naam" SIZE=50 VALUE="$naam"></TD> </TR> <TR> <TD>E-Mail:</TD> <TD><INPUT TYPE=Text NAME="email" SIZE=50 VALUE="$email"></TD> </TR> <TR> <TD>Subject:</TD> <TD><INPUT TYPE=Text NAME="subject" SIZE=50 VALUE="$subject"></TD> </TR> <TR> <TD>Bericht:</TD> <TD><TextAREA COLS=50 ROWS=8 NAME="inhoud">$inhoud</TextAREA></TD> </TR> </TABLE> <INPUT TYPE=Submit VALUE="Voeg toe"> <INPUT TYPE=Reset VALUE="Opnieuw"> </FORM> </CENTER> --- NEW FILE: vraagkop.htpl --- <P> <LI><A HREF="@vraaglink">(<i>bug #@bugnummer</i>) <B>@vraaginhoud</B></A> (@vraagnaam) <P> |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:44
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/htplpdir In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/htplpdir Added Files: Grammar.pm README dataConv.pm dataFunc.pm dataIO.pm helper htplp naam.pl Log Message: --- NEW FILE: Grammar.pm --- package Grammar; # Polymorphic-data-grammar reading by G.P.H. Josten June, 1998 # # This package contains the function to extract the data-grammar from a file. # use strict; require Exporter; @Grammar::ISA = qw(Exporter); @Grammar::EXPORT = qw(read_grammar); sub read_grammar ($) { # # read in the grammar of the data from a grammar file # # PRE: $source contains name of grammar file # POST: %order, %distribution and %keynames contain the information # necessary to retrieve fields from the data and show them on screen my ($source) = @_; my (%order, %distribution, %keynames, $regel, @regel, @lijst, $i); my ($dataseparator) = "#"; my ($fieldseparator) = ", "; open (SOURCE, $source) || die $!; # # first read the order into %order: # defined ($regel = <SOURCE>) || die $!; @regel = split (" ", $regel); $i=0; @lijst = (); while ($i < $regel[1] && defined ($regel = <SOURCE>)) { chomp($regel); push (@lijst, $regel, $i); $i++; } %order = @lijst; # # second the distribution along multiple lines: # defined ($regel = <SOURCE>) || die $!; @regel = split (" ", $regel); $i=0; @lijst = (); while ($i < $regel[1] && defined ($regel = <SOURCE>)) { chomp($regel); push (@lijst, $i, $regel); $i++; } %distribution = @lijst; # # last the names to show in front of each line: # defined ($regel = <SOURCE>) || die $!; @regel = split (" ", $regel); $i=0; @lijst = (); while ($i < $regel[1] && defined ($regel = <SOURCE>)) { chomp($regel); push (@lijst, $i, $regel); $i++; } push (@lijst, "comment", "/"); %keynames = @lijst; close (SOURCE) || die $!; # return the references only!! return [\%order, \%distribution, \%keynames, $dataseparator, $fieldseparator]; } --- NEW FILE: README --- August 5th, 1998 Why Htplp and Editor Htplp and Editor are two Perl-scripts which were written to resolve problems concerning the representation of large quantities of data on WWW as HTML. Htplp is the Parser which generates the pages, Editor is the utility to edit the data. Where it all started The parent problem was a small already existing site of the student association V.V.C.N. Sigma (http://www.sci.kun.nl/sigma/) which contained almost all pictures of the Chemistry students at the University of Nijmegen (most of them member of Sigma). Each year new students arrived and the pages had to be updated (each year of students meant three pages of each a number of kilobytes). I took that job on me (don't ask me why, I can't remember) and did this for one new year of students. My conclusion was that it was an unflexible, easily out-of-date and time consuming way. Everything had to be done manually. Especially when I (yes, one of those great ideas to do some self-torture) came to the idea to improve the layout by using multi-column layout for the pictures, I got tired of it. With some cut and paste it could be done, but it was boring and specially suited for computers to do it for you. The first monster The problems weren't very important, as the pages didn't needed to be very up-to-date. Nevertheless, it is a good visit card to do have a site with accurate and usable information. Besides, it was an interesting challenge which could make things easy in future. With my fresh knowledge of Java ("C1", the introductory course to programming - in Java :-( - was one of the obligatory courses), I set off to build a database and an engine that could read the data and generate the pages for me. An immense monster resulted. It worked, but it was ill-programmed and unreadable, only I worked with it - with reason I presume :-P -, and most of all, it was unflexible and still unmaintainable. But, a database was generated, one of the biggest benefits, and the page generation was automated. The engines most worth, it proved to me with it's first use outside it's original purpose, a use for like-wise layout, not for WWW but for a booklet with information about Sigma. I used this monster more than a year I believe, it has shown it's purpose, but now fortunately it's obsolete. The data The data which was held by a number of files, had to be created and maintained. This was a second problem, because using a text-editor isn't the best way, for mistakes are very easily made. Leaving some special symbol out meant that half the data of one year wasn't read, but skipped. Searching these files and extracting the useful information was another problem. Busy with the data - I was probably adding a new year or updating some names - I came to the idea of writing an editor. Actually, the idea originated because I wanted to facilitate the extraction of information. I was busy typing all fields that represented a single student. Life happened to let me stumble over Perl, I was interested and asked a 'colleague' student - he studied Informatics, I Chemistry at that time, Informatical Chemistry presently - for some advise about books about Perl. I bought to his advice two and with "Learning Perl" in one hand and the data files in the other, I tried to get a better and moreover faster extraction going. But using Unix shell-script (find, grep, sort, etc.) and Unix shell commands within Perl scripts didn't work and typing all information didn't facilitate it very much either this way. Well, why not read it in with Perl, put it in some variables, let Perl do some sorting and voila, my first real useful Perl-script was born. But with that it didn't stop. Hacking around in Perl, I wrote not only a search utility, but also some conversion utilities and another page generating script. But again, they were ill-programmed, hardly better readable, still only I (could) work(ed) with them and they still didn't show very much flexibility. The data improved though, for I typed all data, got some real regularity in it and got fresh ideas about how to better deal with it. The new approach I realised that the power of Perl could be far better utilised for this matter than I did. I hardly did, so that isn't much of a surprise. One benefit of Perl is, that normally it doesn't make a difference between words and numbers. I mean that in Perl for example not only numbers could be used to index in an array of items, but words as well. The Perl hash-variable the best example of this power of Perl in which one value is used to extract another, one to one. Not vice versa by the way. My fantasy got almost wild with the only enlarging space in which I could invent options and ideas and problems and solutions. Meanwhile, I had been busy with some funny command interpreting script which could represent the fields of data of one student in some basic way, could edit them as well and after some trouble, could even search the big lot. Discovering more and more about Perl, I started extracting more and more of the determining values and putting them into handy variables I could initialize at start and manipulated mid-way if necessary. This process resulted in a separate file which contained the full typing of the data and even the representation in the basic way. This information is read in and put in a few variables. In the rest of the script only these variables are used and not their actual value. Comparing with the actual values of these typing variables is only done with user input!! This process plus the ability of recognizing shortened versions of the actual values made the Editor very powerful. The Editor evolved I continued this work and started working on a profound way. I grouped certain functions and made them complete and robust. Most of them had to be converted to my new ideas and this allowed me to reconsider the solutions and improve them to their present state. This makes the Editor a full grown script, with fairly balanced functions and a quite user-friendly user-interface. I already had build an almost complete version of the Editor which I had subjected to some beta-testing (another colleague student :-). The new version could be tested back to back with this one and most testing did I do between all the other programming activities (hint: try to always test an earlier programmed part before you need to use it!). And still my knowledge about Perl is increasing, but the usefulness has converged about now - after building Htplp and Editor -. The data structuring The data had changed a lot in the meantime. First more regularity, second the typing and third cenversion. Conversion from the multi-line format (quite similar to the basic representation) to a single line one. The first two steps had been time consuming and text editor usage intensive, but are worth it now. The integrity of the data has very much increased as well as the managebility, editibility and usability. It also allowed me to experiment a little with how to structure the data. This has resulted in the separate file with the typing and the single-line format, with all fields of data of one student on a single line. This was done deliberately with several thoughts, no particular order, in my mind. Difficult to handle are fields of data of undefined number of lines. As linefeeds and carriage returns are of no use in HTML (it's just treated as whitespace) it was the first I got rid of. I stuffed everything on a single line and separated it by some specific string. At the moment I have chosen for a single character, the guard '#'. In near future the choice will be put in the typing file as well. I call these typing information together the grammar of the data, just to give it a name. Putting everything on a single line, makes the data easily manageble by using a simple array. This can even be sorted without any special work (one single command). Using the Perl functions split and join, the fields can be separated and glued together (single lines again). With the grammar of the data you can find out where a certain field remains and this can be use to extract, compare, manipulate and store the value if wanted. It may sound a bit difficult but it is just short and highly generic all at the same time, flexible at last and powerful indeed. It's real power became clear to me when I tried the Editor on a different data-file. It took two minutes to define a grammar and invent four lines of data. I ran the Editor and it just worked! It really worked!! Not a single change to the Editor was necessary, only the grammar and the data. I had underestimated my own abilities and the power of Perl. What followed With building this Editor which needs only some final commenting, addition of one or two extra functions and documentation on usage and maintenance, I created a profound basis of functions I saw I could use for the parent problem where I started my story. I had deliberately put all the Editor functions grouped in separate files, which could be used as nicely shielded modules. You only need to call the Perl function use and the functions are all yours. I had data, I had grammar and I had a whole bunch of functions, all tested and commented too. I took the page generating script in Perl in front of me and almost paniced in horror. It was awfull, HTML and Perl stood right next to each other, it was one big mess and in this script I had used old copies of the functions I had nicely defined in modules now. To get this readable, I had to get rid of the HTML between the Perl in some or the other way. By this time, I happened to look in some existing Perl script which gives some statistics, but more important, it read a plain text file in and substituted variables it contained (just a dollar sign '$' followed by an identifier). Interesting!! I though and once more I set off. But hey, I might could do better, I might be able to write some script which not only reads in those plain text files and substitutes some variables, but do this for any file, identified by some argument or so. Not a bad idea, I thought, so I hacked a bit in Perl, read in a file and substituted variables and produced the result. Hmm, well, I had to do a lot more if I wanted ever to produce the picture pages of Sigma. It is a tree-like structure with a lot of hyperlink refering to each other. Besides I had to process a lot of information if necessary. But, no worry, I thought, let the parser recognize filenames as variables as well (just dollar sign '$' plus filename) and process these too, Perl scripts as well. So I did, but being busy and stumbling over several difficulties one becomes wiser and wiser. The Htpl parser After lots and lots of trial-and-error activities (regular expressions are very, very, very flexible in Perl :-P), this resulted in Htplp. The name is derived from HTml and PerL Parser, which is not completely accurate, but it will do. This script, or parser if you like to call it that way, starts with reading one argument. This argument determines what site it should parse and generate. From this argument some basic files are derived, a.o. the grammar file, the data file, the main Perl script needed too beside the parsing script and the main text file. The grammar and data are read, some default variables are set and next the main Perl script is executed. Actually, it is the only Perl script that is necessary for that particular site. This script is supposed to do something useful to every remaining argument the parser script received at start. With these arguments the script is given the opportunity to initialize, process and destroy variables which, and this is the trick, are automatically acessible from within the parsing script (they are just global variables, so it's no fancy trick at all and note that the parser script's variables are global too!!). Then the main text file is read in and the real parsing commences. This parsing is no real big deal, although it cost me a lot of fine tuning to get it working. How the parsing works This parsing means only that the parser tries to find a few posibilities and process accordingly. First, the parser could find the word "if" somewhere. If this "if" is followed by a variable ($varname), then it will try to determine wether this variable exists or not, if so, the following part remains, otherwise it is deleted. If it is followed in the same line by the word "fi", then everything in between might survive or not. No "fi", then if the variable isn't set by that site-specific script, than the full line is deleted. The if .. fi construction may be put halfway a line, if .... construction must commence at the beginning of a line. In both if constructions the variable may be directly preceded by an exclamation mark '!', which negates the required existence of the following variable. Other constructs are as mentioned previously, filenames ($filename), with the only restriction that the filename must end with dot plus "htpl" ("$filenaam.htpl"). This is merely a handy choice which I'm not about to change. Final possibilities are just variable substitutions, scalar variables ($varname) and array variables (@varname) as well. Scalar variables are just substituted by their content. Array variables are a bit trickier. I programmed the parser in such a way that it pops the first value (The Perl function shift), which is lost that way. I found it necessary to build in a last option, to not pop that first value, but look at it and possibly use it once again. For this, put a exclamation mark '!' directly behind the @ in @varname (e.g. @!varname). This ought to do the trick :-). After each substitution in a line, the parser tries again, untill it fully fails, then it produces that line. Going over each line exhaustively allows to parse highly nested structures as well (variable names in variable names in variable names in a filename in an array variable in an variable name in an if evaluation in...). This may sound like a lot of work, but Perl manages to do this for a small but difficult page, within 10 seconds (at our server at least, which is not the slowest around). Especially the variable substitutions, which are often the far most done, influence this time greatly. Try to keep the actions as minimal as possible, by presubstituting all those values if possible. This doesn't have to be done exhaustively, the script is fast enough (Perl is compiled before execution!!). If it takes too long, your page might be just too long or perhaps, the server is slow in executing scripts... Finally I hope that this Editor and Htpl Parser may find a lot of future applications and not only done by me. I build these to give them through to future members of the Internetcommittee of V.V.C.N. Sigma. For as long as I will still be around I will try to do some final modifications in order to make those future applications even more possible. Let me note, that the Editor script or some text file nearby that script will contain a more extensive explenation of the use of the grammar. The Editor itself contains a help function which should explain the Editor functions at least a little. The error messages should do the rest, I hope. Htplp should be installed by somebody with at least some Perl experience and he or she could take care of the main site scripts if they are needed. Any layouting can be done by somebody else, like some HTML wizard or so. Minimal knowledge of how to call the script with the right arguments and what variables are available in which situation is necessary though. A documenting file would be very helpfull I suppose. And now the really, really final note: I called the Parser HTml and PerL Parser, but, actually, the HTML part doesn't have to be HTML at all, anything based on plain text could do. LaTeX for example too. May you all have a pleasent exercise of mind with scripts, may they enlighten your life, may they relieve you of a lot of trouble and sorrow and sweat and pain. If they don't, I suggest: R.T.F.M.!!!!!!!! Signed, WoodWorm alias G.P.H. Josten student Informatical Chemistry at the University of Nijmegen member of student association Sigma at Nijmegen member of the internetcommittee of Sigma --- NEW FILE: dataConv.pm --- package dataConv; # Polymorphic-data convert and show by G.P.H. Josten June, 1998 # # This package contains functions convert some database data from single line # format to multiple line format and show it this way on screen. # use strict; require Exporter; @dataConv::ISA = qw(Exporter); @dataConv::EXPORT = qw(compress expand show); sub by_number { # # function used by sort to sort numerical instead of alphanumerical # if ($a < $b) { return -1; } elsif ($b < $a) { return 1; } else { return 0; } } sub compress ($$) { # # compress data fields from over multi lines onto single lines # # PRE: $refdata, a reference to the data in multiline format to be # compressed, $reforder, $refdistr and $refkeys, references to # the hash variables that define how to translate from multi to # single line and $datasep and $fieldsep the strings that # separate the fields in the single resp. multi line format # POST: the data in single line format my ($refdata, $grammar) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (@result, $num_lines, $line, $i, @pos, @gegevens); $num_lines = scalar (keys (%$refdistr)); while (@$refdata) { do { $line = shift (@$refdata); } while ($line =~ /$$refkeys{"comment"}/i); for ($i = 0; $i < $num_lines; $i++) { $line =~ tr/^$$refkeys{$i}//; @pos = split(/$fieldsep/, $$refdistr{$i}); @gegevens[@pos] = split(/$fieldsep/, $line); } shift (@$refdata); # empty line push (@result, join ("$datasep", @gegevens)); } return \@result; } sub expand ($$$) { # # expand one single line of data to multiline format # # PRE: $refdata, a reference to the data in single line format from # which one record is to be expanded; $reforder, $refdistr and # $refkeys, references to the hash variables that define how to # translate from single to multi line format and $datasep and # $fieldsep the strings that separate the fields in the single # resp. multi line format # POST: one data record in multi line format my ($index, $refdata, $grammar) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (@data, @result, @lines, @fields) = ((), (), (), ()); my ($line); # show each of the list by expanding them one by one @data = split (/$datasep/, $$refdata[$index-1]); @lines = (0..(scalar (keys (%$refdistr)) - 1)); # add numbering of output push (@result, "/// ".$index." ///$/"); # add each line with the apropriate datafields foreach (@lines) { # which fields? @fields = split(/$fieldsep/, $$refdistr{$_}); # add line identifying string $line = $$refkeys{$_}; # add the fields $line .= join ("$fieldsep", @data[@fields]); push (@result, "$line$/"); } return @result; } sub show ($$$) { # # show a given number of record from the data # # PRE: $reflist, a reference to a list with all indices to the records # from the data to be shown; # $refdata, a reference to the data in single line format from # which one record is to be expanded; $reforder, $refdistr and # $refkeys, references to the hash variables that define how to # translate from single to multi line format and $datasep and # $fieldsep the strings that separate the fields in the single # resp. multi line format my ($reflist, $refdata, $grammar) = @_; my (@listtoshow) = @$reflist; # got a number? if (@listtoshow) { # show all? if ($listtoshow[0] =~ /^all/i) { @listtoshow = (1..@$refdata); } else { # else sort the received list @listtoshow = (sort by_number (@$reflist)); } # show each of the list by expanding them one by one foreach (@listtoshow) { print &expand ($_, $refdata, $grammar), $/; } } } --- NEW FILE: dataFunc.pm --- package dataFunc; # Polymorphic-data del, find, filter, get, new by G.P.H. Josten June, 1998 # # This package contains functions to delete, find records, filter them out or # build new ones. # use strict; require Exporter; @dataFunc::ISA = qw(Exporter); @dataFunc::EXPORT = qw(del filter find get new_record sort_data undo); use dataConv; sub by_number { # # function used by sort to sort numerical instead of alphanumerical # if ($a < $b) { return -1; } elsif ($b < $a) { return 1; } else { return 0; } } sub del ($$$$) { # # delete records from the database, given some indices # # PRE: $reflist is a reference to the list with indices to the # records that should be deleted, $refdata the reference to # the data list; if $verbose is set true, give some output # POST: reference to the updated data list my ($reflist, $refdata, $grammar, $verbose) = @_; my ($nr, $antwoord, $i, $j, @checked); foreach (sort by_number (@$reflist)) { &show ([$_], $refdata, $grammar); print "verwijderen? "; chomp ($antwoord = <STDIN>); if ($antwoord =~ /^(j|y)/i) { push (@checked, $_); } } my (@new) = (); $j = 1; foreach (@checked) { for ($i = $j; $i < $_; $i++) { push (@new, $$refdata[$i-1]); } $j = $_+1; } for ($i = $j; $i <= @$refdata; $i++) { push (@new, $$refdata[$i-1]); } print "verwijderd zijn: ", join (",", @checked), " overgebleven aantal: ", $#new+1, $/ if (@checked && $verbose); return (\@new); } sub filter ($$$$) { # # grep records out of the database given some criteria # # PRE: $reffilters is a reference to a number of pairs strings # of which the first identifies a unique field and the second # is used to match the value; $grammar is used to extract the # fields from the data, $verbose to show some output on screen # POST: reference to the remaining data my ($reffilters, $refdata, $grammar, $verbose) = @_; my ($reflist, $gedelete, $one, $other); my (@result) = (); ($reflist) = &find ($reffilters, $refdata, $grammar, $verbose); $one = 1; while (@$reflist) { if ($one < $$reflist[0]) { push (@result, $one); $one++; } else { shift @$reflist; $one++; } } while ($one <= @$refdata) { push (@result, $one); $one++; } @result = @$refdata[map {--$_} @result] if @result; $gedelete = @$refdata-@result; print "aantal weggefilterd: ", $gedelete, ", aantal overgebleven: ",$#result+1,$/ if (($gedelete > 0) && $verbose); return \@result; } sub find ($$$$) { # # find records given some criteria # # PRE: $reffilters is a reference to a number of pairs strings # of which the first identifies a unique field and the second # is used to match the value; $grammar is used to extract the # fields from the data, $verbose to show some output on screen # POST: reference to the list with found matches my ($reffilters, $refdata, $grammar, $verbose) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (%filters) = @$reffilters; my (@known, @filtered); my (@result) = (0..$#$refdata); my ($failure) = ""; my (@keynames) = sort (keys (%$reforder)); my ($gegeven, $string, $waarde, @gegevens); while (!$failure && (($gegeven, $string) = each (%filters))) { @filtered = (); # look how many fieldnames match the given description @known = grep {$_ =~ /^$gegeven/i} @keynames; if (@known > 1) { # more than one match print "meer mogelijkheden met $gegeven:$/@known$/" if $verbose; @result = (); $failure = "true"; } elsif (@known > 0) { # one match foreach (@result) { @gegevens = split (/$datasep/, $$refdata[$_]); # select the fieldname that matched the description ($waarde = $gegevens[$$reforder{$known[0]}]) || ($waarde = ""); # keep line if value contains string push (@filtered, $_) if ($waarde =~ /$string/i); } @result = @filtered; @filtered = (); } else { # no matches print "mogelijkheden:$/@keynames$/$/help\tgeeft beschrijving gegevens$/$/" if $verbose; $failure = "true"; @result = (); } } # add to all indices one to get a numbering from 1 to # data @result = map {++$_} @result; if (@result && $verbose) { print "gevonden zijn: ", join (",", @result), $/; } return \@result; } sub get ($$$$) { # # returns a list of all selected values # # PRE: $reflist is a reference to a list of all fieldnames of which # values must be returned, $refdata a reference to the data; # $grammar is used to extract the fields from the data, $verbose # to show some output on screen # POST: reference to the list with all matching values my ($reflist, $refdata, $grammar, $verbose) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (@fields) = @$reflist; my (@result) = (); my ($failure) = ""; my (@keynames) = sort (keys (%$reforder)); my ($field, @gegevens, @known); my (@positions) = (); if ($fields[0] =~ /^all/i) { @positions = sort (values (%$reforder)); } else { while (!$failure && ($field = shift (@fields))) { # look how many fieldnames match the given description @known = grep {$_ =~ /^$field/i} @keynames; if (@known > 1) { # more than one match print "meer mogelijkheden met $field:$/@known$/" if $verbose; @positions = (); $failure = "true"; } elsif (@known > 0) { # one match push (@positions, $$reforder{$known[0]}); } else { # no matches print "mogelijkheden:$/@keynames$/$/help\tgeeft beschrijving gegevens$/$/" if $verbose; $failure = "true"; @positions = (); } } } foreach (0..(@$refdata - 1)) { @gegevens = split (/$datasep/, $$refdata[$_]); push (@result, join ("$datasep", @gegevens[@positions])); } return \@result; } sub new_record ($$) { # # returns updated data # # PRE: $refdata is a reference to the datalist that should be sorted; # $grammar is used to extract the fields from the data, $verbose # to show some output on screen # POST: reference to the sorted datalist my ($refdata, $grammar, $refhelp) = @_; my ($reforder, $refdistr, $refkeys, $datasep, $fieldsep) = @$grammar; my (%invorder, $key, $aantal, $i, $notdone, $record, $value, $last, $newdata); foreach $key (keys(%$reforder)) { $invorder{$$reforder{$key}} = $key; } $last = @$refdata+1; $record = ""; $aantal = keys(%$reforder); $i = 0; $notdone = "true"; print "[$last] geef de waarden:$/"; while ($i < $aantal && $notdone) { print $invorder{$i},"? "; if (defined($value = <STDIN>)) { chomp ($value); $value = " " if !$value; $record .= $value; $record .= $datasep if ($i < $aantal-1); } else { $notdone = ""; } $i++; } if ($notdone) { $newdata = [@$refdata, $record]; $last = @$newdata; print $/; &show ([$last], $newdata, $grammar); print "toevoegen? "; defined ($value = <STDIN>) || ($value = "nee"); if ($value =~ /^(j|y)/i) { $refdata = $newdata; print "$/1 record toegevoegd...$/"; } else { print "$/geen wijzigingen aangebracht...$/"; } } else { print "$/geen wijzigingen aangebracht...$/"; } return $refdata; } sub sort_data ($$) { # # returns alphanumerically sorted data # # PRE: $refdata is a reference to the datalist that should be sorted; # $grammar is used to extract the fields from the data, $verbose # to show some output on screen # POST: reference to the sorted datalist my ($refdata, $verbose) = @_; (print (@$refdata+1," records alphanumeriek gesorteerd$/")) if ($verbose); return [sort (@$refdata)]; } #sub unfilter { # @studenten = @unfilter; #} --- NEW FILE: dataIO.pm --- package dataIO; # Polymorphic-data read, save and print by G.P.H. Josten June, 1998 # # This package contains functions to read, save and print the database data line # per line. # use strict; require Exporter; @dataIO::ISA = qw(Exporter); @dataIO::EXPORT = qw(read_data save_data print_data); @dataIO::EXPORT_OK = qw(read_data save_data print_data); sub read_data ($$){ # # read in data from a file # # PRE: $bron contains the name of the data file and $verbose is set to true # if the number of data read must be shown my ($bron, $verbose) = @_; my (@studenten, @commented_data, $regel, $comment); open (SOURCE, $bron) || die "$!: $bron"; @commented_data = (); @studenten = (); $comment = "\/\/"; while (defined ($regel = <SOURCE>)) { chomp ($regel); if ($regel =~ /^$comment/i) { push (@commented_data, $regel); } else { push (@studenten, $regel); } } close (SOURCE) || die "$!: $bron"; print $#studenten+1," studenten ingelezen uit $bron$/" if $verbose; return (\@studenten, \@commented_data); } sub save_data { # # save given data to a file # # PRE: $doel contains the name of the file to which the data must be saved # *studenten is a reference to a data list and $verbose determines # wether the number of lines written is shown my ($doel, $refstuds, $refcommentdata, $verbose) = @_; open (TARGET, ">$doel") || die "$!: $doel"; foreach (@$refcommentdata) { print TARGET $_,$/; } foreach (@$refstuds) { print TARGET $_,$/; } close (TARGET) || die "$!: $doel"; print @$#refstuds+1," studenten weggeschreven naar $doel$/" if $verbose; } sub print_data { print @_,$/; } --- NEW FILE: helper --- #!/usr/bin/sh cd /vol/www/woc/bin/editor Editor htplp --- NEW FILE: htplp --- #!/usr/local/bin/perl # # First get some libraries necessary to read in data and # get the right fields out of it... # use dataConv; use dataFunc; use dataIO; use Grammar; # # Next find out what the user is requesting... # if (@ARGV) { $mode = shift (@ARGV); if ($mode =~ /^debug/i) { $debug = "true"; if (@ARGV) { $mode = shift (@ARGV); } else { $mode = "smoel"; } } } else { $mode = "smoel"; } # # don't mind the debug info, this script is stuffed with it # print "Content-type: text/html$/$/<PRE>" if $debug; # # Setup the default variables... # $time = gmtime (time ()); #$scriptage = "(".int(-M $0)." days old)"; $script = $0; $script =~ s#.*\/##i; $scriptage = "(".int(-M $script)." days old)"; $path = $&; # that what was cut in previous line $path .= $script."dir/$mode/"; # Wordt niet meer gebruikt !!!! $script = "/cgi-bin/$script?$mode"; $maintainer = "woc\@sci.kun.nl"; $header = "Dit is een test header"; # don't mind, unimportent $body = "Geertje!!"; # ;-> # # Okay, select path to go to the files that contain the mode # specific data and layout... # chdir $mode; # # These are the files which are supposed to contain the main # script, html, data and grammar for the data... # $mainperlfile = "$mode.pl"; $mainfile = "$mode.htpl"; $datafile = $mode."data/$mode.dat"; $grammarfile = $mode."data/$mode.grm"; # # read the data... # $grammar = &read_grammar ($grammarfile); #print "Content-type: text/html$/$/"; #$refdata = &read_data ($datafile, "verbose"); ($refdata, $refcommenteddata) = &read_data ($datafile, ""); # # execute the main script # if (-r $mainperlfile) { do $mainperlfile; } # # read the main html containing file # @mainfile = (); open (MAINFILE, $mainfile) || die "$!:$mainfile"; while (<MAINFILE>) { push (@mainfile, $_); } close (MAINFILE); # # and at last, parse the html you just read... # print "begin while...$/" if $debug; while (@mainfile) { # variable enclosed by if and fi $match = ""; $begin = ""; $var = ""; $end = ""; @var = (); $varcont = " "; @varcont = (); $redo = "true"; if ($mainfile[0] =~ /(\s)(if\s+)(\$.*?)(\s)(.*?)(\sfi)(\b)/i) { print "1" if $debug; $match = $&; $begin = $1; $if = $2; $var = $3; $space = $4; $then = $5; $fi = $6; $end = $7; chomp ($end); $match = &convmatch (\$match);#$match =~ s#\$#\\\$#ig; if (eval "$var") { $mainfile[0] =~ s#$match#$begin$then$end#ig; } else { print "-" if $debug; $mainfile[0] =~ s#$match#$begin$end#ig; } $var = ""; } elsif ($mainfile[0] =~ /(\s)(if\s+\!)(\$.*?)(\s)(.*?)(\sfi)(\b)/i) { print "1b" if $debug; $match = $&; $begin = $1; $if = $2; $var = $3; $space = $4; $then = $5; $fi = $6; $end = $7; chomp ($end); $match = &convmatch (\$match);#$match =~ s#\$#\\\$#ig; if (eval "\!$var") { $mainfile[0] =~ s#$match#$begin$then$end#ig; } else { print "~" if $debug; $mainfile[0] =~ s#$match#$begin$end#ig; } $var = ""; } elsif ($mainfile[0] =~ /(^if\s+)(\$.*?)(\s)(.*)/i) { print "2" if $debug; $match = $&; $if = $1; $var = $2; $space = $3; $then = $4; if (eval "$var") { $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; $mainfile[0] =~ s#$match#$then#i; } else { print "^" if $debug; shift (@mainfile); } $var = ""; } elsif ($mainfile[0] =~ /(^if\s+\!)(\$.*?)(\s)(.*)/i) { print "2b" if $debug; $match = $&; $if = $1; $var = $2; $space = $3; $then = $4; if (eval "\!$var") { $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; $mainfile[0] =~ s#$match#$then#i; } else { print "'`" if $debug; shift (@mainfile); } $var = ""; # substitute $name.htpl with content of file name.htpl } elsif ($mainfile[0] =~ /([^\\]*)(\$)(\S+\.htpl)(.*)/i) { print "4" if $debug; $match = $&; $begin = $1; $var = $2.$3; $file = $3; $end = $4; if (-r $file) { @htplfile = (); open (HTPLFILE, $file) || die $!; while (defined ($line = <HTPLFILE>)) { push (@htplfile, $line); } close (HTPLFILE); if (@htplfile) { $varcont = join ("", @htplfile); } else { print "-" if $debug; $var = "\\".$var; $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; $mainfile[0] = $begin.$end; #= s/$match/$begin$end/ig; $var = ""; } } else { print "-" if $debug; $var = "\\".$var; $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; $mainfile[0] = $begin.$end; #= s/$match/$begin$end/i; $var = ""; } # $variables without if or if ... fi } elsif ($mainfile[0] =~ /([^\\]*?)(\$.*?)(\W)/i) { print "5" if $debug; $match = $&; $begin = $1; $var = $2; $end = $3; if (eval "$var") { $varcont = eval "$var"; } else { print "-$var:" if $debug; $var = "\\".$var; $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; $mainfile[0] =~ s/$match/$begin$end/ig; $var = ""; } # @!variables without if or if ... fi } elsif ($mainfile[0] =~ /([^\\]*?)(\@)(\!)(.*?)(\W)/i) { print "6" if $debug; $match = $&; $begin = $1; $var = $2.$3.$4; $variable = $2.$4; $varname = $4; $end = $5; if (eval "$variable") { $varcont = eval ('$'.$varname.'[0]'); } else { print "-" if $debug; $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; $match =~ s#\@#\\\@#ig; $mainfile[0] =~ s/$match/$begin$end/ig; $var = ""; } # @variables without if or if ... fi } elsif ($mainfile[0] =~ /([^\\]*?[^\\])(\@.*?)(\W)/i) { print "7" if $debug; $match = $&; $begin = $1; $var = $2; print "$var" if $debug; $end = $3; if (eval "$var") { $varcont = eval "shift ($var)"; } else { print "-" if $debug; $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; $match =~ s#\@#\\\@#ig; $mainfile[0] =~ s/$match/$begin$end/ig; $var = ""; } } else { print "0" if $debug; $redo = ""; } if ($redo && $var) { $var = "\\".$var; $varcont || ($varcont = ""); chomp ($varcont); @varcont = split ($/, $varcont); if ($varcont && (@varcont > 1)) { # $htplpnummer = @varcont; foreach (@varcont) { $_ .= $/; } print "*|" if $debug; $first = shift (@mainfile); chomp ($varcont[0]); $first =~ s/$begin$var$end/$begin$varcont[0]/ig; shift (@varcont); chomp ($varcont[$#varcont]); $varcont[$#varcont] = $varcont[$#varcont].$end.$/; (@mainfile) = ($first, @varcont, @mainfile); } else { print "+|" if $debug; $newbegin = &convmatch (\$begin); $newend = &convmatch (\$end); $mainfile[0] =~ s/$newbegin$var$newend/$begin$varcont$end/ig; } } elsif (! $redo) { print ">" if $debug; $mainfile[0] =~ s/\\\@/\@/ig; print shift (@mainfile); } else { print "|" if $debug; } } print "done while...$/</PRE>$/" if $debug; sub convmatch { # # stupid sub to make sure that the substitutions go right # ($_) = @_; $_ = $$_; #print "$_;" if $debug; s#\$#\\\$#ig; s#\*#\\\*#ig; s#\@#\\\@#ig; s#\&#\\\&#ig; s#\?#\\\?#ig; s#\/#\\\/#ig; s#\(#\\\(#ig; s#\)#\\\)#ig; s#\+#\\\+#ig; s#\|#\\\|#ig; s#\[#\\\[#ig; s#\]#\\\]#ig; #print "$_:" if $debug; return $_; } sub readhtml { # # sub to read in a file and put it's content in one variable # my ($file) = @_; my (@result, $line); open (BESTAND, $file) || die $!; while (defined ($line = <BESTAND>)) { push (@result, $line); } close (BESTAND); return join ("", @result); } sub parse_form { # # function to get the input from a form and convert the hexadecimal codes it # might contain... # # Get the input #$buffer = ""; #read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}) || die $!; while (<STDIN>) { # this is more useful, especially in debug mode, because $buffer .= $_; # this way you can enter values from console too. Type } # something like name1=value1&naam2=&naam3=value3, hit # enter and then Ctrl-D (under Unix though) # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s#<!--(.|$/)*-->##g; $value =~ s#\r\n\r\n#\<P\>#ig; # for Unix files to $value =~ s#\r\n#\<BR\>#ig; # get rid of ^M... $value =~ s#$/$/#\<P\>#ig; $value =~ s#$/#\<BR\>#ig; $FORM{$name} = $value; } return %FORM; } --- NEW FILE: naam.pl --- # # substitute $name.pl with evaluated content of file name.pl # } elsif ($mainfile[0] =~ /([^\\]*)(\$)(\S+\.pl)(.*)/i) { #print "3" if $debug; # $match = $&; # $begin = $1; # $var = $2.$3; # $file = $3; # $end = $4; # if (-r $file) { # do $file; # @plfile = (); # # open (PLFILE, $file) || die $!; # while (defined ($line = <PLFILE>)) { # push (@plfile, $line); # } # close (PLFILE); # # if (@plfile) { # $varcont = eval (join (" ", @plfile)); # } else { # $varcont = "\t"; # } ##print ":@plfile:$varcont:" if $debug; # if ($varcont !~ /\S/i) { # $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; # $mainfile[0] = $begin.$end; #s/$match/$begin$end/ig; # $var = ""; ##print "\"$mainfile[0]\"" if $debug; # } # } else { #print "-" if $debug; # $match = &convmatch (\$match); #$match =~ s#\$#\\\$#ig; # $mainfile[0] = $begin.$end; #= s/$match/$begin$end/ig; # $var = ""; # } # if ($mainfile[0] !~ /\S/i) { #print "^" if $debug; # shift (@mainfile); # $var = ""; # } |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:42
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/cache/dadml In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/cache/dadml Added Files: list_content.pl Log Message: --- NEW FILE: list_content.pl --- #!/usr/local/bin/perl -w use strict; use diagnostics; print "Content-type: text/html\n\n"; my $cachedir = "/tmp/woc/dadml-cache"; my @files = <$cachedir/*>; print "<b>Cache bevat " . scalar(@files) . " items.</b>$/"; if (scalar(@files) > 0) { print " <table>$/"; print " <tr><th>CAS-nummer</th><th>Leeftijd</th></tr>$/"; foreach my $file (@files) { my $age = -M $file; $age =~ s/(\d*)\.\d*/$1/; if ($age eq "0") { $age = "<1 dag" } elsif ($age eq "1") { $age .= " dag"; } else { $age .= " dagen"; }; $file =~ s/.*NUMBER(.*)/$1/; print " <tr>$/"; print " <td>$file</td>$/"; print " <td>" . $age . "</td>$/"; print " </tr>$/"; } print " </table>$/"; } 1; |
From: Geert J. <gj...@us...> - 2002-09-03 19:40:42
|
Update of /cvsroot/woc/woc/src/woc/cgi-src/ctview In directory usw-pr-cvs1:/tmp/cvs-serv23171/woc/cgi-src/ctview Added Files: view.pl Log Message: --- NEW FILE: view.pl --- #!/usr/local/gnu/bin/perl -w use diagnostics; use strict; use CGI qw(:standard); print "Content-type: text/html;\n\n"; my $lang1 = param("FROM"); my $lang2 = param("TO"); if ($lang1 ne $lang2) { open(INDEXFILE, "<../../web-docs/gui/index/index.$lang1-$lang2.html") || (print "<b>Cannot open file!</b>\n" && exit(1)); while(<INDEXFILE>) { print; } } else { print "<b>Languages should not be the same!</b>\n"; } |