2011-07-11 23:29:21 +00:00
#!/mod/bin/jimsh
package require cgi
2012-05-21 20:23:41 +00:00
source /mod/webif/lib/setup
2011-07-11 23:29:21 +00:00
require settings.class pkg.class altrow
if {[[settings] pkgdev]} { set filter 0 } else { set filter 1 }
2013-02-09 22:46:15 +00:00
httpheader
2011-07-11 23:29:21 +00:00
proc pkgrow {pkg} {
set name [$pkg get name]
2012-08-04 00:29:57 +00:00
altrow "pkg=\"$name\""
puts "<td nowrap>$name"
if {$::type eq "inst"} {
puts "<br><a href=# class=depends>
<img class=va border=0
src=/images/421_1_00_CH_Title_2R_Arrow.png height=14>
<span class=\"va footnote\">Info</span></a>"
}
puts "</td>"
2011-07-11 23:29:21 +00:00
if {$::type eq "avail"} {
puts "<td nowrap>[$pkg get latest]</td>"
} else {
puts "<td nowrap>[$pkg get installed]</td>"
}
if {$::type eq "upgr"} {
puts "<td nowrap>[$pkg get latest]</td>"
}
2014-02-03 21:42:20 +00:00
puts "<td>"
2011-07-11 23:29:21 +00:00
if {[dict exists $::pkgmeta $name]} {
2014-02-03 21:42:20 +00:00
puts "$::pkgmeta($name)"
2011-07-11 23:29:21 +00:00
} else {
2014-02-03 21:42:20 +00:00
puts "[$pkg get descr]"
2011-07-11 23:29:21 +00:00
}
2014-02-03 21:42:20 +00:00
if {$::type eq "upgr"} {
$pkg loadraw
set url [$pkg get url]
set changes [$pkg get changes]
if {$changes ne ""} {
puts "<br> - <i>$changes</i>"
}
if {$url ne ""} {
puts "
<br>
<a class=va href=\"$url\" target=_blank style=\"color: darkblue\">
<img class=va height=18 width=18 src=/img/info.png> $url
</a>"
}
}
puts "</td>"
2011-07-11 23:29:21 +00:00
if {![$pkg is installed]} {
set type Install
} elseif {$::type eq "upgr" && [$pkg is upgradable]} {
set type Upgrade
} else {
set type Remove
}
2012-08-04 00:29:57 +00:00
puts "<td align=center><small><button id=\"$name\"
2011-07-11 23:29:21 +00:00
action=[string tolower $type]
2011-10-05 22:07:22 +00:00
class=\"va [string tolower $type]\">$type</button></small></td>"
2011-07-11 23:29:21 +00:00
puts "</tr>"
}
pkg loadmeta
2013-02-09 22:46:15 +00:00
set type [cgi_get type "avail"]
2011-07-11 23:29:21 +00:00
set pkgs [pkg $type]
if {[llength $pkgs] > 0} {
puts "<table><tr><th>Package</th>"
if {$type eq "avail"} {
puts "<th>Available</th>"
} else {
puts "<th>Installed</th>"
}
if {$type eq "upgr"} {
puts "<th>Avail</th>"
}
puts "
<th>Description</th>
<th> Action </th>
</tr>
"
foreach pkg $pkgs {
2012-01-06 23:44:55 +00:00
if {$type ne "upgr" && $filter && \
![dict exists $::pkgmeta $pkg]} { continue }
2011-07-11 23:29:21 +00:00
pkgrow [pkg load $pkg]
}
puts "</table>"
2014-02-03 21:42:20 +00:00
if {$type ne "upgr" && $filter} {
2011-07-11 23:29:21 +00:00
puts "<font class=footnote>This is a filtered package list. To show all packages, enable the <i>Show development and advanced packages</i> in the settings screen.</font>"
}
} else {
puts "<i>No packages "
switch $type {
inst { puts "are installed." }
2012-01-06 23:57:31 +00:00
upgr { puts "are available for upgrade; try updating the package list from the Internet using the button above." }
2011-07-11 23:29:21 +00:00
avail { puts "are available for installation." }
}
puts "</i>"
}