forked from hummypkg/webif
d3e7adfd1f
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif@161 2a923420-c742-0410-a762-8d5b09965624
42 lines
919 B
Plaintext
Executable File
42 lines
919 B
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
set services [split [exec /mod/bin/service mlist]]
|
|
|
|
proc button {state service action} {
|
|
puts -nonewline "<a href=#>"
|
|
puts -nonewline "<img border=0 src=/img/$state.png"
|
|
puts -nonewline " onClick=\"go('$service', '$action'); "
|
|
puts -nonewline "toggle(this); return false\">"
|
|
puts "</a>"
|
|
}
|
|
|
|
proc control {s a} {
|
|
return "<a href=/cgi-bin/service.jim?action=$a&service=$s>"
|
|
}
|
|
|
|
foreach service $services {
|
|
set data [split $service ":"]
|
|
set name [lindex $data 0]
|
|
set installed [lindex $data 1]
|
|
set auto [lindex $data 2]
|
|
set running [lindex $data 3]
|
|
|
|
puts "<tr class=even><td>$name</td>"
|
|
if (!$installed) {
|
|
puts "<td colspan=3><i>Not installed</i></td></tr>"
|
|
continue
|
|
}
|
|
|
|
puts "<td>"
|
|
if ($auto) { button on $name auto } else { button off $name auto }
|
|
puts "</td>"
|
|
|
|
puts "<td>"
|
|
if ($running) { button on $name toggle } else {
|
|
button off $name toggle }
|
|
puts "</td>"
|
|
|
|
puts "</tr>"
|
|
}
|
|
|