annotate lisp/w3/w3-forms.el @ 102:a145efe76779 r20-1b3

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