aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cgi-bin/nea.cgi.in149
-rw-r--r--data/eg11.xml24
-rw-r--r--data/eg8.xml438
-rw-r--r--data/eg9.xml239
-rw-r--r--ellinika/cgi.scmi109
5 files changed, 959 insertions, 0 deletions
diff --git a/cgi-bin/nea.cgi.in b/cgi-bin/nea.cgi.in
new file mode 100644
index 0000000..56e8bc5
--- /dev/null
+++ b/cgi-bin/nea.cgi.in
@@ -0,0 +1,149 @@
+#! =GUILE_BINDIR=/guile -s
+=AUTOGENERATED=
+!#
+;;;; Greek Dictionary Web Engine
+;;;; Copyright (C) 2004, 2005 Sergey Poznyakoff
+;;;;
+;;;; This program is free software; you can redistribute it and/or modify
+;;;; it under the terms of the GNU General Public License as published by
+;;;; the Free Software Foundation; either version 2 of the License, or
+;;;; (at your option) any later version.
+;;;;
+;;;; This program is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with this program; if not, write to the Free Software
+;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+;;;;
+
+;;; Tailor this statement to your needs if necessary.
+;=GUILE_COMMENT=;(set! %load-path (cons "=GUILE_SITE=" %load-path))
+
+(use-modules (www cgi)
+ (gamma sql)
+ (gamma gettext)
+ (xmltools dict)
+ (ellinika xlat)
+ (ellinika cgi))
+(cgi:init)
+
+(ellinika-cgi-init)
+
+(define (summary)
+ (let ((conn (sql-connect
+ sql-iface sql-host sql-port sql-database
+ sql-username sql-password)))
+ (cond
+ (conn
+ (let ((result (sql-query conn "SELECT date,header,ident FROM news ORDER BY date")))
+ (cond
+ ((null? result)
+ (display "<div align=\"center\">No news</div>"))
+ (else
+ (display "<table class=\"newssummary\">\n")
+ (for-each
+ (lambda (entry)
+ (display "<tr>\n")
+ (display "<td class=\"date\">")
+ (display (list-ref entry 0))
+ (display "</td>")
+ (display "<td class=\"subject\"><a href=\"")
+ (display (make-cgi-name nea-cgi-path "id" (list-ref entry 2)))
+ (display "\">")
+ (display (list-ref entry 1))
+ (display "</a></td>\n")
+ (display "</tr>\n"))
+ result)
+ (display "</table>"))))
+ (sql-connect-close conn))
+ (else
+ (format #t "<H1>~A</H1>\n"
+ "ΣΦΆΛΜΑ: σύνδεση με το λέξικο απέτυχε.")))))
+
+(define (main)
+ (cond
+ ((cgi:value "id") =>
+ (lambda (id)
+ (let ((conn (sql-connect
+ sql-iface sql-host sql-port sql-database
+ sql-username sql-password)))
+ (cond
+ (conn
+ (let ((result (sql-query conn
+ (string-append
+ "SELECT date,header,text FROM news WHERE ident="
+ id))))
+ (if (null? result)
+ (format #t "<H1>No item found</H1>\n")
+ (for-each
+ (lambda (item)
+ (format #t "<span class=\"itemdate\">~A</span>\n" (car item))
+ (display "<span class=\"itemheader\">\n")
+ (display (cadr item))
+ (display "</span>")
+
+ (display "<div class=\"itemtext\">")
+ (display (caddr item)))
+ result))))
+ (else
+ (format #t "<H1>~A</H1>\n"
+ "ΣΦΆΛΜΑ: σύνδεση με το λέξικο απέτυχε."))))))))
+
+
+(define explist
+ (list (cons "@@program-name@@" (lambda (id)
+ (make-cgi-name nea-cgi-path)))
+ (cons "@@main@@" main)
+ (cons "@@summary@@" summary)))
+
+; FIXME: Again, share it with dict.cgi
+(define (expand-template template)
+ (let loop ((template template))
+ (cond
+ ((string-index template #\@) =>
+ (lambda (w)
+ (display (substring template 0 w))
+ (if (and (< (+ w 2) (string-length template))
+ (char=? (string-ref template (1+ w)) #\@))
+ (let ((end-pos (string-index template #\@ (+ w 2))))
+ (if (and end-pos
+ (< (1+ end-pos) (string-length template))
+ (char=? (string-ref template (1+ end-pos)) #\@))
+ (let* ((name (substring template w (+ end-pos 2)))
+ (entry (assoc name explist)))
+ (cond
+ (entry
+ ((cdr entry))
+ (loop (substring template (+ end-pos 2))))
+ (else
+ (display "@@")
+ (loop (substring template (+ w 2))))))
+ (begin
+ (display "@")
+ (loop (substring template (+ w 1))))))
+ (begin
+ (display "@")
+ (loop (substring template (1+ w)))))))
+ (else
+ (display template)))))
+
+(define (dict-html)
+ (do ((line (read-line) (read-line)))
+ ((eof-object? line) #f)
+ (expand-template line)))
+
+;;; Main
+(display "Content-type: text/html; charset=utf-8\r\n\r\n")
+
+(with-input-from-file
+ (template-file target-language nea-template-file-name)
+ dict-html)
+
+
+;;;; Local variables:
+;;;; mode: Scheme
+;;;; buffer-file-coding-system: utf-8
+;;;; End:
diff --git a/data/eg11.xml b/data/eg11.xml
new file mode 100644
index 0000000..45348eb
--- /dev/null
+++ b/data/eg11.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Copyright (C) 2004 Sergey Poznyakoff
+
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the file COPYING.FDL -->
+
+<DICT>
+
+<T ID="Γνωρίζω την Ελλάδα (1)">
+
+
+</T>
+</DICT>
+
+<!-- Local Variables: -->
+<!-- mode: ellinika-dict -->
+<!-- buffer-file-coding-system: utf-8 -->
+<!-- alternative-input-method: cyrillic-yawerty -->
+<!-- alternative-dictionary: "russian" -->
+<!-- End: -->
diff --git a/data/eg8.xml b/data/eg8.xml
new file mode 100644
index 0000000..e71df6f
--- /dev/null
+++ b/data/eg8.xml
@@ -0,0 +1,438 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Copyright (C) 2004 Sergey Poznyakoff
+
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the file COPYING.FDL -->
+
+<DICT>
+<T ID="Οικογένεια -- Επαγγέλματα">
+
+<NODE>
+ <K>εργάζομαι</K>
+ <P>μετ.</P>
+ <M>работать</M>
+ <X>δουλεύω</X>
+</NODE>
+
+<NODE>
+ <K>ετοιμάζω</K>
+ <P>μετ.</P>
+ <M>готовить</M>
+</NODE>
+
+<NODE>
+ <K>πετυχαίνω</K>
+ <P ID="μετ.">
+ <M>встречать, находить (<C>случайно</C>)</M>
+ </P>
+ <P ID="αμετ.">
+ <M>достигать цели, иметь успех. η παράσταση πέτυχε спектакль удался</M>
+ <M>удаваться</M>
+ </P>
+</NODE>
+
+<NODE>
+ <K>τελειώνω</K>
+ <P>μετ.</P>
+ <M>заканчивать</M>
+</NODE>
+
+<NODE>
+ <K>δουλεύω</K>
+ <P>αμετ.</P>
+ <M>работать</M>
+</NODE>
+
+<NODE>
+ <K>μαζεύω</K>
+ <P>μετ.</P>
+ <M>собирать</M>
+</NODE>
+
+<NODE>
+ <K>γνωρίζω</K>
+ <P>μετ.</P>
+ <M>знакомить</M>
+ <M>знать</M>
+ <M>узнавать</M>
+</NODE>
+
+<NODE>
+ <K>κουράζω</K>
+ <P>αμετ.</P>
+ <M>уставать</M>
+</NODE>
+
+<NODE>
+ <K>δυσκολεύω</K>
+ <P>μετ.</P>
+ <M>затруднять, осложнять</M>
+</NODE>
+
+<NODE>
+ <K>αναγνωρίζω</K>
+ <P>μετ.</P>
+ <M>узнавать</M>
+ <M>признавать</M>
+</NODE>
+
+<NODE>
+ <K>οικογένεια</K>
+ <P>η</P>
+ <M>семья</M>
+</NODE>
+
+<NODE>
+ <K>μέλος</K>
+ <P>το</P>
+ <M>член</M>
+</NODE>
+
+<NODE>
+ <K>χρονιά</K>
+ <P>η</P>
+ <M>время</M>
+ <M>год</M>
+ <M>χρόνος</M>
+</NODE>
+
+<NODE>
+ <K>μηχάνημα</K>
+ <P>το</P>
+ <M>устройство</M>
+ <M>механизм</M>
+ <M>прибор</M>
+</NODE>
+
+<NODE>
+ <K>ηλεκτρονικός</K>
+ <P>επίθ.</P>
+ <M>электронный</M>
+</NODE>
+
+<NODE>
+ <K>σχολή</K>
+ <P>η</P>
+ <M>школа</M>
+ <M>училище</M>
+ <M>факультет</M>
+</NODE>
+
+<NODE>
+ <K>μηχανικός</K>
+ <P>επίθ.</P>
+ <M>Механический</M>
+</NODE>
+
+<NODE>
+ <K>συνεργείο</K>
+ <P>το</P>
+ <M>бригада, артель</M>
+ <M>мастерская, цех</M>
+</NODE>
+
+<NODE>
+ <K>βιοτεχνία</K>
+ <P>η</P>
+ <M>ремесленное производство</M>
+</NODE>
+
+<NODE>
+ <K>σύνταξη</K>
+ <P>η</P>
+ <M>редактирование</M>
+ <M>составление</M>
+ <M>пенсия</M>
+ <M>синтаксис</M>
+</NODE>
+
+<NODE>
+ <K>ένσημο</K>
+ <P>το</P>
+ <M>гербовая марка</M>
+</NODE>
+
+<NODE>
+ <K>οικιακός</K>
+ <P>ο</P>
+ <M>домашний, относящийся к дому</M>
+ <M>τα οικιακά домашние заботы</M>
+</NODE>
+
+<NODE>
+ <K>νιάτα</K>
+ <P>τα</P>
+ <M>молодость</M>
+ <M>να χαρής τα ~ σου ... умоляю ...</M>
+ <M>τα ~ και τα γρόσια δεν κρύβονται <C>посл.</C> молодость и деньги
+ не скроешь</M>
+</NODE>
+
+<NODE>
+ <K>λεβέντης</K>
+ <P>ο</P>
+ <M>молодец</M>
+ <M>богатырь</M>
+</NODE>
+
+<NODE>
+ <K>ελιά</K>
+ <P>η</P>
+ <M>маслина</M>
+</NODE>
+
+<NODE>
+ <K>χτίστης</K>
+ <P>ο</P>
+ <M>строитель, каменщик</M>
+ <M><C>перен.</C> создатель, творец</M>
+</NODE>
+
+<NODE>
+ <K>χωριό</K>
+ <P>το</P>
+ <M>деревня, село</M>
+</NODE>
+
+<NODE>
+ <K>αργία</K>
+ <P>η</P>
+ <M>выходной</M>
+ <M>нерабочий день</M>
+</NODE>
+
+<NODE>
+ <K>Νομική</K>
+ <P>η</P>
+ <M>Юридический факультет</M>
+</NODE>
+
+<NODE>
+ <K>εστιατόριο</K>
+ <P>το</P>
+ <M>ресторан</M>
+ <M>столовая</M>
+</NODE>
+
+<NODE>
+ <K>φωτογραφία</K>
+ <P>η</P>
+ <M>фотография</M>
+</NODE>
+
+<NODE>
+ <K>πρόσωπο</K>
+ <P>το</P>
+ <M>лицо (<C>также перен.</C>)</M>
+</NODE>
+
+<NODE>
+ <K>συμμαθητής</K>
+ <P>ο</P>
+ <M>соученик</M>
+ <X>συμμαθήτρια</X>
+</NODE>
+
+<NODE>
+ <K>συμμαθήτρια</K>
+ <P>η</P>
+ <M>соученица</M>
+</NODE>
+
+<NODE>
+ <K>εργοστάσιο</K>
+ <P>το</P>
+ <M>завод</M>
+ <M>фабрика</M>
+</NODE>
+
+<T ID="επαγγέλματα">
+<NODE>
+ <K>δάσκαλος</K>
+ <P>ο</P>
+ <M>учитель</M>
+ <X>δασκάλα</X>
+</NODE>
+
+<NODE>
+ <K>δασκάλα</K>
+ <P>η</P>
+ <M>учительница</M>
+</NODE>
+
+<NODE>
+ <K>καθηγητής</K>
+ <P>ο</P>
+ <M>преподаватель</M>
+ <M>профессор</M>
+</NODE>
+
+<NODE>
+ <K>βιβλιοπώλης</K>
+ <P>ο</P>
+ <M>продавец книг</M>
+</NODE>
+
+<NODE>
+ <K>επιχειρηματίας</K>
+ <P>ο</P>
+ <M>предприниматель, делец</M>
+</NODE>
+
+<NODE>
+ <K>ηλεκτρολόγος</K>
+ <P>ο</P>
+ <M>электрик</M>
+</NODE>
+
+<NODE>
+ <K>ηλεκτρονικός</K>
+ <P>ο</P>
+ <M>электронщик</M>
+</NODE>
+
+<NODE>
+ <K>τεχνίτης</K>
+ <P>ο</P>
+ <M>ремесленник</M>
+ <M>мастер</M>
+</NODE>
+
+<NODE>
+ <K>επιστήμπνας</K>
+ <P>ο</P>
+ <M>учёный</M>
+</NODE>
+
+<NODE>
+ <K>ράφτης</K>
+ <P>ο</P>
+ <M>портной</M>
+</NODE>
+
+<NODE>
+ <K>μαραγκός</K>
+ <K>ξυλουργός</K>
+ <P>ο</P>
+ <M>столяр</M>
+ <M>плотник</M>
+ <X>ξυλουργός</X>
+</NODE>
+
+<NODE>
+ <K>επιπλοποιός</K>
+ <P>ο</P>
+ <M>мебельщик</M>
+</NODE>
+
+<NODE>
+ <K>γεωργός</K>
+ <P>ο</P>
+ <M>крестьянин</M>
+ <M>земледелец</M>
+ <X>αγρότης</X>
+</NODE>
+
+<NODE>
+ <K>κτηνοτρόφος</K>
+ <P>ο</P>
+ <M>скотовод</M>
+</NODE>
+
+<NODE>
+ <K>καλλιτέχνης</K>
+ <P>ο</P>
+ <M>художник</M>
+</NODE>
+
+<NODE>
+ <K>διμοσιογράφος</K>
+ <P>ο</P>
+ <M>журналист</M>
+</NODE>
+
+<NODE>
+ <K>ελαιοχρωματιστής</K>
+ <P>ο</P>
+ <M>маляр</M>
+</NODE>
+
+<NODE>
+ <K>μηχανικός</K>
+ <P>ο,η</P>
+ <M>инженер</M>
+</NODE>
+
+<NODE>
+ <K>μοδίστρα</K>
+ <P>η</P>
+ <M>швея</M>
+</NODE>
+
+<NODE>
+ <K>μαγείρισσα</K>
+ <P>η</P>
+ <M>повариха</M>
+ <M>кухарка</M>
+</NODE>
+
+<NODE>
+ <K>οικοδόμος</K>
+ <P>ο</P>
+ <M>строитель</M>
+</NODE>
+
+<NODE>
+ <K>αγρότης</K>
+ <P>ο</P>
+ <M>крестьянин</M>
+ <A>αγρότισσα</A>
+</NODE>
+
+<NODE>
+ <K>αγρότισσα</K>
+ <P>η</P>
+ <M>крестьянка</M>
+</NODE>
+
+<NODE>
+ <K>φοιτητής</K>
+ <P>ο</P>
+ <M>ученик</M>
+</NODE>
+
+<NODE>
+ <K>τραπεζικός</K>
+ <P>ο</P>
+ <M>банковский служащий</M>
+</NODE>
+
+<NODE>
+ <K>αρηιτέκτονας</K>
+ <P>ο</P>
+ <M>архитектор</M>
+</NODE>
+
+<NODE>
+ <K>στέλεχος</K>
+ <P>ο</P>
+ <M>руководитель</M>
+ <M>деятель</M>
+ <M><C>πλ.</C> кадры</M>
+</NODE>
+
+</T> <!-- "επαγγέλματα" -->
+
+</T>
+</DICT>
+
+<!-- Local Variables: -->
+<!-- mode: ellinika-dict -->
+<!-- buffer-file-coding-system: utf-8 -->
+<!-- alternative-input-method: cyrillic-yawerty -->
+<!-- alternative-dictionary: "russian" -->
+<!-- End: -->
diff --git a/data/eg9.xml b/data/eg9.xml
new file mode 100644
index 0000000..075ac47
--- /dev/null
+++ b/data/eg9.xml
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Copyright (C) 2004 Sergey Poznyakoff
+
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the file COPYING.FDL -->
+
+<DICT>
+
+<T ID="Ψάχνοντας για δουλειά">
+
+<NODE>
+ <K>πληθαίνω</K>
+ <P ID="μετ.">
+ <M>умножать, увеличивать</M>
+ </P>
+ <P ID="αμετ.">
+ <M>умножаться</M>
+ <M>разможаться</M>
+ </P>
+</NODE>
+
+<NODE>
+ <K>έρχομαι</K>
+ <F>αόρ. ήλθα, ήρθα - μελλ. θα έλθω, έρθω - προστ. έλα, έλατε</F>
+ <P>αμετ.</P>
+ <M>идти <C>одкуда-л.</C>, приходить, прибывать, приезжать</M>
+</NODE>
+
+<NODE>
+ <K>εγκαθιστώ</K>
+ <F>αόρ. ςγκατέστησα</F>
+ <P>μετ.</P>
+ <M>устраивать, определять</M>
+ <M>поселять</M>
+ <M>назначать</M>
+</NODE>
+
+<NODE>
+ <K>πιστεύω</K>
+ <P>αμετ.</P>
+ <M>верить</M>
+ <M>полагать, считать</M>
+</NODE>
+
+<NODE>
+ <K>αντιμετωπίζω</K>
+ <P>μετ.</P>
+ <M>противостоять, давать отпор</M>
+</NODE>
+
+<NODE>
+ <K>χάνω</K>
+ <P ID="μετ.">
+ <M>терять</M>
+ </P>
+ <P ID="αμετ.">
+ <M>проиграть, потерпеть поражение</M>
+ </P>
+</NODE>
+
+<NODE>
+ <K>προσλαμβάνω</K>
+ <F>αόρ. προσέλαβα, παθ.αόρ. προσλήφθηκα</F>
+ <P>μετ.</P>
+ <M>брать, принимать (<C>на работу и т.п.</C>)</M>
+ <M>принимать (<C>цвет и т.п.</C>). ~ ύφος принимать позу</M>
+ <M>воспринимать</M>
+</NODE>
+
+<NODE>
+ <K>αναλαμβάνω</K>
+ <F>αόρ. ανέλαβα, παθ.αόρ. ανελήφθηκα</F>
+ <P ID="μετ.">
+ <M>поднимать, брать в руки</M>
+ <M>брать, принимать на себя (<C>обязанности и т.п.</C>)</M>
+ <M>приступать <C>к чему-л.</C>, браться <C>за что-л.</C></M>
+ <M>взять обратно, вынуть (<C>вклад и т.п.</C>)</M>
+ </P>
+ <P ID="αμετ.">
+ <M>выздоравливать, поправляться, приходить в себя</M>
+ <M>оживляться (<C>о рынке и т.п.</C>)</M>
+ </P>
+</NODE>
+
+<NODE>
+ <K>ενδιαφέρω</K>
+ <F>только ενεστ. и παρατ.</F>
+ <P ID="μετ.">
+ <M>интересовать, заинтересовывать, занимать</M>
+ </P>
+ <P ID="αμετ.">
+ <M>представлять интерес, иметь значение</M>
+ </P>
+</NODE>
+
+<NODE>
+ <K>μισθός</K>
+ <P>ο</P>
+ <M>зарплата</M>
+</NODE>
+
+<NODE>
+ <K>συνθήκη</K>
+ <P>η</P>
+ <M>условие, договор, соглашение</M>
+</NODE>
+
+<NODE>
+ <K>εργασία</K>
+ <P>η</P>
+ <M>труд, работа</M>
+</NODE>
+
+<NODE>
+ <K>γεωπόνος</K>
+ <P>ο</P>
+ <M>агроном</M>
+ <T ID="επαγγέλματα" />
+</NODE>
+
+<NODE>
+ <K>ανεργία</K>
+ <P>η</P>
+ <M>безработица</M>
+</NODE>
+
+<NODE>
+ <K>γραφείο</K>
+ <P>το</P>
+ <M>бюро, контора</M>
+ <M>письменный стол</M>
+ <M>рабочий кабинет</M>
+</NODE>
+
+<NODE>
+ <K>πόλη</K>
+ <P>η</P>
+ <M>город</M>
+</NODE>
+
+<NODE>
+ <K>αφεντικό</K>
+ <P>το</P>
+ <M>хозяин, начальник</M>
+</NODE>
+
+<NODE>
+ <K>οικοδομή</K>
+ <P>η</P>
+ <M>стройка</M>
+</NODE>
+
+<NODE>
+ <K>μεροκάματο</K>
+ <P>το</P>
+ <M>дневной заработок</M>
+</NODE>
+
+<NODE>
+ <K>τέλος</K>
+ <P>το</P>
+ <M>конец</M>
+</NODE>
+
+<NODE>
+ <K>φύλακας</K>
+ <P>ο</P>
+ <M>сторож</M>
+</NODE>
+
+<NODE>
+ <K>δύσκολος</K>
+ <P>επίθ.</P>
+ <M>сложный</M>
+</NODE>
+
+<NODE>
+ <K>σημαντικός</K>
+ <P>επίθ.</P>
+ <M>значительный, важный</M>
+</NODE>
+
+<NODE>
+ <K>επαρχιακός</K>
+ <P>επίθ.</P>
+ <M>провинциальный</M>
+</NODE>
+
+<NODE>
+ <K>γεωργικός</K>
+ <P>επίθ.</P>
+ <M>сельскохозяйственный</M>
+</NODE>
+
+<NODE>
+ <K>σκληρός</K>
+ <P>επίθ.</P>
+ <M>твёрдый, жёсткий</M>
+ <M>жестокий, бессердечный</M>
+ <M>трудный, тяжёлый</M>
+</NODE>
+
+<NODE>
+ <K>άδικα</K>
+ <P>επίρρ.</P>
+ <M>напрасно, зря</M>
+ <M>несправедливо</M>
+</NODE>
+
+<NODE>
+ <K>δοκιμαστικός</K>
+ <P>επίθ.</P>
+ <M>испытательный, опытный, экспериментальный</M>
+</NODE>
+
+<NODE>
+ <K>παραπάνω</K>
+ <P ID="επίρρ.">
+ <M>выше, дальше</M>
+ <M>больше ~ από сверх, кроме</M>
+ </P>
+ <P ID="το">
+ <M>избыток, излишек</M>
+ <M>με το ~ чересчур, слишком</M>
+ </P>
+</NODE>
+</T>
+</DICT>
+
+<!-- Local Variables: -->
+<!-- mode: ellinika-dict -->
+<!-- buffer-file-coding-system: utf-8 -->
+<!-- alternative-input-method: cyrillic-yawerty -->
+<!-- alternative-dictionary: "russian" -->
+<!-- End: -->
diff --git a/ellinika/cgi.scmi b/ellinika/cgi.scmi
new file mode 100644
index 0000000..604d71b
--- /dev/null
+++ b/ellinika/cgi.scmi
@@ -0,0 +1,109 @@
+;;;; -*- scheme -*-
+=AUTOGENERATED=
+;;;; Greek Dictionary Web Engine
+;;;; Copyright (C) 2005 Sergey Poznyakoff
+;;;;
+;;;; This program is free software; you can redistribute it and/or modify
+;;;; it under the terms of the GNU General Public License as published by
+;;;; the Free Software Foundation; either version 2 of the License, or
+;;;; (at your option) any later version.
+;;;;
+;;;; This program is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with this program; if not, write to the Free Software
+;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+;;;;
+
+(define-module (ellinika cgi))
+
+(use-modules (www cgi)
+ (gamma gettext))
+
+;;; User-definable variables
+(define-public base-dir "=PREFIX=")
+(define-public html-dir "=HTMLDIR=")
+(define-public sysconf-dir "=SYSCONFDIR=")
+(define-public locale-dir "=LOCALEDIR=")
+(define-public ref-loc #f)
+
+(define-public dict-cgi-path "cgi-bin/dict.cgi")
+(define-public nea-cgi-path "cgi-bin/nea.cgi") ;; Path to the cgi (relative
+ ;; to the Base HREF)
+
+(define-public config-file-name "ellinika.conf")
+(define-public dict-template-file-name "dict.html")
+(define-public nea-template-file-name "nea.html")
+(define-public target-language "el_GR")
+
+(define-public word-forms-reference '())
+
+(define-public sql-iface "mysql") ;; SQL interface ("mysql" or "postgres")
+(define-public sql-host "localhost") ;; SQL server hostname or a path to the UNIX
+ ;; socket
+(define-public sql-port 3306) ;; SQL port number (0 for sockaddr_un
+ ;; connection)
+(define-public sql-database "ellinika") ;; Name of the database
+(define-public sql-username "gray") ;; Database user name
+(define-public sql-password "") ;; Password for that user name
+
+(define-public match-list-columns 4) ;; Number of colums in fuzzy search output
+;;; End of user-definable variables
+
+(define-public (language-code lang)
+ (cond
+ ((string-index lang #\_) =>
+ (lambda (len)
+ (substring lang 0 len)))
+ (else
+ lang)))
+
+(define-public (template-file lang template-file-name)
+ (string-append html-dir "/" (language-code lang) "/" template-file-name))
+
+(define-public (make-cgi-name cgi-path . rest)
+ (apply
+ string-append
+ (cons
+ cgi-path
+ (let ((arglist (let ((lang (cgi:value "LANG")))
+ (do ((ilist (if lang
+ (cons "LANG" (cons lang rest))
+ rest) (cdr ilist))
+ (i 1 (1+ i))
+ (olist '()))
+ ((null? ilist) (if (null? olist)
+ olist
+ (reverse (cdr olist))))
+ (set! olist (cons (car ilist) olist))
+ (set! olist (cons
+ (if (odd? i) "=" "&amp;")
+ olist))))))
+ (if (null? arglist)
+ arglist
+ (cons "?" arglist))))))
+
+(define-public (ellinika-cgi-init template-file-name)
+ ;;; Load the site defaults
+ (let ((rc-file (string-append sysconf-dir "/" config-file-name)))
+ (if (file-exists? rc-file)
+ (load rc-file)))
+
+;;; Load the language-specific defaults
+ (cond
+ ((cgi:value "LANG") =>
+ (lambda (x)
+ (if (and (file-exists? (template-file x template-file-name))
+ (false-if-exception (setlocale LC_ALL x)))
+ (set! target-language x)))))
+
+;;; Initialize i18n
+ (setlocale LC_ALL target-language)
+ (bindtextdomain "=PACKAGE=" locale-dir)
+ (bind_textdomain_codeset "=PACKAGE=" "UTF-8")
+ (textdomain "=PACKAGE="))
+
+;;; End of cgi.scmi

Return to:

Send suggestions and report system problems to the System administrator.