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)
8 ;; (defun www-edit-display-input-box (object name value &optional format)
9 ;; (when (stringp format)
10 ;; (setq format (intern format)))
12 ;; (if (or (eq format 'HEX)
14 ;; (if (integerp value)
15 ;; (setq prefix "0x")))
16 ;; (princ (www-format-encode-string
17 ;; (format "%s \u2190 %s"
21 ;; (format "<input type=\"text\" name=\"%s\"
22 ;; size=\"30\" maxlength=\"30\" value=\"%s\">
23 ;; <input type=\"submit\" value=\"set\" />
26 ;; (www-format-encode-string
27 ;; (format "%s" name) 'without-tags)
28 ;; (www-format-apply-value object name
34 ;; (defun www-edit-display-feature-input-box (char feature-name
35 ;; &optional format value)
37 ;; (setq format 'default))
39 ;; (setq value (www-get-feature-value char feature-name)))
41 ;; (format "<p><input type=\"text\" name=\"feature-name\"
42 ;; size=\"32\" maxlength=\"256\" value=\"%s\">"
44 ;; (princ (encode-coding-string " \u2190 " 'utf-8-mcs-er))
46 ;; (format "%s<input type=\"text\" name=\"%s\"
47 ;; size=\"64\" maxlength=\"256\" value=\"%s\">
48 ;; <input type=\"submit\" value=\"set\" /></p>
50 ;; (if (or (eq format 'HEX)(eq format 'hex))
54 ;; (mapconcat (lambda (c)
56 ;; ;; ((eq c ?<) "&lt;")
57 ;; ;; ((eq c ?>) "&gt;")
58 ;; ((eq c ?\u0022) """)
60 ;; (char-to-string c))))
63 ;; (if (symbolp format)
68 ;; ;; (www-format-value char feature-name
69 ;; ;; value format 'without-tags)
73 (defun www-edit-display-object-desc (genre uri-object uri-feature-name
74 &optional lang format)
75 (www-display-object-desc genre uri-object nil lang 1 nil
76 uri-feature-name format))
78 ;; (defun www-edit-display-object-desc (genre uri-object uri-feature-name
79 ;; &optional lang format)
80 ;; (when (stringp format)
81 ;; (setq format (intern format)))
82 ;; (let ((object (www-uri-decode-object genre uri-object))
83 ;; (feature-name (www-uri-decode-feature-name uri-feature-name))
84 ;; base-name metadata-name
89 ;; (encode-coding-string
91 ;; <title>EsT %s = %s</title>
94 ;; (decode-uri-string uri-object 'utf-8-mcs-er))
97 ;; (when (eq genre 'character)
98 ;; (dolist (feature (char-feature-property '$object 'additional-features))
99 ;; (mount-char-attribute-table
100 ;; (char-feature-name-at-domain feature '$rev=latest))))
101 ;; (when (setq parents (www-get-feature-value object '<-denotational))
102 ;; (princ (format "<p>%s %s</p>\n<hr>\n"
103 ;; (www-format-value-as-char-list parents)
104 ;; (www-format-feature-name '->denotational lang))))
105 ;; (when (setq parents (www-get-feature-value object '<-subsumptive))
106 ;; (princ (format "<p>%s %s</p>\n<hr>\n"
107 ;; (www-format-value-as-char-list parents)
108 ;; (www-format-feature-name '->subsumptive lang))))
110 ;; (format "<h1>%s</h1>\n"
111 ;; (www-format-encode-string (est-format-object object))))
112 ;; (princ "<form action=\"set.cgi\" method=\"GET\">\n")
114 ;; (encode-coding-string
115 ;; (format "<p>(%s : <input type=\"text\" name=\"%s\"
116 ;; size=\"30\" maxlength=\"30\" value=\"%s\">)</p>
119 ;; (decode-uri-string uri-object 'utf-8-mcs-er))
122 ;; (if (eq genre 'character)
123 ;; (char-attribute-alist object)
124 ;; (concord-object-spec object)))
125 ;; (if (string-match "\\*" (setq str (symbol-name feature-name)))
126 ;; (setq base-name (intern (substring str 0 (match-beginning 0)))
127 ;; metadata-name (intern (substring str (match-end 0))))
128 ;; (setq base-name feature-name))
129 ;; (unless (assq base-name object-spec)
130 ;; (setq object-spec (cons (cons base-name nil)
132 ;; (dolist (cell (sort object-spec
134 ;; (char-attribute-name< (car a)(car b)))))
136 ;; ((eq (car cell) feature-name)
137 ;; (www-edit-display-feature-input-box object feature-name format)
142 ;; (www-format-eval-list
143 ;; (or (char-feature-property (car cell) 'format)
144 ;; '((name) " : " (value)))
145 ;; object (car cell) lang uri-object))
147 ;; (when (and (eq base-name (car cell)) metadata-name)
150 ;; (www-edit-display-feature-input-box object feature-name format)
155 ;; (princ "</form>\n")
158 (defun www-edit-display-feature-desc (uri-feature-name
161 object-genre uri-object)
162 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
163 (property-name (www-uri-decode-feature-name uri-property-name))
166 (encode-coding-string
168 <title>CHISE-wiki feature: %s</title>
173 (princ "<form action=\"set.cgi\" method=\"GET\">\n")
175 (encode-coding-string
176 (format "<h1>feature : <input type=\"text\" name=\"feature\"
177 size=\"30\" maxlength=\"30\" value=\"%s\"></h1>\n"
181 (encode-coding-string
182 (format "<p>(<input type=\"text\" name=\"char\"
183 size=\"30\" maxlength=\"30\" value=\"%s\">に限\u5B9Aしない)
185 (decode-uri-string uri-object 'utf-8-mcs-er))
188 (if (eq property-name 'name)
189 ;; (www-edit-display-input-box
192 ;; (or (www-format-feature-name* feature-name) ""))
193 (www-edit-display-feature-input-box
194 feature-name property-name
195 'string (or (www-format-feature-name* feature-name) ""))
196 (www-html-display-paragraph
197 (format "name : %s [[[edit|edit.cgi?feature=%s&property=name]]]"
198 (or (www-format-feature-name* feature-name) "")
199 ;; (char-feature-property feature-name 'name)
200 uri-feature-name ; (www-uri-encode-feature-name feature-name)
203 (setq name@lang (intern (format "name@%s" lang)))
204 (if (eq property-name name@lang)
205 ;; (www-edit-display-input-box
208 ;; (or (char-feature-property feature-name name@lang) ""))
209 (www-edit-display-feature-input-box
210 feature-name name@lang
211 'string (or (char-feature-property feature-name name@lang) ""))
212 (www-html-display-paragraph
213 (format "%s : %s [[[edit|edit.cgi?feature=%s&property=%s]]]"
215 (or (char-feature-property feature-name name@lang) "")
218 (www-html-display-paragraph
220 (or (www-feature-type feature-name)
221 ;; (char-feature-property feature-name 'type)
223 (if (eq property-name 'value-format)
224 (www-edit-display-feature-input-box
225 feature-name property-name
226 'default ; 'wiki-text
227 (or (www-feature-value-format feature-name)
229 (www-html-display-paragraph
230 (format "value-format : %s [[[edit|edit.cgi?feature=%s&property=value-format]]]"
232 (or (www-feature-value-format feature-name)
235 (if (eq property-name 'value-presentation-format)
236 (www-edit-display-feature-input-box
237 feature-name property-name
238 'default ; 'wiki-text
239 (or (www-feature-value-format feature-name)
241 (www-html-display-paragraph
242 (format "value-presentation-format : %s [[[edit|edit.cgi?feature=%s&property=value-presentation-format]]]"
244 (or (www-feature-value-format feature-name)
247 (if (eq property-name 'format)
248 (www-edit-display-feature-input-box
249 feature-name property-name
251 (or (char-feature-property feature-name 'format)
252 '((name) " : " (value))))
253 (www-html-display-paragraph
254 (format "format : %s [[[edit|edit.cgi?feature=%s&property=format]]]"
256 (char-feature-property feature-name 'format))
258 (www-html-display-paragraph
259 (format "description : %s"
260 (or (char-feature-property feature-name 'description)
263 (www-html-display-paragraph
264 (format "description@%s : %s"
266 (or (char-feature-property
268 (intern (format "description@%s" lang)))
273 (defun www-batch-edit ()
274 (setq terminal-coding-system 'binary)
276 (let* ((target (pop command-line-args-left))
277 (user (pop command-line-args-left))
278 (accept-language (pop command-line-args-left))
280 (intern (car (split-string
282 (car (split-string accept-language ","))
286 (princ "Content-Type: text/html; charset=UTF-8
288 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
289 \"http://www.w3.org/TR/html4/loose.dtd\">
293 (mapcar (lambda (cell)
294 (if (string-match "=" cell)
298 (substring cell 0 (match-beginning 0))
300 (substring cell (match-end 0)))
301 (list (decode-uri-string cell 'utf-8-mcs-er))))
302 (split-string target "&")))
303 (setq ret (car target))
304 (cond ((eq (car ret) 'char)
305 (www-edit-display-object-desc
307 (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
308 (decode-uri-string (cdr (assq 'feature target))
311 (decode-uri-string (cdr (assq 'format target))
314 ((eq (car ret) 'feature)
315 (www-edit-display-feature-desc
316 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
317 (decode-uri-string (cdr (assq 'property target))
322 ;; (cdr (assq 'char target))
326 (www-edit-display-object-desc
329 (decode-uri-string (cdr (assq 'feature target))
332 (decode-uri-string (cdr (assq 'format target))
335 (www-html-display-paragraph
336 (format "%S" target))
338 (princ (format "user=%s\n" user))
339 (princ (format "local user=%s\n" (user-login-name)))
340 (princ (format "lang=%S\n" lang))
341 (princ emacs-version)
343 (princ (encode-coding-string xemacs-chise-version 'utf-8-jp-er))
349 (princ (format "%S" err)))
352 (provide 'cwiki-edit)