From: MORIOKA Tomohiko Date: Fri, 10 Dec 2010 11:12:49 +0000 (+0900) Subject: (www-edit-display-feature-input-box): New function [moved from X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6851d8c0d14df3adf99ff443992cb43dea9cbf65;p=chise%2Fest.git (www-edit-display-feature-input-box): New function [moved from cwiki-edit.el]. (www-display-object-desc): - Add new optional arguments `uri-feature-name-to-edit' and `editing-format'; it `uri-feature-name-to-edit' is specified, input box is displayed and `editing-format' is used as the format to parse the input. - Semantics of level 1 was changed to level 0, namely if `level' is 0, display header, otherwise don't display header. --- diff --git a/cwiki-view.el b/cwiki-view.el index e2ca292..e2a2796 100644 --- a/cwiki-view.el +++ b/cwiki-view.el @@ -5,14 +5,66 @@ (defvar chise-wiki-edit-url "edit.cgi") (defvar chise-wiki-add-url "add.cgi") -(defun www-display-object-desc (genre uri-object &optional lang level simple) +(defun www-edit-display-feature-input-box (char feature-name + &optional format value) + (unless format + (setq format 'default)) + (unless value + (setq value (www-get-feature-value char feature-name))) + (princ + (format "

" + feature-name)) + (princ (encode-coding-string " \u2190 " 'utf-8-mcs-er)) + (princ + (format "%s +

+" + (if (or (eq format 'HEX)(eq format 'hex)) + "0x" + "") + format + (mapconcat (lambda (c) + (cond + ;; ((eq c ?<) "&lt;") + ;; ((eq c ?>) "&gt;") + ((eq c ?\u0022) """) + (t + (char-to-string c)))) + (www-format-value char feature-name + value format 'without-tags) + ""))) + ) + +(defun www-display-object-desc (genre uri-object &optional lang level simple + uri-feature-name-to-edit editing-format) (unless level - (setq level 1)) + (setq level 0)) (let ((object (www-uri-decode-object genre uri-object)) + feature-name-to-edit + base-name-to-edit metadata-name-to-edit + without-header logical-feature chise-wiki-displayed-features parents - GlyphWiki-id) + GlyphWiki-id ret object-spec) + (if (eq level 0) + (setq level 1 + without-header nil) + (setq without-header t)) (when object + (when uri-feature-name-to-edit + (setq feature-name-to-edit + (www-uri-decode-feature-name uri-feature-name-to-edit)) + (setq ret (symbol-name feature-name-to-edit)) + (if (string-match "\\*" ret) + (setq base-name-to-edit (intern + (substring ret 0 (match-beginning 0))) + metadata-name-to-edit (intern + (substring ret (match-end 0)))) + (setq base-name-to-edit feature-name-to-edit)) + (when (stringp editing-format) + (setq editing-format (intern editing-format)))) (when (and (eq genre 'character) (= (length uri-object) 1)) (setq uri-object (www-uri-encode-object object))) @@ -75,9 +127,25 @@ level)) (if (> level 1) (princ "