(chise-wiki-edit-url): Use "edit.cgi" instead of "edit/edit.cgi".
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Sun, 4 Apr 2010 23:49:07 +0000 (08:49 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Sun, 4 Apr 2010 23:49:07 +0000 (08:49 +0900)
(chise-wiki-add-url): Use "add.cgi" instead of "edit/add.cgi".
(www-display-char-desc): Add new optional argument `simple'; display
"Edit" and "New Account" buttons when running with simple mode;
display "Simple" button when running with edit mode.
(www-batch-view): Modify to support mode.

cwiki-view.el

index a389aec..9893cfb 100644 (file)
@@ -2,10 +2,10 @@
 (require 'cwiki-common)
 
 (defvar chise-wiki-view-url "view.cgi")
-(defvar chise-wiki-edit-url "edit/edit.cgi")
-(defvar chise-wiki-add-url "edit/add.cgi")
+(defvar chise-wiki-edit-url "edit.cgi")
+(defvar chise-wiki-add-url "add.cgi")
 
-(defun www-display-char-desc (uri-char &optional lang level)
+(defun www-display-char-desc (uri-char &optional lang level simple)
   (unless level
     (setq level 1))
   (let ((char (www-uri-decode-char uri-char))
       (dolist (feature (char-feature-property '$object 'additional-features))
        (mount-char-attribute-table
         (char-feature-name-at-domain feature '$rev=latest)))
+      (princ
+       (format
+       (if simple
+           "<div style=\"text-align:right;\">
+<a href=\"edit/view.cgi?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?char=%s\">
+<input type=\"submit\" value=\"Simple\" />
+</a>
+</div>
+<hr />\n")
+       uri-char))
       (when (setq parents (www-char-feature char '<-denotational))
        (princ (format "<p>%s %s</p>\n<hr>\n"
                       (www-format-value-as-char-list parents)
                '((name) " : " (value)))
            char
            logical-feature ; (car cell)
-           lang uri-char))
-         (princ
-          (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
+           lang uri-char
+           nil simple))
+         (unless simple
+           (princ
+            (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
 ><input type=\"submit\" value=\"note\" /></a>"
-                  chise-wiki-edit-url
-                  (www-format-encode-string uri-char)
-                  (www-format-encode-string
-                   (www-uri-encode-feature-name
-                    (intern (format "%s*note"
-                                    logical-feature ; (car cell)
-                                    ))))))
+                    chise-wiki-edit-url
+                    (www-format-encode-string uri-char)
+                    (www-format-encode-string
+                     (www-uri-encode-feature-name
+                      (intern (format "%s*note"
+                                      logical-feature ; (car cell)
+                                      )))))))
          (princ
           (if (= level 1)
               "</p>\n"
@@ -222,6 +241,7 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
       (let* ((target (pop command-line-args-left))
             (user (pop command-line-args-left))
             (accept-language (pop command-line-args-left))
+            (mode (intern (pop command-line-args-left)))
             (lang
              (intern
               (car (split-string
@@ -260,7 +280,7 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
          (cond ((eq (car ret) 'char)
                 (www-display-char-desc
                   (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
-                 lang)
+                 lang nil (eq mode 'simple))
                 )
                ((eq (car ret) 'feature)
                 (www-display-feature-desc
@@ -271,12 +291,13 @@ size=\;; "30\" maxlength=\"30\" value=\"\" />")
                 ))
          ))
        (princ "\n<hr>\n")
+       (princ (format "mode=%S\n" mode))
        (princ (format "user=%s\n" user))
-       (princ (format "local user=%s\n" (user-login-name)))
+        ;; (princ (format "local user=%s\n" (user-login-name)))
        (princ (format "lang=%S\n" lang))
-       (princ emacs-version)
-       (princ " CHISE ")
-       (princ xemacs-chise-version)
+       (princ (emacs-version))
+        ;; (princ " CHISE ")
+        ;; (princ xemacs-chise-version)
        (princ "
 </body>
 </html>")