diff --git a/var/mongoose/html/m/index.jim b/var/mongoose/html/m/index.jim index 634120a..b5ce6e9 100755 --- a/var/mongoose/html/m/index.jim +++ b/var/mongoose/html/m/index.jim @@ -41,7 +41,7 @@ puts "" tb "/images/323_1_10_Menu_Video.png" "Browse" "browse.jim" tb "/images/321_1_00_Menu_CHList.png" "Schedule" "schedule.jim" tb "/img/spanner.png" "Services" "#" -tb "/img/packages.png" "Packages" "#" +tb "/img/packages.png" "Packages" "pkgi_b.jim" tb "/images/326_1_00_Menu_Settings.png" "Settings" \ "/cgi-bin/settings.jim\" rel=\"external" tb "/img/diagnostics.png" "Diag" "#" diff --git a/var/mongoose/html/m/lib/header.jim b/var/mongoose/html/m/lib/header.jim index ebe41b2..ff73842 100755 --- a/var/mongoose/html/m/lib/header.jim +++ b/var/mongoose/html/m/lib/header.jim @@ -45,18 +45,20 @@ if {[string range $pageid end-1 end] eq "_d"} { set _dialog 1 } +set _bare 0 +if {[string range $pageid end-1 end] eq "_b"} { + set _bare 1 +} + puts "" -if {$_dialog} { - puts "
\n" -} else { - puts " -
+proc _header {{title ""}} { -
- -
+ if {$title eq ""} { + set title "[system model] ([system hostname])" + } + return "
+

$title

+ " +} -

[system model] ([system hostname])

+if {$_bare} { + puts "" +} elseif {$_dialog} { + puts "
\n" +} else { + puts " +
+ +
+ +
+ [_header]
} diff --git a/var/mongoose/html/m/pkga_b.jim b/var/mongoose/html/m/pkga_b.jim new file mode 120000 index 0000000..64931a4 --- /dev/null +++ b/var/mongoose/html/m/pkga_b.jim @@ -0,0 +1 @@ +pkgi_b.jim \ No newline at end of file diff --git a/var/mongoose/html/m/pkgi_b.jim b/var/mongoose/html/m/pkgi_b.jim new file mode 100755 index 0000000..fd7b993 --- /dev/null +++ b/var/mongoose/html/m/pkgi_b.jim @@ -0,0 +1,127 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup +require settings.class pkg.class + +if {[[settings] pkgdev]} { set filter 0 } else { set filter 1 } + +pkg loadmeta + +proc nav {active} { + set q "
\n
    \n" + foreach f {installed available upgrades} { + append q "
  • " + append q "[string totitle $f]
  • \n" + } + append q "
\n
\n" + return $q +} + +proc pkgtop {type} { + puts " +
+
+ [_header] + [nav $type] +
+
+ " +} + +proc pkgrow {type pkg} { + set name [$pkg get name] + puts "
  • $name

    " + + if {$type eq "avail"} { + puts "

    [$pkg get latest]

    " + } else { + puts "

    [$pkg get installed]

    " + } + + if {$type eq "upgr"} { + puts "

    Latest: [$pkg get latest]

    " + } + + if {[dict exists $::pkgmeta $name]} { + puts "

    $::pkgmeta($name)

    " + } else { + puts "

    [$pkg get descr]

    " + } + + if {![$pkg is installed]} { + set btype Install + } elseif {$type eq "upgr" && [$pkg is upgradable]} { + set btype Upgrade + } else { + set btype Remove + } + +# puts "" +#
    + +puts " +

    + $btype +

    +" + puts "
  • " +} + +proc pkglist {type} { + set pkgs [pkg $type] + + if {[llength $pkgs] <= 0} { + puts "No packages " + switch $type { + inst { puts "are installed." } + upgr { puts "are available for upgrade; try updating the package list from the Internet using the button below." } + avail { puts "are available for installation." } + } + puts "" + return + } + + puts "
      " + + foreach pkg $pkgs { + if {$type ne "upgr" && $::filter && \ + ![dict exists $::pkgmeta $pkg]} { continue } + pkgrow $type [pkg load $pkg] + } + if {$::filter} { + puts "
    • This is a filtered package list. To show all packages, enable the Show development and advanced packages in the settings screen.
    • " + } + puts "
    " +} + +mheader + +switch $pageid { + pkgi_b { + set type installed + set qtype inst + } + pkga_b { + set type available + set qtype avail + } + default { + set type upgrades + set qtype upgr + } +} + +pkgtop $type +pkglist $qtype +mfooter + diff --git a/var/mongoose/html/m/pkgu_b.jim b/var/mongoose/html/m/pkgu_b.jim new file mode 120000 index 0000000..64931a4 --- /dev/null +++ b/var/mongoose/html/m/pkgu_b.jim @@ -0,0 +1 @@ +pkgi_b.jim \ No newline at end of file diff --git a/var/mongoose/html/m/style.css b/var/mongoose/html/m/style.css index e46c5e0..e6309d5 100644 --- a/var/mongoose/html/m/style.css +++ b/var/mongoose/html/m/style.css @@ -94,3 +94,8 @@ table.keyval td text-decoration: none; } +p.wsn +{ + white-space: normal; +} +