1 ;; -*- coding: utf-8-mcs-er -*-
2 (require 'cwiki-common)
5 (defvar chise-wiki-view-url "view.cgi")
6 (defvar chise-wiki-edit-url "edit.cgi")
7 (defvar chise-wiki-add-url "add.cgi")
9 (defun www-display-object-desc (genre uri-object &optional lang level simple)
12 (let ((object (www-uri-decode-object genre uri-object))
13 logical-feature chise-wiki-displayed-features
17 (when (and (eq genre 'character)
18 (= (length uri-object) 1))
19 (setq uri-object (www-uri-encode-object object)))
24 <title>EsT %s = %s</title>
27 (decode-uri-string uri-object 'utf-8-mcs-er))
30 (when (eq genre 'character)
31 (dolist (feature (char-feature-property '$object 'additional-features))
32 (mount-char-attribute-table
33 (char-feature-name-at-domain feature '$rev=latest))))
37 "<div style=\"text-align:right;\">
38 <a href=\"edit/view.cgi?%s=%s\">
39 <input type=\"submit\" value=\"Edit\" />
41 <input type=\"submit\" value=\"New Account\" />
44 "<div style=\"text-align:right;\">
45 <a href=\"../view.cgi?%s=%s\">
46 <input type=\"submit\" value=\"Simple\" />
52 (when (setq parents (www-get-feature-value object '<-denotational))
53 (princ (format "<p>%s %s</p>\n<hr>\n"
54 (www-format-value-as-char-list parents)
55 (www-format-feature-name '->denotational lang))))
56 (when (setq parents (www-get-feature-value object '<-subsumptive))
57 (princ (format "<p>%s %s</p>\n<hr>\n"
58 (www-format-value-as-char-list parents)
59 (www-format-feature-name '->subsumptive lang))))
60 (when (eq genre 'character)
61 (setq GlyphWiki-id (char-GlyphWiki-id object)))
62 (princ (format "<h%d>%s%s</h%d>\n"
64 (www-format-encode-string
65 (est-format-object object)
66 ;; (if (eq genre 'character)
67 ;; (char-to-string object)
68 ;; (format "%s" (concord-object-id object)))
72 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
74 GlyphWiki-id GlyphWiki-id)
79 (dolist (cell (sort (if (eq genre 'character)
80 (char-attribute-alist object)
81 (concord-object-spec object))
84 (char-feature-name-sans-versions (car a))
85 (char-feature-name-sans-versions (car b))))))
86 (setq logical-feature (char-feature-name-sans-versions (car cell)))
87 (unless (memq logical-feature chise-wiki-displayed-features)
88 (push logical-feature chise-wiki-displayed-features)
91 "<div class=\"feature\" style=\"line-height:150%\">\n"
95 (www-feature-format logical-feature)
97 logical-feature ; (car cell)
102 (format " <a href=\"%s?%s=%s&feature=%s&format=wiki-text\"
103 ><input type=\"submit\" value=\"note\" /></a>"
106 (www-format-encode-string uri-object)
107 (www-format-encode-string
108 (www-uri-encode-feature-name
109 (intern (format "%s*note"
110 logical-feature ; (car cell)
123 (format "<a href=\"%s?%s=%s\"
124 ><input type=\"submit\" value=\"add feature\" /></a>
128 (www-format-encode-string uri-object))))
133 (when (eq genre 'character)
135 "<form action=\"http://www.chise.org/ids-find\">\n")
137 (www-format-encode-string
138 (est-format-object object)
139 ;; (if (eq genre 'character)
140 ;; (format "%c" object)
141 ;; (format "%s" (concord-object-id object)))
145 " <input type=\"text\" name=\"components\"
146 size=\"30\" maxlength=\"30\" value=\"%s\" />"
147 (encode-coding-string
148 (est-format-object object)
149 ;; (if (eq genre 'character)
150 ;; (char-to-string object)
151 ;; (format "%s" (concord-object-id object)))
154 (www-format-encode-string
155 "ă\u542Bă\u6F22\u5B57ă\u63A2ă"))
156 (princ " <input type=\"submit\" value=\"search\" />\n")
164 (defun www-display-feature-desc (uri-feature-name genre uri-object
165 &optional lang simple)
166 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
167 (name@lang (intern (format "name@%s" lang))))
169 (encode-coding-string
171 <title>EsT feature: %s</title>
179 "<div style=\"text-align:right;\">
180 <a href=\"edit/view.cgi?feature=%s&%s=%s\">
181 <input type=\"submit\" value=\"Edit\" />
183 <input type=\"submit\" value=\"New Account\" />
186 "<div style=\"text-align:right;\">
187 <a href=\"../view.cgi?feature=%s&%s=%s\">
188 <input type=\"submit\" value=\"Simple\" />
192 uri-feature-name genre uri-object))
194 (format "<h1>%s</h1>\n"
195 (www-format-encode-string
196 (symbol-name feature-name))))
197 (princ (format "<p>name : %s "
198 (or (www-format-feature-name feature-name) "")))
202 " <a href=\"%s?feature=%s&property=name&format=string&%s=%s\">"
207 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
212 (www-format-encode-string
215 (or (char-feature-property feature-name name@lang) ""))))
219 " <a href=\"%s?feature=%s&property=%s&format=string&%s=%s\">"
225 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
227 (www-html-display-paragraph
229 (or (www-feature-type feature-name)
230 ;; (char-feature-property feature-name 'type)
232 (princ (format "<p>value-format : %s "
235 (or (www-feature-value-format feature-name)
242 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&%s=%s\"
248 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
251 (princ "<p>format : ")
252 (www-html-display-text
253 (decode-coding-string
255 (www-feature-format feature-name))
260 " <a href=\"%s?feature=%s&property=format&format=wiki-text&%s=%s\"
266 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
269 (www-html-display-paragraph
270 (format "description : %s"
271 (or (char-feature-property feature-name 'description)
274 (www-html-display-paragraph
275 (format "description@%s : %s"
277 (or (char-feature-property
279 (intern (format "description@%s" lang)))
283 (defun www-batch-view ()
284 (setq terminal-coding-system 'binary)
286 (let* ((target (pop command-line-args-left))
287 (user (pop command-line-args-left))
288 (accept-language (pop command-line-args-left))
289 (mode (intern (pop command-line-args-left)))
294 (car (split-string accept-language ","))
298 (princ "Content-Type: text/html; charset=UTF-8
300 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
301 \"http://www.w3.org/TR/html4/loose.dtd\">
306 (when (string-match "^char=\\(&[^&;]+;\\)" target)
307 (setq ret (match-end 0))
310 (www-uri-encode-object
311 (www-uri-decode-object
312 'character (match-string 1 target)))
313 (substring target ret))))
315 (mapcar (lambda (cell)
316 (if (string-match "=" cell)
320 (substring cell 0 (match-beginning 0))
322 (substring cell (match-end 0)))
323 (list (decode-uri-string cell 'utf-8-mcs-er))))
324 (split-string target "&")))
325 (setq ret (car target))
326 (cond ((eq (car ret) 'char)
327 (www-display-object-desc
333 ((eq (car ret) 'feature)
334 (www-display-feature-desc
335 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
337 (cdr (assq 'char target))
342 (www-display-object-desc
350 (princ (format "mode=%S\n" mode))
351 (princ (format "user=%s\n" user))
352 ;; (princ (format "local user=%s\n" (user-login-name)))
353 (princ (format "lang=%S\n" lang))
354 (princ (encode-coding-string (emacs-version) 'utf-8-jp-er))
356 ;; (princ xemacs-chise-version)
362 (princ (format "%S" err)))
365 (provide 'cwiki-view)