aboutsummaryrefslogtreecommitdiff
path: root/ellinika/cgi.scmi
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2005-02-13 23:07:13 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2005-02-13 23:07:13 +0000
commit543b8a04841f1e4f526b1b12e329e9ec2a9d3063 (patch)
tree836fbbfd0f5086a93357543842e004d39edd41a3 /ellinika/cgi.scmi
parentbf108549b699e7c9893afba441d69ec5e3c91faa (diff)
downloadellinika-543b8a04841f1e4f526b1b12e329e9ec2a9d3063.tar.gz
ellinika-543b8a04841f1e4f526b1b12e329e9ec2a9d3063.tar.bz2
Added to the repository
git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@299 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'ellinika/cgi.scmi')
-rw-r--r--ellinika/cgi.scmi109
1 files changed, 109 insertions, 0 deletions
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.