1 ;; -*- coding: utf-8-mcs-er -*-
2 (require 'cwiki-common)
4 (defvar chise-wiki-view-url "view.cgi")
5 (defvar chise-wiki-edit-url "edit.cgi")
6 (defvar chise-wiki-add-url "add.cgi")
8 (defun www-display-object-desc (genre uri-object &optional lang level simple)
11 (let ((object (www-uri-decode-object genre uri-object))
12 logical-feature chise-wiki-displayed-features
16 (when (and (eq genre 'character)
17 (= (length uri-object) 1))
18 (setq uri-object (www-uri-encode-object object)))
23 <title>EsT %s = %s</title>
26 (decode-uri-string uri-object 'utf-8-mcs-er))
29 (when (eq genre 'character)
30 (dolist (feature (char-feature-property '$object 'additional-features))
31 (mount-char-attribute-table
32 (char-feature-name-at-domain feature '$rev=latest))))
36 "<div style=\"text-align:right;\">
37 <a href=\"edit/view.cgi?char=%s\">
38 <input type=\"submit\" value=\"Edit\" />
40 <input type=\"submit\" value=\"New Account\" />
43 "<div style=\"text-align:right;\">
44 <a href=\"../view.cgi?char=%s\">
45 <input type=\"submit\" value=\"Simple\" />
50 (when (setq parents (www-get-feature-value object '<-denotational))
51 (princ (format "<p>%s %s</p>\n<hr>\n"
52 (www-format-value-as-char-list parents)
53 (www-format-feature-name '->denotational lang))))
54 (when (setq parents (www-get-feature-value object '<-subsumptive))
55 (princ (format "<p>%s %s</p>\n<hr>\n"
56 (www-format-value-as-char-list parents)
57 (www-format-feature-name '->subsumptive lang))))
58 (when (eq genre 'character)
59 (setq GlyphWiki-id (char-GlyphWiki-id object)))
60 (princ (format "<h%d>%s%s</h%d>\n"
62 (www-format-encode-string
63 (est-format-object object)
64 ;; (if (eq genre 'character)
65 ;; (char-to-string object)
66 ;; (format "%s" (concord-object-id object)))
70 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
72 GlyphWiki-id GlyphWiki-id)
77 (dolist (cell (sort (if (eq genre 'character)
78 (char-attribute-alist object)
79 (concord-object-spec object))
82 (char-feature-name-sans-versions (car a))
83 (char-feature-name-sans-versions (car b))))))
84 (setq logical-feature (char-feature-name-sans-versions (car cell)))
85 (unless (memq logical-feature chise-wiki-displayed-features)
86 (push logical-feature chise-wiki-displayed-features)
89 "<div class=\"feature\" style=\"line-height:150%\">\n"
93 (www-feature-format logical-feature)
95 logical-feature ; (car cell)
100 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
101 ><input type=\"submit\" value=\"note\" /></a>"
103 (www-format-encode-string uri-object)
104 (www-format-encode-string
105 (www-uri-encode-feature-name
106 (intern (format "%s*note"
107 logical-feature ; (car cell)
120 (format "<a href=\"%s?char=%s\"
121 ><input type=\"submit\" value=\"add feature\" /></a>
124 (www-format-encode-string uri-object))))
129 (when (eq genre 'character)
131 "<form action=\"http://www.chise.org/ids-find\">\n")
133 (www-format-encode-string
134 (est-format-object object)
135 ;; (if (eq genre 'character)
136 ;; (format "%c" object)
137 ;; (format "%s" (concord-object-id object)))
141 " <input type=\"text\" name=\"components\"
142 size=\"30\" maxlength=\"30\" value=\"%s\" />"
143 (encode-coding-string
144 (est-format-object object)
145 ;; (if (eq genre 'character)
146 ;; (char-to-string object)
147 ;; (format "%s" (concord-object-id object)))
150 (www-format-encode-string
151 "ă\u542Bă\u6F22\u5B57ă\u63A2ă"))
152 (princ " <input type=\"submit\" value=\"search\" />\n")
160 (defun www-display-feature-desc (uri-feature-name uri-object
161 &optional lang simple)
162 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
163 (name@lang (intern (format "name@%s" lang))))
165 (encode-coding-string
167 <title>EsT feature: %s</title>
175 "<div style=\"text-align:right;\">
176 <a href=\"edit/view.cgi?feature=%s&char=%s\">
177 <input type=\"submit\" value=\"Edit\" />
179 <input type=\"submit\" value=\"New Account\" />
182 "<div style=\"text-align:right;\">
183 <a href=\"../view.cgi?feature=%s&char=%s\">
184 <input type=\"submit\" value=\"Simple\" />
188 uri-feature-name uri-object))
190 (format "<h1>%s</h1>\n"
191 (www-format-encode-string
192 (symbol-name feature-name))))
193 (princ (format "<p>name : %s "
194 (or (www-format-feature-name feature-name) "")))
198 " <a href=\"%s?feature=%s&property=name&format=string&char=%s\">"
202 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
207 (www-format-encode-string
210 (or (char-feature-property feature-name name@lang) ""))))
214 " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\">"
219 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
221 (www-html-display-paragraph
223 (or (www-feature-type feature-name)
224 ;; (char-feature-property feature-name 'type)
226 (princ (format "<p>value-format : %s "
229 (or (www-feature-value-format feature-name)
236 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
241 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
244 (princ "<p>format : ")
245 (www-html-display-text
246 (decode-coding-string
248 (www-feature-format feature-name))
253 " <a href=\"%s?feature=%s&property=format&format=wiki-text&char=%s\"
258 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
261 (www-html-display-paragraph
262 (format "description : %s"
263 (or (char-feature-property feature-name 'description)
266 (www-html-display-paragraph
267 (format "description@%s : %s"
269 (or (char-feature-property
271 (intern (format "description@%s" lang)))
275 (defun www-batch-view ()
276 (setq terminal-coding-system 'binary)
278 (let* ((target (pop command-line-args-left))
279 (user (pop command-line-args-left))
280 (accept-language (pop command-line-args-left))
281 (mode (intern (pop command-line-args-left)))
286 (car (split-string accept-language ","))
290 (princ "Content-Type: text/html; charset=UTF-8
292 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
293 \"http://www.w3.org/TR/html4/loose.dtd\">
298 (when (string-match "^char=\\(&[^&;]+;\\)" target)
299 (setq ret (match-end 0))
302 (www-uri-encode-object
303 (www-uri-decode-object
304 'character (match-string 1 target)))
305 (substring target ret))))
307 (mapcar (lambda (cell)
308 (if (string-match "=" cell)
312 (substring cell 0 (match-beginning 0))
314 (substring cell (match-end 0)))
315 (list (decode-uri-string cell 'utf-8-mcs-er))))
316 (split-string target "&")))
317 (setq ret (car target))
318 (cond ((eq (car ret) 'char)
319 (www-display-object-desc
325 ((eq (car ret) 'feature)
326 (www-display-feature-desc
327 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
328 (cdr (assq 'char target))
333 (www-display-object-desc
341 (princ (format "mode=%S\n" mode))
342 (princ (format "user=%s\n" user))
343 ;; (princ (format "local user=%s\n" (user-login-name)))
344 (princ (format "lang=%S\n" lang))
345 (princ (encode-coding-string (emacs-version) 'utf-8-jp-er))
347 ;; (princ xemacs-chise-version)
353 (princ (format "%S" err)))
356 (provide 'cwiki-view)