webif/var/mongoose/include/packages.jim

59 lines
1015 B
Plaintext
Raw Normal View History

#!/mod/bin/jimsh
source /mod/var/mongoose/lib/pkg.class
puts {
<style type=text/css>
.ui-button, .ui-button-text { padding: 0; font-size: 12px; }
</style>
<script type=text/javascript src=/js/packages.js></script>
<table class=borders>
<tr>
<th>Package</th>
<th>Installed</th>
<th>Avail</th>
<th>Description</th>
</tr>
}
set avail [pkg avail]
foreach name [lsort [array names avail]] {
set pkg [pkg load $name $avail($name)]
if {![$pkg is installed]} {
puts "<tr>"
} elseif {[$pkg is upgradable]} {
puts "<tr class=yellowshade>"
} else {
puts "<tr class=greenshade>"
}
puts "
<td>$name</td>
<td>[$pkg get installed]</td>
<td>[$pkg get latest]</td>
<td>[$pkg get descr]</td>
"
if {![$pkg is installed]} {
set type Install
} elseif {[$pkg is upgradable]} {
set type Upgrade
} else {
set type Remove
}
puts "<td align=center><button id=\"$name\"
action=[string tolower $type]
class=[string tolower $type]>$type</button></td>"
puts "</tr>"
}
puts "</table>"