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 2009/06/24 14:55:19 UTC
svn commit: r788004 - in /tcl/site/rivet/static: ./ about.html ajax.html
download.html file_download.html file_upload.html hello_world.html
index.html scripts.html shaded_table.html templates.html var_access.html
Author: mxmanghi
Date: Wed Jun 24 12:55:18 2009
New Revision: 788004
URL: http://svn.apache.org/viewvc?rev=788004&view=rev
Log:
Adding static pages of the new website
Added:
tcl/site/rivet/static/
tcl/site/rivet/static/about.html
tcl/site/rivet/static/ajax.html
tcl/site/rivet/static/download.html
tcl/site/rivet/static/file_download.html
tcl/site/rivet/static/file_upload.html
tcl/site/rivet/static/hello_world.html
tcl/site/rivet/static/index.html
tcl/site/rivet/static/scripts.html
tcl/site/rivet/static/shaded_table.html
tcl/site/rivet/static/templates.html
tcl/site/rivet/static/var_access.html
Added: tcl/site/rivet/static/about.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/about.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/about.html (added)
+++ tcl/site/rivet/static/about.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,130 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>Apache Rivet Contact</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">Apache Rivet Contact</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div>
+ <p>
+ <h2>Contact</h2>
+ <p>
+ To contact the <b>Apache Rivet</b>
+ team, please write to our mailing list, at
+ <a href="mailto:rivet-dev@tcl.apache.org">rivet-dev@tcl.apache.org</a>
+.
+ </p>
+ <p>
+ This list is archived here: <a href="http://mail-archives.apache.org/mod_mbox/tcl-rivet-dev/">
+ http://mail-archives.apache.org/mod_mbox/tcl-rivet-dev/</a>
+ </p>
+ <p>
+ To subscribe, send email to
+ <a href="mailto:rivet-dev-subscribe@tcl.apache.org">rivet-dev-subscribe@tcl.apache.org</a>
+ </p>
+ </p>
+ <p>
+ <h2>Credits</h2>
+ <p>
+ <b>Apache Rivet</b>
+ owes its existance to a lot of
+ people. First and foremost, to the people behind the
+ <a href="http://httpd.apache.org/contributors/">Apache Web Server</a>
+
+ and the <a href="http://www.tcl.tk/community/coreteam/index.html">Tool
+ Command Language</a>
+.
+ </p>
+ <p>
+ The two primary authors of the Rivet code are Damon
+ Courtney and <a href="http://www.dedasys.com/davidw/">David
+ Welton</a>
+. The nice logo was created by Randy Stanard,
+ of <a href="http://dewittdesigns.com/">DeWitt Designs</a>
+.
+ </p>
+ </p>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:</div>
+ <div class="rightaligned">:20-06-2009</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/ajax.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/ajax.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/ajax.html (added)
+++ tcl/site/rivet/static/ajax.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,269 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>Ajax</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">Ajax</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+<div class="staticmenu" id="examples">
+ <div class="menuheader">Examples</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Hello world!</a>
+ </span>
+ <span class="navitem">
+ <a href="shaded_table.html" class="menuitem">A shaded table</a>
+ </span>
+ <span class="navitem">
+ <a href="var_access.html" class="menuitem">Variable Access</a>
+ </span>
+ <span class="navitem">
+ <a href="file_upload.html" class="menuitem">File Upload</a>
+ </span>
+ <span class="navitem">
+ <a href="file_download.html" class="menuitem">File Download</a>
+ </span>
+ <span class="navitem">
+ <a href="ajax.html" class="menuitem">XML and Ajax</a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div class="example">
+ <p class="title">
+ <b>Example 6. XML Messages and Ajax</b>
+ </p>
+ <div class="example-contents">
+ <p>
+ The <b>headers</b>
+ command is crucial for generating XML messages that have to be understood by JavaScript
+ code used in Ajax applications.
+ </p>
+ <p>
+ Ajax is a web programming technique that heavily relies on the abilty of JavaScript (and other scriping
+ languages like VBScript) to manipulate dynamically the HTML structure of a page. In modern browsers
+ JavaScript code is enabled to send GET or POST requests to the webserver. These requests can request
+ the server to run scripts (for example Rivet Tcl scripts) that build responses and to be sent back to
+ the browser. JavaScript code reads asynchronously these responses, elaborates their content and accordingly
+ modifies the page on display. Ajax helps to build web applications that are more responsive and flexible,
+ if you can cope with the complexities, subtleties and incompatibilities even among the most common browsers
+ available. Instead of going through the cycle of request-generation-transfer of a page, Ajax allows the programmer
+ to request and transmit only the essential data, thus matching the general requirement of separation between data
+ and user interface (and saving the server from sending over the same html code and graphics when only a
+ fraction of a page has to be refreshed)
+ </p>
+ <p>
+ In Ajax applications the communication between client and server is controlled by 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>
+ By creating an instance of this class a POST or GET request can be sent to the server, whose response is
+ stored in a property ('returnedText') of the communication object. It's become widely customary to encode
+ in XML messages the response from the server to the browser. A number of XML specification are being used
+ for this, among which XML-RPC and SOAP are worth to be quoted. Anyway, you can invent your own message
+ definitions (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 set with a reference to an object that represent the DOM of the XML response.
+ By means of the XML W3C DOM tree methods and properties you can write scripts that read and manipulate
+ the data embedded in the XML message.
+ </p>
+ <p>
+ 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 class="programlisting"># The database array contains xml fragments representing the
+# results of queries to a database. Many databases are now able
+# to produce the results of a query in XML.
+#
+#array unset composer
+#
+set composer(1) "<composer>\n"
+append composer(1) " <first_name>Claudio</first_name>\n"
+append composer(1) " <last_name>Monteverdi</last_name>\n"
+append composer(1) " <lifespan>1567-1643</lifespan>\n"
+append composer(1) " <era>Renaissance/Baroque</era>\n"
+append composer(1) " <key>1</key>\n"
+append composer(1) "</composer>\n"
+
+set composer(2) "<composer>\n"
+append composer(2) " <first_name>Johann Sebastian</first_name>\n"
+append composer(2) " <last_name>Bach</last_name>\n"
+append composer(2) " <lifespan>1685-1750</lifespan>\n"
+append composer(2) " <era>Baroque</era>\n"
+append composer(2) " <key>2</key>\n"
+append composer(2) "</composer>\n"
+
+set composer(3) "<composer>\n"
+append composer(3) " <first_name>Ludwig</first_name>\n"
+append composer(3) " <last_name>van Beethoven</last_name>\n"
+append composer(3) " <lifespan>1770-1827</lifespan>\n"
+append composer(3) " <era>Romantic</era>\n"
+append composer(3) " <key>3</key>\n"
+append composer(3) "</composer>\n"
+
+set composer(4) "<composer>\n"
+append composer(4) " <first_name>Wolfgang Amadaeus</first_name>\n"
+append composer(4) " <last_name>Mozart</last_name>\n"
+append composer(4) " <lifespan>1756-1791</lifespan>\n"
+append composer(4) " <era>Classical</era>\n"
+append composer(4) " <key>4</key>\n"
+append composer(4) "</composer>\n"
+
+set composer(5) "<composer>\n"
+append composer(5) " <first_name>Robert</first_name>\n"
+append composer(5) " <last_name>Schumann</last_name>\n"
+append composer(5) " <lifespan>1810-1856</lifespan>\n"
+append composer(5) " <era>Romantic</era>\n"
+append composer(5) " <key>5</key>\n"
+append composer(5) "</composer>\n"
+
+# 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 [array names composer] {
+ if {[regexp {<last_name>(.+)</last_name>} $composer($nm) m last_name] && \
+ [regexp {<first_name>(.+)</first_name>} $composer($nm) m first_name]} {
+ append xml " <composer key='$nm'>$first_name $last_name</composer>\n"
+ }
+ }
+ append xml "</catalog>"
+ }
+ composer {
+ if {[var exists rec_id]} {
+ set rec_id [var get rec_id]
+ if {[info exists composer($rec_id)]} {
+ append xml $composer($rec_id)
+ }
+ }
+ }
+ }
+
+# 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>
+ 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 href="http://people.apache.org/~mxmanghi/rivet-ajax.tar.gz">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>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:$Author: </div>
+ <div class="rightaligned">:20-06-2009</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/download.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/download.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/download.html (added)
+++ tcl/site/rivet/static/download.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,113 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>Download Apache Rivet</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">Download Apache Rivet</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div>
+ <p>
+ The latest stable <b>Rivet</b>
+ release may be downloaded
+ from the links provided at this page:
+ <p>
+ <a href="http://www.apache.org/dyn/closer.cgi/tcl/rivet">http://www.apache.org/dyn/closer.cgi/tcl/rivet</a>
+ </p>
+ </p>
+ <p>
+ <b>Apache Rivet</b>
+ is actively developed - you can
+ always get the most recent version from SVN.
+ </p>
+ <p>
+ <code>svn co http://svn.apache.org/repos/asf/tcl/rivet/trunk rivet</code>
+ </p>
+ <p>
+ In addition, for your convenience, snapshots of the CVS
+ tree are available here:
+ <a href="http://cvs.apache.org/snapshots/tcl-rivet/">http://cvs.apache.org/snapshots/tcl-rivet/</a>
+ </p>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:</div>
+ <div class="rightaligned">:</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/file_download.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/file_download.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/file_download.html (added)
+++ tcl/site/rivet/static/file_download.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,219 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>File Download</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">File Download</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+<div class="staticmenu" id="examples">
+ <div class="menuheader">Examples</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Hello world!</a>
+ </span>
+ <span class="navitem">
+ <a href="shaded_table.html" class="menuitem">A shaded table</a>
+ </span>
+ <span class="navitem">
+ <a href="var_access.html" class="menuitem">Variable Access</a>
+ </span>
+ <span class="navitem">
+ <a href="file_upload.html" class="menuitem">File Upload</a>
+ </span>
+ <span class="navitem">
+ <a href="file_download.html" class="menuitem">File Download</a>
+ </span>
+ <span class="navitem">
+ <a href="ajax.html" class="menuitem">XML and Ajax</a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div class="example">
+ <p class="title">
+ <b>Example 5. File Download</b>
+ </p>
+ <div class="example-contents">
+ <p>
+ 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>
+ 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 <quote>content-type</quote>
+ 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>
+ 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>
+ Putting Tcl and Rivet in charge of the whole download mechanism helps in building cleaner and safer approaches
+ to the download problem.
+ </p>
+ <p>
+ 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
+ <b>pdf_repository</b>
+ variable.
+ </p>
+ <p>
+ This code is reported as an example of how to control the protocol using the headers command.
+ </p>
+ <pre 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 {
+ source pdf_not_found_error.rvt
+ }
+} else {
+ source parameter_not_defined_error.rvt
+}
+</pre>
+ <p>
+ Before the pdf is sent the procedure sets the Content-Type, Content-Disposition, Content-Description and
+ Content-Length headers to inform the client about the file type, name and size. Notice that in order to
+ set the Content-Type header Rivet uses a specialiezed form of the headers 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 being violated)
+ </p>
+ </div>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:</div>
+ <div class="rightaligned">:</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/file_upload.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/file_upload.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/file_upload.html (added)
+++ tcl/site/rivet/static/file_upload.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,176 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>File Upload</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">File Upload</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+<div class="staticmenu" id="examples">
+ <div class="menuheader">Examples</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Hello world!</a>
+ </span>
+ <span class="navitem">
+ <a href="shaded_table.html" class="menuitem">A shaded table</a>
+ </span>
+ <span class="navitem">
+ <a href="var_access.html" class="menuitem">Variable Access</a>
+ </span>
+ <span class="navitem">
+ <a href="file_upload.html" class="menuitem">File Upload</a>
+ </span>
+ <span class="navitem">
+ <a href="file_download.html" class="menuitem">File Download</a>
+ </span>
+ <span class="navitem">
+ <a href="ajax.html" class="menuitem">XML and Ajax</a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div class="example">
+ <p class="title">
+ <b>Example 4. File Upload</b>
+ </p>
+ <div class="example-contents">
+ <p>
+ The <b>upload</b>
+ 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, upload.html 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 <b>form</b>
+ 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 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>
+ In the script invoked by the form (upload.rvt) <b>upload ?argument ...?</b>
+ commands can be used to
+ manipulate the various files uploaded.
+ </p>
+ <pre class="programlisting"><?
+upload save MyUpload /tmp/uploadfiles/file1
+puts "Saved file [upload filename MyUpload] \
+ ([upload size MyUpload] bytes) to server"
+?>
+</pre>
+ <p>
+ 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>
+ It is also important to understand that some upload commands are effective only when used in a mutually
+ exclusive way. Apache stores the data in temporary files which are read by the
+ <b>upload save ?upload name? ?filename?</b>
+
+ or by the <b>upload data ?upload name?</b>
+ command. Subsequent calls to these 2 commands using the
+ same <b>?upload name?</b>
+ argument will return no data on the second call. Likewise upload channel
+ ?upload name? 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 upload data ?upload name? command.
+ </p>
+ </div>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:</div>
+ <div class="rightaligned">:</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/hello_world.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/hello_world.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/hello_world.html (added)
+++ tcl/site/rivet/static/hello_world.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,147 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>Hello World</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">Hello World</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+<div class="staticmenu" id="examples">
+ <div class="menuheader">Examples</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Hello world!</a>
+ </span>
+ <span class="navitem">
+ <a href="shaded_table.html" class="menuitem">A shaded table</a>
+ </span>
+ <span class="navitem">
+ <a href="var_access.html" class="menuitem">Variable Access</a>
+ </span>
+ <span class="navitem">
+ <a href="file_upload.html" class="menuitem">File Upload</a>
+ </span>
+ <span class="navitem">
+ <a href="file_download.html" class="menuitem">File Download</a>
+ </span>
+ <span class="navitem">
+ <a href="ajax.html" class="menuitem">XML and Ajax</a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div class="example">
+ <a name="hello%20world"/>
+ <p class="title">
+ <b>Example 1. Hello World</b>
+ </p>
+ <div class="example-contents">
+ <p>
+ As with any tool, it's always nice to see something work, so
+ let's create a small "Hello World" page.
+ </p>
+ <p>
+ 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 class="programlisting">
+<?
+ puts "Hello world"
+?> </pre>
+ </div>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:$Author: $</div>
+ <div class="rightaligned">:</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/index.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/index.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/index.html (added)
+++ tcl/site/rivet/static/index.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,219 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>Rivet</title>
+ <link rel="stylesheet" href="/rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="/picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">Rivet - Webscripting for Tcl'ers</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="/static/download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="/static/hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="/static/about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div>
+ <p>
+ <b>Apache Rivet</b>
+ is a powerful, flexible, consistent,
+ fast, and robust solution to creating web applications:
+ </p>
+ <p>
+ <b>Powerful</b>
+: Apache Rivet puts the Tool Command
+ Language in the hands of the programmer, allowing him or
+ her to manipulate data easily and concisely. Millions
+ of lines of Tcl code already exist - all you have to do
+ is glue them together to create unique and useful
+ applications. Rivet unites this power with the Apache
+ web server.
+ </p>
+ <p>
+ <b>Flexible</b>
+: The original design constraints for Tcl
+ required that it be flexible enough to be inserted and
+ function in an extreme variety of environments. That's
+ still true today, and makes Tcl, and as a consequence,
+ Apache Rivet, easy to integrate into your business to
+ leverage existing systems.
+ </p>
+ <p>
+ <b>Consistent</b>
+: The Tool Command Language is
+ integrated with Apache Rivet in such a way as to provide
+ you with an easy-to-learn interface that won't surprise
+ you. Because of this, you can use the same, elegant
+ programming language for your web applications, GUI's
+ (with the Tk toolkit), and quick'n'dirty system
+ administration tasks. Very simple!
+ </p>
+ <p>
+ <b>Fast</b>
+: A dedicated team of programmers works to
+ make sure Apache Rivet locks in tightly with both Tcl
+ and Apache, ensuring that you get as much performance as
+ your hardware can handle. Where you need to squeeze out
+ the last bit of speed, the Tool Command Language
+ provides you with a high-quality C API which lets you
+ write Tcl extensions in no time.
+ </p>
+ <p>
+ <b>Robust</b>
+: Created in the late 80's by U.C. Berkeley
+ professor John Ousterhout, Tcl has stood the test of
+ time, being used in such notable companies as IBM,
+ Oracle, Cisco, AOL, and many, many others. There is a
+ core group of maintainers who oversee the development
+ and maintainance of the Tool Command Language, so that
+ it continues to improve, yet maintains its rock-solid
+ nature.
+ </p>
+ <p>
+ Rivet can be used in two different ways: in
+ <a href="/static/templates.html">Rivet templates</a>
+ or
+ with pure <a href="/static/scripts.html">Tcl scripts</a>
+ </p>
+ <!--table>
+ <tbody>
+ <tr>
+ <td colspan="2"><hr width="90%" /></td>
+ </tr>
+ <tr>
+ <td align="center"><b>Rivet Templates (.rvt)</b></td>
+ <td align="center"><b>Tcl Scripts (.tcl)</b></td>
+
+ </tr>
+ <tr>
+ <td width="50%">
+ Templates let you add a bit of code to your HTML,
+ to add dynamic content to it, or speed up creation
+ of repetitive elements. Templates are appropriate
+ for quick'n'dirty pages, where you just need to do
+ some scripting quickly. But they are also
+ appropriate for the 'display' component of your
+ complex application.
+ </td>
+ <td>
+ Pure Tcl scripts let you do the heavy lifting to
+ control your application. A sensible design
+ pattern is to put most of your complex logic in
+ these files, and then parse template files to
+ display the results. This means that those who
+ are creating the HTML files don't have to know
+ much Tcl, and only need to call a few simple
+ commands.
+ </td>
+ </tr>
+ <tr class="code">
+
+ <td class="code">
+<pre class="code">
+ <span class="type"><table></span>
+ <span class="type"><tbody></span>
+ <span class="type"><tr></span>
+ <span class="type"><td></span>
+<?
+<span class="keyword">foreach</span> line [chat::model::getlines $user] {
+ puts <span class="string">"$line<br>"</span>
+}
+?>
+ <span class="type"></td></span>
+ <span class="type"></tr></span>
+ <span class="type"></tbody></span>
+ <span class="type"></table></span>
+</pre>
+ </td>
+
+ <td class="code">
+<pre class="code">
+<span class="keyword">proc</span> <span class="function-name">chat::model::getlines</span> {user} {
+ set sk [chat::model::getsock]
+ puts $sk [list user $user cmd get msg <span class="string">""</span>]
+ <span class="keyword">if</span> { ! [eof $sk] } {
+ gets $sk data
+ <span class="keyword">return</span> <span class="string">"$data"</span>
+ } <span class="keyword">else</span> {
+ <span class="keyword">error</span> <span class="string">"Problem with socket"</span>
+
+ }
+}
+</pre>
+ </td>
+ </tr>
+ </tbody>
+ </table-->
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:$Author: $</div>
+ <div class="rightaligned">:20-06-2009</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/"><img src="/picts/apache_pb.gif" alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/"><img src="/picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/scripts.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/scripts.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/scripts.html (added)
+++ tcl/site/rivet/static/scripts.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,154 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>Tcl Scripts</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">Tcl Scripts</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+<div class="staticmenu" id="examples">
+ <div class="menuheader">Examples</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Hello world!</a>
+ </span>
+ <span class="navitem">
+ <a href="shaded_table.html" class="menuitem">A shaded table</a>
+ </span>
+ <span class="navitem">
+ <a href="var_access.html" class="menuitem">Variable Access</a>
+ </span>
+ <span class="navitem">
+ <a href="file_upload.html" class="menuitem">File Upload</a>
+ </span>
+ <span class="navitem">
+ <a href="file_download.html" class="menuitem">File Download</a>
+ </span>
+ <span class="navitem">
+ <a href="ajax.html" class="menuitem">XML and Ajax</a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div>
+ <p>
+ Pure Tcl scripts let you do the heavy lifting to control your application. A sensible
+ design pattern is to put most of your complex logic in these files, and then parse template
+ files to display the results. This means that those who are creating the HTML files don't
+ have to know much Tcl, and only need to call a few simple commands.
+ </p>
+ <p>
+ <pre class="programlisting">proc chat::model::getlines {user} {
+ set sk [chat::model::getsock]
+ puts $sk [list user $user cmd get msg ""]
+ if { ! [eof $sk] } {
+ gets $sk data
+ return "$data"
+ } else {
+ error "Problem with socket"
+ }
+}
+
+</pre>
+ </p>
+ <p>
+ For instance scripts are useful when you want to have control of the http protocol and you are not transmitting
+ text/html data. See the example regarding the <a href="file_download.html">file download</a>
+
+ or the xml messaging in <a href="ajax.html">Ajax</a>
+ development.
+ </p>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:$Author: $</div>
+ <div class="rightaligned">:22-06-2009</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/shaded_table.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/shaded_table.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/shaded_table.html (added)
+++ tcl/site/rivet/static/shaded_table.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,156 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>A Shaded Table</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">A Shaded Table</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+<div class="staticmenu" id="examples">
+ <div class="menuheader">Examples</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Hello world!</a>
+ </span>
+ <span class="navitem">
+ <a href="shaded_table.html" class="menuitem">A shaded table</a>
+ </span>
+ <span class="navitem">
+ <a href="var_access.html" class="menuitem">Variable Access</a>
+ </span>
+ <span class="navitem">
+ <a href="file_upload.html" class="menuitem">File Upload</a>
+ </span>
+ <span class="navitem">
+ <a href="file_download.html" class="menuitem">File Download</a>
+ </span>
+ <span class="navitem">
+ <a href="ajax.html" class="menuitem">XML and Ajax</a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div class="example">
+ <p class="title">
+ <b>Example 2. A Shaded Table</b>
+ </p>
+ <div class="example-contents">
+ <p style="width: 90%">In another simple example, we dynamically generate a table:</p>
+ <pre 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>
+ <p>
+ <img src="../picts/table.png"/>
+ </p>
+ </div>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:$Author: $</div>
+ <div class="rightaligned">:22-06-2009</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/templates.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/templates.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/templates.html (added)
+++ tcl/site/rivet/static/templates.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>Rivet Templates</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">Rivet Templates</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+<div class="staticmenu" id="examples">
+ <div class="menuheader">Examples</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Hello world!</a>
+ </span>
+ <span class="navitem">
+ <a href="shaded_table.html" class="menuitem">A shaded table</a>
+ </span>
+ <span class="navitem">
+ <a href="var_access.html" class="menuitem">Variable Access</a>
+ </span>
+ <span class="navitem">
+ <a href="file_upload.html" class="menuitem">File Upload</a>
+ </span>
+ <span class="navitem">
+ <a href="file_download.html" class="menuitem">File Download</a>
+ </span>
+ <span class="navitem">
+ <a href="ajax.html" class="menuitem">XML and Ajax</a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div>
+ <div>
+ Templates let you add a bit of code to your HTML,
+ to add dynamic content to it, or speed up creation
+ of repetitive elements. Templates are appropriate
+ for quick'n'dirty pages, where you just need to do
+ some scripting quickly. But they are also
+ appropriate for the 'display' component of your
+ complex application.
+ </div>
+ <div>
+ <pre class="programlisting"><html>
+ <head><title>Tcl code in a Rivet Template</title></head>
+ <body>
+ <table>
+ <tbody>
+ <tr>
+ <td>
+
+<?
+foreach line [chat::model::getlines $user] {
+ puts "$line<br>"
+}
+?>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </body>
+</html>
+</pre>
+ </div>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:$Author: $</div>
+ <div class="rightaligned">:20-06-2009</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Added: tcl/site/rivet/static/var_access.html
URL: http://svn.apache.org/viewvc/tcl/site/rivet/static/var_access.html?rev=788004&view=auto
==============================================================================
--- tcl/site/rivet/static/var_access.html (added)
+++ tcl/site/rivet/static/var_access.html Wed Jun 24 12:55:18 2009
@@ -0,0 +1,240 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <title>Variable Access</title>
+ <link rel="stylesheet" href="../rivet.css" />
+ </head>
+ <body>
+ <!--p align="center"></p -->
+ <!-- ? parray ::rivetweb::html_menu ? -->
+ <div id="bigcontainer">
+ <div id="pageheadline">
+ <div class="decoration"><img src="../picts/Rivetlogo_smaller.png" alt="Apache Rivet" /></div>
+ <div class="headline">Variable Access</div>
+ </div>
+ <div id="pagecontents">
+ <div class="navbar navleft"><div class="staticmenu" id="main">
+ <div class="menuheader">Rivet</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="../index.html" class="menuitem">Rivet Homepage</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/">Apache Tcl Home</a>
+ </span>
+ <span class="navitem">
+ <a href="http://www.tcl.tk/">The Tcl Language</a>
+ </span>
+ <span class="navitem">
+ <a href="download.html" class="menuitem">Download</a>
+ </span>
+ <span class="navitem">
+ <a href="http://tcl.apache.org/rivet/manual/">Documentation</a>
+ </span>
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Examples</a>
+ </span>
+ <span class="navitem">
+ <a href="about.html" class="menuitem">
+ About Us - Contact
+ </a>
+ </span>
+ </div>
+</div>
+<div class="staticmenu" id="examples">
+ <div class="menuheader">Examples</div>
+ <div class="itemcontainer">
+ <span class="navitem">
+ <a href="hello_world.html" class="menuitem">Hello world!</a>
+ </span>
+ <span class="navitem">
+ <a href="shaded_table.html" class="menuitem">A shaded table</a>
+ </span>
+ <span class="navitem">
+ <a href="var_access.html" class="menuitem">Variable Access</a>
+ </span>
+ <span class="navitem">
+ <a href="file_upload.html" class="menuitem">File Upload</a>
+ </span>
+ <span class="navitem">
+ <a href="file_download.html" class="menuitem">File Download</a>
+ </span>
+ <span class="navitem">
+ <a href="ajax.html" class="menuitem">XML and Ajax</a>
+ </span>
+ </div>
+</div>
+
+</div>
+ <div class="navbar navright"></div>
+ <div id="content">
+ <div class="contentheadline"></div>
+ <div><div class="example">
+ <p class="title">
+ <b>Example 3. Variable Access</b>
+ </p>
+ <div class="example-contents">
+ <p>Here, we demonstrate how to access variables set by GET or POST operations.</p>
+ <p>Given an HTML form like the following:</p>
+ <pre 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>We can use this Rivet script to get the variable values:</p>
+ <pre 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>The first statement checks to make sure that the boss 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>In the second block of code, the variable salary is fetched, with one more error check - because it's a
+ number, it needs to be composed of digits.</p>
+ <p>The boss 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>The last bit of variable handing code is a bit trickier. Because skills 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>The script then checks to make sure that errlist is empty and outputting a thankyou message.
+ If errlist is not empty, the list of errors it contains is printed.</p>
+ </div>
+</div>
+
+</div>
+
+ </div>
+ <div class="clearfloats"></div>
+ <!--div class="leftaligned">:</div>
+ <div class="rightaligned">:</div-->
+ <div>
+ <table align="center" width="100%">
+ <tr>
+ <td align="left">
+ <a href="http://www.apache.org/">
+ <img src="../picts/apache_pb.gif"
+ alt="Powered by Apache" border="0" width="259" height="32"></a>
+
+ </td>
+ <td align="right">
+ <a href="http://www.tcl.tk/">
+ <img src="../picts/tclp.gif" alt="Powered by Tcl" border="0" width="42" height="64"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org