From 328ca16b5c31d0a85389dbd50f9104005a91ce66 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Mon, 5 Nov 2012 21:57:29 +0000 Subject: [PATCH] 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 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/browse/browse.js | 3 +- var/mongoose/cgi-bin/browse/download.jim | 3 +- var/mongoose/html/m/index.jim | 4 +- var/mongoose/html/m/lib/header.jim | 2 + var/mongoose/html/m/pkgi_b.jim | 62 +++++++++++++++++++----- var/mongoose/html/m/script.js | 62 ++++++++++++++++++++++++ var/mongoose/html/m/services.jim | 59 ++++++++++++++++++++++ var/mongoose/html/m/style.css | 29 +++++++++++ var/mongoose/lib/bin/auto | 2 +- var/mongoose/lib/ts.class | 8 ++- 11 files changed, 215 insertions(+), 21 deletions(-) create mode 100755 var/mongoose/html/m/services.jim diff --git a/CONTROL/control b/CONTROL/control index 2ea5327..c81296c 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -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) diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index 8884d63..9c2d53e 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -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': diff --git a/var/mongoose/cgi-bin/browse/download.jim b/var/mongoose/cgi-bin/browse/download.jim index 3b74951..c264572 100755 --- a/var/mongoose/cgi-bin/browse/download.jim +++ b/var/mongoose/cgi-bin/browse/download.jim @@ -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" diff --git a/var/mongoose/html/m/index.jim b/var/mongoose/html/m/index.jim index b5ce6e9..47ca696 100755 --- a/var/mongoose/html/m/index.jim +++ b/var/mongoose/html/m/index.jim @@ -40,11 +40,11 @@ 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/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 diff --git a/var/mongoose/html/m/lib/header.jim b/var/mongoose/html/m/lib/header.jim index ff73842..c83fc62 100755 --- a/var/mongoose/html/m/lib/header.jim +++ b/var/mongoose/html/m/lib/header.jim @@ -25,6 +25,8 @@ puts { + diff --git a/var/mongoose/html/m/pkgi_b.jim b/var/mongoose/html/m/pkgi_b.jim index fd7b993..82af8be 100755 --- a/var/mongoose/html/m/pkgi_b.jim +++ b/var/mongoose/html/m/pkgi_b.jim @@ -35,7 +35,7 @@ proc pkgtop {type} { proc pkgrow {type pkg} { set name [$pkg get name] - puts "
  • $name

    " + puts "
  • $name

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

    [$pkg get latest]

    " @@ -61,38 +61,34 @@ proc pkgrow {type pkg} { set btype Remove } -# puts "" -#
    - -puts " + puts "

    $btype

    -" + " + puts "
  • " } proc pkglist {type} { set pkgs [pkg $type] + puts "
      " + if {[llength $pkgs] <= 0} { - puts "No packages " + 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." } + 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 "" + puts "
    " return } - puts "
      " - foreach pkg $pkgs { if {$type ne "upgr" && $::filter && \ ![dict exists $::pkgmeta $pkg]} { continue } @@ -122,6 +118,46 @@ switch $pageid { } pkgtop $type + +puts { +
        +
      • + +} + +if {$pageid eq "pkgu_b"} { + puts { + + } +} + +puts { +
      • +
      +} + pkglist $qtype + +puts { +
      +
      +

      Results

      +
      +
      +

      +
      +
      +
      +} + mfooter diff --git a/var/mongoose/html/m/script.js b/var/mongoose/html/m/script.js index 7958b25..9935a7a 100644 --- a/var/mongoose/html/m/script.js +++ b/var/mongoose/html/m/script.js @@ -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(' 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); + }); + +}); diff --git a/var/mongoose/html/m/services.jim b/var/mongoose/html/m/services.jim new file mode 100755 index 0000000..2afa555 --- /dev/null +++ b/var/mongoose/html/m/services.jim @@ -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 "
        " +set i 0 +foreach service $services { + lassign [split $service ":"] name installed auto running + + if (!$installed) { + puts "
      • [string totitle $name]

        " + puts "

        Not installed.

        " + puts "
      • " + continue + } + + incr i + + puts " +
      • +
        +

        [string totitle $name]

        + + + + +
        + " + puts "
      • " +} +puts "
      " + +mfooter + diff --git a/var/mongoose/html/m/style.css b/var/mongoose/html/m/style.css index e6309d5..f63b5e1 100644 --- a/var/mongoose/html/m/style.css +++ b/var/mongoose/html/m/style.css @@ -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; +} + diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index daef743..ddcd6a7 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -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} { diff --git a/var/mongoose/lib/ts.class b/var/mongoose/lib/ts.class index 344a697..24cc809 100644 --- a/var/mongoose/lib/ts.class +++ b/var/mongoose/lib/ts.class @@ -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