You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2012/12/03 02:28:38 UTC
svn commit: r1416332 [4/7] - in /tcl/site/rivet/manual2.0: ./ images/
Added: tcl/site/rivet/manual2.0/escape_string.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/manual2.0/escape_string.html?rev=1416332&view=auto
==============================================================================
--- tcl/site/rivet/manual2.0/escape_string.html (added)
+++ tcl/site/rivet/manual2.0/escape_string.html Mon Dec 3 01:28:30 2012
@@ -0,0 +1,11 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>escape_string</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="Apache Rivet"><link rel="up" href="commands.html" title="Rivet Tcl Commands and Variables"><link rel="prev" href="escape_shell_command.html" title="escape_shell_command"><link rel="next" href="headers.html" title="headers"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">escape_string</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="escape_shell_command.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center">Rivet Tcl Commands and Variables</th><td width="20%" align="right"> <a accesskey="n" href="headers.html"><img
src="images/next.png" alt="Next"></a></td></tr></table></div><div class="refentry" title="escape_string"><div class="refentry.separator"><hr></div><a name="escape_string"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>escape_string — convert a string into escaped characters.</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">escape_string</span> ?<span style="font-family:monospace; font-weight: bold;">string</span>?</div></div></div><div class="refsect1" title="Description"><a name="idp5509568"></a><h2>Description</h2><p style="width:90%">
+ Scans through each character in the specified string looking
+ for special characters, escaping them as needed, mapping
+ special characters to a quoted hexadecimal equivalent,
+ returning the result.
+ </p><p style="width:90%">
+ This is useful for quoting strings that are going to be
+ part of a URL.
+ </p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top">
+ You must require the Rivet package in order to gain access to this command
+ </td></tr></table></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="escape_shell_command.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="commands.html"><img src="images/up.png" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="headers.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">escape_shell_command </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> headers</td></tr></table></div></body></html>
Added: tcl/site/rivet/manual2.0/examples.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/manual2.0/examples.html?rev=1416332&view=auto
==============================================================================
--- tcl/site/rivet/manual2.0/examples.html (added)
+++ tcl/site/rivet/manual2.0/examples.html Mon Dec 3 01:28:30 2012
@@ -0,0 +1,456 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Examples and Usage</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="Apache Rivet"><link rel="up" href="index.html" title="Apache Rivet"><link rel="prev" href="wrapline.html" title="wrapline"><link rel="next" href="tcl_packages.html" title="Rivet Tcl Packages"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Examples and Usage</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="wrapline.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="tcl_packages.html"><img src="images/next.png" alt="Next"></a></td></tr></table></
div><div class="section" title="Examples and Usage"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="examples"></a>Examples and Usage</h2></div></div></div><p style="width:90%">
+ Some examples of Rivet usage follow. Some prior Tcl knowledge
+ is assumed. If you don't know much Tcl, don't worry, it's easy,
+ and there are some good resources available on the web that will
+ get you up to speed quickly. Go to the
+ <a class="link" href="help.html#websites" title="Web Sites">web sites</a> section and have a look.
+ </p><div class="example"><a name="hello%20world"></a><p class="title"><b>Example 1. Hello World</b></p><div class="example-contents"><p style="width:90%">
+ As with any tool, it's always nice to see something work, so
+ let's create a small "Hello World" page.</p><p style="width:90%">
+ Assuming you have Apache configured correctly, create a file
+ called <code class="filename">hello.rvt</code> where Apache can find
+ it, with the following content:
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting"><?
+puts "Hello World"
+?>
+</pre><p style="width:90%">
+ If you then access it with your browser, you should see a
+ blank page with the text "Hello World" (without the quotes) on it.
+ </p></div></div><br class="example-break"><div class="example"><a name="idp6308640"></a><p class="title"><b>Example 2. Generate a Table</b></p><div class="example-contents"><p style="width:90%">
+ In another simple example, we dynamically generate a table:
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting"><? puts "<table>\n"
+for {set i 1} { $i <= 8 } {incr i} {
+ puts "<tr>\n"
+ for {set j 1} {$j <= 8} {incr j} {
+ set num [ expr $i * $j * 4 - 1]
+ puts [ format "<td bgcolor=\"%02x%02x%02x\" > $num $num $num </td>\n" \
+ $num $num $num ]
+ }
+ puts "</tr>\n"
+}
+puts "</table>\n" ?>
+</pre><p style="width:90%">
+ If you read the code, you can see that this is pure Tcl. We
+ could take the same code, run it outside of Rivet, and it
+ would generate the same HTML!
+ </p><p style="width:90%">
+ The result should look something like this:
+ </p><div><img src="images/table.png"></div></div></div><br class="example-break"><div class="example"><a name="variable_access"></a><p class="title"><b>Example 3. Variable Access</b></p><div class="example-contents"><p style="width:90%">
+ Here, we demonstrate how to access variables set by GET or
+ POST operations.
+ </p><p style="width:90%">
+ Given an HTML form like the following:
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting"> <form action="vars.rvt">
+ <table>
+ <tbody>
+ <tr>
+ <td><b>Title:</b></td>
+ <td><input name="title"></td>
+ </tr>
+ <tr>
+ <td><b>Salary:</b></td>
+ <td><input name="salary"></td>
+ </tr>
+ <tr>
+ <td><b>Boss:</b></td>
+ <td><input name="boss"></td></tr>
+ <tr>
+ <td><b>Skills:</b></td>
+ <td>
+ <select name="skills" multiple="multiple">
+ <option>c</option>
+ <option>java</option>
+ <option>Tcl</option>
+ <option>Perl</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><input type="submit"></td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+</pre><p style="width:90%">
+ We can use this Rivet script to get the variable values:
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting"><?
+set errlist {}
+if { [var exists title] } {
+ set title [var get title]
+} else {
+ set errlist "You need to enter a title"
+}
+
+if { [var exists salary] } {
+ set salary [var get salary]
+ if { ! [string is digit $salary] } {
+ lappend errlist "Salary must be a number"
+ }
+} else {
+ lappend errlist "You need to enter a salary"
+}
+
+if { [var exists boss] } {
+ set boss [var get boss]
+} else {
+ set boss "Mr. Burns"
+}
+
+if { [var exists skills] } {
+ set skills [var list skills]
+} else {
+ lappend errlist "You need to enter some skills"
+}
+
+if { [llength $errlist] != 0 } {
+ foreach err $errlist {
+ puts "<b> $err </b>"
+ }
+} else {
+ puts "Thanks for the information!"
+ ?>
+ <table>
+ <tbody>
+ <tr>
+ <td><b>Title:</b></td>
+ <td><? puts $title ?></td>
+ </tr>
+ <tr>
+ <td><b>Boss:</b></td>
+ <td><? puts $boss ?></td>
+ </tr>
+ <tr>
+ <td><b>Salary:</b></td>
+ <td><? puts $salary ?></td>
+ </tr>
+ <tr>
+ <td><b>Skills:</b></td>
+ <td><? puts $skills ?></td>
+ </tr>
+ </tbody>
+ </table>
+ <?
+}
+?>
+</pre><p style="width:90%">
+ The first statement checks to make sure that the
+ <code class="varname">boss</code> variable has been passed to the
+ script, and then does something with that information. If
+ it's not present, an error is added to the list of errors.
+ </p><p style="width:90%">
+ In the second block of code, the variable
+ <code class="varname">salary</code> is fetched, with one more error
+ check - because it's a number, it needs to be composed of
+ digits.
+ </p><p style="width:90%">
+ The <code class="varname">boss</code> variable isn't required to have
+ been sent - we set it to "Mr. Burns" if it isn't among the
+ information we received.
+ </p><p style="width:90%">
+ The last bit of variable handing code is a bit trickier.
+ Because <code class="varname">skills</code> is a listbox, and can
+ potentially have multiple values, we opt to receive them as a
+ list, so that at some point, we could iterate over them.
+ </p><p style="width:90%">
+ The script then checks to make sure that
+ <code class="varname">errlist</code> is empty and outputting a thankyou
+ message. If <code class="varname">errlist</code> is not empty, the list
+ of errors it contains is printed.
+ </p></div></div><br class="example-break"><div class="example"><a name="file_upload"></a><p class="title"><b>Example 4. File Upload</b></p><div class="example-contents"><p style="width:90%">
+ The <span style="font-family:monospace"><span class="command"><strong>upload</strong></span></span> command endows Rivet with an
+ interface to access files transferred over http as parts of a
+ multipart form. The following HTML in one file, say,
+ <code class="filename">upload.html</code> creates a form with a text
+ input entry. By clicking the file chooser button the file
+ browser shows up and the user selects the file to be uploaded
+ (the file path will appear in the text input). In order to make
+ sure you're uploading the whole file you must combine the
+ action of the enctype and method attributes of the
+ <form...> tag in the way shown in the example. Failure
+ to do so would result in the client sending only the file's
+ path, rather than the actual contents.
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting"><form action="foo.rvt" enctype="multipart/form-data" method="post">
+<input type="file" name="MyUpload"></input>
+<input type="submit" value="Send File"></input>
+</form>
+</pre><p style="width:90%">
+ In the script invoked by the form
+ (<code class="filename">upload.rvt</code>) <span style="font-family:monospace"><span class="command"><strong>upload</strong></span></span>
+ ?<span style="font-family:monospace; font-weight: bold;">argument ...</span>? commands can be used to manipulate the
+ various files uploaded.
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting"><?
+upload save MyUpload /tmp/uploadfiles/file1
+puts "Saved file [upload filename MyUpload] \
+ ([upload size MyUpload] bytes) to server"
+?></pre><p style="width:90%">
+ Don't forget that the apache server must have write access to
+ the directory where files are being created. The Rivet Apache
+ directives have a substantial impact on the upload process,
+ you have to carefully read the docs in order to set the
+ appropriate directives values that would match your
+ requirements.
+ </p><p style="width:90%">
+ It is also important to understand that some
+ <span style="font-family:monospace"><span class="command"><strong>upload</strong></span></span> commands are effective only when
+ used in a mutually exclusive way. Apache stores the data in
+ temporary files which are read by the <span style="font-family:monospace"><span class="command"><strong>upload save
+ ?<span style="font-family:monospace; font-weight: bold;">upload name</span>? ?<span style="font-family:monospace; font-weight: bold;">filename</span>?</strong></span></span> or by the
+ <span style="font-family:monospace"><span class="command"><strong>upload data ?<span style="font-family:monospace; font-weight: bold;">upload name</span>?</strong></span></span>
+ command. Subsequent calls to these 2 commands using the same
+ ?<span style="font-family:monospace; font-weight: bold;">upload name</span>? argument will return no data on the
+ second call. Likewise <span style="font-family:monospace"><span class="command"><strong>upload channel ?<span style="font-family:monospace; font-weight: bold;">upload
+ name</span>?</strong></span></span> will return a Tcl file channel that you
+ can use in regular Tcl scripts only if you haven't already
+ read the data, for example with a call to the <span style="font-family:monospace"><span class="command"><strong>upload
+ data ?<span style="font-family:monospace; font-weight: bold;">upload name</span>?</strong></span></span> command.
+ </p></div></div><br class="example-break"><div class="example"><a name="file_download"></a><p class="title"><b>Example 5. File Download</b></p><div class="example-contents"><p style="width:90%">
+ In general setting up a data file for being sent over http is
+ as easy as determining the file's URI and letting Apache's
+ do all that is needed. If this approach fits your design all
+ you have to do is to keep the downloadable files somewhere
+ within Apache's DocumentRoot (or in any of the directories
+ Apache has right to access).
+ </p><p style="width:90%">
+ When a client sends a request for a file, Apache takes
+ care of determining the filetype, sends appropriate headers to
+ the client and then the file content. The client is responsible
+ for deciding how to handle the data accordingly to the
+ "content-type" headers and its internal design. For example
+ when browsers give up trying to display a certain "content-type"
+ they display a download dialog box asking for directions from
+ the user.
+ </p><p style="width:90%">
+ Rivet can help if you have more sofisticated needs. For
+ instance you may be developing an application that uses
+ webpages to collect input data. This information might be
+ passed on to scripts or programs for processing.
+ In this case a real file representing the
+ data doesn't exist and the content is generated on demand
+ by the server.
+ In other circumstances you may need to dynamically inhibit
+ the download of specific files and hide them away,
+ Your scripts may expunge from the pages
+ every link to these files (your pages are dynamic, aren't
+ they?) and move them out of way, but it looks like a
+ cumbersome solution.
+ </p><p style="width:90%">
+ Putting Tcl and Rivet in charge of the whole download
+ mechanism helps in building cleaner and safer approaches to
+ the download problem.
+ </p><p style="width:90%">
+ In this example a procedure checks for the existence of a
+ parameter passed in by the browser. The parameter is the name
+ (without extension) of a pdf file.
+ Pdf files are stored in a directory whose path is
+ in the <span style="font-family:monospace"><span class="command"><strong>pdf_repository</strong></span></span> variable.
+ </p><p style="width:90%">
+ This code is reported as an example of how to control
+ the protocol using the <span style="font-family:monospace"><span class="command"><strong>headers</strong></span></span> command.
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting"># Code example for the transmission of a pdf file.
+
+if {[var exists pdfname]} {
+ set pdfname [var get pdfname]
+
+# let's build the full path to the pdf file. The 'pdf_repository'
+# directory must be readable by the apache children
+
+ set pdf_full_path [file join $pdf_repository ${pdfname}.pdf]
+ if {[file exists $pdf_full_path]} {
+
+# Before the file is sent we inform the client about the file type and
+# file name. The client can be proposed a filename different from the
+# original one. In this case, this is the point where a new file name
+# must be generated.
+
+ headers type "application/pdf"
+ headers add Content-Disposition "attachment; filename=${pdfname}.pdf"
+ headers add Content-Description "PDF Document"
+
+# The pdf is read and stored in a Tcl variable. The file handle is
+# configured for a binary read: we are just shipping raw data to a
+# client. The following 4 lines of code can be replaced by any code
+# that is able to retrieve the data to be sent from any data source
+# (e.g. database, external program, other Tcl code)
+
+ set paper [open $pdf_full_path r]
+ fconfigure $paper -translation binary
+ set pdf [read $paper]
+ close $paper
+
+# Now we got the data: let's tell the client how many bytes we are
+# about to send (useful for the download progress bar of a dialog box)
+
+ headers add Content-Length [string length $pdf]
+
+# Let's send the actual file content
+
+ puts $pdf
+
+ } else {
+ parse pdf_not_found_error.rvt
+ }
+} else {
+ parse parameter_not_defined_error.rvt
+}
+</pre><p style="width:90%">
+ Before the pdf is sent the procedure sets the
+ <code class="constant">Content-Type</code>,
+ <code class="constant">Content-Disposition</code>,
+ <code class="constant">Content-Description</code> and
+ <code class="constant">Content-Length</code> headers to inform
+ the client about the file type, name and size. Notice that in
+ order to set the <code class="constant">Content-Type</code> header Rivet
+ uses a specialiezed form of the <span style="font-family:monospace"><span class="command"><strong>headers</strong></span></span>
+ command. Headers must be sent before data gets sent down the
+ output channel. Messing with this prescription causes an error
+ to be raised (in fact the protocol itself is been violated)
+ </p><p style="width:90%">
+ More information about the meaning of the mime headers in the
+ http context can be found at
+ <a class="ulink" href="http://www.w3.org/Protocols/rfc2616/rfc2616.html" target="_top">http://www.w3.org/Protocols/rfc2616/rfc2616.html</a>
+ </p></div></div><br class="example-break"><div class="example"><a name="ajax_xml_messaging"></a><p class="title"><b>Example 6. XML Messages and Ajax</b></p><div class="example-contents"><p style="width:90%">
+ The <span style="font-family:monospace"><span class="command"><strong>headers</strong></span></span> command is crucial for generating
+ XML messages that have to be understood by JavaScript code used
+ in Ajax applications.
+ </p><p style="width:90%">
+ Ajax is a web programming technique that heavily relies on the abilty of a web browser to run in backround
+ JavaScript functions. JavaScript functions can be run as callbacks of events generated by a user interaction
+ but they can also react to other I/O events, for example network events.
+ Modern browsers endow JavaScript with the ability to build http GET/POST requests to be sent to a remote
+ webserver. Generally these requests refer to scripts (e.g. Tcl scripts run by Rivet) which inherit as
+ variables the arguments encoded in the request.
+ The output produced by these scripts is sent back to the browser where callbacks functions extract
+ information and hand it down to functions that directly manipulate a page's DOM.
+ Therefore through Ajax becomes possible to build web applications that are more responsive and flexible:
+ instead of going through the cycle of request-generation-transfer-display
+ of a whole page, Ajax scripts request from a webserver only the essential data to be displayed.
+ Ajax emphasizes the requirement of separation between data and user interface, saves
+ the server from sending over the same html code and graphics if only a fraction of a page has to be
+ updated, allows the programmer to design flexible solutions for complex forms and makes possible
+ to find new innovative approaches to simple problems (e.g. Google tips that show up as you type in
+ a query). A downside of this approach is the large number of complexities, subtleties and incompatibilities
+ that still exist in the way different versions of popular browsers handle the DOM elements of a page.
+ </p><p style="width:90%">
+ JavaScript can handle the communication between client and server through an instance of a
+ specialized object. For quite a long time 2 approaches existed, the non-IE world (Firefox,Safari,Opera...)
+ used the XMLHttpRequest class to create this object, whereas IE (before IE7) used the ActiveXObject class.
+ With the release of IE7 Microsoft introduced native support for XMLHttpRequest class objects thus enabling
+ programmers with a unique method for the development of dynamic pages.
+ </p><p style="width:90%">
+ By creating an instance of this class a POST or GET request can be sent to the server and the response is
+ stored in a property ('returnedText') of the communication object. It's become widely customary to encode
+ these responses in XML messages. You can invent your own message structure (either based on XML or anything
+ else), but one has to be aware that if the http headers are properly set and the message returned to the
+ client is a well formed XML fragment, also the property XMLResponse is assigned with a reference to an object
+ that represents the DOM of the XML response. By means of the XML W3C DOM interface the programmer can easily
+ manipulate the data embedded in the XML message.
+ </p><p style="width:90%">
+ In this example a Rivet script initializes an array with the essential data regarding a few of the major
+ composers of the european music. This array plays the role of a database. The script sends back to the
+ client two types of responses: a catalog of the composers or a single record of a composer.
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">#
+# Ajax query servelet: a pseudo database is built into the dictionary 'composers' with the
+# purpose of emulating the role of a real data source.
+# The script answers with 2 types of responses: a catalog of the record ids and a database
+# entry matching a given rec_id. The script obviously misses the error handling and the
+# likes. Just an example to see rivet sending xml data to a browser. The full Tcl, JavaScript
+# and HTML code are available from http://people.apache.org/~mxmanghi/rivet-ajax.tar.gz
+
+# This example requires Tcl8.5 or Tcl8.4 with package 'dict'
+# (http://pascal.scheffers.net/software/tclDict-8.5.2.tar.gz)
+#
+
+# A pseudo database. rec_id matches a record in the db
+
+set composers [dict create 1 {first_name Claudio middle_name "" last_name Monteverdi \
+ lifespan 1567-1643 era Renaissance/Baroque} \
+ 2 {first_name Johann middle_name Sebastian last_name Bach \
+ lifespan 1685-1750 era Baroque } \
+ 3 {first_name Ludwig middle_name "" last_name "van Beethoven" \
+ lifespan 1770-1827 era Classical/Romantic} \
+ 4 {first_name Wolfgang middle_name Amadeus last_name Mozart \
+ lifespan 1756-1791 era Classical } \
+ 5 {first_name Robert middle_name "" last_name Schumann \
+ lifespan 1810-1856 era Romantic} ]
+
+# we use the 'load' argument in order to determine the type of query
+#
+# load=catalog: we have to return a list of the names in the database
+# load=composer&res_id=<id>: the script is supposed to return the record
+# having <id> as record id
+
+if {[var exists load]} {
+
+# the xml declaration is common to every message (error messages included)
+
+ set xml "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
+ switch [var get load] {
+ catalog {
+ append xml "<catalog>\n"
+ foreach nm [dict keys $composers] {
+ set first_name [dict get $composers $nm first_name]
+ set middle_name [dict get $composers $nm middle_name]
+ set last_name [dict get $composers $nm last_name]
+ append xml " <composer key=\"$nm\">$first_name "
+ if {[string length [string trim $middle_name]] > 0} {
+ append xml "$middle_name "
+ }
+ append xml "$last_name</composer>\n"
+ }
+ append xml "</catalog>\n"
+ }
+ composer {
+ append xml "<composer>\n"
+ if {[var exists rec_id]} {
+ set rec_id [var get rec_id]
+ if {[dict exists $composers $rec_id]} {
+
+ foreach {k v} [dict get $composers $rec_id] {
+ append xml "<$k>$v</$k>\n"
+ }
+
+ }
+ }
+ append xml "</composer>\n"
+ }
+ }
+
+# we have to tell the client this is an XML message. Failing to do so
+# would result in an XMLResponse property set to null
+
+ headers type "text/xml"
+ headers add Content-Length [string length $xml]
+ puts $xml
+}
+
+</pre><p style="width:90%">
+ For sake of brevity the JavaScript and HTML will not listed here. They can be downloaded (along with the Tcl
+ script) stored in the <a class="ulink" href="http://people.apache.org/~mxmanghi/rivet-ajax.tar.gz" target="_top">rivet-ajax.tar.gz</a> archive.
+ By simply opening this tar archive in a directory accessible
+ by your apache server and pointing your browser to the rivetService.html page you should see a page with a
+ drop-down list. Every time a different name is picked from the list a new query is sent and logged in the
+ apache access.log file, even though the html is never reloaded.
+ </p></div></div><br class="example-break"><div class="example"><a name="calendar"></a><p class="title"><b>Example 7. A Calendar Utility</b></p><div class="example-contents"><p style="width:90%">
+ Rivet comes with a <span class="emphasis"><em>Calendar</em></span> package that provides classes for printing
+ calendar tables in various forms.
+ </p><p style="width:90%">
+ The <span class="emphasis"><em>HtmlCalendar</em></span> class prints a calendar table in a similar form the Unix
+ program 'cal' does. Example: the following code
+ </p><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">package require Calendar
+
+proc ::cal_cell_attributes { day month year weekday } {
+ if {$weekday == 3} {
+ return [list class curr_wkday]
+ }
+}
+
+set htmlc [HtmlCalendar #auto]
+set html_txt [$htmlc emit -container {table class calendar} -current_weekday 3 \
+ -cell_function cal_cell_attributes ]
+puts $html_txt
+</pre><p style="width:90%">
+
+ with some CSS styling would print
+ </p><p style="width:90%">
+ </p><div><img src="images/calendar.png"></div><p style="width:90%">
+ </p></div></div><br class="example-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="wrapline.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="tcl_packages.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">wrapline </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> Rivet Tcl Packages</td></tr></table></div></body></html>
Added: tcl/site/rivet/manual2.0/form.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/manual2.0/form.html?rev=1416332&view=auto
==============================================================================
--- tcl/site/rivet/manual2.0/form.html (added)
+++ tcl/site/rivet/manual2.0/form.html Mon Dec 3 01:28:30 2012
@@ -0,0 +1,17 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Form: An HTML Form Fields Generation Utility</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="Apache Rivet"><link rel="up" href="index.html" title="Apache Rivet"><link rel="prev" href="session_package.html" title="Session Package"><link rel="next" href="form_package.html" title="form"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Form: An HTML Form Fields Generation Utility</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="session_package.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="form_package.html"><im
g src="images/next.png" alt="Next"></a></td></tr></table></div><div class="section" title="Form: An HTML Form Fields Generation Utility"><div class="titlepage"><div><div><hr><h2 class="title" style="clear: both"><a name="form"></a>Form: An HTML Form Fields Generation Utility</h2></div></div></div><div class="section" title="Introduction"><div class="titlepage"><div><div><h3 class="title"><a name="idp7981088"></a>Introduction</h3></div></div></div><p style="width:90%">
+ The <span style="font-family:monospace"><span class="command"><strong>form</strong></span></span> package is a utility for generating html forms. A <span style="font-family:monospace"><span class="command"><strong>form</strong></span></span>
+ object command saves the programmer from typing the cumbersome html code of input elements,
+ working out a solution for better standardization and readability of the code.
+ <span style="font-family:monospace"><span class="command"><strong>form</strong></span></span> requires that only the minimum necessary to distinguish the element is
+ typed, greatly simplyfing the development of forms.
+ Options to the command are treated as a list of parameter-value pairs that become the defaults
+ for the corresponding attributes of the form.
+ </p><p style="width:90%">
+ A <span style="font-family:monospace"><span class="command"><strong>form</strong></span></span> object has specialized menthods to generate all of the standard
+ input fields, i.e. text, password, hidden, generic button, submit or reset buttons and
+ image. <span style="font-family:monospace"><span class="command"><strong>form</strong></span></span> creates select input fields, radiobutton and checkbox
+ boolean options groups. Also new inputs introduced with HTML5 are supported: color, date,
+ datetime, datetime-local, email, file, month, number, range, search, tel, time, url, week.
+ </p><p style="width:90%">
+ Other input elements can be generated using the general purpose 'field' method.
+ </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="session_package.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="form_package.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">Session Package </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> form</td></tr></table></div></body></html>
Added: tcl/site/rivet/manual2.0/form_package.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/manual2.0/form_package.html?rev=1416332&view=auto
==============================================================================
--- tcl/site/rivet/manual2.0/form_package.html (added)
+++ tcl/site/rivet/manual2.0/form_package.html Mon Dec 3 01:28:30 2012
@@ -0,0 +1,194 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>form</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="Apache Rivet"><link rel="up" href="form.html" title="Form: An HTML Form Fields Generation Utility"><link rel="prev" href="form.html" title="Form: An HTML Form Fields Generation Utility"><link rel="next" href="calendar_package.html" title="Calendar Package"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">form</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="form.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center">Form: An HTML Form Fields Generation Utility</th><td width="20%" align="right"> <a accesskey="n" href="calend
ar_package.html"><img src="images/next.png" alt="Next"></a></td></tr></table></div><div class="refentry" title="form"><a name="form_package"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>form — a Tcl command object for creating HTML forms</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">form</span> <span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>form_name</code></em></span> ?<span style="font-family:monospace; font-weight: bold;">-option1 <em class="replaceable"><code>value_1</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">-option2 <em class="replaceable"><code>value_2</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">...</span>
?</div></div></div><div class="refsect1"><a name="idp8039024"></a><p style="width:90%">
+ creates and returns a new Tcl command named <em class="replaceable"><code>form_name</code></em>.
+ </p><div class="refsect2" title="Options"><a name="idp8040320"></a><h3>Options</h3><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-method</span> ?<span style="font-family:monospace; font-weight: bold;">post|get</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ The http method for sending the form data back to the server.
+ Possible values are get or post
+ </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-name</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>form_name</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ a name for the form being created: this value becomes the value of the
+ attribute 'name' in the <form> tag.
+ </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-defaults</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>default_values</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ an array of default values to be assigned to the fields of the form.
+ Every name in the array is matched with an input field, when
+ a given field gets added to the form it is initialized with the
+ value of the corresponding variable in the array.
+ This option works well in conjuction with the
+ <span style="font-family:monospace"><span class="command"><strong>load_response</strong></span></span> command of Rivet when default
+ values come from another form.
+ </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-action</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>URL</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ The URL the data are being sent to. If no ?<span style="font-family:monospace; font-weight: bold;">-action</span>? switch is specified
+ the data are sent to the form's URL.
+ </div></div></dd></dl></div></div></div><div class="refsect1" title="Form Object Commands"><a name="idp8059840"></a><h2>Form Object Commands</h2><p style="width:90%">
+ Form object commands follow the usual syntax of Tcl commands with a ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>subcommand</code></em></span>? argument playing the
+ role of a switch among various functionalities of the command. Form objects also need the ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>name</code></em></span>? parameter
+ which is to become the value of the 'name' attribute in an input field. This argument is the key that has to be
+ used by the server-side script to retrieve the input field value.
+ </p><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex ">
+ form_object <span style="font-family:monospace; font-weight: bold;">subcommand</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">-option1 <em class="replaceable"><code>value1</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">-option2 <em class="replaceable"><code>value2</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">...</span>?</div></div></div></dd></dl></div><p style="width:90%">
+ Options passed to a subcommand are copied into the tag as attribute="value" pairs.
+ Some subcommands (e.g. form, radiobuttons and checkboxes) treat specific options in a way
+ that fits the specific organization and function of these fields.
+ </p><p style="width:90%">
+ Exceptions to this general syntax are the <span style="font-family:monospace"><span class="command"><strong>field</strong></span></span> and <span style="font-family:monospace"><span class="command"><strong>end</strong></span></span> subcommands.
+ <span style="font-family:monospace"><span class="command"><strong>field</strong></span></span> is an abstract input field creation method and requires an additional
+ parameter specifiyng the type of field to create. Every concrete input field generation command
+ uses this subcommand internally to print the final html.
+ </p></div><div class="refsect1" title="Subcommands"><a name="idp8074416"></a><h2>Subcommands</h2><div class="refsect2"><a name="idp8075088"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">start</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">-method <em class="replaceable"><code>get | post</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">-name <em class="replaceable"><code>form_name</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">-defaults <em class="replaceable"><code>default_values</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">-action
<em class="replaceable"><code>URL</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Print the <form> tag with all its attributes.
+ This command must be called as first in the form generation
+ process. The following is a sample of code creating a form named 'formname' whose data will
+ be sent via the GET method. Initial form fields values will be obtained from array
+ <code class="varname">response</code>
+ </div><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">
+form myform -defaults response -method get -name formname
+myform start
+myform text text_entry -size 20
+myform select option_selected -values {opt1 opt2 opt3 opt4}
+myform submit submit -value Search
+myform end</pre><div style="margin-bottom:1.5ex ; padding .5ex">
+ The code prints a form that sends a text entry content and the option value
+ associated with a radiobutton. The URL of the server script is the same that
+ created the form. Use the ?<span style="font-family:monospace; font-weight: bold;">-url</span>? option to specify a different url.
+ </div></div></dd></dl></div><div class="refsect3" title="Options"><a name="idp8088816"></a><div style="padding:4 ; margin-top:3 ; margin-left: 5%;">Options</div><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-method</span> ?<span style="font-family:monospace; font-weight: bold;">post|get</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ The method to be used to encode the form data.
+ Possible values are get or post
+ </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-name</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>form_name</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ a name for the form being generated: this value becomes the value of the
+ attribute 'name' in the <form> tag.
+ </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-defaults</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>default_values</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ an array of default values to be assigned to the fields of the form.
+ Every name in the array is matched with an input field, when
+ a given field gets added to the form it is initialized with the
+ value of the corresponding variable in the array.
+ This option works well in conjuction with the
+ <span style="font-family:monospace"><span class="command"><strong>load_response</strong></span></span> command of Rivet when default values
+ come from another form.
+ </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-action</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>URL</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ The URL the data will be sent to. If no ?<span style="font-family:monospace; font-weight: bold;">-action</span>? switch is specified
+ the data are sent to the form's URL.
+ </div></div></dd></dl></div></div></div><div class="refsect2"><a name="idp8108352"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">end</span> </div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Print the </form> closing tag. This command must
+ be called last in the form generation process
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8111888"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">field</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">type</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Print a field of the given ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>type</code></em></span>? and ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>name</code></em></span>?,
+ including any default key-value pairs defined for this field
+ type and optional key-value pairs included with the statement
+ </div></div></dd></dl></div><div class="refsect3" title="Options"><a name="idp8120320"></a><div style="padding:4 ; margin-top:3 ; margin-left: 5%;">Options</div><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-opt1</span> ?<span style="font-family:monospace; font-weight: bold;">val1</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Option description
+ </div></div></dd></dl></div></div></div><div class="refsect2"><a name="idp8125392"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">radiobuttons</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">-values <em class="replaceable"><code>values</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">-labels <em class="replaceable"><code>labels</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ the <span style="font-family:monospace"><span class="command"><strong>radiobutton</strong></span></span> creates a whole radiobutton group
+ with the values and labels specified in the argument list.
+ If no ?<span style="font-family:monospace; font-weight: bold;">-labels</span>? switch is
+ passed to the subcommand the values are printed as labels of
+ the radiobutton.
+ </div><div class="refsect3" title="Options"><a name="idp8134816"></a><div style="padding:4 ; margin-top:3 ; margin-left: 5%;">Options</div><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-values</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>values_list</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ List of values associated with the radiobuttons to be displayed
+ </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-labels</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>labels_list</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ List of labels to be printed with every radiobutton. There must
+ be a label for every radiobutton
+ </div></div></dd></dl></div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Example:
+ </div><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">
+form myform -defaults response -method get -name formname
+myform start
+myform text text_entry -size 20
+myform radiobuttons fruit -values {big medium small} \
+ -labels {Watermelon Orange Strawberry} \
+ -class myradiobclass
+myform submit submit -value Search
+myform end</pre><div style="margin-bottom:1.5ex ; padding .5ex">
+ will print the following HTML code.
+ </div><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">
+<input type="radio" name="fruit" class="myradiobclass" value="big" />Watermelon
+<input type="radio" name="fruit" class="myradiobclass" value="medium" />Orange
+<input type="radio" name="fruit" class="myradiobclass" value="small" />Strawberry
+</pre><div style="margin-bottom:1.5ex ; padding .5ex">
+ if the <code class="varname">response</code> array has a variable for the name 'fruit' the corresponding
+ radiobutton field is automatically checked. The options ?<span style="font-family:monospace; font-weight: bold;">values</span>? and ?<span style="font-family:monospace; font-weight: bold;">labels</span>?
+ are used internally and don't get into the tag attributes. If a ?<span style="font-family:monospace; font-weight: bold;">labels</span>?
+ option is not given, labels are assigned using the ?<span style="font-family:monospace; font-weight: bold;">values</span>? list.
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8152752"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">checkbox</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">-label <em class="replaceable"><code>label</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">-value <em class="replaceable"><code>value</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ The <span style="font-family:monospace; font-weight: bold;">checkbox</span> subcommand emits a checkbox
+ type input field with the name, label and value attributes set
+ according to the parameters passed to the subcommand.
+ </div><div class="refsect3" title="Options"><a name="idp8161376"></a><div style="padding:4 ; margin-top:3 ; margin-left: 5%;">Options</div><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-values</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>values_list</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ List of values associated with the checkboxes to be displayed
+ </div></div></dd><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-left: 5%; margin-bottom:3 ; width:70%;"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">-labels</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>labels_list</code></em></span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ List of labels to be printed with every checkbox. There must
+ be a label for every checkbox
+ </div></div></dd></dl></div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Example:
+ </div><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">myform checkbox options -value opt1 -label "Option 1"
+myform checkbox options -value opt2 -label "Option 2"
+myform checkbox options -value opt3 -label "Option 3"
+myform checkbox options -value opt4 -label "Option 4"</pre><div style="margin-bottom:1.5ex ; padding .5ex">
+ Provided opt2 was in response array (in the list valued 'options' variable) that
+ initialized the form, the output would look like this
+ </div><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting"><input type="checkbox" name="options" label="Option 1" value="opt1" />Option 1
+<input type="checkbox" name="options" label="Option 2" value="opt2"
+ checked="checked" />Option 2
+<input type="checkbox" name="options" label="Option 3" value="opt3" />Option 3
+<input type="checkbox" name="options" label="Option 4" value="opt4" />Option 4</pre></div></dd></dl></div></div><div class="refsect2"><a name="idp8173984"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">password</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Same as text, but the input is obfuscated so as not to reveal the text being typed
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8179552"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">hidden</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ hidden input element: typicall embedded in a form in order to
+ pass status variables.
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8185136"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">submit</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ emits the code for a classical HTML submit button. Example: the following
+ code
+ </div><div style="margin-bottom:1.5ex ; padding .5ex">
+ <pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">
+ form myform -defaults response -method get -name feedsearch
+ myform start
+ myform submit submit -value Search</pre>
+ </div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Would emit a form like this
+ </div><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">
+ <form...>
+ <input type="submit" name="submit" value="Search" />
+ </form></pre></div></dd></dl></div></div><div class="refsect2"><a name="idp8193152"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">button</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ emits the code for a button field having ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>name</code></em></span>? as name
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8199792"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">reset</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Classical HTML reset button that resets the input fields
+ back to their initial values
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8205424"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">image</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an image input field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8210992"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">checkbox</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits a checkbox input field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8216512"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">radio</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits a radiobutton input field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8222032"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">color</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "color" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8227616"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">date</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "date" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8233152"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">datetime</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "datetime" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8238688"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">datetime_local</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "datetime_local" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8244224"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">email</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "email" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8249760"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">file</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "file" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8255296"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">month</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "month" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8260832"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">number</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "number" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8266368"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">range</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "range" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8271904"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">search</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "search" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8277440"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">tel</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "tel" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8282976"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">time</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "time" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8288512"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">text</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits a 'text' editable input form field. Example:
+ </div><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">
+myform text text_entry -size 20</pre><div style="margin-bottom:1.5ex ; padding .5ex">
+ will output the following html line
+ </div><pre style="background:#ccc; margin: 2ex; margin-right: 10%; padding: 1ex; border: dashed black 1px ; white-space: pre; font-family: monospace; font-size: 90%;" class="programlisting">
+<input type="text" name="text_entry" size="20" />
+</pre></div></dd></dl></div></div><div class="refsect2"><a name="idp8296224"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">url</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "url" form field
+ </div></div></dd></dl></div></div><div class="refsect2"><a name="idp8301712"></a><div class="variablelist"><dl><dt></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "> <span style="font-family:monospace; font-weight: bold;">week</span> ?<span style="font-family:monospace; font-weight: bold;">name</span>? ?<span style="font-family:monospace; font-weight: bold;">args</span>?</div></div><div style="margin-bottom:1.5ex ; padding .5ex">
+ Emits an HTML 5 "week" form field
+ </div></div></dd></dl></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="form.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="form.html"><img src="images/up.png" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="calendar_package.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">Form: An HTML Form Fields Generation Utility </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> Calendar Package</td></tr></table></div></body></html>
Added: tcl/site/rivet/manual2.0/headers.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/manual2.0/headers.html?rev=1416332&view=auto
==============================================================================
--- tcl/site/rivet/manual2.0/headers.html (added)
+++ tcl/site/rivet/manual2.0/headers.html Mon Dec 3 01:28:30 2012
@@ -0,0 +1,25 @@
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>headers</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="Apache Rivet"><link rel="up" href="commands.html" title="Rivet Tcl Commands and Variables"><link rel="prev" href="escape_string.html" title="escape_string"><link rel="next" href="http_accept.html" title="http_accept"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">headers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="escape_string.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center">Rivet Tcl Commands and Variables</th><td width="20%" align="right"> <a accesskey="n" href="http_accept.html"><img src="images/next.png
" alt="Next"></a></td></tr></table></div><div class="refentry" title="headers"><div class="refentry.separator"><hr></div><a name="headers"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>headers — set and parse HTTP headers.</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span> (<span style="font-family:monospace; font-weight: bold;">set</span> | <span style="font-family:monospace; font-weight: bold;">redirect</span> | <span style="font-family:monospace; font-weight: bold;">add</span> | <span style="font-family:monospace; font-weight: bold;">type</span> | <span style="font-family:monospace; font-weight: bold;">numeric</span>)</div></div></div><div class="refsect1" title="Description"><a name="idp5520592"></a><h2>Des
cription</h2><p style="width:90%">
+ The <span style="font-family:monospace"><span class="command"><strong>headers</strong></span></span> command is for setting and
+ parsing HTTP headers.
+ </p><div class="variablelist"><dl><dt><span class="term"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span> <span style="font-family:monospace; font-weight: bold;">set</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>headername</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>value</code></em></span>?</div></div>
+ </span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
+ Set arbitrary header names and values.
+ </div></div></dd><dt><span class="term">
+ <div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span> <span style="font-family:monospace; font-weight: bold;">redirect</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>uri</code></em></span>?</div></div>
+ </span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
+ Redirect from the current page to a new
+ URI. <span class="emphasis"><em>Must</em></span> be done in the first block
+ of TCL code.
+ </div></div></dd><dt><span class="term">
+ <div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span> <span style="font-family:monospace; font-weight: bold;">add</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>headername</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>value</code></em></span>?</div></div>
+ </span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Add text to header
+ <code class="varname">headername</code>.</div></div></dd><dt><span class="term"><div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span> <span style="font-family:monospace; font-weight: bold;">type</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>content-type</code></em></span>?</div></div>
+ </span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
+ This command sets the <code class="constant">Content-type</code>
+ header returned by the script, which is useful if you wish
+ to send content other than HTML with Rivet - PNG or jpeg
+ images, for example.
+ </div></div></dd><dt><span class="term">
+ <div class="cmdsynopsis" style="width:80%"><div style="background:#ccccff ; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">headers</span> <span style="font-family:monospace; font-weight: bold;">numeric</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>response code</code></em></span>?</div></div>
+ </span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">Set a numeric response code, such as 200, 404 or 500.
+ </div></div></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="escape_string.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="commands.html"><img src="images/up.png" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="http_accept.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">escape_string </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> http_accept</td></tr></table></div></body></html>
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org