load_response
#set global variable, this is where editing of database filename, etc
#takes place
set datafile guest
set page_title "Simple Example Guestbook"
set background_color "#ffffff"
set homepage "/neowebscript/demos"
set scriptname guestbook.nhtml
proc emit_guestbook {display} {
global datafile page_title background_color webenv response
global homepage scriptname
html ""
html ""
html "$page_title"
html ""
html ""
html "Click here to create an entry
"
set num_to_show 10
set idlist [dbkeys $datafile *]
if {[catch {set idlist [dbkeys $datafile *]} firsttime] != 0} {
set num_ids 0
set first_id 0
} else {
set num_ids [llength $idlist]
set sorted_ids [lsort -integer $idlist]
if {$num_to_show > $num_ids} {set num_to_show $num_ids}
set first_id [expr $num_ids - $num_to_show]
if {$first_id < 0} {set first_id 0}
set work_ids [lrange $sorted_ids $first_id end]
html "These are the last $num_to_show, of $num_ids"
html " people, who were kind enough to sign our guestbook
"
html "
"
foreach id [lsort -integer -decreasing $work_ids] {
dbfetch $datafile $id dbarray
html "
Entry made at "
html "[clock format $dbarray(time) -format $webenv(NEO_TIME_FORMAT)]"
html " using $dbarray(user_agent) "
html "from $dbarray(remote_host)
"
html "
"
html ""
}
}
html ""
html ""
}
proc create_entry {} {
global datafile page_title background_color webenv scriptname
html ""
html ""
html "$page_title - Create New Entry"
html ""
html ""
html "To make an entry in our guest book, enter your information "
html "in the blanks below and click on the Sign In button below. "
html ""
html ""
html ""
html ""
}
proc check_entry {} {
global datafile page_title background_color webenv response scriptname
html ""
html ""
html "$page_title - Check New Entry"
html ""
html ""
html "If there are any mistakes in your entry, click the back button on your browser. "
html "If everything is correct, click the Submit It! button."
html "
Entry made at [clock format $response(time) -format $webenv(NEO_TIME_FORMAT)]"
html " using $response(user_agent) from $response(remote_host)
"
html "
"
html ""
html ""
html ""
html ""
}
proc thank_you {} {
global datafile page_title background_color webenv response homepage
global scriptname
html ""
html ""
html "$page_title - Thank You"
html ""
html ""
html "