# # rfc.ws3 -- example use of sessions with websh # nca-073-9 # # Copyright (C) 1996-2000 by Netcetera AG. # All rights reserved. # # See the file "license.terms" for information on usage and # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # @(#) $Id$ # web::filecounter idgen -filename [file join .. .. data rfc state.SEQNO] web::filecontext dscc -path [file join .. .. data rfc %d.dsc] \ -idgen idgen proc startPage {} { return "\nRFC index\n\n\n" } proc finishPage {} { return "
[web::copyright -version]
" } proc formatLink {url {show ""}} { if {$show == ""} { set show $url } return "$show" } proc putLink {url {show ""}} { web::put [formatLink $url $show] } web::command delete { file delete [file join .. .. data rfc [web::param dscid].dsc] web::dispatch -cmd default -querystring "" -postdata "" } web::command submit { if { [web::param -count dscid] } { dscc::init [web::param dscid] } else { dscc::new [idgen nextval] } foreach nam [web::formvar] { web::log info {$nam} dscc::cset $nam [web::formvar $nam] } dscc::commit web::dispatch -cmd default -querystring "" -postdata "" } web::command edit { if { [web::param -count dscid] } { dscc::init [web::param dscid] set action [web::cmdurl submit [list dscid [web::param dscid]]] set rfc [dscc::cget rfc] set url [dscc::cget url] set sdsc [dscc::cget sdsc] } else { set action [web::cmdurl submit] set rfc "" set url "" set sdsc "" } web::put [startPage] web::putx {
RFC number
{web::putx {}}
URL
{web::putx {}}
short description
{web::putx {}}
} web::put [finishPage] } proc doToggle {aTog} { upvar $aTog tog if {$tog == 1} {set tog 0} else {set tog 1} return $tog } web::command default { set toggle 1 web::put [startPage] putLink [web::cmdurl edit] new web::put "


" catch { set flist [glob pattern [file join .. .. data rfc *.dsc]] } msg if {[info exists flist]} { web::put " " foreach dsc $flist { if {$toggle == 0 } { web::put { } } else { web::put { } } doToggle toggle set dsc [file rootname [file tail $dsc]] dscc::init $dsc web::put "" web::put "" web::put "" web::put "" web::put " " } } web::put "
[formatLink [web::cmdurl edit [list dscid $dsc]] {o}][formatLink [web::cmdurl delete [list dscid $dsc]] {x}][formatLink [dscc::cget url] [dscc::cget rfc]][dscc::cget sdsc]
" web::put [finishPage] } web::dispatch -track id