annotate lisp/w3/w3-forms.el @ 114:8619ce7e4c50 r20-1b9

Import from CVS: tag r20-1b9
author cvs
date Mon, 13 Aug 2007 09:21:54 +0200
parents 360340f9fd5f
children 9f59509498e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1 ;;; w3-forms.el --- Emacs-w3 forms parsing code for new display engine
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Author: wmperry
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
3 ;; Created: 1997/03/18 23:20:04
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
4 ;; Version: 1.79
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: faces, help, comm, data, languages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@cs.indiana.edu)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
11 ;;; This file is part of GNU Emacs.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; You should have received a copy of the GNU General Public License
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
26 ;;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; FORMS processing for html 2.0/3.0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
32 (eval-when-compile
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
33 (require 'cl))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
34
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
35 (eval-and-compile
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
36 (require 'w3-display)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
37 (require 'widget)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
38 (condition-case nil
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
39 (require 'wid-edit)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
40 (error (require 'widget-edit))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
41
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
42 (require 'w3-vars)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
43 (require 'mule-sysdp)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
44
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
45 (defvar w3-form-use-old-style nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
46 "*Non-nil means use the old way of interacting for form fields.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
47
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
48 (define-widget-keywords :emacspeak-help :w3-form-data)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
49
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
50 (defvar w3-form-keymap
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
51 (let ((map (copy-keymap global-map))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
52 (eol-loc (where-is-internal 'end-of-line nil t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
53 (if widget-keymap
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
54 (cl-map-keymap (function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
55 (lambda (key binding)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
56 (define-key map
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
57 (if (vectorp key) key (vector key))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
58 (case binding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
59 (widget-backward 'w3-widget-backward)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
60 (widget-forward 'w3-widget-forward)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
61 (otherwise binding)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
62 widget-keymap))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
63 (define-key map [return] 'w3-form-maybe-submit-by-keypress)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
64 (define-key map "\r" 'w3-form-maybe-submit-by-keypress)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
65 (define-key map "\n" 'w3-form-maybe-submit-by-keypress)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
66 (define-key map "\t" 'w3-widget-forward)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
67 (define-key map "\C-k" 'widget-kill-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
68 (define-key map "\C-a" 'widget-beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
69 (if eol-loc
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
70 (define-key map eol-loc 'widget-end-of-line))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
71 map))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
72
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;; A form entry area is a vector
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
74 ;; [ type name default-value value maxlength options widget plist]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;; Where:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;; type = symbol defining what type of form entry area it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ;; (ie: file, radio)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;; name = the name of the form element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ;; default-value = the value this started out with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (defsubst w3-form-element-type (obj) (aref obj 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (defsubst w3-form-element-name (obj) (aref obj 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defsubst w3-form-element-default-value (obj) (aref obj 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (defsubst w3-form-element-value (obj) (aref obj 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (defsubst w3-form-element-size (obj) (aref obj 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (defsubst w3-form-element-maxlength (obj) (aref obj 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (defsubst w3-form-element-options (obj) (aref obj 6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (defsubst w3-form-element-action (obj) (aref obj 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (defsubst w3-form-element-widget (obj) (aref obj 8))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
90 (defsubst w3-form-element-plist (obj) (aref obj 9))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (defsubst w3-form-element-set-type (obj val) (aset obj 0 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defsubst w3-form-element-set-name (obj val) (aset obj 1 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defsubst w3-form-element-set-default-value (obj val) (aset obj 2 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (defsubst w3-form-element-set-value (obj val) (aset obj 3 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (defsubst w3-form-element-set-size (obj val) (aset obj 4 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (defsubst w3-form-element-set-maxlength (obj val) (aset obj 5 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (defsubst w3-form-element-set-options (obj val) (aset obj 6 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (defsubst w3-form-element-set-action (obj val) (aset obj 7 val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defsubst w3-form-element-set-widget (obj val) (aset obj 8 val))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
101 (defsubst w3-form-element-set-plist (obj val) (aset obj 9 val))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
103 (defun w3-form-determine-size (el size)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
104 (case (w3-form-element-type el)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
105 (checkbox 3)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
106 (radio 4)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
107 ((reset submit) (+ 2 (length (or (w3-form-element-value el)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
108 (symbol-name
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
109 (w3-form-element-type el))))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
110 (multiline 21)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
111 (hidden nil)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
112 (file (or size 26))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
113 ((float password text int)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
114 (if w3-form-use-old-style
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
115 (or size 22)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
116 (or size 20)))
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
117 (image (+ 2 (length (or
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
118 (plist-get (w3-form-element-plist el) 'alt)
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
119 "Form-Image"))))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
120 (option
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
121 (let ((options (copy-sequence (w3-form-element-options el))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
122 (or size
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
123 (length (caar (sort options
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
124 (function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
125 (lambda (x y)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
126 (>= (length (car x))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
127 (length (car y)))))))))))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
128 (otherwise (or size 22))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
129
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
130 ;;###autoload
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
131 (defun w3-form-add-element (plist face)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
132 (let* ((action (plist-get plist 'action))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
133 (el (vector (plist-get plist 'type)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
134 (plist-get plist 'name)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
135 (plist-get plist 'default)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
136 (plist-get plist 'value)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
137 (plist-get plist 'size)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
138 (plist-get plist 'maxlength)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
139 (plist-get plist 'options)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
140 action
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
141 nil
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
142 plist))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
143 (size (w3-form-determine-size el (plist-get plist 'size)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
144 (node (assoc action w3-form-elements)))
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
145 (if (and (eq (plist-get plist 'type) 'hidden)
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
146 (not (assq '*table-autolayout w3-display-open-element-stack)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
147 (if node
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
148 (setcdr node (cons el (cdr node)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
149 (setq w3-form-elements (cons (cons action (list el))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
150 w3-form-elements))))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
151 (if size
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
152 (set-text-properties (point)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
153 (progn (insert-char ?T size) (point))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
154 (list 'w3-form-info (cons el face)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
155 'start-open t
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
156 'end-open t
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
157 'rear-nonsticky t)))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
158
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
159 (defun w3-form-resurrect-widgets ()
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
160 (let ((st (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
161 ;; FIXME! For some reason this loses on long lines right now.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
162 (widget-push-button-gui nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
163 info nd node action face)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
164 (while st
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
165 (if (setq info (get-text-property st 'w3-form-info))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
166 (progn
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
167 (setq nd (or (next-single-property-change st 'w3-form-info)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
168 (point-max))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
169 face (cdr info)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
170 info (car info)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
171 action (w3-form-element-action info)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
172 node (assoc action w3-form-elements))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
173 (goto-char st)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
174 (delete-region st nd)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
175 (if (not (w3-form-element-size info))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
176 (w3-form-element-set-size info 20))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
177 (if node
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
178 (setcdr node (cons info (cdr node)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
179 (setq w3-form-elements (cons (cons action (list info))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
180 w3-form-elements)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
181 (w3-form-add-element-internal info face)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
182 (setq st (next-single-property-change st 'w3-form-info)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
183 (setq st (next-single-property-change st 'w3-form-info))))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
184
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
185 (defsubst w3-form-mark-widget (widget el)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
186 (let ((widgets (list widget))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
187 (children (widget-get widget :children))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
188 (parent (widget-get widget :parent)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
189 (w3-form-element-set-widget el widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
190 ;; Get _all_ the children associated with this widget
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
191 (while children
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
192 (setq widgets (cons (car children) widgets))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
193 (if (widget-get (car children) :children)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
194 (setq children (append children
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
195 (widget-get (car children) :children))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
196 (setq children (cdr children)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
197 (while (widget-get widget :parent)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
198 (setq widget (widget-get widget :parent)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
199 widgets (cons widget widgets)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
200 (setq children (widget-get widget :buttons))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
201 ;; Special case for radio buttons
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
202 (while children
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
203 (setq widgets (cons (car children) widgets))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
204 (if (widget-get (car children) :children)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
205 (setq children (append children
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
206 (widget-get (car children) :children))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
207 (setq children (cdr children)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
208 (while widgets
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
209 (setq widget (pop widgets))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
210 (widget-put widget :emacspeak-help 'w3-form-summarize-field)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
211 (widget-put widget :help-echo 'w3-form-summarize-field)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
212 (widget-put widget :w3-form-data el))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
213
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
214 (defun w3-form-add-element-internal (el face)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (let* ((widget nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (inhibit-read-only t)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
218 (widget-creation-function nil))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
219 (setq widget-creation-function (or (get (w3-form-element-type el)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 'w3-widget-creation-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 'w3-form-default-widget-creator)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
222 widget (and (fboundp widget-creation-function)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
223 (funcall widget-creation-function el face)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (if (not widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 nil
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
226 (w3-form-mark-widget widget el))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; These properties tell the add-element function how to actually create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;; each type of widget.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (put 'checkbox 'w3-widget-creation-function 'w3-form-create-checkbox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (put 'multiline 'w3-widget-creation-function 'w3-form-create-multiline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (put 'radio 'w3-widget-creation-function 'w3-form-create-radio-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (put 'reset 'w3-widget-creation-function 'w3-form-create-submit-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (put 'submit 'w3-widget-creation-function 'w3-form-create-submit-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (put 'hidden 'w3-widget-creation-function 'ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (put 'file 'w3-widget-creation-function 'w3-form-create-file-browser)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (put 'option 'w3-widget-creation-function 'w3-form-create-option-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (put 'keygen 'w3-widget-creation-function 'w3-form-create-keygen-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (put 'button 'w3-widget-creation-function 'w3-form-create-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (put 'image 'w3-widget-creation-function 'w3-form-create-image)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
241 (put 'int 'w3-widget-creation-function 'w3-form-create-integer)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
242 (put 'float 'w3-widget-creation-function 'w3-form-create-float)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
243 (put 'custom 'w3-widget-creation-function 'w3-form-create-custom)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
244 (put 'text 'w3-widget-creation-function 'w3-form-create-text)
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
245 (put 'password 'w3-widget-creation-function 'w3-form-create-password)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
246
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
247 ;; Custom support.
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
248 (defvar w3-custom-options nil)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
249 (make-variable-buffer-local 'w3-custom-options)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
250
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
251 (defun w3-form-create-custom (el face)
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
252 (condition-case ()
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
253 (require 'cus-edit)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
254 (error (require 'custom-edit)))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
255 (let* ((name (w3-form-element-name el))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
256 (var-name (w3-form-element-value el))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
257 (type (plist-get (w3-form-element-plist el) 'custom-type))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
258 (widget (widget-create (cond ((string-equal type "variable")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
259 'custom-variable)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
260 ((string-equal type "face")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
261 'custom-face)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
262 ((string-equal type "group")
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
263 'custom-group)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
264 (t 'item)) (intern var-name))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
265 (custom-magic-reset widget)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
266 (push widget w3-custom-options)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
267 widget))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (defun w3-form-create-checkbox (el face)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
270 (widget-create 'checkbox
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
271 :button-face face
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (and (w3-form-element-default-value el) t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
274 (defun w3-form-radio-button-update (widget child event)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
275 (widget-radio-action widget child event)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
276 (w3-form-mark-widget widget (widget-get widget :w3-form-data)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
277
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (defun w3-form-create-radio-button (el face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (let* ((name (w3-form-element-name el))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
280 (action (w3-form-element-action el))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
281 (uniqid (cons name action))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
282 (formobj (cdr (assoc uniqid w3-form-radio-elements)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (widget nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (if formobj
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (setq widget (w3-form-element-widget formobj))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
288 (widget-radio-add-item widget
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
289 (list 'item
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
290 :format "%t"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
291 :tag ""
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
292 :value (w3-form-element-value el)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
293 (w3-form-mark-widget widget el)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
294 (if (w3-form-element-default-value el)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
295 (progn
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
296 (widget-put widget 'w3-form-default-value
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
297 (w3-form-element-value el))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
298 (widget-value-set widget (w3-form-element-value el))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 nil)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
300 (setq widget (widget-create
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
301 'radio-button-choice
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
302 :value (w3-form-element-value el)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
303 :action 'w3-form-radio-button-update
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
304 (list 'item
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
305 :format "%t"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
306 :tag ""
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
307 :value (w3-form-element-value el)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
308 w3-form-radio-elements (cons (cons uniqid el)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 w3-form-radio-elements))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
310 (widget-put widget 'w3-form-default-value (w3-form-element-value el))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (defun w3-form-create-button (el face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ;; This handles dealing with the bogus Netscape 'button' input type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 ;; that lots of places have been using to slap javascript shit onto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (let ((val (w3-form-element-value el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (if (or (not val) (string= val ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (setq val "Push Me"))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
319 (widget-create 'push-button
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
320 :notify 'ignore
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
321 :button-face face
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
322 :value-face face
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
323 val)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (defun w3-form-create-image (el face)
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
326 (widget-create 'push-button
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
327 :notify 'w3-form-submit/reset-callback
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
328 :value (or
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
329 (plist-get (w3-form-element-plist el) 'alt)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
330 (w3-form-element-value el)
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
331 "Form-Image")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (defun w3-form-create-submit-button (el face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (let ((val (w3-form-element-value el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (if (or (not val) (string= val ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (setq val (if (eq (w3-form-element-type el) 'submit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 "Submit"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 "Reset")))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
339 (widget-create 'push-button
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
340 :notify 'w3-form-submit/reset-callback
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 :button-face face val)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (defun w3-form-create-file-browser (el face)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
344 (widget-create 'file
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
345 :button-face face
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
346 :value-face face
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
347 :size (w3-form-element-size el)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
348 :must-match t
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
349 :value (w3-form-element-value el)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
351 (defvar w3-form-valid-key-sizes
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
352 '(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
353 ("1024 (Premium)" . 1024)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
354 ("896 (Regular)" . 896)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
355 ("768 (Unleaded)" . 768)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
356 ("512 (Low Grade)" . 512)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
357 ("508 (Woos)" . 508)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
358 ("256 (Test Grade)" . 256)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
359 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
360 "An assoc list of available key sizes and meaningful descriptions.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
361
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (defun w3-form-create-keygen-list (el face)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
363 (let ((tmp w3-form-valid-key-sizes)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
364 (longest 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
365 (options nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
366 (while tmp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
367 (if (> (length (caar tmp)) longest)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
368 (setq longest (length (caar tmp))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
369 (setq options (cons (list 'choice-item :tag (caar tmp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
370 :value (cdar tmp)) options)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
371 tmp (cdr tmp)))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
372 (apply 'widget-create 'menu-choice
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
373 :value 1024
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
374 :ignore-case t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 :tag "Key Length"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
376 :size (1+ longest)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
377 :button-face face
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 :value-face face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 options)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (defun w3-form-create-option-list (el face)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
382 (let* ((size (w3-form-determine-size el nil))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
383 (widget (apply 'widget-create 'menu-choice
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
384 :value (w3-form-element-value el)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
385 :ignore-case t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 :tag "Choose"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
387 :format "%v"
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
388 :size size
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 :value-face face
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
390 :button-face face
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (list 'choice-item :format "%[%t%]"
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
395 :emacspeak-help 'w3-form-summarize-field
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
396 :menu-tag-get (` (lambda (zed) (, (car x))))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
397 :tag (mule-truncate-string (car x) size ? )
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
398 :button-face face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
399 :value-face face
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
400 :value (car x))))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
401 (w3-form-element-options el)))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
402 (widget-value-set widget (w3-form-element-value el))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ;(defun w3-form-create-multiline (el face)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
406 ; (widget-create 'text :value-face face (w3-form-element-value el)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (defun w3-form-create-multiline (el face)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
409 (widget-create 'push-button
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
410 :notify 'w3-do-text-entry
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
411 "Multiline text area"))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
412
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
413 (defun w3-form-create-integer (el face)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
414 (if w3-form-use-old-style
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
415 (w3-form-default-widget-creator el face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
416 (widget-create 'integer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
417 :size (w3-form-element-size el)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
418 :value-face face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
419 :tag ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
420 :format "%v"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
421 :keymap w3-form-keymap
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
422 :w3-form-data el
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
423 (w3-form-element-value el))))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
424
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
425 (defun w3-form-create-float (el face)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
426 (if w3-form-use-old-style
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
427 (w3-form-default-widget-creator el face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
428 (widget-create 'number
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
429 :size (w3-form-element-size el)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
430 :value-face face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
431 :format "%v"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
432 :tag ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
433 :keymap w3-form-keymap
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
434 :w3-form-data el
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
435 (w3-form-element-value el))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
437 (defun w3-form-create-text (el face)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
438 (if w3-form-use-old-style
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
439 (w3-form-default-widget-creator el face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
440 (widget-create 'editable-field
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
441 :keymap w3-form-keymap
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
442 :size (w3-form-element-size el)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
443 :value-face face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
444 :w3-form-data el
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
445 (w3-form-element-value el))))
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
446
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
447 (defun w3-form-create-password (el face)
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
448 ;; *sigh* This will fail under XEmacs, but I can yell at them about
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
449 ;; upgrading separately for the release of 19.15 and 20.0
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
450 (if w3-form-use-old-style
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
451 (w3-form-default-widget-creator el face)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
452 (widget-create 'editable-field
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
453 :secret ?*
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
454 :keymap w3-form-keymap
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
455 :size (w3-form-element-size el)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
456 :value-face face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
457 :button-face face
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
458 :w3-form-data el
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
459 (w3-form-element-value el))))
88
821dec489c24 Import from CVS: tag r20-0
cvs
parents: 86
diff changeset
460
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (defun w3-form-default-widget-creator (el face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (widget-create 'link
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 :notify 'w3-form-default-button-callback
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
464 :value-to-internal 'w3-form-default-button-update
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 :size (w3-form-element-size el)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 :value-face face
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
467 :button-face face
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
468 :w3-form-data el
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (w3-form-element-value el)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
471 (defun w3-form-default-button-update (w v)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
472 (let ((info (widget-get w :w3-form-data)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
473 (widget-put w :tag
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
474 (if info
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
475 (mule-truncate-string
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
476 (if (eq 'password (w3-form-element-type info))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
477 (make-string (length v) ?*)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
478 v)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
479 (w3-form-element-size info) ? )))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
480 v))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
481
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (defun w3-form-default-button-callback (widget &rest ignore)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
483 (let* ((obj (widget-get widget :w3-form-data))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (typ (w3-form-element-type obj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (def (widget-value widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (val nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (case typ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (password
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
490 (setq val (funcall url-passwd-entry-func "Password: " def)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (otherwise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (setq val (read-string
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
493 (concat (capitalize (symbol-name typ)) ": ") def))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (widget-value-set widget val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (apply 'w3-form-possibly-submit widget ignore))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
496
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
497 ;; These properties tell the help-echo function how to summarize each
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
498 ;; type of widget.
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
499 (put 'checkbox 'w3-summarize-function 'w3-form-summarize-checkbox)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
500 (put 'multiline 'w3-summarize-function 'w3-form-summarize-multiline)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
501 (put 'radio 'w3-summarize-function 'w3-form-summarize-radio-button)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
502 (put 'reset 'w3-summarize-function 'w3-form-summarize-submit-button)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
503 (put 'submit 'w3-summarize-function 'w3-form-summarize-submit-button)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
504 (put 'button 'w3-summarize-function 'w3-form-summarize-submit-button)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
505 (put 'file 'w3-summarize-function 'w3-form-summarize-file-browser)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
506 (put 'option 'w3-summarize-function 'w3-form-summarize-option-list)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
507 (put 'keygen 'w3-summarize-function 'w3-form-summarize-keygen-list)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
508 (put 'image 'w3-summarize-function 'w3-form-summarize-image)
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
509 (put 'password 'w3-summarize-function 'w3-form-summarize-password)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
510 (put 'hidden 'w3-summarize-function 'ignore)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
511
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
512 (defun w3-form-summarize-field (widget &rest ignore)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
513 "Sumarize a widget that should be a W3 form entry area.
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
514 This can be used as the :help-echo property of all w3 form entry widgets."
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
515 (let ((info nil)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
516 (func nil)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
517 (msg nil)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
518 )
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
519 (setq info (widget-get widget :w3-form-data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
520 (if info
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
521 nil
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
522 (while (widget-get widget :parent)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
523 (setq widget (widget-get widget :parent)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
524 (setq info (widget-get widget :w3-form-data)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
525 (if (not info)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
526 (signal 'wrong-type-argument (list 'w3-form-widget widget)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
527 (setq func (or (get (w3-form-element-type info) 'w3-summarize-function)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
528 'w3-form-summarize-default)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
529 msg (and (fboundp func) (funcall func info widget)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
530 ;; FIXME! This should be removed once emacspeak is updated to
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
531 ;; more closely follow the widget-y way of just returning the string
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
532 ;; instead of having the underlying :help-echo or :emacspeak-help
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
533 ;; implementation do it.
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
534 (and msg (message "%s" msg))))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
535
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
536 (defsubst w3-form-field-label (data)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
537 ;;; FIXXX!!! Need to reimplement using the new forms implementation!
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
538 (declare (special w3-form-labels))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
539 (cdr-safe
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
540 (assoc (or (plist-get (w3-form-element-plist data) 'id)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
541 (plist-get (w3-form-element-plist data) 'label))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
542 w3-form-labels)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
543
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
544 (defun w3-form-summarize-default (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
545 (let ((label (w3-form-field-label data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
546 (name (w3-form-element-name data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
547 (value (widget-value (w3-form-element-widget data))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
548 (format "Text field %s set to: %s" (or label (concat "called " name))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
549 value)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
550
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
551 (defun w3-form-summarize-password (data widget)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
552 (let ((label (w3-form-field-label data))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
553 (name (w3-form-element-name data)))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
554 (format "Password field %s is a secret. Shhh."
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
555 (or label (concat "called " name)))))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
556
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
557 (defun w3-form-summarize-multiline (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
558 (let ((name (w3-form-element-name data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
559 (label (w3-form-field-label data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
560 (value (w3-form-element-value data)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
561 (format "Multiline text input %s set to: %s"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
562 (or label (concat "called " name))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
563 value)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
564
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
565 (defun w3-form-summarize-checkbox (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
566 (let ((name (w3-form-element-name data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
567 (label (w3-form-field-label data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
568 (checked (widget-value (w3-form-element-widget data))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
569 (format "Checkbox %s is %s" (or label name) (if checked "on" "off"))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
570
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
571 (defun w3-form-summarize-option-list (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
572 (let ((name (w3-form-element-name data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
573 (label (w3-form-field-label data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
574 (default (w3-form-element-default-value data)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
575 (format "Option list (%s) set to: %s" (or label name)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
576 (widget-value (w3-form-element-widget data)))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
577
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
578 (defun w3-form-summarize-image (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
579 (let ((name (w3-form-element-name data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
580 (label (w3-form-field-label data)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
581 (concat "Image entry " (or label (concat "called " name)))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
582
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
583 (defun w3-form-summarize-submit-button (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
584 (let* ((type (w3-form-element-type data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
585 (label (w3-form-field-label data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
586 (button-text (widget-value (w3-form-element-widget data)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
587 (type-desc (case type
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
588 (submit "Submit Form")
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
589 (reset "Reset Form")
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
590 (button "A Button"))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
591 (format "%s: %s" type-desc (or label button-text ""))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
592
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
593 (defun w3-form-summarize-radio-button (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
594 (let ((name (w3-form-element-name data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
595 (label (w3-form-field-label data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
596 (cur-value (widget-value (w3-form-element-widget data)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
597 (this-value (widget-value (widget-get-sibling widget))))
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
598 (if (equal this-value cur-value)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
599 (format "Radio group %s has %s pressed"
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
600 (or label name) this-value)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
601 (format "Press this to change radio group %s from %s to %s" (or label name) cur-value
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 98
diff changeset
602 this-value))))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
603
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
604 (defun w3-form-summarize-file-browser (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
605 (let ((name (w3-form-element-name data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
606 (label (w3-form-field-label data))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
607 (file (widget-value (w3-form-element-widget data))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
608 (format "File entry %s pointing to: %s" (or label name) (or file
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
609 "[nothing]"))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
610
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
611 (defun w3-form-summarize-keygen-list (data widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
612 )
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
613
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
614
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
615 (defun w3-form-maybe-submit-by-keypress ()
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
616 (interactive)
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
617 (let ((widget (widget-at (point))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
618 (if widget
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
619 (w3-form-possibly-submit widget))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
620
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (defun w3-form-possibly-submit (widget &rest ignore)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
622 (let* ((formobj (widget-get widget :w3-form-data))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (ident (w3-form-element-action formobj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (widgets (w3-all-widgets ident))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (text-fields 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (text-p nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;; Gack. Netscape auto-submits forms of one text field
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;; here we go through the list of widgets in this form and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;; determine which are not submit/reset/button inputs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 ;; If the # == 1, then submit the form.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (while widgets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (setq text-fields (+
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 text-fields
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (case (w3-form-element-type (car widgets))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 ((submit reset image button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (setq text-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (otherwise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 widgets (cdr widgets)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (if (and (= text-fields 1) text-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (w3-submit-form ident))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (defun w3-form-submit/reset-callback (widget &rest ignore)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
649 (let* ((formobj (widget-get widget :w3-form-data))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (w3-submit-button formobj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 (case (w3-form-element-type formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (submit (w3-submit-form (w3-form-element-action formobj)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (reset (w3-revert-form (w3-form-element-action formobj)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (image (w3-submit-form (w3-form-element-action formobj)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (otherwise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 "Impossible widget type %s triggered w3-form-submit/reset-callback"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (w3-form-element-type formobj))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (defun w3-do-text-entry (widget &rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (let* ((data (list widget (current-buffer)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
662 (formobj (widget-get widget :w3-form-data))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (buff (get-buffer-create (format "Form Entry: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (w3-form-element-name formobj)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (switch-to-buffer-other-window buff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (indented-text-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (if (w3-form-element-value formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (insert (w3-form-element-value formobj)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (setq w3-current-last-buffer data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (message "Press C-c C-c when finished with text entry.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (local-set-key "\C-c\C-c" 'w3-finish-text-entry)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (defun w3-finish-text-entry ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (if w3-current-last-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (let* ((widget (nth 0 w3-current-last-buffer))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
678 (formobj (widget-get widget :w3-form-data))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (buff (nth 1 w3-current-last-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (valu (buffer-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (local-set-key "\C-c\C-c" 'undefined)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (kill-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (delete-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (if (not (and buff (bufferp buff) (buffer-name buff)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (message "Could not find the form buffer for this text!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 (switch-to-buffer buff)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (w3-form-element-set-value formobj valu)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (defsubst w3-all-widgets (actn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 ;; Return a list of data entry widgets in form number ACTN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (cdr-safe (assoc actn w3-form-elements)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (defun w3-revert-form (actn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (let* ((formobjs (w3-all-widgets actn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (inhibit-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 deft type widget formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (while formobjs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (setq formobj (car formobjs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 widget (w3-form-element-widget formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 formobjs (cdr formobjs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 deft (w3-form-element-default-value formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 type (w3-form-element-type formobj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (case type
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 88
diff changeset
709 ((submit reset image hidden) nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (radio
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
711 (setq deft (widget-get widget 'w3-form-default-value))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
712 (if (and widget deft)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
713 (widget-value-set widget deft)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (checkbox
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (if deft
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (widget-value-set widget t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (widget-value-set widget nil)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
718 (multiline
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
719 (w3-form-element-set-value formobj (w3-form-element-default-value
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
720 formobj)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (widget-value-set widget deft))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (otherwise
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
724 (widget-value-set widget deft))))
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
725 (widget-setup))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (defun w3-form-encode-helper (formobjs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (let (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (submit-button-data w3-submit-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 formobj result widget temp type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (while formobjs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (setq formobj (car formobjs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 type (w3-form-element-type formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 widget (w3-form-element-widget formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 formobjs (cdr formobjs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 temp (case type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (reset nil)
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 82
diff changeset
738 (button nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (image
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (if (and (eq submit-button-data formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (w3-form-element-name formobj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (setq result (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (concat (w3-form-element-name formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 ".x") "0")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (concat (w3-form-element-name formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 ".y") "0"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (submit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (if (and (eq submit-button-data formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (w3-form-element-name formobj))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (cons (w3-form-element-name formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (w3-form-element-value formobj))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (radio
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
758 (let* ((radio-name (w3-form-element-name formobj))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
759 (radio-object (cdr-safe
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
760 (assoc
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
761 (cons
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
762 radio-name
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
763 (w3-form-element-action formobj))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
764 w3-form-radio-elements)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
765 (chosen-widget (and radio-object
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
766 (widget-radio-chosen
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
767 (w3-form-element-widget
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
768 radio-object)))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
769 (if (assoc radio-name result)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 nil
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
771 (cons radio-name (widget-value chosen-widget)))))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
772 ((int float)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
773 (cons (w3-form-element-name formobj)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
774 (number-to-string (or (condition-case ()
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
775 (widget-value widget)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
776 (error nil)) 0))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 (checkbox
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 (if (widget-value widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (cons (w3-form-element-name formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (w3-form-element-value formobj))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 (let ((dat nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 (fname (widget-value widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 (set-buffer (get-buffer-create " *w3-temp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (setq dat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (insert-file-contents-literally fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (error (concat "Error accessing " fname))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (cons (w3-form-element-name formobj) dat))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (option
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (cons (w3-form-element-name formobj)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
794 (cdr-safe
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
795 (assoc (widget-value widget)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
796 (w3-form-element-options formobj)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (keygen
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
798 (cons (w3-form-element-name formobj)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
799 (format "Should create a %d bit RSA key"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
800 (widget-value widget))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 ((multiline hidden)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (cons (w3-form-element-name formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (w3-form-element-value formobj)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (otherwise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (cons (w3-form-element-name formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (widget-value widget)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (if temp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 (setq result (cons temp result))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (defun w3-form-encode-make-mime-part (id data separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (concat separator "\nContent-id: " id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 "\nContent-length: " (length data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 "\n\n" data))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (defun w3-form-encode-multipart/x-www-form-data (formobjs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 ;; Create a multipart form submission.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 ;; Returns a cons of two strings. Car is the separator used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 ;; cdr is the body of the MIME message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 (let ((separator "---some-separator-for-www-form-data"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 (cons separator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 (mapconcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (lambda (formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (w3-form-encode-make-mime-part (car formobj) (cdr formobj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 separator)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (w3-form-encode-helper formobjs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 "\n"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 (fset 'w3-form-encode-multipart/form-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 'w3-form-encode-multipart/x-www-form-data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 (fset 'w3-form-encode- 'w3-form-encode-application/x-www-form-urlencoded)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (defun w3-next-widget (pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (let* ((next (cond ((get-text-property pos 'button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (next-single-property-change pos 'button))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 ((get-text-property pos 'field)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (next-single-property-change pos 'field))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 (t pos)))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
840 (button (and next (next-single-property-change next 'button)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
841 (field (and next (next-single-property-change next 'field))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (setq next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 ((and button field) (min button field))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (button button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (field field)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 (and next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 (or (get-text-property next 'button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 (get-text-property next 'field)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (defun w3-form-encode (result &optional enctype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 "Create a string suitably encoded for a URL request."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (let ((func (intern (concat "w3-form-encode-" enctype))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
855 (if (fboundp func)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
856 (funcall func result)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
857 (w3-warn 'html (format "Bad encoding type for form data: %s" enctype))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
858 (w3-form-encode-application/x-www-form-urlencoded result))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (defun w3-form-encode-text/plain (result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (let ((query ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (setq query
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (mapconcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (lambda (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (let ((nam (car widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (val (cdr widget)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (if (string-match "\n" nam)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 (setq nam (mapconcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (if (= x ?\n) "," (char-to-string x))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 nam "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 (concat nam " " val))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (w3-form-encode-helper result) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 query))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (defun w3-form-encode-application/x-gopher-query (result)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
879 (concat "\t" (cdr (car (w3-form-encode-helper result)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (defun w3-form-encode-xwfu (chunk)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 "Escape characters in a string for application/x-www-form-urlencoded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 Blasphemous crap because someone didn't think %20 was good enough for encoding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 spaces. Die Die Die."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (mapconcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (lambda (char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 ((= char ? ) "+")
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
890 ((memq char url-unreserved-chars) (char-to-string char))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
891 (t (upcase (format "%%%02x" char))))))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
892 (mule-encode-string chunk) ""))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (defun w3-form-encode-application/x-www-form-urlencoded (result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (mapconcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (lambda (data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (concat (w3-form-encode-xwfu (car data)) "="
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (w3-form-encode-xwfu (cdr data)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (w3-form-encode-helper result) "&"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (defun w3-form-encode-application/x-w3-isindex (result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (let* ((info (w3-form-encode-helper result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (query (cdr-safe (assoc "isindex" info))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (if query
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (url-hexify-string query)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 "")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (defun w3-form-encode-application/gopher-ask-block (result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 (let ((query ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 ;;; gopher+ will expect all the checkboxes/etc, even if they are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 ;;; not turned on. Should still ignore RADIO boxes that are not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ;;; active though.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (while result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (if (and (not (and (string= (nth 2 (car result)) "RADIO")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (not (nth 6 (car result)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (not (member (nth 2 (car result)) '("SUBMIT" "RESET"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (setq query (format "%s\r\n%s" query (nth 5 (car result)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (setq result (cdr result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (concat query "\r\n.\r\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (defun w3-submit-form (ident)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 ;; Submit form entry fields matching ACTN as their action identifier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (let* ((result (w3-all-widgets ident))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
925 (enctype (or (cdr (assq 'enctype ident))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
926 "application/x-www-form-urlencoded"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (query (w3-form-encode result enctype))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (themeth (upcase (or (cdr (assq 'method ident)) "get")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (theurl (cdr (assq 'action ident))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (if (and (string= "GET" themeth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (string-match "\\([^\\?]*\\)\\?" theurl))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 (setq theurl (url-match theurl 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ((or (string= "POST" themeth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 (string= "PUT" themeth))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 (if (consp query)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (setq enctype (concat enctype "; separator=\""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (substring (car query) 3 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 "\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 query (cdr query)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 (let ((url-request-method themeth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (url-request-data query)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (url-request-extra-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (cons (cons "Content-type" enctype) url-request-extra-headers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (w3-fetch theurl)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ((string= "GET" themeth)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
947 (let ((theurl (concat theurl (if (string-match "gopher" enctype)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
948 "" "?") query)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (w3-fetch theurl)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (w3-warn 'html (format "Unknown submit method: %s" themeth))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (let ((theurl (concat theurl "?" query)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (w3-fetch theurl))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 (provide 'w3-forms)