(www-display-feature-desc): Add new optional argument `simple';
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Mon, 5 Apr 2010 00:57:46 +0000 (09:57 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Mon, 5 Apr 2010 00:57:46 +0000 (09:57 +0900)
display "Edit" and "New Account" buttons when running with simple
mode; display "Simple" button when running with edit mode.
(www-batch-view): Modify for `www-display-feature-desc' to support
mode.

cwiki-view.el

index 9659fc4..9442281 100644 (file)
@@ -140,7 +140,8 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
         "<li>\n"))
       )))
 
-(defun www-display-feature-desc (uri-feature-name uri-char &optional lang)
+(defun www-display-feature-desc (uri-feature-name uri-char
+                                                 &optional lang simple)
   (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
        (name@lang (intern (format "name@%s" lang))))
     (princ
@@ -152,24 +153,37 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
       'utf-8-mcs-er))
     (princ "<body>\n")
     (princ
+     (format
+      (if simple
+         "<div style=\"text-align:right;\">
+<a href=\"edit/view.cgi?feature=%s&char=%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\">
+<input type=\"submit\" value=\"Simple\" />
+</a>
+</div>
+<hr />\n")
+      uri-feature-name uri-char))
+    (princ
      (format "<h1>%s</h1>\n"
             (www-format-encode-string
              (symbol-name feature-name))))
     (princ (format "<p>name : %s "
                   (or (www-format-feature-name feature-name) "")))
     (princ
-     (format " <a href=\"%s?feature=%s&property=name&format=string&char=%s\"
-><input type=\"submit\" value=\"edit\" /></a>"
-            chise-wiki-edit-url
-            uri-feature-name
-            uri-char))
-    ;; (www-html-display-text
-    ;;  (format "[[[edit|%s?feature=%s&property=name&char=%s]]]"
-    ;;          ;; (char-feature-property feature-name 'name)
-    ;;          chise-wiki-edit-url
-    ;;          uri-feature-name ; (www-uri-encode-feature-name feature-name)
-    ;;          uri-char))
-    (princ "</p>")
+     (format
+      " <a href=\"%s?feature=%s&property=name&format=string&char=%s\">"
+      chise-wiki-edit-url
+      uri-feature-name
+      uri-char))
+    (unless simple
+      (princ "<input type=\"submit\" value=\"edit\" />"))
+    (princ "</a>\n</p>\n")
     (when lang
       (princ "<p>")
       (princ
@@ -178,19 +192,15 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
                name@lang
                (or (char-feature-property feature-name name@lang) ""))))
       (princ
-       (format " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\"
-><input type=\"submit\" value=\"edit\" /></a>"
-              chise-wiki-edit-url
-              uri-feature-name
-              name@lang
-              uri-char))
-      ;; (www-html-display-text
-      ;;  (format " [[[edit|%s?feature=%s&property=%s&char=%s]]]"
-      ;;          chise-wiki-edit-url
-      ;;          uri-feature-name
-      ;;          name@lang
-      ;;          uri-char))
-      (princ "</p>"))
+       (format
+       " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\">"
+       chise-wiki-edit-url
+       uri-feature-name
+       name@lang
+       uri-char))
+      (unless simple
+       (princ "<input type=\"submit\" value=\"edit\" />"))
+      (princ "</a>\n</p>\n"))
     (www-html-display-paragraph
      (format "type : %s"
              (or (www-feature-type feature-name)
@@ -203,18 +213,16 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
                        'default)
                    'default
                    'without-tags)))
-    ;; (www-html-display-paragraph
-    ;;  (format "value-format : %s"
-    ;;          (www-xml-format-list
-    ;;           (or (www-feature-value-format feature-name)
-    ;;               'default))))
     (princ
      (format
       " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
-><input type=\"submit\" value=\"edit\" /></a></p>"
+>"
       chise-wiki-edit-url
       uri-feature-name
       uri-char))
+    (unless simple
+      (princ "<input type=\"submit\" value=\"edit\" />"))
+    (princ "</a>\n</p>\n")
 
     (www-html-display-paragraph
      (format "format : %s"
@@ -279,15 +287,16 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
          (setq ret (car target))
          (cond ((eq (car ret) 'char)
                 (www-display-char-desc
-                  (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
-                 lang nil (eq mode 'simple))
+                  (cdr ret)
+                 lang nil
+                 (eq mode 'simple))
                 )
                ((eq (car ret) 'feature)
                 (www-display-feature-desc
                  (decode-uri-string (cdr ret) 'utf-8-mcs-er)
                   (cdr (assq 'char target))
-                 ;; (decode-uri-string (cdr (assq 'char target)))
-                 lang)
+                 lang
+                 (eq mode 'simple))
                 ))
          ))
        (princ "\n<hr>\n")