2011-07-01 22:56:53 +00:00
|
|
|
|
|
|
|
if {![exists -proc require]} {
|
2011-07-05 18:38:42 +00:00
|
|
|
proc require {args} {{done {}}} {
|
2011-07-01 22:56:53 +00:00
|
|
|
foreach file $args {
|
2011-07-07 22:33:19 +00:00
|
|
|
if {$file ni $done} {
|
2012-05-21 20:23:41 +00:00
|
|
|
uplevel source "/mod/webif/lib/$file"
|
2011-07-05 18:38:42 +00:00
|
|
|
lappend $done $file
|
|
|
|
}
|
2011-07-01 22:56:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-09 22:46:15 +00:00
|
|
|
proc httpheader {{type "text/html"} {cache 0} {extra ""}} {{done 0}} {
|
|
|
|
if {$done} return
|
|
|
|
if {!$cache} {
|
|
|
|
puts -nonewline "Content-Type: $type; no-cache\r\n"
|
|
|
|
puts -nonewline "Expires: -1\r\n"
|
|
|
|
puts -nonewline "Pragma: no-cache\r\n"
|
|
|
|
puts -nonewline "Cache-Control: no-cache\r\n"
|
|
|
|
} else {
|
|
|
|
puts "Content-Type: $type\r\n"
|
|
|
|
}
|
|
|
|
puts -nonewline $extra
|
|
|
|
puts -nonewline "\r\n"
|
|
|
|
set done 1
|
|
|
|
}
|
|
|
|
|
|
|
|
proc header {{type "text/html"} {cache 0}} {
|
|
|
|
httpheader $type $cache
|
2012-05-21 20:23:41 +00:00
|
|
|
uplevel source /mod/webif/html/lib/header.jim
|
2011-07-01 22:56:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc footer {} {
|
2012-05-21 20:23:41 +00:00
|
|
|
uplevel source /mod/webif/html/lib/footer.jim
|
2011-07-01 22:56:53 +00:00
|
|
|
}
|
2012-01-22 19:47:47 +00:00
|
|
|
|
2012-10-23 22:51:54 +00:00
|
|
|
proc mheader {} {
|
|
|
|
uplevel source /mod/webif/html/m/lib/header.jim
|
|
|
|
}
|
|
|
|
|
|
|
|
proc mfooter {} {
|
|
|
|
uplevel source /mod/webif/html/m/lib/footer.jim
|
|
|
|
}
|
|
|
|
|
2012-01-22 19:47:47 +00:00
|
|
|
# Replace the built-in jim {file copy} command with one that is
|
|
|
|
# largefile safe.
|
|
|
|
|
|
|
|
require filecopy
|
2011-07-01 22:56:53 +00:00
|
|
|
}
|
|
|
|
|