checkpoint - mobile version working, fixed auto bug

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1201 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-11-05 21:57:29 +00:00
parent e15b82fe2d
commit 328ca16b5c
11 changed files with 215 additions and 21 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 0.9.14-2
Version: 0.10.0
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.6),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2)

View File

@ -412,7 +412,8 @@ var menuclick = function(action, el, pos)
case 'download':
window.location.href = '/cgi-bin/browse/download.jim?file=' +
file;
file + '&base=' +
encodeURIComponent(document.URL.match(/:\/\/(.[^/]+)/)[1]);
break;
case 'crop':

View File

@ -11,6 +11,7 @@ cgi_input
#cgi_dump
set file [cgi_get file]
set urlbase [cgi_get base ""]
# Default to just downloading the raw file.
set url $file
@ -22,7 +23,7 @@ if {[string match {*.ts} $file]} {
# If it's encrypted on disk and the DLNA option is available,
# then use the server to perform decryption on the fly.
if {[$ts flag "ODEncrypted"] > 0} {
set dlna [$ts dlnaloc]
set dlna [$ts dlnaloc $urlbase]
if {[llength $dlna]} { lassign $dlna url mime }
#puts "DLNA: $dlna"

View File

@ -40,11 +40,11 @@ puts "</li>"
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/spanner.png" "Services" "services.jim"
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" "#"
#tb "/img/diagnostics.png" "Diag" "#"
tb "/img/desktop.png" "Desktop Version" "/\" rel=\"external"
#eval_plugins toolbar

View File

@ -25,6 +25,8 @@ puts {
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/lib/jquery.mobile/jquery.mobile.js">
</script>
<script type="text/javascript" src="/js/enadis.js">
</script>
<script type="text/javascript" src="/m/script.js"></script>
<xlink rel="apple-touch-icon" href="/img/mobile.png" />
<xlink rel="apple-touch-icon" sizes="57x57" href="/img/remote_57.png" />

View File

@ -35,7 +35,7 @@ proc pkgtop {type} {
proc pkgrow {type pkg} {
set name [$pkg get name]
puts "<li><h3>$name</h3>"
puts "<li class=\"pkg_$name\"><h3>$name</h3>"
if {$type eq "avail"} {
puts "<p class=ui-li-aside>[$pkg get latest]</p>"
@ -61,38 +61,34 @@ proc pkgrow {type pkg} {
set btype Remove
}
# puts "<td align=center><small><button id=\"$name\"
# action=[string tolower $type]
# class=\"va [string tolower $type]\">$type</button></small></td>"
# <div data-role=controlgroup data-type=horizontal data-mini=true>
puts "
puts "
<p>
<a data-inline=true data-role=button data-mini=true data-theme=e
href=#
action=[string tolower $btype] pkg=\"$name\"
class=[string tolower $btype]>$btype</a>
</p>
"
"
puts "</li>"
}
proc pkglist {type} {
set pkgs [pkg $type]
puts "<ul data-role=listview>"
if {[llength $pkgs] <= 0} {
puts "<i>No packages "
puts "<li><i>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." }
upgr { puts "are available for upgrade; try updating the package list from the Internet using the button above." }
avail { puts "are available for installation." }
}
puts "</i>"
puts "</i></li></ul>"
return
}
puts "<ul data-role=listview>"
foreach pkg $pkgs {
if {$type ne "upgr" && $::filter && \
![dict exists $::pkgmeta $pkg]} { continue }
@ -122,6 +118,46 @@ switch $pageid {
}
pkgtop $type
puts {
<ul data-role=listview>
<li>
<button data-theme=e class=opkg_update>
Update package list from Internet
</button>
}
if {$pageid eq "pkgu_b"} {
puts {
<button data-theme=e class=opkg_upgrade>
Upgrade all packages
</button>
}
}
puts {
</li>
</ul>
}
pkglist $qtype
puts {
<div data-role=popup class="opkg_popup ui-corner-all" data-theme=e>
<div data-role=header data-theme=a class=ui-corner-top>
<h1>Results</h1>
</div>
<div data-role=content data-theme=d class="ui-corner-bottom ui-content">
<p class="pre opkg_popup_text" data-theme=d></p>
</div>
<center><div class="hidden opkg_op_complete">
<img border=0 src=/images/167_2_00_Check_W2_SUB.png>
Operation complete.
<a href=# data-role=button data-inline=true data-rel=back
data-mini=true data-theme=b>Close</a>
</div></center>
</div>
}
mfooter

View File

@ -124,4 +124,66 @@ $(document).delegate('#browsepage', 'pageinit', function() {
shrunk_callback);
});
var opkgreload = false;
function execopkg(arg, pkg)
{
$.mobile.showPageLoadingMsg();
s('a').disable();
s('.opkg_op_complete').hide('fast');
s('.opkg_popup_text')
.empty()
.html('<img src=/img/loading.gif> Processing...');
s('.opkg_popup').popup('open', {transition: 'pop'})
s('.opkg_popup_text').load('/cgi-bin/opkg.jim?cmd=' + arg, function() {
s('.opkg_op_complete').slideDown('slow');
if (opkgreload)
window.location.reload(true);
else
{
if (pkg)
s('.pkg_' + pkg).slideUp();
$.mobile.hidePageLoadingMsg();
s('a').enable();
}
});
}
$(document).delegate('#pkga,#pkgi,#pkgu', 'pageinit', function() {
$('a.remove, a.install, a.upgrade')
.click(function() {
if ($(this).attr('action') == 'remove' &&
!confirm('Please confirm removal of the ' +
$(this).attr('pkg') + ' package.'))
return;
execopkg(encodeURIComponent($(this).attr('action') +
' ' + $(this).attr('pkg')), $(this).attr('pkg'));
});
$('button.opkg_update').on('click', function() {
opkgreload = true;
execopkg('update');
});
$('button.opkg_upgrade').on('click', function() {
opkgreload = true;
execopkg('upgrade');
});
});
$(document).delegate('#servicespage', 'pageinit', function() {
// Don't allow turning off the web server from within the web server..
$('select[service=mongoose]').disable();
$('select.auto,select.toggle').on('change', function() {
var url = '/cgi-bin/service.jim?action=' +
escape($(this).attr('act')) +
'&service=' +
escape($(this).attr('service'));
$.get(url);
});
});

View File

@ -0,0 +1,59 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
mheader
set services [split [exec /mod/bin/service mlist]]
puts "<ul data-role=listview>"
set i 0
foreach service $services {
lassign [split $service ":"] name installed auto running
if (!$installed) {
puts "<li><h3>[string totitle $name]</h3>"
puts "<p><i>Not installed.</i></p>"
puts "</li>"
continue
}
incr i
puts "
<li>
<div data-role=fieldcontain data-mini=true>
<h3>[string totitle $name]</h3>
<label class=va for=toggle$i>State:</label>
<select class=toggle act=toggle data-role=slider service=$name>
"
if {$running} {
puts "<option value=off>Off</option>"
puts "<option value=on selected>On</option>"
} else {
puts "<option value=off selected>Off</option>"
puts "<option value=on>On</option>"
}
puts "
</select>
<label class=va for=auto$i>Auto-start:</label>
<select class=auto act=auto data-role=slider service=$name>
"
if ($auto) {
puts "<option value=off>Off</option>"
puts "<option value=on selected>On</option>"
} else {
puts "<option value=off selected>Off</option>"
puts "<option value=on>On</option>"
}
puts "
</select>
</div>
"
puts "</li>"
}
puts "</ul>"
mfooter

View File

@ -99,3 +99,32 @@ p.wsn
white-space: normal;
}
pre, .pre, .prelike
{
font-family: Consolas, 'Courier New', Courier, monospace;
color: black;
background: #f9d9b0 url('/img/prebg.png') repeat-x top;
line-height: 1.24;
padding: 3px 8px;
margin: 0 5em 1em 5em;
border-color: #f9d9b0;
border-bottom: 1px solid #f9bc6d;
border-top-left-radius: 4px;
-webkit-border-top-left-radius: 4px;
-moz-border-radius-topleft: 4px;
-khtml-border-top-left-radius: 4px;
border-top-right-radius: 4px;
-webkit-border-top-right-radius: 4px;
-moz-border-radius-topright: 4px;
-khtml-border-top-right-radius: 4px;
}
pre, .pre
{
white-space: pre-wrap;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
white-space: break-word;
}

View File

@ -151,8 +151,8 @@ proc do_decrypt {ts} {
puts " Removing/binning old copy."
# Move the old recording to the bin if undelete is installed.
set bin [bindir $file "$dustbin/webif_autodecrypt"]
if {$dustbin ne ""} {
set bin [bindir $file "$dustbin/webif_autodecrypt"]
set tail [file tail $rfile]
file rename "$rfile.encrypted" "$bin/$tail.ts"
foreach ext {nts hmt thm} {

View File

@ -169,7 +169,7 @@ ts method settitle {newtitle} {
exec /mod/bin/hmt "+settitle=${newtitle}" $file
}
ts method dlnaloc {} {
ts method dlnaloc {{urlbase 0}} {
set mime "video/ts"
if {![file exists $::dmsfile]} { return {} }
if {[catch {set db [sqlite3.open $::dmsfile]}]} { return {} }
@ -185,7 +185,11 @@ ts method dlnaloc {} {
set rec [lindex $muri 0]
set xuri [lindex $rec 3]
set mime [lindex $rec 1]
set url "http://[system ip]:9000/web/$xuri"
if {$urlbase ne "0"} {
set url "http://$urlbase:9000/web/$xuri"
} else {
set url "http://[system ip]:9000/web/$xuri"
}
}
$db close