package screen overhaul

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3673 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2017-02-01 17:43:05 +00:00
parent f19dfe65eb
commit 40a1a42433
13 changed files with 202 additions and 44 deletions

View File

@ -1,10 +1,10 @@
Package: webif
Priority: optional
Section: web
Version: 1.4.0-3
Version: 1.4.0-4
Architecture: mipsel
Maintainer: af123@hpkg.tv
Depends: tcpfix,webif-channelicons(>=1.1.25),lighttpd(>=1.4.39-1),jim(>=0.77),jim-oo(>=0.77),jim-sqlite3(>=0.76),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.5),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.10),webif-charts(>=1.2-1),stripts(>=1.2.5-3),tmenu(>=1.21-2),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.95),sqlite3(>=3.15.1)
Suggests:
Description: An evolving web interface for the Humax.
Tags: http://hummy.tv/forum/threads/7619/
Tags: https://hummy.tv/forum/threads/7712/

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 B

BIN
webif/html/img/pkgbeta.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,18 @@
source /mod/webif/lib/setup
jqplugin enadis iajax
jqplugin enadis iajax qtip2 tablesorter2
jscss script.js style.css
header
if {[[settings] pkgdev]} { set filter 0 } else { set filter 1 }
puts "
<script type=text/javascript>
var pkgfilter = $filter;
</script>
"
puts {
<div class=va style="padding: 0 0 1em 0">
@ -56,6 +64,12 @@ puts {
<span>Upgrades</span>
</a>
</li>
<span class="tabright hidden">
<span class=footnote id=filtertext></span>
<small>
<button id=b_filter>Filter</button>
</small>
</span>
</ul>
</div>
}

View File

@ -2,15 +2,32 @@
package require cgi
source /mod/webif/lib/setup
require settings.class pkg.class altrow
require settings.class pkg.class
if {[[settings] pkgdev]} { set filter 0 } else { set filter 1 }
#if {[[settings] pkgdev]} { set filter 0 } else { set filter 1 }
httpheader
proc pkgrow {name pkg} {
altrow "pkg=\"$name\""
set class p_adv
if {[dict exists $::pkgmeta $name]} { set class p_base }
# Always show beta packages
if {$pkg(repo) ne "base"} { set class p_beta }
# Always show local/no-repo packages
if {$pkg(repo) eq "none"} { set class p_none }
puts "<tr class=\"$class r_$pkg(repo)\" repo=$pkg(repo) pkg=\"$name\">"
puts "<td nowrap>$name"
if {$pkg(repo) eq "none"} {
puts "<img class=\"va norepo\" src=/img/pkgmissing.png>"
} elseif {$pkg(repo) ne "base"} {
puts "<img class=\"va beta\" src=/img/pkgbeta.png>"
} elseif {$class eq "p_adv"} {
puts "<img class=\"va adv\" src=/img/pkgadvanced.png>"
}
if {$::type eq "inst"} {
puts "<br><a href=# class=depends>&nbsp;&nbsp;
<img class=va border=0
@ -30,14 +47,10 @@ proc pkgrow {name pkg} {
}
puts "<td>"
if {[dict exists $pkg description]} {
set descr $pkg(description)
} else {
set descr "No longer in package repository."
}
set descr $pkg(description)
set changes ""
regexp {(.*) \[(.*)\]} $descr x descr changes
if {[dict exists $::pkgmeta $name]} {
if {[dict exists $::pkgmeta $name] && $::pkgmeta($name) ne "-"} {
puts $::pkgmeta($name)
} else {
puts $descr
@ -82,12 +95,27 @@ proc pkgrow {name pkg} {
puts "</tr>"
}
set pkgdata [pkg getall]
set pkgdata {}
foreach repo [pkg repolist] {
set pkgdata [dict merge $pkgdata [pkg getall $repo]]
}
if {[file exists /mod/var/opkg/beta]} {
foreach {pkg data} [pkg getall beta] {
if {[dict exists $data description]} {
set pkgdata($pkg) $data
set localpkg {}
# Add in any installed packages not present in any repo.
foreach {p v} [pkg instverlist] {
if {![dict exists $pkgdata $p]} {
lappend localpkg $p
if {[catch {
set _p [pkg load $p]
$_p loadraw
set pkgdata($p) [$_p get raw]
lappend pkgdata($p) repo none installed $v
}]} {
set pkgdata($p) [list \
repo "none" \
installed $v \
description "Not in any repository." \
]
}
}
}
@ -118,7 +146,8 @@ foreach {pkg data} $pkgdata {
}
if {[llength $pkgs] > 0} {
puts "<table><tr><th>Package</th>"
puts "<table class=\"$type tablesorter\">"
puts "<thead><tr><th>Package</th>"
if {$type eq "avail"} {
puts "<th>Available</th>"
@ -134,18 +163,20 @@ if {[llength $pkgs] > 0} {
<th>Description</th>
<th>&nbsp;&nbsp;Action&nbsp;&nbsp;</th>
</tr>
</thead>
<tbody>
"
foreach pkg [lsort $pkgs] {
if {$type ne "upgr" && $filter && \
![dict exists $::pkgmeta $pkg]} continue
# if {$type ne "upgr" && $filter && $pkg ni $localpkg && \
# ![dict exists $::pkgmeta $pkg]} continue
if {![dict exists $pkgdata $pkg]} continue
pkgrow $pkg $pkgdata($pkg)
}
puts "</table>"
if {$type ne "upgr" && $filter} {
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>"
}
puts "</tbody></table>"
# if {$type ne "upgr" && $filter} {
# 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 {

View File

@ -1,6 +1,6 @@
var opkg = '/cgi-bin/opkg.jim';
$(document).ready(function() {
$(function() {
var busy = false;
var tswitch = false;
@ -28,6 +28,7 @@ $('#pkgtabs').tabs({
"Loading data... Please wait...");
busy = true;
$('#pkgtabs').tabs('disable');
$('span.tabright').hide();
},
activate: function(event, ui) {
window.location.hash = ui.newTab.index();
@ -41,10 +42,11 @@ $('#pkgtabs').tabs({
"Loading data... Please wait...");
busy = true;
$('#pkgtabs').tabs('disable');
$('span.tabright').hide();
},
load: function() {
load: function(event, ui) {
busy = false;
setup_buttons();
setup_tab(ui.tab.index(), ui.panel);
$('#pkgtabs').tabs('enable');
},
spinner: '<img border=0 src=/img/spin.gif> ' +
@ -143,9 +145,50 @@ function execopkg(arg, pkg)
busy = false;
}
function setup_buttons()
function update_filter($table, change)
{
$('button.remove, button.install, button.upgrade')
if (change)
pkgfilter = !pkgfilter;
if (pkgfilter)
{
$table.find('tr.p_adv').hide();
console.log('hiding');
$('#filtertext').text('Not showing advanced packages');
$('#b_filter').text('Show');
}
else
{
$table.find('tr.p_adv').show();
console.log('showing');
$('#filtertext').text('Advanced packages are being shown');
$('#b_filter').text('Hide');
}
$table.trigger('update', [true]);
$('#b_filter').button().off('click').on('click', function() {
update_filter($table, 1);
});
}
function setup_tab(index, panel)
{
var $tab = $(panel).find('table.tablesorter');
if (index == 2)
$('span.tabright').hide();
else
{
update_filter($tab);
$('span.tabright').show();
}
$tab.tablesorter({
theme: 'webif',
widthFixed: false,
widgets: ['zebra', 'stickyHeaders']
});
$(panel).find('button.remove, button.install, button.upgrade')
.button()
.click(function() {
if ($(this).attr('action') == 'remove' &&
@ -157,12 +200,19 @@ function setup_buttons()
$(this).closest('tr').attr('pkg'));
}).fadeIn('slow');
$('a.depends').click(function(e) {
$(panel).find('a.depends').click(function(e) {
e.preventDefault();
var pkg = $(this).closest('tr').attr('pkg');
stick = true;
execopkg('whatdepends ' + pkg, false);
});
$(panel).find('tr[pkg=webif]').find('button[action=remove]').disable();
$(panel).find('img.norepo').qtip({content: 'Not in repository'});
$(panel).find('img.adv').qtip({content: 'Advanced package'});
$(panel).find('img.beta')
.qtip({content: 'Beta package, use at your own risk'});
}
});

View File

@ -4,13 +4,42 @@ button.install
background-image: none;
background: #ccff99;
}
button.remove
{
display: none;
background-image: none;
background: #ff6666;
}
button.upgrade
{
display: none;
}
.tabright
{
float: right;
padding-right: 2em;
}
tr.p_adv td
{
/*background: #b9daff !important;*/
/*color: black;*/
font-style: italic;
color: blue;
}
tr.p_none td
{
font-style: italic;
color: #ff8c00;
}
tr.p_beta td
{
font-style: italic;
color: #c70039;
}

View File

@ -4,7 +4,7 @@ package require cgi
source /mod/webif/lib/setup
jqplugin tablesorter2 contextMenu form blockui confirmAction \
timepicker datepair growl qtip
timepicker datepair growl qtip2
jscss {
/js/icons.js

View File

@ -4,7 +4,7 @@ package require cgi
source /mod/webif/lib/setup
require settings.class
jqplugin enadis qtip
jqplugin enadis qtip2
jscss {} style.css
header

View File

@ -30,6 +30,12 @@ pkg method _load {nm} {
}
}
}
if {$descr eq ""} {
$self loadraw
if {[dict exists $raw description]} {
set descr $raw(description)
}
}
regexp {(.*) \[(.*)\]} $descr x descr changes
set info [exec /bin/opkg list-installed $nm]
regexp {^([^ ]+) - ([^ ]+)$} $info x x installed
@ -37,15 +43,31 @@ pkg method _load {nm} {
return $self
}
proc {pkg getall} {{repo base}} {
set pkglist {}
proc {pkg instverlist} {} {{cache {}}} {
if {[llength $cache]} { return $cache }
# Fetch details of installed packages
foreach line [split [exec /bin/opkg list-installed] "\n"] {
lassign $line pkg x ver
#regexp {^([^ ]+) - ([^ ]+)$} $line pkg x ver
set installed($pkg) $ver
set cache($pkg) $ver
}
return $cache
}
proc {pkg repolist} {} {
set repos {}
foreach line [split [file read /etc/opkg/opkg.conf] "\n"] {
lassign $line tag repo
if {$tag eq "src/gz"} { ladd repos $repo }
}
return $repos
}
proc {pkg getall} {{repo base}} {
set pkglist {}
# Fetch details of installed packages
set installed [pkg instverlist]
# Now build list of all packages
@ -53,10 +75,6 @@ proc {pkg getall} {{repo base}} {
error "Error opening repository, $msg"
}
foreach {p v} $installed {
set pkglist($p) [list installed $v]
}
set pkg {}
set cur ""
foreach line [split [$fp read] "\n"] {
@ -76,11 +94,15 @@ proc {pkg getall} {{repo base}} {
set pkglist($name) $pkg
}
set name $val
set iver 0
if {[dict exists $installed $val]} {
set pkg "installed $installed($val)"
} else {
set pkg {installed 0}
set iver $installed($val)
}
set pkg [list \
"installed" $iver \
"repo" $repo \
]
set lasttag ""
continue
}
@ -99,8 +121,14 @@ pkg method loadraw {} {
set tag ""
set txt ""
set raw {}
if {[file exists "/mod/var/opkg/info/$name.control"]} {
set data [file read "/mod/var/opkg/info/$name.control"]
} else {
set data [exec /bin/opkg info $name]
}
foreach line [split [exec /bin/opkg info $name] "\n"] {
foreach line [split $data "\n"] {
if {$tag ne "" && [string match { *} $line]} {
append raw($tag) $line
continue