summaryrefslogtreecommitdiffstats
path: root/htmlform.scm
diff options
context:
space:
mode:
authorSteve Langasek <vorlon@debian.org>2005-01-10 08:53:33 +0000
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:30 -0800
commite33f9eb9cf5cc29c36ce2aa7e10cd0f37ae0cc8e (patch)
treeabbf06041619e445f9d0b772b0d58132009d8234 /htmlform.scm
parentf559c149c83da84d0b1c285f0298c84aec564af9 (diff)
parent8466d8cfa486fb30d1755c4261b781135083787b (diff)
downloadslib-e33f9eb9cf5cc29c36ce2aa7e10cd0f37ae0cc8e.tar.gz
slib-e33f9eb9cf5cc29c36ce2aa7e10cd0f37ae0cc8e.zip
Import Debian changes 3a1-4.2debian/3a1-4.2
slib (3a1-4.2) unstable; urgency=low * Non-maintainer upload. * Add guile.init.local for use within the build dir, since otherwise we have an (earlier unnoticed) circular build-dep due to a difference between scm and guile. slib (3a1-4.1) unstable; urgency=low * Non-maintainer upload. * Build-depend on guile-1.6 instead of scm, since the new version of scm is wedged in unstable (closes: #281809). slib (3a1-4) unstable; urgency=low * Also check for expected creation on slibcat. (Closes: #240096) slib (3a1-3) unstable; urgency=low * Also check for /usr/share/guile/1.6/slib before installing for guile 1.6. (Closes: #239267) slib (3a1-2) unstable; urgency=low * Add format.scm back into slib until gnucash stops using it. * Call guile-1.6 new-catalog (Closes: #238231) slib (3a1-1) unstable; urgency=low * New upstream release * Remove Info section from doc-base file (Closes: #186950) * Remove period from end of description (linda, lintian) * html gen fixed upstream (Closes: #111778) slib (2d4-2) unstable; urgency=low * Fix url for upstream source (Closes: #144981) * Fix typo in slib.texi (enquque->enqueue) (Closes: #147475) * Add build depends. slib (2d4-1) unstable; urgency=low * New upstream. slib (2d3-1) unstable; urgency=low * New upstream. * Remove texi2html call in debian/rules. Now done upstream. Add make html instead. * Changes to rules and doc-base to conform to upstream html gen * Clean up upstream makefile to make sure it cleans up after itself.
Diffstat (limited to 'htmlform.scm')
-rw-r--r--htmlform.scm74
1 files changed, 47 insertions, 27 deletions
diff --git a/htmlform.scm b/htmlform.scm
index 935e006..d659aeb 100644
--- a/htmlform.scm
+++ b/htmlform.scm
@@ -8,7 +8,7 @@
;1. Any copy made of this software must include this copyright notice
;in full.
;
-;2. I have made no warrantee or representation that the operation of
+;2. I have made no warranty or representation that the operation of
;this software will be error-free, and I am under no obligation to
;provide any services, by way of maintenance, update, or otherwise.
;
@@ -22,11 +22,12 @@
(require 'parameters)
(require 'object->string)
(require 'string-search)
-(require 'database-utilities)
+(require 'databases)
(require 'common-list-functions)
;;;;@code{(require 'html-form)}
;;@ftindex html-form
+
(define html:blank (string->symbol ""))
;;@body Returns a string with character substitutions appropriate to
@@ -60,7 +61,7 @@
;;@samp{author}, @samp{copyright}, @samp{keywords}, @samp{description},
;;@samp{date}, @samp{robots}, @dots{}.
(define (html:meta name content)
- (sprintf #f "\n<META NAME=\"%s\" CONTENT=\"%s\">" name (html:atval content)))
+ (sprintf #f "\\n<META NAME=\"%s\" CONTENT=\"%s\">" name (html:atval content)))
;;@body Returns a tag of HTTP information suitable for passing as the
;;third argument to @code{html:head}. The tag produced is @samp{<META
@@ -68,7 +69,7 @@
;;@samp{Expires}, @samp{PICS-Label}, @samp{Content-Type},
;;@samp{Refresh}, @dots{}.
(define (html:http-equiv name content)
- (sprintf #f "\n<META HTTP-EQUIV=\"%s\" CONTENT=\"%s\">"
+ (sprintf #f "\\n<META HTTP-EQUIV=\"%s\" CONTENT=\"%s\">"
name (html:atval content)))
;;@args delay uri
@@ -81,8 +82,8 @@
;;this tag, Netscape or IE browsers will fetch and redisplay this page.
(define (html:meta-refresh delay . uri)
(if (null? uri)
- (sprintf #f "\n<META HTTP-EQUIV=\"Refresh\" CONTENT=\"%d\">" delay)
- (sprintf #f "\n<META HTTP-EQUIV=\"Refresh\" CONTENT=\"%d;URL=%s\">"
+ (sprintf #f "\\n<META HTTP-EQUIV=\"Refresh\" CONTENT=\"%d\">" delay)
+ (sprintf #f "\\n<META HTTP-EQUIV=\"Refresh\" CONTENT=\"%d;URL=%s\">"
delay (car uri))))
;;@args title backlink tags ...
@@ -101,10 +102,12 @@
(sprintf #f "<HTML>\\n")
(sprintf #f "%s"
(html:comment "HTML by SLIB"
- "http://swissnet.ai.mit.edu/~jaffer/SLIB.html"))
+ "http://swissnet.ai.mit.edu/~jaffer/SLIB"))
(sprintf #f " <HEAD>\\n <TITLE>%s</TITLE>\\n %s\\n </HEAD>\\n"
(html:plain title) (apply string-append args))
- (sprintf #f "<BODY><H1>%s</H1>\\n" (or backlink (html:plain title)))))
+ (if (and backlink (substring-ci? "<H1>" backlink))
+ backlink
+ (sprintf #f "<BODY><H1>%s</H1>\\n" (or backlink (html:plain title))))))
;;@body Returns HTML string to end a page.
(define (html:body . body)
@@ -217,7 +220,7 @@
(let ((value-list (map car foreign-values))
(visibles (map cadr foreign-values)))
(string-append
- (sprintf #f "<SELECT NAME=%#a SIZE=%d%s>"
+ (sprintf #f "<SELECT NAME=%#a SIZE=%d%s>\\n"
(html:atval pname)
(case arity
((single optional) 1)
@@ -227,7 +230,7 @@
(else "")))
(apply string-append
(map (lambda (value visible)
- (sprintf #f "<OPTION VALUE=%#a%s>%s"
+ (sprintf #f "<OPTION VALUE=%#a%s>%s\\n"
(html:atval value)
(if (member value default-list) " SELECTED" "")
(html:plain visible)))
@@ -297,11 +300,6 @@
;;@body Returns a string which generates a @dfn{reset} button.
(define (form:reset) "<INPUT TYPE=RESET>")
-(define (html:delimited-list . rows)
- (apply string-append
- "<DL>"
- (append rows '("</DL>"))))
-
;;@body Returns a string which generates an INPUT element for the field
;;named @1. The element appears in the created form with its
;;representation determined by its @2 and domain. For domains which
@@ -363,11 +361,33 @@
(remove-if (lambda (s) (= 1 (string-length s))) (cdr aliat)))
(set! longname (if (null? longname) #f (car longname)))
(if longname
- (string-append
- "<DT>" (html:strong-doc longname doc) "<DD>"
- (form:element pname arity default-list foreign-values))
+ (sprintf #f "<DT>%s\\n<DD>%s\\n"
+ (html:strong-doc longname doc)
+ (form:element pname arity default-list foreign-values))
""))
+;;@body Wraps its arguments with delimited-list (@samp{DL} command.
+(define (html:delimited-list . rows)
+ (apply string-append
+ "<DL>"
+ (append rows '("</DL>"))))
+
+;;;used by command:make-editable-table in db2html.scm;
+;;; and by command->p-specs in htmlform.scm.
+;;@body Returns a list of the @samp{visible-name} or first fields of
+;;table @1.
+(define (get-foreign-choices tab)
+ (define dlst ((tab 'get* 1)))
+ (do ((dlst dlst (cdr dlst))
+ (vlst (if (memq 'visible-name (tab 'column-names))
+ ((tab 'get* 'visible-name))
+ dlst)
+ (cdr vlst))
+ (out '() (if (member (car dlst) (cdr dlst))
+ out
+ (cons (list (car dlst) (car vlst)) out))))
+ ((null? dlst) out)))
+
;;@body
;;
;;The symbol @2 names a command table in the @1 relational database.
@@ -389,16 +409,16 @@
;; (html:head 'commands)
;; (html:body
;; (sprintf #f "<H2>%s:</H2><BLOCKQUOTE>%s</BLOCKQUOTE>\\n"
-;; (html:plain 'build)
-;; (html:plain ((comtab 'get 'documentation) 'build)))
+;; (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))))
+;; '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
(define (command->p-specs rdb command-table command)