Require 'est-xml.
[chise/est.git] / cwiki-view.el
index 28c25f4..6061fe9 100644 (file)
@@ -15,7 +15,7 @@
     (when object
       (when (and (eq genre 'character)
                 (= (length uri-object) 1))
-       (setq uri-object (www-uri-encode-char object)))
+       (setq uri-object (www-uri-encode-object object)))
       (when (= level 1)
        (princ
         (encode-coding-string
        (format
        (if simple
            "<div style=\"text-align:right;\">
-<a href=\"edit/view.cgi?char=%s\">
+<a href=\"edit/view.cgi?%s=%s\">
 <input type=\"submit\" value=\"Edit\" />
 </a>
 <input type=\"submit\" value=\"New Account\" />
 </div>
 <hr />\n"
          "<div style=\"text-align:right;\">
-<a href=\"../view.cgi?char=%s\">
+<a href=\"../view.cgi?%s=%s\">
 <input type=\"submit\" value=\"Simple\" />
 </a>
 </div>
 <hr />\n")
+       genre
        uri-object))
       (when (setq parents (www-get-feature-value object '<-denotational))
        (princ (format "<p>%s %s</p>\n<hr>\n"
            nil simple))
          (unless simple
            (princ
-            (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
+            (format " <a href=\"%s?%s=%s&feature=%s&format=wiki-text\"
 ><input type=\"submit\" value=\"note\" /></a>"
                     chise-wiki-edit-url
+                    genre
                     (www-format-encode-string uri-object)
                     (www-format-encode-string
                      (www-uri-encode-feature-name
         "<li>\n"))
       (unless simple
        (princ
-        (format "<a href=\"%s?char=%s\"
+        (format "<a href=\"%s?%s=%s\"
 ><input type=\"submit\" value=\"add feature\" /></a>
 "
                 chise-wiki-add-url
+                genre
                 (www-format-encode-string uri-object))))
       (princ
        (if (= level 1)
           "<p>\n"
         "<li>\n"))
-      (princ
-       "<form action=\"http://chise.zinbun.kyoto-u.ac.jp/ids-find\">\n")
-      (princ
-       (www-format-encode-string
-       (est-format-object object)
-        ;; (if (eq genre 'character)
-        ;;     (format "%c" object)
-        ;;   (format "%s" (concord-object-id object)))
-       ))
-      (princ
-       (format
-       " <input type=\"text\" name=\"components\"
+      (when (eq genre 'character)
+       (princ
+        "<form action=\"http://www.chise.org/ids-find\">\n")
+       (princ
+        (www-format-encode-string
+         (est-format-object object)
+         ;; (if (eq genre 'character)
+         ;;     (format "%c" object)
+         ;;   (format "%s" (concord-object-id object)))
+         ))
+       (princ
+        (format
+         " <input type=\"text\" name=\"components\"
 size=\"30\" maxlength=\"30\" value=\"%s\" />"
-       (encode-coding-string
-         (est-format-object object)
-        ;; (if (eq genre 'character)
-         ;;     (char-to-string object)
-         ;;   (format "%s" (concord-object-id object)))
-        'utf-8-jp-er)))
-      (princ
-       (www-format-encode-string
-       "を\u542Bむ\u6F22\u5B57を\u63A2す"))
-      (princ " <input type=\"submit\" value=\"search\" />\n")
-      (princ "</form>\n")
+         (encode-coding-string
+          (est-format-object object)
+          ;; (if (eq genre 'character)
+          ;;     (char-to-string object)
+          ;;   (format "%s" (concord-object-id object)))
+          'utf-8-jp-er)))
+       (princ
+        (www-format-encode-string
+         "を\u542Bむ\u6F22\u5B57を\u63A2す"))
+       (princ " <input type=\"submit\" value=\"search\" />\n")
+       (princ "</form>\n"))
       (princ
        (if (= level 1)
           "</p>\n"
         "<li>\n"))
       )))
 
-(defun www-display-feature-desc (uri-feature-name uri-object
+(defun www-display-feature-desc (uri-feature-name genre uri-object
                                                  &optional lang simple)
   (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
        (name@lang (intern (format "name@%s" lang))))
@@ -172,19 +176,19 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
      (format
       (if simple
          "<div style=\"text-align:right;\">
-<a href=\"edit/view.cgi?feature=%s&char=%s\">
+<a href=\"edit/view.cgi?feature=%s&%s=%s\">
 <input type=\"submit\" value=\"Edit\" />
 </a>
 <input type=\"submit\" value=\"New Account\" />
 </div>
 <hr />\n"
          "<div style=\"text-align:right;\">
-<a href=\"../view.cgi?feature=%s&char=%s\">
+<a href=\"../view.cgi?feature=%s&%s=%s\">
 <input type=\"submit\" value=\"Simple\" />
 </a>
 </div>
 <hr />\n")
-      uri-feature-name uri-object))
+      uri-feature-name genre uri-object))
     (princ
      (format "<h1>%s</h1>\n"
             (www-format-encode-string
@@ -194,9 +198,10 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
     (unless simple
       (princ
        (format
-       " <a href=\"%s?feature=%s&property=name&format=string&char=%s\">"
+       " <a href=\"%s?feature=%s&property=name&format=string&%s=%s\">"
        chise-wiki-edit-url
        uri-feature-name
+       genre
        uri-object))
       (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
     (princ "</p>\n")
@@ -210,10 +215,11 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
       (unless simple
        (princ
         (format
-         " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\">"
+         " <a href=\"%s?feature=%s&property=%s&format=string&%s=%s\">"
          chise-wiki-edit-url
          uri-feature-name
          name@lang
+         genre
          uri-object))
        (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
       (princ "</p>\n"))
@@ -232,10 +238,11 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
     (unless simple
       (princ
        (format
-       " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
+       " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&%s=%s\"
 >"
        chise-wiki-edit-url
        uri-feature-name
+       genre
        uri-object))
       (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
     (princ "</p>\n")
@@ -249,10 +256,11 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
     (unless simple
       (princ
        (format
-       " <a href=\"%s?feature=%s&property=format&format=wiki-text&char=%s\"
+       " <a href=\"%s?feature=%s&property=format&format=wiki-text&%s=%s\"
 >"
        chise-wiki-edit-url
        uri-feature-name
+       genre
        uri-object))
       (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
     (princ "</p>\n")
@@ -298,7 +306,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
            (setq ret (match-end 0))
            (setq target
                  (concat "char="
-                         (www-uri-encode-char
+                         (www-uri-encode-object
                           (www-uri-decode-object
                            'character (match-string 1 target)))
                          (substring target ret))))
@@ -324,6 +332,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
                ((eq (car ret) 'feature)
                 (www-display-feature-desc
                  (decode-uri-string (cdr ret) 'utf-8-mcs-er)
+                 (car ret)
                  (cdr (assq 'char target))
                  lang
                  (eq mode 'simple))
@@ -341,7 +350,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\" />"
        (princ (format "user=%s\n" user))
         ;; (princ (format "local user=%s\n" (user-login-name)))
        (princ (format "lang=%S\n" lang))
-       (princ (emacs-version))
+       (princ (encode-coding-string (emacs-version) 'utf-8-jp-er))
         ;; (princ " CHISE ")
         ;; (princ xemacs-chise-version)
        (princ "