aboutsummaryrefslogtreecommitdiff
path: root/cgi-bin
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-06-13 16:52:32 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-06-13 16:52:32 +0000
commit85b9be5b1a35ed0806baca33b4c2c48982bc7b7b (patch)
treebe4b8b29788a01ae350db2bfc7e5c16a8c2be523 /cgi-bin
parentfe64dd60a586677968ca734c2dd189a5c03874c9 (diff)
downloadellinika-85b9be5b1a35ed0806baca33b4c2c48982bc7b7b.tar.gz
ellinika-85b9be5b1a35ed0806baca33b4c2c48982bc7b7b.tar.bz2
Display dictionary stats
git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@114 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'cgi-bin')
-rw-r--r--cgi-bin/dict.cgi.in37
1 files changed, 37 insertions, 0 deletions
diff --git a/cgi-bin/dict.cgi.in b/cgi-bin/dict.cgi.in
index 1b69d19..188e259 100644
--- a/cgi-bin/dict.cgi.in
+++ b/cgi-bin/dict.cgi.in
@@ -793,6 +793,34 @@
;;;
+(define (stat key)
+ (let ((stat-data #f))
+ (if (not stat-data)
+ (set! stat-data (let ((conn (sql-connect
+ sql-iface sql-host sql-port sql-database
+ sql-username sql-password)))
+ (cond
+ (conn
+ (let ((x (sql-query conn
+ "SELECT count,updated from stat")))
+ (sql-connect-close conn)
+ x))
+ (else
+ '())))))
+
+ (if (null? stat-data)
+ "<>"
+ (case key
+ ((#:updated)
+ (list-ref (car stat-data) 1))
+ ((#:count)
+ (list-ref (car stat-data) 0))
+ (else
+ "<>")))))
+
+
+;;;
+
(define (dict-html)
(do ((line (read-line) (read-line)))
((eof-object? line) #f)
@@ -800,6 +828,15 @@
((string=? line "@@dict@@")
(main-form)
(dict-search))
+ ((string=? line "@@stat_updated@@")
+ (display (stat #:updated)))
+ ((string=? line "@@stat_count@@")
+ (display
+ (let ((s (stat #:count)))
+ (if (string=? s "<>")
+ s
+ (let ((n (string->number s)))
+ (string-append s " " (ngettext "λέξη" "λέξεις" n)))))))
(else
(display line)
(newline)))))

Return to:

Send suggestions and report system problems to the System administrator.