summaryrefslogtreecommitdiffstats
path: root/htmlform.txi
diff options
context:
space:
mode:
authorJames LewisMoss <dres@debian.org>2001-07-27 23:45:29 -0400
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:29 -0800
commitf559c149c83da84d0b1c285f0298c84aec564af9 (patch)
treef1c91bcb9bb5e6dad87b643127c3f878d80d89ee /htmlform.txi
parentc394920caedf3dac1981bb6b10eeb47fd6e4bb21 (diff)
parent87b82b5822ca54228cfa6df29be3ad9d4bc47d16 (diff)
downloadslib-f559c149c83da84d0b1c285f0298c84aec564af9.tar.gz
slib-f559c149c83da84d0b1c285f0298c84aec564af9.zip
Import Debian changes 2d2-1debian/2d2-1
slib (2d2-1) unstable; urgency=low * New upstream version * Revert back to free. Is now so. slib (2d1-1) unstable; urgency=low * New upstream version. * Move to non-free. FSF pointed out license doesn't allow modified versions to be distributed. * Get a complete list of copyrights that apply to the source into copyright file. * Remove setup for guile 1.3. * Remove postrm. Just calling install-info (lintian) Move install-info call to prerm since doc-base doesn't do install-info. slib (2c9-3) unstable; urgency=low * Change info location to section "The Algorithmic Language Scheme" to match up with where guile puts it's files. * Postinst is running slibconfig now. (Closes: #75891) slib (2c9-2) unstable; urgency=low * Stop installing slibconfig (for guile). * In postinst if /usr/sbin/slibconnfig exists call it (Close: #75843 #75891). slib (2c9-1) unstable; urgency=low * New upstream (Closes: #74760) * replace string-index with strsrch:string-index in http-cgi.scm. * Add doc-base support (Closes: #31163)
Diffstat (limited to 'htmlform.txi')
-rw-r--r--htmlform.txi343
1 files changed, 131 insertions, 212 deletions
diff --git a/htmlform.txi b/htmlform.txi
index c16818f..ffa0665 100644
--- a/htmlform.txi
+++ b/htmlform.txi
@@ -1,162 +1,182 @@
-
-
-
@code{(require 'html-form)}
+@ftindex html-form
-@defvar *html:output-port*
-Procedure names starting with @samp{html:} send their output
-to the port @var{*html:output-port*}. @var{*html:output-port*} is initially the current output port.
-@end defvar
-
-
-@defun make-atval txt
+@defun html:atval txt
Returns a string with character substitutions appropriate to
send @var{txt} as an @dfn{attribute-value}.
@cindex attribute-value
@end defun
-
-@defun make-plain txt
+@defun html:plain txt
Returns a string with character substitutions appropriate to
send @var{txt} as an @dfn{plain-text}.
@cindex plain-text
@end defun
-
-@defun html:start-page title backlink @dots{}
-Outputs headers for an HTML page named @var{title}.
+@defun html:meta name content
+Returns a tag of meta-information suitable for passing as the
+third argument to @code{html:head}. The tag produced is @samp{<META
+NAME="@var{name}" CONTENT="@var{content}">}. The string or symbol @var{name} can be
+@samp{author}, @samp{copyright}, @samp{keywords}, @samp{description},
+@samp{date}, @samp{robots}, @dots{}.
@end defun
-
-@defun html:end-page
-Outputs HTML codes to end a page.
+@defun html:http-equiv name content
+Returns a tag of HTTP information suitable for passing as the
+third argument to @code{html:head}. The tag produced is @samp{<META
+HTTP-EQUIV="@var{name}" CONTENT="@var{content}">}. The string or symbol @var{name} can be
+@samp{Expires}, @samp{PICS-Label}, @samp{Content-Type},
+@samp{Refresh}, @dots{}.
@end defun
+@defun html:meta-refresh delay uri
-@defun html:pre line1 line @dots{}
-Writes (using @code{html:printf}) the strings @var{line1}, @var{lines} as
-@dfn{PRE}formmated plain text (rendered in fixed-width font).
-@cindex PRE
-Newlines are inserted between @var{line1}, @var{lines}. HTML tags (@samp{<tag>})
-within @var{lines} will be visible verbatim.
-@end defun
+@defunx html:meta-refresh delay
-@defun html:comment line1 line @dots{}
-Writes (using @code{html:printf}) the strings @var{line1} as HTML
-comments.
+Returns a tag suitable for passing as the third argument to
+@code{html:head}. If @var{uri} argument is supplied, then @var{delay} seconds after
+displaying the page with this tag, Netscape or IE browsers will fetch
+and display @var{uri}. Otherwise, @var{delay} seconds after displaying the page with
+this tag, Netscape or IE browsers will fetch and redisplay this page.
@end defun
+@defun html:head title backlink tags @dots{}
-@section HTML Tables
-@defun html:start-table caption
+@defunx html:head title backlink
-@end defun
-
-
-@defun html:end-table
+@defunx html:head title
+Returns header string for an HTML page named @var{title}. If @var{backlink} is a string,
+it is used verbatim between the @samp{H1} tags; otherwise @var{title} is
+used. If string arguments @var{tags} ... are supplied, then they are
+included verbatim within the @t{<HEAD>} section.
@end defun
-
-@defun html:heading columns
-Outputs a heading row for the currently-started table.
+@defun html:body body @dots{}
+Returns HTML string to end a page.
@end defun
-
-@defun html:href-heading columns urls
-Outputs a heading row with column-names @var{columns} linked to URLs @var{urls}.
+@defun html:pre line1 line @dots{}
+Returns the strings @var{line1}, @var{lines} as @dfn{PRE}formmated plain text
+@cindex PRE
+(rendered in fixed-width font). Newlines are inserted between @var{line1},
+@var{lines}. HTML tags (@samp{<tag>}) within @var{lines} will be visible verbatim.
@end defun
-
-@defun make-row-converter k foreigns
-
-
-The positive integer @var{k} is the primary-key-limit (number of
-primary-keys) of the table. @var{foreigns} is a list of the filenames of
-foreign-key field pages and #f for non foreign-key fields.
-
-@code{make-row-converter} returns a procedure taking a row for its single argument. This
-returned procedure prints the table row to @var{*html:output-port*}.
+@defun html:comment line1 line @dots{}
+Returns the strings @var{line1} as HTML comments.
@end defun
+@section HTML Forms
-@defun table-name->filename table-name
-
-Returns the symbol @var{table-name} converted to a filename.
+@defun html:form method action body @dots{}
+The symbol @var{method} is either @code{get}, @code{head}, @code{post},
+@code{put}, or @code{delete}. The strings @var{body} form the body of the
+form. @code{html:form} returns the HTML @dfn{form}.
+@cindex form
@end defun
-
-
-@defun table->html caption db table-name match-key1 @dots{}
-
-Writes HTML for @var{db} table @var{table-name} to @var{*html:output-port*}.
-
-The optional @var{match-key1} @dots{} arguments restrict actions to a subset of
-the table. @xref{Table Operations, match-key}.
+@defun html:hidden name value
+Returns HTML string which will cause @var{name}=@var{value} in form.
@end defun
-
-@defun table->page db table-name index-filename
-
-Writes a complete HTML page to @var{*html:output-port*}. The string
-@var{index-filename} names the page which refers to this one.
+@defun html:checkbox pname default
+Returns HTML string for check box.
@end defun
-
-@defun catalog->html db caption
-
-Writes HTML for the catalog table of @var{db} to @var{*html:output-port*}.
+@defun html:text pname default size @dots{}
+Returns HTML string for one-line text box.
@end defun
+@defun html:text-area pname default-list
+Returns HTML string for multi-line text box.
+@end defun
-@defun catalog->page db caption
+@defun html:select pname arity default-list foreign-values
+Returns HTML string for pull-down menu selector.
+@end defun
-Writes a complete HTML page for the catalog of @var{db} to
-@var{*html:output-port*}.
+@defun html:buttons pname arity default-list foreign-values
+Returns HTML string for any-of selector.
@end defun
+@defun form:submit submit-label command
-@section HTML Forms
+@defunx form:submit submit-label
+The string or symbol @var{submit-label} appears on the button which submits the form.
+If the optional second argument @var{command} is given, then @code{*command*=@var{command}}
+and @code{*button*=@var{submit-label}} are set in the query. Otherwise,
+@code{*command*=@var{submit-label}} is set in the query.
+@end defun
+
+@defun form:image submit-label image-src
+The @var{image-src} appears on the button which submits the form.
+@end defun
+@defun form:reset
+Returns a string which generates a @dfn{reset} button.
+@cindex reset
+@end defun
+@defun form:element pname arity default-list foreign-values
+Returns a string which generates an INPUT element for the field
+named @var{pname}. The element appears in the created form with its
+representation determined by its @var{arity} and domain. For domains which
+are foreign-keys:
+@table @code
+@item single
+select menu
+@item optional
+select menu
+@item nary
+check boxes
+@item nary1
+check boxes
+@end table
+If the foreign-key table has a field named @samp{visible-name}, then
+the contents of that field are the names visible to the user for
+those choices. Otherwise, the foreign-key itself is visible.
+For other types of domains:
-@defun html:start-form method action
-The symbol @var{method} is either @code{get}, @code{head}, @code{post},
-@code{put}, or @code{delete}. @code{html:start-form} prints the header for an HTML
-@dfn{form}.
-@cindex form
+@table @code
+@item single
+text area
+@item optional
+text area
+@item boolean
+check box
+@item nary
+text area
+@item nary1
+text area
+@end table
@end defun
+@defun form:delimited pname doc aliat arity default-list foreign-values
-@defun html:end-form pname submit-label
-@code{html:end-form} prints the footer for an HTML @dfn{form}. The string @var{submit-label}
-@cindex form
-appears on the button which submits the form.
+
+Returns a HTML string for a form element embedded in a line of a
+delimited list. Apply map @code{form:delimited} to the list returned by
+@code{command->p-specs}.
@end defun
+@defun command->p-specs rdb command-table command
-@defun command->html rdb command-table command method action
-The symbol @var{command-table} names a command table in the @var{rdb} relational
-database.
+The symbol @var{command-table} names a command table in the @var{rdb} relational database.
+The symbol @var{command} names a key in @var{command-table}.
-@code{command->html} writes an HTML-2.0 @dfn{form} for command @var{command} to the
-@cindex form
-current-output-port. The @samp{SUBMIT} button, which is labeled @var{command},
-invokes the URI @var{action} with method @var{method} with a hidden attribute
-@code{*command*} bound to the command symbol submitted.
-
-An action may invoke a CGI script
-(@samp{http://www.my-site.edu/cgi-bin/search.cgi}) or HTTP daemon
-(@samp{http://www.my-site.edu:8001}).
+@code{command->p-specs} returns a list of lists of @var{pname}, @var{doc}, @var{aliat},
+@var{arity}, @var{default-list}, and @var{foreign-values}. The
+returned list has one element for each parameter of command @var{command}.
This example demonstrates how to create a HTML-form for the @samp{build}
command.
@@ -165,122 +185,21 @@ command.
(require (in-vicinity (implementation-vicinity) "build.scm"))
(call-with-output-file "buildscm.html"
(lambda (port)
- (fluid-let ((*html:output-port* port))
- (html:start-page 'commands)
- (command->html
- build '*commands* 'build 'post
- (or "/cgi-bin/build.cgi"
- "http://localhost:8081/buildscm"))
- html:end-page)))
-@end example
-@end defun
-
-
-
-
-
-
-@c node HTTP and CGI service, Printing Scheme, HTML Forms, Textual Conversion Packages
-@section HTTP and CGI service
-
-@code{(require 'html-form)}
-
-
-@defun cgi:serve-command rdb command-table
-Reads a @samp{"POST"} or @samp{"GET"} query from
-@code{(current-input-port)} and executes the encoded command from @var{command-table}
-in relational-database @var{rdb}.
-
-This example puts up a plain-text page in response to a CGI query.
-
-@example
-(display "Content-Type: text/plain") (newline) (newline)
-(require 'html-form)
-(load (in-vicinity (implementation-vicinity) "build.scm"))
-(cgi:serve-command build '*commands*)
+ (display
+ (string-append
+ (html:head 'commands)
+ (html:body
+ (sprintf #f "<H2>%s:</H2><BLOCKQUOTE>%s</BLOCKQUOTE>\\n"
+ (html:plain 'build)
+ (html:plain ((comtab 'get 'documentation) 'build)))
+ (html:form
+ 'post
+ (or "http://localhost:8081/buildscm" "/cgi-bin/build.cgi")
+ (apply html:delimited-list
+ (apply map form:delimited
+ (command->p-specs build '*commands* 'build)))
+ (form:submit 'build)
+ (form:reset))))
+ port)))
@end example
@end defun
-
-
-@defun serve-urlencoded-command rdb command-table urlencoded
-Reads attribute-value pairs from @var{urlencoded}, converts them to
-parameters and invokes the @var{rdb} command named by the parameter
-@code{*command*}.
-@end defun
-
-
-
-
-
-
-
-
-@defun http:serve-query input-port output-port serve-proc
-reads the @dfn{query-string} from @var{input-port}. If this is a valid
-@cindex query-string
-@samp{"POST"} or @samp{"GET"} query, then @code{http:serve-query} calls @var{serve-proc} with two
-arguments, the query-string and the header-alist.
-
-Otherwise, @code{http:serve-query} replies (to @var{output-port}) with appropriate HTML describing the
-problem.
-@end defun
-
-
-This example services HTTP queries from port 8081:
-
-@example
-(define socket (make-stream-socket AF_INET 0))
-(socket:bind socket 8081)
-(socket:listen socket 10)
-(dynamic-wind
- (lambda () #f)
- (lambda ()
- (do ((port (socket:accept socket)
- (socket:accept socket)))
- (#f)
- (dynamic-wind
- (lambda () #f)
- (lambda ()
- (fluid-let ((*html:output-port* port))
- (http:serve-query
- port port
- (lambda (query-string header)
- (http:send-header
- '(("Content-Type" . "text/plain")))
- (with-output-to-port port
- (lambda ()
- (serve-urlencoded-command
- build '*commands* query-string)))))))
- (lambda () (close-port port)))))
- (lambda () (close-port socket)))
-@end example
-
-
-@defun http:read-request-line port
-Reads the first non-blank line from @var{port} and, if successful,
-returns a list of three itmes from the request-line:
-
-@enumerate 0
-
-@item Method
-
-Either one of the symbols @code{options}, @code{get}, @code{head},
-@code{post}, @code{put}, @code{delete}, or @code{trace}; Or a string.
-
-@item Request-URI
-
-A string. At the minimum, it will be the string @samp{"/"}.
-
-@item HTTP-Version
-
-A string. For example, @samp{HTTP/1.0}.
-@end enumerate
-@end defun
-
-
-@defun cgi:read-query-string
-Reads the @dfn{query-string} from @code{(current-input-port)}.
-@cindex query-string
-@code{cgi:read-query-string} reads a @samp{"POST"} or @samp{"GET"} queries, depending on the
-value of @code{(getenv "REQUEST_METHOD")}.
-@end defun