[Wisp-cvs] wisp/web gray.cgi,NONE,1.1 names.cgi,NONE,1.1 show.cgi,NONE,1.1 wisp.css,NONE,1.1 Makefil
Status: Alpha
Brought to you by:
digg
|
From: <di...@us...> - 2002-08-31 14:29:40
|
Update of /cvsroot/wisp/wisp/web
In directory usw-pr-cvs1:/tmp/cvs-serv4997/web
Modified Files:
Makefile.am index.html
Added Files:
gray.cgi names.cgi show.cgi wisp.css
Log Message:
Moved gray.cgi, names.cgi, show.cgi, and wisp.css from doc/examples to web .
--- NEW FILE: gray.cgi ---
#! /usr/bin/wisp -eC
Content-type: text/html; charset=utf-8
|: (use strings) :|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Gray Scales (Sample eWisp run)</title>
<link type="text/css" href="wisp.css" rel="stylesheet">
</head>
<!-- @(#) $Id: gray.cgi,v 1.1 2002/08/31 14:29:38 digg Exp $ -->
<body>
<h1>Gray Scales</h1>
<p>This is running on Wisp version [: wisp-version :] that was built at
about [: wisp-build :] by [: wisp-builder :] and
might or might not be the current version.</p>
<p>Look at the <a href='show.cgi?file=gray.cgi'>source code</a>.</p>
<p>Here's an automatically generated list of some gray tones:</p>
<table cellpadding=16 width='100%'>
|:
(do ((row 0 (+ row 1)))
((>= row 8))
(write-string "<tr>\n")
(do ((col 0 (+ col 1)))
((>= col 8))
(my i (+ (* col 32) (* row 4))
(my hex-color (pad-left (integer->string i 16) 2 #\0)
(set! hex-color (string-append hex-color hex-color hex-color))
(print "<td style='background-color: #$,[hex-color]'><tt style='color: blue'>$,[hex-color]</tt></td>\n"))))
(write-string "</tr>\n"))
:|
</table>
<hr>
<p>
<a href='http://validator.w3.org/check/referer'><img
src='/valid-html401.gif' alt='Valid HTML 4.01!'
style='border: 0' width='88' height='31'></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="/vcss.gif" alt="Valid CSS!"
style='border: 0' width="88" height="31"></a>
</p>
</body>
</html>
|: ; vim: ft=ewisp
--- NEW FILE: names.cgi ---
#! /usr/bin/wisp -Ce
Content-type: text/html; charset=utf-8
Pragma: no-cache
Expires: Fri, 1 Sep 2000 00:00:00 +0000
|: (use cgi strings time) :|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Name list demo</title>
<link rel="stylesheet" href="wisp.css" type="text/css">
<!-- @(#) $Id: names.cgi,v 1.1 2002/08/31 14:29:38 digg Exp $ -->
</head>
<body class=white>
<h1 style="text-align: center">Name list demo</h1>
<div style="text-align: center">
<table cellpadding=16>
<tr><td style="color: black; background-color: #ffffc0">
|: (define time (unix-time)) :|
It's currently [: time :] o' Unix clock. <p>
|: (define time-parts (posix-time->utc time)) :|
Therefore, have a nice
[: (vector-ref
'#("January" "February" "March"
"April" "May" "June"
"July" "August" "September"
"October" "November" "December")
(- (second time-parts) 1)) :]
[: (my mday (third time-parts)
(string-append
(integer->string mday)
(cond
((and (>= mday 4) (<= mday 19)) "th")
((= (remainder mday 10) 1) "st")
((= (remainder mday 10) 2) "nd")
((= (remainder mday 10) 3) "rd")
(else "th")))) :]
[: (first time-parts) :] CE! <p>
<form action="names.cgi" method=get>
|: (define *whole-list* (make-box '()))
;; I urge you to acknowledge that it's very insecure to have the user maintain
;; his status data and send it back to you and thusly, it should NOT be done.
;; HOWEVER, by doing this in a demo like this, maybe you, a potential
;; developer, can see for yourself why this is so bad.
;; Besides, it makes the Lisp-style CGI processing much more apparent.
(let ((old (dict-fetch *cgi-query* 'old))
(inp (dict-fetch *cgi-query* 'inp)))
(if inp
(begin
(car! inp)
(set! inp (string-join (string->word-list inp)))
(if (string=? inp "")
(print "Toggle an empty name, huh?<p>\n")
(if old
(begin
(car! old)
(if (not (cons? old))
(set! old (list old)))
(my filt? #f
(set! old (collect
(lambda (emit)
(for-each
(lambda (vi)
(cond
((string=? vi inp)
(set! filt? #t))
((string-ci=? vi inp)
(set! filt? #t)
(emit inp))
(else
(emit vi))))
old)
(if (not filt?)
(emit inp)))))))
(set! old (list inp))))
(set! (box-ref *whole-list*) old)
(print "<p>Your list has $(length (box-ref *whole-list*)) names so far")
(if (not (null? (box-ref *whole-list*)))
(print ", as follows"))
(print ".</p>\n")
(if (not (box-ref *whole-list*))
(set! (box-ref *whole-list*) '()))
(if (not (null? (box-ref *whole-list*)))
(begin
(print "<ol>\n")
(for-each
(lambda (n)
(print "<li> $,[n]\n")
(print "<input type=hidden name=old value=\"$,[n]\">\n")) (box-ref *whole-list*))
(print "</ol>\n"))))))
:|
<p>Name: <input name=inp> <input type=submit value=Toggle></p>
</form>
</td></tr>
<tr><td style="width: 24em">
Whenever you enter a name and hit the Toggle button, the name will be added
to the list above|: (if (null? (box-ref *whole-list*))
(print " (which is not shown currently \
because it's empty)")) :|.
If the name happens to be there already, it's, contrariwise, removed. <p>
Note that this application is case knowledgeable.<p>
That's it. <p>
Well, the <a href="show.cgi?file=names.cgi">source</a> is available too.
<p>
And finally, you might want to validate that this machine-generated page
uses <a href="http://validator.w3.org/check/referer">valid HTML</a> and
<a href="http://jigsaw.w3.org/css-validator/check/referer">valid CSS</a>.
</td></tr>
</table>
</div>
</body>
</html>
|: #| vim: set ft=ewisp: |# :|
--- NEW FILE: show.cgi ---
#! /usr/bin/wisp -Ce
Content-type: text/html; charset=UTF-8
|:
;;;; show.cgi - show a script to a web client
;;
;; Copyleft © 2002 by Andres Soolo (di...@us...)
;; This file is licensed under the GNU GPL v2. If you
;; don't know what that means, please do read the GPL.
;;
;;;; @(#) $Id: show.cgi,v 1.1 2002/08/31 14:29:38 digg Exp $
(use
cgi unix)
(define source-name (dict-ref *cgi-query* 'file "show.cgi"))
(define errors? (make-box #f))
:|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Listing of [: (html-encode source-name) :]</title>
<link rel="stylesheet" href="wisp.css" type="text/css">
</head>
<body>
<h1>Listing of [: (html-encode source-name) :]</h1>
<hr>
|: (if (or (absolute-path? source-name)
(path-contains-dotdot? source-name))
(begin
(print "<div class=err>Sorry, I can't let you \
see this file.</div>\n")
(set! (box-ref errors?) #t))
(my source-file (try (open-input-file source-name)
(except ()
'#f))
(if source-file
(begin
(print "<pre class=listing><tt>\n")
(let (loop)
(my source-line (read-line source-file)
(if (not (eof-object? source-line))
(begin
(print "$,(html-encode source-line)\n")
(loop)))))
(print "</tt></pre>"))
(begin
(print "<div class=err>Sorry, I couldn't \
open this file.</div>")
(set! (box-ref errors?) #t)))))
:|
<hr>
|: (define identity (if (box-ref errors?) "error message" "listing")) :|
<p>This [: identity :] was generated by a
<a href="http://wisp.sourceforge.net/">Wisp</a> script. <br>
[: ; It could be done in a better way.
(if (string=? source-name "show.cgi")
""
"See the <a href=\"show.cgi?file=show.cgi\">\
listing of the lister</a>.<br>") :]
<a href="http://validator.w3.org/check/referer">Validate</a> this [: identity :].</p>
</body>
</html>
|: #| vim: set ft=ewisp
--- NEW FILE: wisp.css ---
(This appears to be a binary file; contents omitted.)
Index: Makefile.am
===================================================================
RCS file: /cvsroot/wisp/wisp/web/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am 28 Aug 2002 20:05:43 -0000 1.1
+++ Makefile.am 31 Aug 2002 14:29:37 -0000 1.2
@@ -6,4 +6,17 @@
#
#### @(#) $Id$
-EXTRA_DIST = .cvsignore index.html
+EXTRA_DIST = .cvsignore gray.cgi index.html names.cgi show.cgi wisp.css
+
+webdir = ${prefix}/share/doc/wisp/web
+
+install: install-dir install-readable install-executable
+
+install-dir:
+ install -d ${webdir}
+
+install-readable: index.html wisp.css
+ install -m644 $^ ${webdir}
+
+install-executable: gray.cgi names.cgi show.cgi
+ install -m755 $^ ${webdir}
Index: index.html
===================================================================
RCS file: /cvsroot/wisp/wisp/web/index.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- index.html 28 Aug 2002 20:05:43 -0000 1.1
+++ index.html 31 Aug 2002 14:29:38 -0000 1.2
@@ -4,6 +4,7 @@
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
<link type="text/css" href="wisp.css" rel="stylesheet">
<title>Resources for the Wisp Community</title>
+<!-- @(#) $Id$ -->
</head>
<body>
<center>
@@ -27,12 +28,12 @@
src="vcss.gif" border="0" width="88" height="31"
alt="Valid CSS!"></a>
<p>
- <a href="http://www.anybrowser.org/campaign/"><img
- src=anybrowser.gif border=0 width=88 height=31
- alt="Best viewed with ANY browser"></a>
+ <a href="http://www.anybrowser.org/campaign/"><img
+ src=anybrowser.gif border=0 width=88 height=31
+ alt="Best viewed with ANY browser"></a>
<p>
<hr>
- <p>
+ <p>
<b>Hosted by</b><br>
<a href="http://www.sourceforge.net/"><img
src="http://sourceforge.net/sflogo.php?group_id=3492"
|