restructure restartpending, create folder, cancel restartpending once nothing pending

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1784 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2014-02-10 23:03:36 +00:00
parent 97289969f1
commit 1984d7151b
12 changed files with 93 additions and 13 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 1.0.8-2
Version: 1.0.8-3
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.8),mongoose(>=3.0-9),jim(>=0.74-4),jim-oo,jim-sqlite3(>=0.74-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.14),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.05),ffmpeg,id3v2,multienv(>=1.6)

View File

@ -7,7 +7,7 @@ require rsv.class system.class
httpheader
if {[cgi_get act] eq "cancel"} {
file delete /tmp/.restartpending
system restartpending 0
exit
}
@ -18,7 +18,7 @@ if {[cgi_get now] eq "yes"} {
exit
}
file delete /tmp/.restartpending
system restartpending 0
header
# Commit pending reservations on older mod versions.

View File

@ -427,7 +427,16 @@ button.red
div#restart_block
{
text-align: center;
z-index: 31;
float: right;
width: 60%;
position: absolute;
top: 10px;
left: 100px;
background-color: #f8f8f8;
opacity: 0.9;
filter:alpha(opacity=90);
}
img.bmp, img.doublebmp

View File

@ -29,9 +29,9 @@ puts {
}
source /mod/webif/html/lib/topbar.jim
puts "<div id=restart_block>"
puts "<center><div id=restart_block>"
source /mod/webif/include/restart.jim
puts "</div>"
puts "</div></center>"
source /mod/webif/include/diskcheck.jim
source /mod/webif/include/notify.jim

View File

@ -15,6 +15,7 @@ puts {
<li class=delete><a href=#delete>Delete</a></li>
<li class=separator><a href=#ar>Enable AR</a></li>
<li class=separator><a href=#folder>Change Folder</a></li>
<li class=separator><a href=#mkfolder>Create Folder</a></li>
</ul>
<div id=padding style="display: none">

View File

@ -0,0 +1,32 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require rsv.class system.class
httpheader
set slot [cgi_get slot 0]
set table [cgi_get table TBL_RESERVATION]
set event [rsv slot $table $slot]
# Humax TV replaces these characters.
# "%*./:<>?\|
set dir "[system mediaroot]/[\
regsub -all {["%*\./:<>?\\|]} [$event get szFPBRecPath] "_"]"
if {[file exists $dir]} {
puts "Folder $dir already exists."
} else {
if {[catch {file mkdir $dir} msg]} {
puts "Failed to create $dir ($msg)"
} else {
puts "Created $dir"
}
}
system restartpending

View File

@ -24,6 +24,7 @@ puts {
<script type=text/javascript src=/js/jquery.form.js></script>
<script type=text/javascript src=script.js></script>
<div id=output class=hidden></div>
<div id=sdialogue></div>
}

View File

@ -148,9 +148,15 @@ function preparemenu(el, menu)
$('#optmenu').disableContextMenuItems('#ar');
if ($(el).attr('table') != 'pending' && $(el).attr('reckind') == 4)
{
$('#optmenu').enableContextMenuItems('#folder');
$('#optmenu').enableContextMenuItems('#mkfolder');
}
else
{
$('#optmenu').disableContextMenuItems('#folder');
$('#optmenu').disableContextMenuItems('#mkfolder');
}
}
function menuclick(action, el, pos)
@ -192,6 +198,18 @@ function menuclick(action, el, pos)
$('#fchange').dialog('open');
break;
case 'mkfolder':
$('#output')
.empty()
.show('slow')
.load('mkdir.jim?slot=' + sid,
function() {
$(output)
.css('font-style', 'italic')
.delay(5000).fadeOut('slow');
});
break;
default:
alert('Unhandled menu event, ' + action);
}

View File

@ -1,13 +1,16 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
if {[file exists /tmp/.restartpending]} {
require system.class rsv.class
if {[rsv count pending] > 0} {
puts {
<center>
<div style="width: 60%; height: 0.7em;
<div style="width: 100%; height: 0.7em;
background: url(/img/stripes.gif) repeat-x;"></div>
<div style="font-size: 1.2em; width: 60%; text-align: center; padding: 0.5em">
A restart is required in order to complete a scheduling operation.
@ -28,7 +31,7 @@ puts {
<small><button id=restart_cancel>Dismiss</button></small>
</font>
</div>
<div style="width: 60%; height: 0.7em; margin-bottom: 2em;
<div style="width: 100%; height: 0.7em;
background: url(/img/stripes.gif) repeat-x;"></div>
</center>
<script type=text/javascript>
@ -50,5 +53,9 @@ puts {
</script>
}
} else {
system restartpending 0
}
}

View File

@ -14,13 +14,17 @@ proc _lock_to_port {id} {
proc _lock_dummy {newsock addr port} { }
proc acquire_lock {id} {
proc acquire_lock {id {timeout 0}} {
global _locks
set port [_lock_to_port $id]
if {[catch {set socket [socket stream.server "127.0.0.1:$port"]} msg]} {
return 0
incr timeout [clock seconds]
while {[catch {set socket [\
socket stream.server "127.0.0.1:$port"]} msg]} {
if {[clock seconds] > $timeout} { return 0 }
sleep 0.2
}
set _locks($id) $socket

View File

@ -309,6 +309,10 @@ proc {rsv list} {{table tbl_reservation} {extra ""}} {
return $records
}
proc {rsv count} {{table tbl_reservation}} {
return [llength [rsv list $table]]
}
proc {rsv lookuptab} {} {
set records {}
foreach tab {tbl_reservation pending} {

View File

@ -192,8 +192,12 @@ proc {system reboot} {} {
exec /sbin/reboot
}
proc {system restartpending} {} {
close [open /tmp/.restartpending w]
proc {system restartpending} {{mode 1}} {
if {$mode} {
close [open /tmp/.restartpending w]
} else {
file delete /tmp/.restartpending
}
}
proc {system param} {param {type Value} {tbl MENUCONFIG}} {