diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | cgi-bin/nea.cgi.in | 131 | ||||
-rw-r--r-- | xml/ru/ellinika.xml | 9 |
3 files changed, 110 insertions, 41 deletions
@@ -1,6 +1,17 @@ +2005-06-27 Sergey Poznyakoff <gray@Noldor.runasimi.org> + + * mainstyle.css: Added new classes + * cgi-bin/dict.cgi.in: Rewritten using new Gamma. + * cgi-bin/nea.cgi.in: updated + * po/POTFILES.in: Add nea.cgi + * xml/ru/arthra.xml: Fix typo + * xml/ru/ellinika.xml: Updated + * xml/ru/lingua.conf.in: New tags. + 2005-06-26 Sergey Poznyakoff <gray@Noldor.runasimi.org> * cgi-bin/nea.cgi.in: Mostly rewritten + * ellinika/cgi.scmi (monima-nea-template-file-name): New variable. Keeps the template name for a "permanent link" news article. diff --git a/cgi-bin/nea.cgi.in b/cgi-bin/nea.cgi.in index 86bbeb0..ca609ab 100644 --- a/cgi-bin/nea.cgi.in +++ b/cgi-bin/nea.cgi.in @@ -49,7 +49,7 @@ (define (sql-error-handler err descr) (format #t "<h1 class=\"error\">~A</h1>\n" - "ΣΦΆΛΜΑ: σύνδεση με το λέξικο απέτυχε.") + (_ "ΣΦΆΛΜΑ: σύνδεση με την βάση δεδομένων απέτυχε.")) (with-output-to-port (current-error-port) (lambda () @@ -63,60 +63,109 @@ (lambda (key err descr) (sql-error-handler err descr)))) +(defmacro assert-article (expr) + `(if article + (if (null? article) + (format #t "<h1 class=\"error\">~A</h1>\n" + (_ "Κάμια καταχώρηση")) + ,expr))) + (define (summary) (catch-sql (let ((result (sql-query conn "SELECT date,header,ident FROM news ORDER BY date"))) (cond ((null? result) - (display "<div align=\"center\">No news</div>")) + (display "<div align=\"center\">") + (display (_ "Κανένα νέα")) + (display "</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>") - (display "\n</tr>\n")) - result) + (display "<table class=\"news-summary\">\n") + (let ((ctr 0)) + (for-each + (lambda (entry) + (display "<tr class=\"") + (display (if (= (modulo ctr 2) 0) "even" "odd")) + (display "\">\n") + (set! ctr (1+ ctr)) + (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>") + (display "\n</tr>\n")) + result)) (display "</table>")))))) - + +(define (display-article-header item) + (format #t "<span class=\"itemdate\">~A</span>\n" (car item)) + (display "<span class=\"itemsubject\">\n") + (display (list-ref item 2)) + (display "</span> ")) + +(define (display-article-text item . rest) + (let ((class (and (not (null? rest)) (car rest)))) + (cond + (class + (display "\n<div class=\"") + (display class) + (display "\">\n") + (display (list-ref item 3)) + (display "</div>\n")) + (else + (display (list-ref item 3)))))) + (define (main) (catch-sql - (if article - (if (null? article) - (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 (list-ref item 2)) - (display "</span> ") - - (if (not (cgi:value "timestamp")) - (permalink "span" (list-ref item 1))) - - (display "<div class=\"itemtext\">") - (display (list-ref item 3)) - (display "</div>")) - article))))) + (assert-article + (for-each + (lambda (item) + (display-article-header item) + + (if (not (cgi:value "timestamp")) + (permalink "span" (list-ref item 1))) + + (display-article-text item "itemtext")) + article)))) (define (title) (if article - (display (if (null? article) "No item" (list-ref (car article) 2))))) + (display (if (null? article) + (string-append + "<h1 class=\"error\">" + (_ "Κάμια καταχώρηση") + "</h1>") + (list-ref (car article) 2))))) (define (nea-html) (let ((explist (list (cons "@@main@@" main) (cons "@@summary@@" summary) - (cons "@@title@@" title)))) + (cons "@@title@@" title) + (cons "@@article-text@@" + (lambda () + (catch-sql + (assert-article + (display-article-text (car article)))))) + (cons "@@article-date@@" + (lambda () + (catch-sql + (assert-article + (display (caar article)))))) + (cons "@@article-header@@" + (lambda () + (catch-sql + (assert-article + (display (list-ref (car article) 2)))))) + (cons "@@full-header@@" + (lambda () + (catch-sql + (assert-article + (display-article-header + (car article))))))))) (do ((line (read-line) (read-line))) ((eof-object? line) #f) @@ -158,8 +207,14 @@ (list (cons "@@main@@" (lambda () (sql-error-handler err descr))) + (cons "@@article-text@@" + (lambda () + (sql-error-handler err descr))) (cons "@@summary@@" (lambda () #f)) - (cons "@@title@@" (lambda () #f))))) + (cons "@@title@@" (lambda () #f)) + (cons "@@article-date@@" (lambda () #f)) + (cons "@@article-header@@" (lambda () #f)) + (cons "@@full-header@@" (lambda () #f))))) (do ((line (read-line) (read-line))) ((eof-object? line) #f) (expand-template explist line) diff --git a/xml/ru/ellinika.xml b/xml/ru/ellinika.xml index c64a78d..7003fc7 100644 --- a/xml/ru/ellinika.xml +++ b/xml/ru/ellinika.xml @@ -64,8 +64,10 @@ this notice is preserved.</PARA> <INCLUDE FILE="intro.xml" /> <PAGE PREFIX="nea" HEADER="Новости сайта" REF="NEA"> -<PARA>@@main@@</PARA> -<PARA>@@summary@@</PARA> +<news> +<news:article>@@main@@</news:article> +<news:summary>@@summary@@</news:summary> +</news> </PAGE> <INCLUDE FILE="istoria.xml" /> @@ -124,7 +126,8 @@ this notice is preserved.</PARA> <GROUP TITLE="permalink" HIDDEN="1"> <PAGE PREFIX="monima" HEADER="@@title@@" REF="NEA"> -<PARA>@@main@@</PARA> +<PARA>@@article-date@@</PARA> +<news:permanent-article>@@article-text@@</news:permanent-article> </PAGE> </GROUP> |