webif/var/mongoose/lib/setup
hummypkg c095cc7913 1.0.5
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1632 2a923420-c742-0410-a762-8d5b09965624
2013-07-30 20:07:13 +00:00

58 lines
1.4 KiB
Plaintext

if {![exists -proc require]} {
proc require {args} {{done {}}} {
foreach file $args {
if {$file ni $done} {
uplevel source "/mod/webif/lib/$file"
lappend $done $file
}
}
}
proc httpheader {{type "text/html"} {cache 0} {extra ""}} {{done 0}} {
if {$done} return
if {!$cache} {
puts -nonewline "Content-Type: $type; charset=\"UTF-8\"; 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 -nonewline "Content-Type: $type; charset=\"UTF-8\"\r\n"
}
if {$extra ne ""} { puts -nonewline "$extra" }
puts -nonewline "\r\n"
set done 1
}
proc header {{type "text/html"} {cache 0}} {
httpheader $type $cache
uplevel source /mod/webif/html/lib/header.jim
}
proc footer {} {
uplevel source /mod/webif/html/lib/footer.jim
}
proc mheader {} {
uplevel source /mod/webif/html/m/lib/header.jim
}
proc mfooter {} {
uplevel source /mod/webif/html/m/lib/footer.jim
}
proc jqplugin {name} {
foreach file [glob "/mod/webif/html/lib/jquery.$name/*.js"] {
set file [join [lrange [split $file /] 4 end] /]
puts "<script type=text/javascript src=/$file></script>"
}
foreach file [glob "/mod/webif/html/lib/jquery.$name/*.css"] {
set file [join [lrange [split $file /] 4 end] /]
puts "<link href=/$file rel=stylesheet type=text/css />"
}
}
require fileops
}