(www-display-feature-desc): Add edit button for `format'.
[chise/est.git] / cwiki-view.el
index 9659fc4..dd143b2 100644 (file)
        (if (= level 1)
           "<p>\n"
         "<li>\n"))
-      (princ
-       (format "<a href=\"%s?char=%s\"
+      (unless simple
+       (princ
+        (format "<a href=\"%s?char=%s\"
 ><input type=\"submit\" value=\"add feature\" /></a>
 "
-              chise-wiki-add-url
-              (www-format-encode-string uri-char)))
+                chise-wiki-add-url
+                (www-format-encode-string uri-char))))
       (princ
        (if (= level 1)
           "<p>\n"
@@ -140,7 +141,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 +154,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>")
+    (unless simple
+      (princ
+       (format
+       " <a href=\"%s?feature=%s&property=name&format=string&char=%s\">"
+       chise-wiki-edit-url
+       uri-feature-name
+       uri-char))
+      (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
+    (princ "</p>\n")
     (when lang
       (princ "<p>")
       (princ
@@ -177,20 +192,16 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
        (format "%s : %s"
                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>"))
+      (unless simple
+       (princ
+        (format
+         " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\">"
+         chise-wiki-edit-url
+         uri-feature-name
+         name@lang
+         uri-char))
+       (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
+      (princ "</p>\n"))
     (www-html-display-paragraph
      (format "type : %s"
              (or (www-feature-type feature-name)
@@ -203,24 +214,33 @@ 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
+       (format
+       " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
+>"
+       chise-wiki-edit-url
+       uri-feature-name
+       uri-char))
+      (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
+    (princ "</p>\n")
 
-    (www-html-display-paragraph
-     (format "format : %s"
-            (www-xml-format-list
-             (or (char-feature-property feature-name 'format)
-                 '((name) " : " (value))))))
+    (princ "<p>format : ")
+    (www-html-display-text
+     (www-xml-format-list
+      (or (char-feature-property feature-name 'format)
+         '((name) " : " (value)))))
+    (unless simple
+      (princ
+       (format
+       " <a href=\"%s?feature=%s&property=format&format=wiki-text&char=%s\"
+>"
+       chise-wiki-edit-url
+       uri-feature-name
+       uri-char))
+      (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
+    (princ "</p>\n")
+    
     (www-html-display-paragraph
      (format "description : %s"
              (or (char-feature-property feature-name 'description)
@@ -279,15 +299,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")