rivet-3.1.1/doc/examples/hello1.rvt000644 001750 001750 00000000025 13415407112 017714 0ustar00manghimanghi000000 000000 rivet-3.1.1/doc/xml/directives.xml000644 001750 001750 00000050034 13415407112 017645 0ustar00manghimanghi000000 000000
Apache Rivet &version; Configuration
Rivet directives are used within the Apache httpd server configuration to set up the environment where Rivet script will be run. Apache Rivet Configuration lines Rivet has 3 general scope directives RivetDirConf: for configuration directives meant to apply to a directory tree RivetUserConf: for directives specific to a user private space RivetServerConf: for any directive meant to apply globally (either to the whole Rivet installation or a single virtual host) These directives are applied so that RivetDirConf will override RivetUserConf, which in turn overrides any RivetServerConf directives. Not every configuration directory is meaningful to a scope directive, as shown in the table below. The scope of application of a configuration line is matched also with the context where it appears. Virtual hosts definitions are contexts where rivet configuration lines can appear in many adding further customization to a given virtual host server. Example of configuration of a web server having independent interpreters for each virtual host, a larger default cache and a specific script to be executed before any templates/scripts located in /var/www/myrivetapp <IfModule rivet_module> AddType application/x-httpd-rivet .rvt AddType application/x-rivet-tcl .tcl RivetServerConf CacheSize 100 RivetServerConf SeparateVirtualInterps On </IfModule> <Directory /var/www/myrivetapp> RivetDirConf BeforeScript "source /var/www/myrivetapp/before_script.tcl" </Directory>
Configuration Directives
Configuration DirectivesDirConfUserConfServerConfVirtual HostNotes
AbortScriptXXXX
AfterScriptXXXX
AfterEveryScriptXXXX
BeforeScriptXXXX
CacheSizeX
ChildExitScriptX
ChildInitScriptX
ErrorScriptXXXX
ExportRivetNSX
GlobalInitScriptXeffective only when SeparateVirtualInterps is Off (default)
ImportRivetNSX
HonorHeaderOnlyRequestsX
MpmBridgeXglobal setting
RequestHandlerXX
SeparateChannelsXglobal setting
SeparateVirtualInterpsXglobal setting
ServerInitScriptX
UploadDirectoryXXX
UploadFilesToVarX
UploadMaxSizeXX
AbortScript script If an is defined control is passed to it as soon as the command is called. is the right place where specific actions can be taken to catch resources left dangling by the sudden interruption. AfterScript script Script to be called after each parsed .rvt template or .tcl script is executed In virtual hosts, this option overrides any AfterScript definitions at the global level. AfterEveryScript script is a script that is to be run anyway before requests processing ends. This script is therefore run both when the content generation script completes successfully and when its execution is interrupted by . The code in this script can understand whether it's running after the page was interrupted by calling with the argument -aborting. The command will return 1 if an abort_page call took place earlier in the request processing. BeforeScript script Script to be evaluated before each server parsed (.rvt) page. This can be used to create a standard header, for instance. It could also be used to load code that you need for every page, if you don't want to put it in a when you are first developing a web site. This code is evaluated at the global level, not inside the request namespace where pages are evaluated. In virtual hosts, this option takes precedence over the global setting. CacheSize size Sets the size of the internal page cache, where is the number of byte-compiled pages to be cached for future use. Default is MaxRequestsPerChild / 5, or 50, if MaxRequestsPerChild is 0. This option is completely global, even when using separate per-virtual host interpreters. ChildExitScript script Script to be evaluated when each Apache child process exits. This is the logical place to clean up resources created in , if necessary. In virtual hosts, this script is run in addition to any global childexitscript. When SeparateVirtualInterp any ChildExitScript placed within a will be that Virtual Host specific exit handler ChildInitScript script Script to be evaluated when each Apache child process is initialized. This is the recommended place to load modules, create global variables, open connections to other facilities (such as databases) and so on. In virtual hosts, this script is run in addition to any global childinitscript. When SeparateVirtualInterp any ChildInitScript placed within a will be that Virtual Host specific ininitalization ErrorScript script When Rivet encounters an error in a script, it constructs an HTML page with some information about the error, and the script that was being evaluated. If an is specified, it is possible to create custom error pages. This may be useful if you want to make sure that users never view your source code. In virtual hosts, this option takes precedence over the global setting. ExportRivetNS yes no Rivet commands are created within the ::rivet namespace. Setting this option you tell mod_rivet to place the whole command set on the export list of namespace, enabling your scripts to import them in a different namespace. This option is, by nature, only available at the global level HonorHeaderOnlyRequests yes no If a HEAD requests is issued by the client Rivet detects this case and sends back to the client a standard header response. If the real header has to be examined (e.g. for debugging) you can turn this options on. This option is, by nature, only available at the global level ImportRivetNS yes no Rivet commands are created within the ::rivet namespace. Setting this option you tell mod_rivet to place the whole command set on the export list of namespace (implicitly forcing also ExportRivetNS) and then importing the commands on the namespace export list into the global namespace This option is provided only for compatibility with existing code that assumes mod_rivet commands to reside in the global namespace. It's utterly discouraged to use it and it could be removed in future versions of Rivet This option is, by nature, only available at the global level MpmBridge string This global only option tells mod_rivet which MPM bridge has to be loaded. The string argument is interpreted first as a name of an MPM bridge and it's interpolated in the string bridge = apr_pstrcat(pool,RIVET_DIR,"/mpm/rivet_",rsc->mpm_bridge,"_mpm.so",NULL); Where RIVET_DIR is the location of the rivet libraries whose definition is controlled by the configuration argument --with-rivet-target-dir=DIR. For example RivetServerConf MpmBridge lazy will cause the rivet_lazy_mpm.so library module to be loaded. If such library does not exists mod_rivet tries to check if such definition is the fully qualified path to such MPM bridge. If this fails the module causes the web server to stop with an error. RequestHandler request_handler_filename Filename of the request handler script. Overrides the default request handler. Can be virtual host specific Note that changing this scripts requires the programmer to understand mod_rivet request processing model. See the request processing manual page SeparateChannels yes no Internally mod_rivet creates a new Tcl channel (Rivet channel) which is configured as stdout and registered to each existing interpreter. There is no need of multiple channels in a single thread as each thread can serve only one request at a time. But if you are deploying mod_rivet in a complex environment running unrelated applications developed by different teams, it could be the case to have SeparateVirtualInterps set. If you want to enhance the environment separation you may also set SeparateChannels to force mod_rivet to create a channel per each Tcl interpreter thus enabling single application code to change the Rivet channel parameters without affecting other applications (even though changing the Tcl channel parameters is a rare necessity). Setting this options increases the system overheads as each Rivet channel needs to allocate its own control structures and internal buffers. This option is implemented in order to have fine-grained control over mod_rivet. In nearly all practical cases you won't need to change Rivet Channel (stdout) settings for different applications by calling fconfigure stdout ..... This option is, by nature, only available at the global level and has effect only if also SeparateVirtualInterps is set SeparateVirtualInterps yes no If on, Rivet will create a separate Tcl interpreter for each Apache virtual host. This is useful in an ISP type situation where it is desirable to separate clients into separate interpreters, so that they don't accidentally interfere with one another. This option is, by nature, only available at the global level. By enabling SeparateVirtualInterps you must rely only on ChildInitScript to initialize the interpreters. Don't expect the initialization done in ServerInitScript and GlobalInitScript to be handed down to the slave interpreters that are private to each configured virtual host. ServerInitScript script The directive ServerInitScript plays a special role since the script runs within the master interpreter, an interpreter created when the Apache web server is setting up for answering requests and before worker processes/threads are started. During this stage Apache is still running as a single process, so this is the right place for doing initialization of systems such as any IPC systems. On systems with the capability of forking child processes the Apache web server can run the prefork MPM. By default rivet selects the prefork brigde which makes mod_rivet work the way mod_rivet &version2-generic; work. In a web server with this set up child processes inherit a copy of the address space from the parent processes and therefore Tcl interpreters too are replicated into the child address space. If SeparateVirtualInteprs is Off child processes run with a copy of the Tcl master interpreter and ServerInitScipt thus provides a way to initialize only once any subsequent Tcl interpreters created by fork calls as each of them are clones of the master interpreter. UploadDirectory directory Directory to place uploaded files. In virtual hosts, this option takes precedence over the global setting. UploadFilesToVar yesno This option controls whether it is possible to upload files to a Tcl variable. If you have a size limit, and don't have to deal with large files, this might be more convenient than sending the data to a file on disk. UploadMaxSize size Maximum size for uploaded files. In virtual hosts, this option takes precedence over the global setting.
rivet-3.1.1/doc/images/draft.png000644 001750 001750 00000042056 13415407112 017242 0ustar00manghimanghi000000 000000 PNG  IHDRKZJgAMA a IDATxv۸asV8 BLhp7v8<[ w`9*i$4`-B ! xb^8x5oTGa0 s;&!b;07kBC}b$xkeY?|os$x cx? /󇄎 {w:Rqpt5Ih'xH1' 桕R4EAB;[ ?Hhŏ1}ZBNBHQvC4)rB29턶n}|CCkׯzA= 4ew i}dx4! ZHNWUŸC4b/_a~9B[4l/C4l,+4l)rϟ? 4`3&+m-c 8z%*i@55 WO#xyy9NB7?6ϳ3cNhLkظwNH1&i֮.yB e=9i4M8mrv/ .@b,5ẻVwͬ [ xm=oD% k v R"e2ʽV}Bv=%~n4M0\.OǽKkm{_ބ4Dd桿 8Z9ɧGHhT4{C% μ$ʤ k4!OT,;NB rzAHCyiʲ,NӂZikòvV41} 7}JyeѳIބ4<蛄zӾgiBcB rzi:InL녙~~~.K܅JrWB+iO}%BH$ 3?UNpEz2?,fNnXk]%kg~J~ZK=q ibߛyq|ArBkyݗۉ#1' _Ьvmۮy*[OSIH]Vބ4|ޑZMrnxޣ$eQI w*~o*i{Oθ Rb44Њ.uYTiI_;[IptЩJph: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r+b?.epV"i,^CZn6XNK說؝~H+9--rwB rVI䴿h$8>29qi}dkh"tJZ촞&j9MBa.ծr#;֜秗'ޘ `XIiOO*!"iF݋ƽCW"z,ii<Üj~Z"|&RCw4004_YYk|לw^k$4$לv8}dnBgiCH$& IiREH!œ& a}iFH-& y#6i~І9MBAҏ$Ih8Bz9MBk,Ih8Bځ9]eUU$4 `9,FTOpXKs##st9i:+s(BڟsBڣr,iipƜ&!$4#B:orZ:!Χ9$:-bFH.Ih7Ж&m?`uIENDB`rivet-3.1.1/doc/xml/help.xml000644 001750 001750 00000005706 13415407112 016442 0ustar00manghimanghi000000 000000
Resources - How to Get Help
Mailing Lists The Rivet mailing list is the first place you should turn for help. If you haven't found the solution to your problem in the documentation or you have a question, idea, or comment about the Rivet code itself send email to rivet-dev@tcl.apache.org. To subscribe to the list, post email to rivet-dev-subscribe@tcl.apache.org. The mailing list archives are available at
Newsgroup The newsgroup is a good place to ask about Tcl questions in general. Rivet developers also follow the newsgroup, but it's best to ask Rivet-specific questions on the Rivet list.
Web Sites There are several web sites that cover Apache and Tcl extensively. is the home for the Apache Tcl project. Go there for the latest versions of our software (if you aren't reading these pages off of the site!). is the first place to go for questions about the Apache web server. is the canonical site for Tcl information. is the Tcl'ers Wiki, a free-form place to search for answers and ask for help.
Bug Tracking System Apache Rivet uses the Apache Bug Tracking system at . Here, you can report problems, or check and see if existing issues are already known and being dealt with.
IRC Occasionally, someone from the Rivet team is on IRC at irc.freenode.net, channel #tcl.
Editing Rivet Template Files Rivet makes available code for two popular editors, emacs and vim to facilitate the editing of Rivet template files. The key concept is that the editor is aware of the <? and ?> tags and switches back and forth between Tcl and HTML modes as the cursor moves. These files, two-mode-mode.el and rvt.vim are available in the contrib/ directory.
rivet-3.1.1/doc/html/escape_sgml_chars.html000664 001750 001750 00000005325 13414171740 021467 0ustar00manghimanghi000000 000000 escape_sgml_chars

Name

escape_sgml_chars — escape special SGML characters in a string.

Synopsis

::rivet::escape_sgml_chars ?string?

Description

Scans through each character in the specified string looking for any special (with respect to SGML, and hence HTML) characters from the specified string, and returns the result. For example, the right angle bracket is escaped to the corrected ampersand gt symbol.

rivet-3.1.1/contrib/rvt.vim000644 001750 001750 00000001101 13415407112 016374 0ustar00manghimanghi000000 000000 " RVT (mod_dtcl) syntax file. " Language: Tcl + HTML " Maintainer: Wojciech Kocjan " Filenames: *.rvt if version < 600 syntax clear elseif exists("b:current_syntax") finish endif if !exists("main_syntax") let main_syntax = 'rvt' endif if version < 600 so :p:h/html.vim else runtime! syntax/html.vim unlet b:current_syntax endif syntax include @tclTop syntax/tcl.vim syntax region rvtTcl keepend matchgroup=Delimiter start="" contains=@tclTop let b:current_syntax = "rvt" if main_syntax == 'rvt' unlet main_syntax endif rivet-3.1.1/rivet/packages/session/session-drop.sql000644 001750 001750 00000000166 13415407112 023156 0ustar00manghimanghi000000 000000 -- -- Drop session management SQL tables -- -- $Id$ -- -- drop table rivet_session_cache; drop table rivet_session; rivet-3.1.1/tests/docroot2/vhost2.rvt000644 001750 001750 00000000370 13415407112 020272 0ustar00manghimanghi000000 000000 " puts "::childinit2 exists
" } elseif {[info exists ::beforescript2]} { ?>Virtual Host2 Test" } ?> rivet-3.1.1/tests/inspect.test000644 001750 001750 00000002343 13415407112 017125 0ustar00manghimanghi000000 000000 ::tcltest::test inspect-1.1 {basic introspection 1.1} { apachetest::start { -c "RivetServerConf ChildInitScript \"set init 1\"" } {} { catch { set inspect_page [::http::geturl "${urlbase}inspect.tcl?p=childinit"] set match [string trim [::http::data $inspect_page]] ::http::cleanup $inspect_page } } set match } {set init 1} ::tcltest::test inspect-1.2 {basic introspection 1.2} { apachetest::start { -c "RivetServerConf ChildInitScript \"set init 1\"" } {} { catch { set inspect_page [::http::geturl "${urlbase}inspect.tcl"] set match [string trim [::http::data $inspect_page]] ::http::cleanup $inspect_page } } set match } {server {ChildInitScript {set init 1}}} ::tcltest::test inspect-1.3 {basic introspection 1.3} { file copy -force inspect.tcl /tmp/ apachetest::start { -c "DocumentRoot /tmp" } {} { catch { set inspect_page [::http::geturl "${urlbase}inspect.tcl?p=script"] set match [::http::data $inspect_page] ::http::cleanup $inspect_page } } file delete /tmp/inspect.tcl set match } {/tmp/inspect.tcl} rivet-3.1.1/doc/html/xml.html000664 001750 001750 00000012702 13414171740 016622 0ustar00manghimanghi000000 000000 xml

Name

xml — XML Fragments creation

Synopsis

::rivet::xml ?string? ?tag descriptor? ?tag descriptor? ?...?

Description

Given a string and a variable number of tag descriptors return XML fragment made by nesting the tags with the same hierarchical order they are listed on the command line. The tag descriptors can be a one element list (the tag) or an odd-length list whose first argument is the tag namme and the remaining elements are interpreted as attribute name-attribute value pairs.

::rivet::xml can work as a replacement of ::rivet::html provided you take care of sending the string with command puts

::rivet::xml "a string" b u
<== <b><u>a string</u></b>

You can specify the tags attributes by replacing a tag specification with a odd-length list containing the tag name and a series of attribute-value pairs

::rivet::xml "a string" [list div class box id testbox] b i
<== <div class="box" id="testbox"><b><i>a string</i></b></div>
::rivet::xml "text to be wrapped in XML" div [list a href http://..../ title "info message"] 
<== <div><a href="http://..../" title="info message">text to be wrapped in XML</a></div>

A single argument is interpreted as a list of tag name and attributes to be coded as a self closing element

::rivet::xml [list b a1 v1 a2 v2]
<== <b a1="v1" a2="v2" />

Unless the string is literally an empty string

::rivet::xml "" [list b a1 v1 a2 v2]
<== <b a1="v1" a2="v2"></b>

which is useful for generating 'script' elements in an HTML page header that wouldn't be understood as single closing element

::rivet::xml "" [list script type "text/javascript" src js/myscripts.js]
<== <script type="text/javascript" src="js/myscripts.js"></script>
rivet-3.1.1/doc/html/images/warning.png000644 001750 001750 00000002331 13414160235 020544 0ustar00manghimanghi000000 000000 PNG  IHDRשPLTE!)1BJRZks{{{RRZZ{{99JJ11))))))!!p;bKGDHIDATxm}o0M5%%m szP^UDKnk[;һ?0n!qCtEXtSoftware@(#)ImageMagick 4.2.8 99/08/01 cristy@mystic.es.dupont.com!*tEXtSignaturec42b7d2d564aab588891979703f02b45OߓtEXtPage24x24+0+0r[ 1IENDB`rivet-3.1.1/doc/html/formbroker.html000664 001750 001750 00000006671 13414171740 020202 0ustar00manghimanghi000000 000000 The Form Broker

The Form Broker

Introduction

The FormBroker package creates instances of form data description objects. These objects instances have a simple set of methods to validate and control data as typically posted by HTML forms, thus data represented as the map of form variables to their values. In Rivet this association can be obtained either calling load_response or var, (form variables can be selectively read also calling ::rivet::var_post or ::rivet::var_qs)

[Note]Note
The FormBroker package is still experimental. Basic functionalities and interface are not likely to change but internal details and implementation could be redesigned in future releases. More specifically the external validator mechanism will likely need design improvements.
rivet-3.1.1/tests/tclconf.tcl000644 001750 001750 00000000105 13415407112 016705 0ustar00manghimanghi000000 000000 # fake tcl 'config' file puts stderr [info script] puts stderr [pwd]rivet-3.1.1/tests/config.test000644 001750 001750 00000006242 13415407112 016727 0ustar00manghimanghi000000 000000 # $Id$ set testfilename1 config.rvt ::tcltest::test config-1.1 {ErrorScript config test} { apachetest::start { -c "RivetUserConf ErrorScript 'puts \"Page broken\"'" } {} { catch { set page [::http::geturl "${urlbase}$testfilename1?brokenpage"] set match [string trim [::http::data $page]] ::http::cleanup $page } } set match } {Page broken} ::tcltest::test config-1.2 {ErrorScript config test} { apachetest::start { -c "RivetUserConf ErrorScript 'puts \"Page broken\"'" -c "AccessFileName test-htaccess" } {} { catch { set page [::http::geturl "${urlbase}$testfilename1?brokenpage"] set match [string trim [::http::data $page]] ::http::cleanup $page } } set match } {Local Page Header this page is BROKEN} ::tcltest::test config-2.1 {BeforeScript test} { set fl [open htaccess2 w] puts $fl {RivetUserConf BeforeScript 'puts "Local Page Header"'} close $fl apachetest::start { -c "AccessFileName htaccess2" } {} { catch { set page [::http::geturl "${urlbase}$testfilename1?goodpage"] set match [string trim [::http::data $page]] ::http::cleanup $page # Now change what's in the ".htaccess" file, and see if it # picks it up. set fl [open htaccess2 w] puts $fl {RivetUserConf BeforeScript 'puts "New Local Page Header"'} close $fl set page [::http::geturl "${urlbase}$testfilename1?goodpage"] append match [string trim [::http::data $page]] ::http::cleanup $page } } set match } {Local Page Header Page BodyNew Local Page Header Page Body} # List of all the configs to try set ConfigList { {-c "RivetUserConf BeforeScript 'puts \"Page Header\"'"} {-c "RivetUserConf BeforeScript 'puts \"Page Header\"'" -c "AccessFileName test-htaccess"} {-c "RivetUserConf AfterScript 'puts \"Page Footer\"'"} {-c "RivetUserConf AfterScript 'puts \"Page Footer\"'" -c "AccessFileName test-htaccess"} {-D DIRTEST} {-D DIRTEST -c "AccessFileName test-htaccess"} {-D DIRTEST -D SERVERCONFTEST} {-D SERVERCONFTEST -c "AccessFileName test-htaccess"} {-D SERVERCONFTEST} {-D DIRTEST -D SERVERCONFTEST -c "AccessFileName test-htaccess"} } # Corresponding list of results we should get set ResultList { {Page Header Page Body} {Local Page Header Page Body Local Page Footer} {Page Body Page Footer} {Local Page Header Page Body Local Page Footer} {Page Header Page Body Page Footer} {Local Page Header Page Body Local Page Footer} {Page Header Page Body Page Footer} {Local Page Header Page Body Local Page Footer} {Page Header Page Body Page Footer} {Local Page Header Page Body Local Page Footer} } set i 0 foreach Config $ConfigList { incr i ::tcltest::test config-auto-${i}.1 {config test} { apachetest::start $Config {} { catch { set page [::http::geturl "${urlbase}$testfilename1?goodpage"] set match [string trim [::http::data $page]] } } set match } [lindex $ResultList [expr $i - 1]] } rivet-3.1.1/doc/README000644 001750 001750 00000001740 13415407112 015042 0ustar00manghimanghi000000 000000 $Id$ Graphic files that are to be displayed in the manual must be in the doc/images/ directory. Files in this directory are copied into the doc/html/images directory where they are referenced by the html pages. Files have to be added to svn manually. References to this files must be relative to the manual root and therefore they look like Code examples can be put in their native form in 'doc/examples'. Adding new examples to the documentation is a 4 step procedure now: 1) Compile and install Rivet 2) Create a new code example in the doc/examples directory. The file has to keep code in native form, i.e. capable to run when placed in your webspace. 3) Run 'make examples'. This procedure will collect the files in 'examples' and store them escaped into 'examples-sgml'. Thus files in this directory are fit for inclusion in XML/XHTML documentation 4) Update the manual to add the reference to the newly generated example. rivet-3.1.1/tests/exit.tcl000644 001750 001750 00000000225 13415407112 016231 0ustar00manghimanghi000000 000000 # -- exit.tcl # # testing effects of calling the core exit command which # actually should have been trapped by ::rivet::exit # # $Id: $ ::exit 100 rivet-3.1.1/rivet/packages/form/form2.tcl000644 001750 001750 00000042112 13415407112 021016 0ustar00manghimanghi000000 000000 # form.tcl -- generate forms automatically. # Copyright 2002-2004 The Apache Software Foundation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. package require Itcl package provide form 2.1 # Rivet form class # # ::itcl::class form { constructor {args} { # set the form method to be a post and the action to be # a refetching of the current page set arguments(method) post set arguments(action) [::rivet::env DOCUMENT_URI] # use $this for the type for form-global stuff like form arguments import_data form $this arguments $args if {[info exists arguments(defaults)]} { # make the public variable contain the name of the array # we are sucking default values out of set defaults $arguments(defaults) upvar 1 $arguments(defaults) callerDefaults array set DefaultValues [array get callerDefaults] unset arguments(defaults) } else { array set DefaultValues {} } } destructor { } method destroy {} { ::itcl::delete object $this } # # import_data -- given a field type, field name, name of an array, and a # list of key-value pairs, prepend any default key-value pairs, # then store the resulting key-value pairs in the named array # protected method import_data {type name arrayName list} { upvar 1 $arrayName data # we now guarantee an array, though empty, will exist array set data {} # # If there are elements in the defaultArgs array for the # specified type, combine them with the list of key-value # pairs, putting the DefaultArgs values first so the # key-value pairs from list can possibly override them. # if {[info exists DefaultArgs($type)]} { set list [concat $DefaultArgs($type) $list] } # # if we don't have an even number of key-value pairs, # that just ain't right # if {[llength $list] % 2} { return -code error "Unmatched key-value pairs" } # # for each key-value pair in the list, strip the first # dash character from the key part and map it to lower # case, then use that as the key for the passed-in # array and store the corresonding value in there # # we also prep and return the list of key-value pairs, normalized # with the lowercase thing # set return "" foreach {var val} $list { set var [string range [string tolower $var] 1 end] if {$var == "prefix"} { set prefix $val continue } set data($var) $val if {($var == "values") || ($var == "labels")} { continue } lappend return -$var $val } return $return } # # argstring - given an array name, construct a string of the # style key1="data1" key2="data2" etc for each key value pair in the # array # protected method argstring {arrayName} { upvar 1 $arrayName data set string "" foreach arg [lsort [array names data]] { append string " $arg=\"$data($arg)\"" } return $string } # # default_value ?-list? ?--? name ?value? # # If value is not given, returns a default value # for that name if one exists, else an empty list. # # if a name and a value are given, the default value is set to that # name (and the new default value is returned). # # The default value is a list if "-list" is given. method default_value {args} { # Command line if {[lindex $args 0] eq "-list"} { set isList 1 set args [lrange $args 1 end] } if {[lindex $args 0] eq "--"} { set args [lrange $args 1 end] } switch -exact -- [llength $args] { 1 { # Return default value lassign $args name if {default_exists $name]} { if {[info exists isList]} { return [default_list_get $name] } else { return [default_value_get $name] } } else { return } } 2 { # Set default value lassign $args name value set DefaultValues($name) $value if {[info exists isList]} { set DefaultValues(__$name) 1 } else { unset -nocomplain DefaultValues(__$name) } } default { error "wrong argument count" } } } # # default_exists - return true, if a default value exists protected method default_exists {name} { return [info exists DefaultValues($name)] } # # default_list_get - get the default value as a list # return with error if there is no default value protected method default_list_get {name} { if {[info exists DefaultValues(__$name)]} { return $DefaultValues($name) } else { return [list $DefaultValues($name)] } } # # default_value_get - get the default value as a value # return with error if there is no default value protected method default_value_get {name} { if {[info exists DefaultValues(__$name)]} { return [lindex $DefaultValues($name) 0] } else { return $DefaultValues($name) } } # # default_value_exists - return true, if the given value exists in the # default list protected method default_value_exists {name value} { if { ! [info exists DefaultValues($name)] } { return 0 } if {[info exists DefaultValues(__$name)]} { return [expr {$value in $DefaultValues($name)}] } return [expr {$value eq $DefaultValues($name)}] } # # default_args - given a type and a variable number of arguments, # if there are no arguments other than the type, return the # element of that name from the DefaultArgs array, if that element # exists, else return an empty list. # # if a name and a value are given, sets the DefaultArgs to the variable # list of arguments. # method default_args {type args} { # if only one argument was specified if {[::rivet::lempty $args]} { if {![info exists DefaultArgs($type)]} { return } return $DefaultArgs($type) } # make sure we have an even number of key-value pairs if {[llength $args] % 2} { return -code error "Unmatched key-value pairs" } # set the DefaultArgs for the specified type return [set DefaultArgs($type) $args] } # # start - generate the
with all of its arguments # method start {{args ""}} { if {![::rivet::lempty $args]} { # replicated in constructor import_data form $this arguments $args } ::rivet::html "" } # # end - generate the
# method end {} { ::rivet::html "" } # # field - emit a field of the given field type and name, including # any default key-value pairs defined for this field type and # optional key-value pairs included with the statement # method field {type name args} { # import any default key-value pairs, then any specified in this # field declaration import_data $type $name data $args switch -- $type { "radio" - "checkbox" { # if there's a label then prepare to output it. if {[info exists data(label)]} { set label "" $data(label) "" } # if there is a default value for this field # and it matches the value we have for it, make # the field show up as selected (checked) # Alternatively, select a checkbox, if it has no value but a # default value with arbitrary value. if { [info exists data(value)] && [default_value_exists $name $data(value)] || ![info exists data(value)] && $type eq "checkbox" && [info exists DefaultValues($name)] } { set data(checked) "checked" } } } # For non multi-choice widgets: set default value if there is no value # given if { ! [info exists data(value)] && [default_exists $name] && $type ni {"select" "radio" "checkbox"} } { set data(value) [default_value_get $name] } # generate the field definition set string "" if {[info exists label]} { append string $label } # ...and emit it ::rivet::html $string } # # text -- emit an HTML "text" field # method text {name args} { field text $name {*}$args } # # password -- emit an HTML "password" field # method password {name args} { field password $name {*}$args } # # hidden -- emit an HTML "hidden" field # method hidden {name args} { field hidden $name {*}$args } # # submit -- emit an HTML "submit" field # method submit {name args} { field submit $name {*}$args } # # button -- emit an HTML "button" field # method button {name args} { field button $name {*}$args } # # reset -- emit an HTML "reset" button # method reset {name args} { field reset $name {*}$args } # # image -- emit an HTML image field # method image {name args} { field image $name {*}$args } # # checkbox -- emit an HTML "checkbox" form field # method checkbox {name args} { field checkbox $name {*}$args } # # radio -- emit an HTML "radiobutton" form field # method radio {name args} { field radio $name {*}$args } # # color -- emit an HTML 5 "color" form field # method color {name args} { field color $name {*}$args } # # date -- emit an HTML 5 "date" form field # method date {name args} { field date $name {*}$args } # # datetime -- emit an HTML 5 "datetime" form field # method datetime {name args} { field datetime $name {*}$args } # # datetime_local -- emit an HTML 5 "datetime-local" form field # method datetime_local {name args} { field datetime-local $name {*}$args } # # email -- emit an HTML 5 "email" form field # method email {name args} { field email $name {*}$args } # # file -- emit an HTML 5 "file" form field # method file {name args} { field file $name {*}$args } # # month -- emit an HTML 5 "month" form field # method month {name args} { field month $name {*}$args } # # number -- emit an HTML 5 "number" form field # method number {name args} { field number $name {*}$args } # # range -- emit an HTML 5 "range" form field # method range {name args} { field range $name {*}$args } # # search -- emit an HTML 5 "search" form field # method search {name args} { field search $name {*}$args } # # tel -- emit an HTML 5 "tel" form field # method tel {name args} { field tel $name {*}$args } # # time -- emit an HTML 5 "time" form field # method time {name args} { field time $name {*}$args } # # url -- emit an HTML 5 "url" form field # method url {name args} { field url $name {*}$args } # # week -- emit an HTML 5 "week" form field # method week {name args} { field week $name {*}$args } # # radiobuttons -- # method radiobuttons {name args} { set data(values) [list] set data(labels) [list] set list [import_data radiobuttons $name data $args] if {[::rivet::lempty $data(labels)]} { set data(labels) $data(values) } foreach label $data(labels) value $data(values) { radio $name {*}$list -label $label -value $value } } # # checkboxes -- # method checkboxes {name args} { set data(values) [list] set data(labels) [list] set list [import_data checkboxes $name data $args] if {[::rivet::lempty $data(labels)]} { set data(labels) $data(values) } foreach label $data(labels) value $data(values) { checkbox $name {*}$list -label $label -value $value } } # # select -- generate a selector # # part of the key value pairs can include -values with a list, # and -labels with a list and it'll populate the