finish restart

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@253 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg
2011-07-08 20:39:57 +00:00
parent 88ada938d1
commit 42b5805c45
20 changed files with 298 additions and 107 deletions

View File

@@ -48,8 +48,9 @@ $(document).ready(function() {
$('#results').slideDown(function() {
$('#restore_working').slideUp();
refresh_files();
alert('!!!!!!!!!!!!!! PLEASE NOTE !!!!!!!!!!!!!!\n\nAfter a restore you must restart the box using the link at the top of the screen or via the remote control and then add at least one scheduled entry using the remote control (which you can then delete).');
window.location.reload(true);
$('#restore_warning').slideDown();
$('#restart_block').load(
'/cgi-bin/restartblock.jim');
});
});
}

View File

@@ -99,6 +99,7 @@ foreach line $data {
puts "Restoring favourite channels..."
$rsvdb query {delete from channel.TBL_FAV}
set grp 0
foreach line $data {
set vals [split $line "\t"]
if {[lindex $vals 0] ne "fav"} { continue }
@@ -108,6 +109,11 @@ foreach line $data {
set chan [lindex $vals 3]
set hsvc [findhsvc $chan]
if {$grp != $group} {
set grp $group
puts " Group $grp"
}
puts " $chan"
if {!$hsvc} {

View File

@@ -46,15 +46,11 @@ proc entry {file} {{i 0}} {
if {$ext eq ".ts" && [file exists "${base}.nts"]} {
set type ts
set ts [ts fetch $file 1]
set img 741_1_10_Video_Title.png
set pad 0
set newpad "top: -6; left: 4;"
set img Video_TS
} else {
set type gen
set ts 0
set img 743_4_10_Video_Xvid_File.png
set pad "2"
set newpad "top: -2; left: 2;"
set img Video_Other
}
puts "
@@ -69,26 +65,9 @@ proc entry {file} {{i 0}} {
if {![file exists "[file rootname $file].hmi"]} { set new 1 }
}
if {$new} {
# Overlay the new image over the media one.
puts "
<span style=\"position: relative; left: 0; top 0;
padding: $pad\">
<img class=va border=0 width=45 src=/images/$img
style=\"padding: $pad;
position: relative; top: 0; left: 0\">
<img class=va border=0
src=/images/743_1_10_Video_New.png
style=\"position: absolute; $newpad
width: 18\">
</span>
"
} else {
puts "
<img class=va border=0 width=45 src=/images/$img
style=\"padding:$pad\">
"
}
if {$new} { append img _New }
puts "<img class=va border=0 src=/img/$img.png>"
puts "
$bfile
@@ -101,11 +80,15 @@ proc entry {file} {{i 0}} {
# Icons
set locked 0
set encd 0
set def unknown
if {$type eq "ts"} {
# HD / SD
if {[$ts get definition] eq "HD"} {
set def HD
set img "172_1_00_HD"
} else {
set def SD
set img "172_1_26_SD"
}
puts "<img class=va src=/images/$img.png height=21>"
@@ -119,6 +102,7 @@ proc entry {file} {{i 0}} {
# Encrypted
if {[$ts flag "Encrypted"] > 0} {
set encd 1
puts "<img class=va
src=/images/749_1_26_Video_Encryption.png
height=21>"
@@ -137,7 +121,7 @@ proc entry {file} {{i 0}} {
puts "
<a href=#>
<img class=\"opt va\" border=0 width=45 type=$type did=$i
locked=$locked
locked=$locked encd=$encd def=$def new=$new
src=/images/181_1_00_Help5_OPT_Plus.png>
</a>
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
@@ -163,6 +147,8 @@ puts {
<ul id=optmenu class=contextMenu>
<li><a href=#delete>Delete</a></li>
<li><a href=#lock>Toggle Lock</a></li>
<li><a href=#enc>Toggle Enc</a></li>
<li><a href=#new>Toggle New</a></li>
<li><a href=#rename>Rename</a></li>
<li><a href=#download>Download</a></li>
</ul>

View File

@@ -69,6 +69,18 @@ function lock_callback(file, type, id)
$.get(url, function() { window.location.reload(true); });
}
function enc_callback(file, type, id)
{
var url = '/cgi-bin/browse/enc.jim?file=' + encodeURIComponent(file);
$.get(url, function() { window.location.reload(true); });
}
function new_callback(file, type, id)
{
var url = '/cgi-bin/browse/new.jim?file=' + encodeURIComponent(file);
$.get(url, function() { window.location.reload(true); });
}
function rename_submit()
{
var s = $('#renameform_form').serialize();
@@ -98,6 +110,26 @@ function preparemenu(el, menu)
{
if (el.attr('type') == 'ts')
{
if (el.attr('def') == 'HD')
{
$('#optmenu').enableContextMenuItems('#enc');
if (el.attr('encd') == 1)
$(menu).changeContextMenuItem('#enc',
'Remove ENC');
else
$(menu).changeContextMenuItem('#enc',
'Set ENC');
}
else
$('#optmenu').disableContextMenuItems('#enc');
$('#optmenu').enableContextMenuItems('#new');
if (el.attr('new') == 1)
$(menu).changeContextMenuItem('#new', 'Mark watched');
else
$(menu).changeContextMenuItem('#new', 'Mark new');
$('#optmenu').enableContextMenuItems('#lock');
if (el.attr('locked') == 1)
{
@@ -114,7 +146,10 @@ function preparemenu(el, menu)
{
$('#optmenu').enableContextMenuItems('#delete');
$('#optmenu').disableContextMenuItems('#lock');
$('#optmenu').disableContextMenuItems('#enc');
$('#optmenu').disableContextMenuItems('#new');
}
}
@@ -139,6 +174,16 @@ var menuclick = function(action, el, pos)
file, type, id);
break;
case 'enc':
confirm_action('change the ENC flag on', enc_callback,
file, type, id);
break;
case 'new':
confirm_action('change the New flag on', new_callback,
file, type, id);
break;
case 'rename':
$('#rename').val(bfile);
$('#renameorig').val(file);

View File

@@ -0,0 +1,27 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
#set _cgi(file) "/media/My Video/The Walking Dead/The Walking Dead S01E06.ts"
set file [dict get $_cgi file]
set ts [ts fetch $file]
if {[set ts [ts fetch $file]] != 0} {
set action enc
if {[$ts flag "Encrypted"]} { set action unenc }
if {[$ts $action]} {
puts "Successfully [set action]ed $file."
} else {
puts "Problem [set action]ing $file,
[$ts get error]"
}
}

View File

@@ -0,0 +1,27 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
puts "Content-Type: text/html"
puts ""
cgi_input
#cgi_dump
#set _cgi(file) "/media/My Video/The Walking Dead/The Walking Dead S01E06.ts"
set file [dict get $_cgi file]
set ts [ts fetch $file]
if {[set ts [ts fetch $file]] != 0} {
set action new
if {[$ts flag "New"]} { set action watched }
if {[$ts set_$action]} {
puts "Successfully marked $file as $action."
} else {
puts "Problem marking $file as $action,
[$ts get error]"
}
}

View File

@@ -0,0 +1,8 @@
#!/mod/bin/jimsh
puts "Content-Type: text/html"
puts ""
puts [exec /etc/init.d/S90settop restart]
file delete /tmp/.restartpending

View File

@@ -0,0 +1,7 @@
#!/mod/bin/jimsh
puts "Content-Type: text/html"
puts ""
source /mod/var/mongoose/include/restart.jim

View File

@@ -56,9 +56,6 @@ header
puts {<script type="text/javascript" src="/js/jquery.form.js"></script>}
puts {
<style type=text/css>
.ui-button, .ui-button-text { padding: 0; font-size: 10px; }
</style>
<script type=text/javascript>
$(document).ready(function () {
$(":submit").button();
@@ -93,7 +90,9 @@ puts "
<td><input name=hostname value=\"$hostname\"
class=\"text ui-widget-content ui-corner-all\"
length=20 maxlength=50>
<small>
<input id=hostname_submit value=\"change\" type=submit>
</small>
<div id=hostname_output></div>
</td>
</form>
@@ -122,7 +121,9 @@ foreach grp [$settings channel_groups] {
puts "
</select>
<small>
<input name=channel_group value=\"set\" type=submit>
</small>
<div id=channel_group_output></div>
</td>
</form>
@@ -145,7 +146,9 @@ puts "
<td><input name=smtp_server value=\"$smtp_server\"
class=\"text ui-widget-content ui-corner-all\"
length=20 maxlength=50>
<small>
<input id=smtp_server_submit value=\"change\" type=submit>
</small>
<div id=smtp_server_output></div>
</td>
</form>

View File

@@ -1,62 +1,62 @@
/* Generic context menu styles */
.contextMenu {
position: absolute;
width: 120px;
z-index: 99999;
border: solid 1px #CCC;
background: #EEE;
padding: 0px;
margin: 0px;
display: none;
}
.contextMenu LI {
list-style: none;
padding: 0px;
margin: 0px;
}
.contextMenu A {
color: #333;
text-decoration: none;
display: block;
line-height: 20px;
height: 20px;
background-position: 6px center;
background-repeat: no-repeat;
outline: none;
padding: 1px 5px;
padding-left: 28px;
}
.contextMenu LI.hover A {
color: #FFF;
background-color: #3399FF;
}
.contextMenu LI.disabled A {
color: #AAA;
cursor: default;
}
.contextMenu LI.hover.disabled A {
background-color: transparent;
}
.contextMenu LI.separator {
border-top: solid 1px #CCC;
}
/*
Adding Icons
You can add icons to the context menu by adding
classes to the respective LI element(s)
*/
.contextMenu LI.edit A { background-image: url(images/page_white_edit.png); }
.contextMenu LI.cut A { background-image: url(images/cut.png); }
.contextMenu LI.copy A { background-image: url(images/page_white_copy.png); }
.contextMenu LI.paste A { background-image: url(images/page_white_paste.png); }
.contextMenu LI.delete A { background-image: url(images/page_white_delete.png); }
.contextMenu LI.quit A { background-image: url(images/door.png); }
/* Generic context menu styles */
.contextMenu {
position: absolute;
width: 140px;
z-index: 99999;
border: solid 1px #CCC;
background: #EEE;
padding: 0px;
margin: 0px;
display: none;
}
.contextMenu LI {
list-style: none;
padding: 0px;
margin: 0px;
}
.contextMenu A {
color: #333;
text-decoration: none;
display: block;
line-height: 20px;
height: 20px;
background-position: 6px center;
background-repeat: no-repeat;
outline: none;
padding: 1px 5px;
padding-left: 28px;
}
.contextMenu LI.hover A {
color: #FFF;
background-color: #3399FF;
}
.contextMenu LI.disabled A {
color: #AAA;
cursor: default;
}
.contextMenu LI.hover.disabled A {
background-color: transparent;
}
.contextMenu LI.separator {
border-top: solid 1px #CCC;
}
/*
Adding Icons
You can add icons to the context menu by adding
classes to the respective LI element(s)
*/
.contextMenu LI.edit A { background-image: url(images/page_white_edit.png); }
.contextMenu LI.cut A { background-image: url(images/cut.png); }
.contextMenu LI.copy A { background-image: url(images/page_white_copy.png); }
.contextMenu LI.paste A { background-image: url(images/page_white_paste.png); }
.contextMenu LI.delete A { background-image: url(images/page_white_delete.png); }
.contextMenu LI.quit A { background-image: url(images/door.png); }

View File

@@ -52,6 +52,13 @@ div.footer
padding-top: 2em;
}
div.warningbox
{
background: url('/img/redshade.png') repeat-x;
padding: 0.5em;
margin: 1em;
}
table
{
empty-cells: show;
@@ -236,6 +243,11 @@ img.progress
display: block;
}
.hidden
{
display: none;
}
input.text
{
padding: .4em;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

View File

@@ -58,9 +58,6 @@ $(document).ready(function() {
<br>
</center>
</div>
<!--#exec cmd="/mod/var/mongoose/include/mediatomb.jim" -->
</div>
<div style="clear: both">
@@ -107,6 +104,9 @@ $(document).ready(function() {
</div>
<div style="clear: both">
<!--#exec cmd="/mod/var/mongoose/include/mediatomb.jim" -->
</div>
<div class=footer>
<ul>
<li>

View File

@@ -7,6 +7,17 @@ puts {
<script type=text/javascript src=/cgi-bin/backup/backup.js></script>
<h2>Backup/Restore</h2>
<div id=restart_block></div>
<div id=restore_warning class="hidden warningbox">
<center>
<b>!!!!!!!!!!!!!! PLEASE NOTE !!!!!!!!!!!!!!
<br><br>
After restoring the scheduled recordings you <b>MUST</b> restart the box using
the link at the top of the screen or via the remote control and then add
at least one scheduled entry using the remote control
(which you can then delete).
</div>
<div style="clear: both; float: left; width: 40%; border: 1px solid grey;
padding: 1em">
To create a backup of your current favourite channel configuration and

View File

@@ -1,16 +1,52 @@
#!/mod/bin/jimsh
if {![file exists /tmp/.restartpending]} { exit }
if {[file exists /tmp/.restartpending]} {
puts {
<center>
<div style="width: 60%; height: 0.8em;
<div style="width: 60%; height: 0.7em;
background: url(/img/stripes.gif) repeat-x;"></div>
<div style="width: 60%; text-align: center; padding: 0.5em">
A restart is required in order to complete a scheduling operation.
</div>
<div style="width: 60%; height: 0.8em;
background: url(/img/stripes.gif) repeat-x;"></div>
</center>
<div style="font-size: 1.2em; width: 60%; text-align: center; padding: 0.5em">
A warm restart is required in order to complete a scheduling operation.
<br>
<font class=blood>
}
# Is humaxtv doing anything?
set pid [exec pgrep humaxtv]
set c 0
catch { set c [exec /mod/bin/lsof -p $pid | grep Video | fgrep .ts | wc -l] }
if {$c > 0} {
puts "Cannot restart whilst box is busy."
} else {
puts {
Restart via the remote control or
<small><button id=restart_humaxtv>Restart now</button></small>
}
}
puts {
</font>
</div>
<div style="width: 60%; height: 0.7em; margin-bottom: 2em;
background: url(/img/stripes.gif) repeat-x;"></div>
</center>
<script type=text/javascript>
$('#restart_humaxtv').button();
$('#restart_humaxtv').click(function() {
if (confirm('Are you sure you wish to perform a warm restart now?'))
{
$.ajax({
url: '/cgi-bin/restart.jim',
success: function() {
window.location.reload(true);
}
});
}
});
</script>
}
}

View File

@@ -45,14 +45,36 @@ ts method flag {f} {
ts method unlock {} {
set cmd [list /mod/bin/hmt -lock $file]
#puts "CMD: $cmd"
exec {*}$cmd
return 1
}
ts method lock {} {
set cmd [list /mod/bin/hmt +lock $file]
#puts "CMD: $cmd"
exec {*}$cmd
return 1
}
ts method unenc {} {
set cmd [list /mod/bin/hmt -protect $file]
exec {*}$cmd
return 1
}
ts method enc {} {
set cmd [list /mod/bin/hmt +protect $file]
exec {*}$cmd
return 1
}
ts method set_new {} {
set cmd [list /mod/bin/hmt +new $file]
exec {*}$cmd
return 1
}
ts method set_watched {} {
set cmd [list /mod/bin/hmt -new $file]
exec {*}$cmd
return 1
}