diff --git a/CONTROL/control b/CONTROL/control index 7ea0dd0..1f857c9 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.9.13-5 +Version: 0.9.13-6 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/backup/backup.js b/var/mongoose/cgi-bin/backup/backup.js index 944677f..23f87a7 100755 --- a/var/mongoose/cgi-bin/backup/backup.js +++ b/var/mongoose/cgi-bin/backup/backup.js @@ -7,6 +7,8 @@ function refresh_files() .button('option', 'disabled', false); $('#delete_button').removeAttr('disabled') .button('option', 'disabled', false); + $('#view_button').removeAttr('disabled') + .button('option', 'disabled', false); }); }); } @@ -38,6 +40,15 @@ $(document).ready(function() { }); } }); + $('#view_button').click(function() { + var backup = $('input.restore:checked').val(); + $('#results').load('/cgi-bin/backup/view.jim?' + + $('input.restore').serialize(), function() { + $('#results').slideDown(function() { + refresh_files(); + }); + }); + }); $('#restore_button').click(function() { var backup = $('input.restore:checked').val(); if (confirm('!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE CONFIRM !!!!!!!!!!!!!!!!!!!!!!!!!\n\nAre you sure you wish to erase all scheduled recordings and favourite channels and then restore them from\n' + backup + '?')) diff --git a/var/mongoose/cgi-bin/backup/view.jim b/var/mongoose/cgi-bin/backup/view.jim new file mode 100755 index 0000000..1db8dd9 --- /dev/null +++ b/var/mongoose/cgi-bin/backup/view.jim @@ -0,0 +1,60 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup + +require rsv.class findhsvc + +set dir /mod/var/backup + +puts "Content-Type: text/html" +puts "" + +cgi_input +#cgi_dump + +#set _cgi(restore_file) "backup-2011-Jul-09-20:37" + +if {![dict exists $_cgi restore_file]} { + puts "No filename supplied." + exit +} + +set file [file tail [dict get $_cgi restore_file]] +set ffile "/$dir/$file.rbk" + +if {![file exists $ffile]} { + puts "Backup file $file does not exist." + exit +} + +if {[catch { set fd [open $ffile r] } msg]} { + puts "Error opening $file - $msg" + exit +} + +puts "Listing scheduled events from $file..." + +set fields [lsort [[rsv] vars]] + +set data [split [read $fd] "\n"] + +foreach line $data { + set vals [split $line "\t"] + if {[lindex $vals 0] ne "event"} { continue } + set vars {} + set i 0 + foreach f $fields { + if {$f eq "aulEventToRecordInfo"} { continue } + incr i + lappend vars $f [lindex $vals $i] + } + + set rsv [rsv new $vars] + + puts " [$rsv name] ([$rsv channel_name])" +} + +close $fd +rsv cleanup + diff --git a/var/mongoose/html/pkg/index.shtml b/var/mongoose/html/pkg/index.shtml index f51cd34..037ad72 100644 --- a/var/mongoose/html/pkg/index.shtml +++ b/var/mongoose/html/pkg/index.shtml @@ -42,10 +42,6 @@