1 ;; -*- coding: utf-8-mcs-er -*-
2 (defvar chise-wiki-view-url "view.cgi")
3 (defvar chise-wiki-edit-url "edit.cgi")
5 (require 'cwiki-format)
7 ;; (defun www-edit-display-input-box (object name value &optional format)
8 ;; (when (stringp format)
9 ;; (setq format (intern format)))
11 ;; (if (or (eq format 'HEX)
13 ;; (if (integerp value)
14 ;; (setq prefix "0x")))
15 ;; (princ (www-format-encode-string
16 ;; (format "%s \u2190 %s"
20 ;; (format "<input type=\"text\" name=\"%s\"
21 ;; size=\"30\" maxlength=\"30\" value=\"%s\">
22 ;; <input type=\"submit\" value=\"set\" />
25 ;; (www-format-encode-string
26 ;; (format "%s" name) 'without-tags)
27 ;; (www-format-apply-value object name
33 (defun www-edit-display-feature-input-box (char feature-name
34 &optional format value)
36 (setq format 'default))
38 (setq value (www-get-feature-value char feature-name)))
40 (format "<p><input type=\"text\" name=\"feature-name\"
41 size=\"32\" maxlength=\"256\" value=\"%s\">"
43 (princ (encode-coding-string " \u2190 " 'utf-8-mcs-er))
45 (format "%s<input type=\"text\" name=\"%s\"
46 size=\"64\" maxlength=\"256\" value=\"%s\">
47 <input type=\"submit\" value=\"set\" /></p>
49 (if (or (eq format 'HEX)(eq format 'hex))
53 (mapconcat (lambda (c)
55 ;; ((eq c ?<) "&lt;")
56 ;; ((eq c ?>) "&gt;")
57 ((eq c ?\u0022) """)
60 (www-format-value char feature-name
61 value format 'without-tags)
65 (defun www-edit-display-object-desc (genre uri-object uri-feature-name
66 &optional lang format)
67 (when (stringp format)
68 (setq format (intern format)))
69 (let ((object (www-uri-decode-object genre uri-object))
70 (feature-name (www-uri-decode-feature-name uri-feature-name))
71 base-name metadata-name
78 <title>EsT %s = %s</title>
81 (decode-uri-string uri-object 'utf-8-mcs-er))
84 (when (eq genre 'character)
85 (dolist (feature (char-feature-property '$object 'additional-features))
86 (mount-char-attribute-table
87 (char-feature-name-at-domain feature '$rev=latest))))
88 (when (setq parents (www-get-feature-value object '<-denotational))
89 (princ (format "<p>%s %s</p>\n<hr>\n"
90 (www-format-value-as-char-list parents)
91 (www-format-feature-name '->denotational lang))))
92 (when (setq parents (www-get-feature-value object '<-subsumptive))
93 (princ (format "<p>%s %s</p>\n<hr>\n"
94 (www-format-value-as-char-list parents)
95 (www-format-feature-name '->subsumptive lang))))
97 (format "<h1>%s</h1>\n"
98 (www-format-encode-string (est-format-object object))))
99 (princ "<form action=\"set.cgi\" method=\"GET\">\n")
101 (encode-coding-string
102 (format "<p>(%s : <input type=\"text\" name=\"%s\"
103 size=\"30\" maxlength=\"30\" value=\"%s\">)</p>
106 (decode-uri-string uri-object 'utf-8-mcs-er))
109 (if (eq genre 'character)
110 (char-attribute-alist object)
111 (concord-object-spec object)))
112 (if (string-match "\\*" (setq str (symbol-name feature-name)))
113 (setq base-name (intern (substring str 0 (match-beginning 0)))
114 metadata-name (intern (substring str (match-end 0))))
115 (setq base-name feature-name))
116 (unless (assq base-name object-spec)
117 (setq object-spec (cons (cons base-name nil)
119 (dolist (cell (sort object-spec
121 (char-attribute-name< (car a)(car b)))))
123 ((eq (car cell) feature-name)
124 (www-edit-display-feature-input-box object feature-name format)
129 (www-format-eval-list
130 (or (char-feature-property (car cell) 'format)
131 '((name) " : " (value)))
132 object (car cell) lang uri-object))
134 (when (and (eq base-name (car cell)) metadata-name)
137 (www-edit-display-feature-input-box object feature-name format)
145 (defun www-edit-display-feature-desc (uri-feature-name
148 object-genre uri-object)
149 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
150 (property-name (www-uri-decode-feature-name uri-property-name))
153 (encode-coding-string
155 <title>CHISE-wiki feature: %s</title>
160 (princ "<form action=\"set.cgi\" method=\"GET\">\n")
162 (encode-coding-string
163 (format "<h1>feature : <input type=\"text\" name=\"feature\"
164 size=\"30\" maxlength=\"30\" value=\"%s\"></h1>\n"
168 (encode-coding-string
169 (format "<p>(<input type=\"text\" name=\"char\"
170 size=\"30\" maxlength=\"30\" value=\"%s\">に限\u5B9Aしない)
172 (decode-uri-string uri-object 'utf-8-mcs-er))
175 (if (eq property-name 'name)
176 ;; (www-edit-display-input-box
179 ;; (or (www-format-feature-name* feature-name) ""))
180 (www-edit-display-feature-input-box
181 feature-name property-name
182 'string (or (www-format-feature-name* feature-name) ""))
183 (www-html-display-paragraph
184 (format "name : %s [[[edit|edit.cgi?feature=%s&property=name]]]"
185 (or (www-format-feature-name* feature-name) "")
186 ;; (char-feature-property feature-name 'name)
187 uri-feature-name ; (www-uri-encode-feature-name feature-name)
190 (setq name@lang (intern (format "name@%s" lang)))
191 (if (eq property-name name@lang)
192 ;; (www-edit-display-input-box
195 ;; (or (char-feature-property feature-name name@lang) ""))
196 (www-edit-display-feature-input-box
197 feature-name name@lang
198 'string (or (char-feature-property feature-name name@lang) ""))
199 (www-html-display-paragraph
200 (format "%s : %s [[[edit|edit.cgi?feature=%s&property=%s]]]"
202 (or (char-feature-property feature-name name@lang) "")
205 (www-html-display-paragraph
207 (or (www-feature-type feature-name)
208 ;; (char-feature-property feature-name 'type)
210 (if (eq property-name 'value-format)
211 (www-edit-display-feature-input-box
212 feature-name property-name
213 'default ; 'wiki-text
214 (or (www-feature-value-format feature-name)
216 (www-html-display-paragraph
217 (format "value-format : %s [[[edit|edit.cgi?feature=%s&property=value-format]]]"
219 (or (www-feature-value-format feature-name)
222 (if (eq property-name 'format)
223 (www-edit-display-feature-input-box
224 feature-name property-name
226 (or (char-feature-property feature-name 'format)
227 '((name) " : " (value))))
228 (www-html-display-paragraph
229 (format "format : %s [[[edit|edit.cgi?feature=%s&property=format]]]"
231 (char-feature-property feature-name 'format))
233 (www-html-display-paragraph
234 (format "description : %s"
235 (or (char-feature-property feature-name 'description)
238 (www-html-display-paragraph
239 (format "description@%s : %s"
241 (or (char-feature-property
243 (intern (format "description@%s" lang)))
248 (defun www-batch-edit ()
249 (setq terminal-coding-system 'binary)
251 (let* ((target (pop command-line-args-left))
252 (user (pop command-line-args-left))
253 (accept-language (pop command-line-args-left))
255 (intern (car (split-string
257 (car (split-string accept-language ","))
261 (princ "Content-Type: text/html; charset=UTF-8
263 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
264 \"http://www.w3.org/TR/html4/loose.dtd\">
268 (mapcar (lambda (cell)
269 (if (string-match "=" cell)
273 (substring cell 0 (match-beginning 0))
275 (substring cell (match-end 0)))
276 (list (decode-uri-string cell 'utf-8-mcs-er))))
277 (split-string target "&")))
278 (setq ret (car target))
279 (cond ((eq (car ret) 'char)
280 (www-edit-display-object-desc
282 (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
283 (decode-uri-string (cdr (assq 'feature target))
286 (decode-uri-string (cdr (assq 'format target))
289 ((eq (car ret) 'feature)
290 (www-edit-display-feature-desc
291 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
292 (decode-uri-string (cdr (assq 'property target))
297 ;; (cdr (assq 'char target))
301 (www-edit-display-object-desc
304 (decode-uri-string (cdr (assq 'feature target))
307 (decode-uri-string (cdr (assq 'format target))
310 (www-html-display-paragraph
311 (format "%S" target))
313 (princ (format "user=%s\n" user))
314 (princ (format "local user=%s\n" (user-login-name)))
315 (princ (format "lang=%S\n" lang))
316 (princ emacs-version)
318 (princ (encode-coding-string xemacs-chise-version 'utf-8-jp-er))
324 (princ (format "%S" err)))