diff --git a/CONTROL/control b/CONTROL/control
index b4165067..811a0347 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -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)
diff --git a/var/mongoose/cgi-bin/restart.jim b/var/mongoose/cgi-bin/restart.jim
index f673b8e0..9dc01b08 100755
--- a/var/mongoose/cgi-bin/restart.jim
+++ b/var/mongoose/cgi-bin/restart.jim
@@ -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.
diff --git a/var/mongoose/html/css/style.css b/var/mongoose/html/css/style.css
index 61bff781..2ec28356 100644
--- a/var/mongoose/html/css/style.css
+++ b/var/mongoose/html/css/style.css
@@ -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
diff --git a/var/mongoose/html/lib/header.jim b/var/mongoose/html/lib/header.jim
index 3800dff8..a25d14dd 100755
--- a/var/mongoose/html/lib/header.jim
+++ b/var/mongoose/html/lib/header.jim
@@ -29,9 +29,9 @@ puts {
}
source /mod/webif/html/lib/topbar.jim
-puts "
"
+puts "
"
source /mod/webif/include/restart.jim
-puts "
"
+puts " "
source /mod/webif/include/diskcheck.jim
source /mod/webif/include/notify.jim
diff --git a/var/mongoose/html/sched/assets.jim b/var/mongoose/html/sched/assets.jim
index d5080a5c..c590edb2 100755
--- a/var/mongoose/html/sched/assets.jim
+++ b/var/mongoose/html/sched/assets.jim
@@ -15,6 +15,7 @@ puts {
Delete
Enable AR
Change Folder
+ Create Folder
diff --git a/var/mongoose/html/sched/mkdir.jim b/var/mongoose/html/sched/mkdir.jim
new file mode 100755
index 00000000..f445aa1a
--- /dev/null
+++ b/var/mongoose/html/sched/mkdir.jim
@@ -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
+
diff --git a/var/mongoose/html/sched/sched.jim b/var/mongoose/html/sched/sched.jim
index af2f354a..947d59cb 100755
--- a/var/mongoose/html/sched/sched.jim
+++ b/var/mongoose/html/sched/sched.jim
@@ -24,6 +24,7 @@ puts {
+
}
diff --git a/var/mongoose/html/sched/script.js b/var/mongoose/html/sched/script.js
index 940d015f..24ba545b 100755
--- a/var/mongoose/html/sched/script.js
+++ b/var/mongoose/html/sched/script.js
@@ -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);
}
diff --git a/var/mongoose/include/restart.jim b/var/mongoose/include/restart.jim
index 15c8bc0e..16102ddd 100755
--- a/var/mongoose/include/restart.jim
+++ b/var/mongoose/include/restart.jim
@@ -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 {
-
A restart is required in order to complete a scheduling operation.
@@ -28,7 +31,7 @@ puts {
-
}
+} else {
+ system restartpending 0
+}
+
}
diff --git a/var/mongoose/lib/lock b/var/mongoose/lib/lock
index efc281f7..51410701 100644
--- a/var/mongoose/lib/lock
+++ b/var/mongoose/lib/lock
@@ -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
diff --git a/var/mongoose/lib/rsv.class b/var/mongoose/lib/rsv.class
index db9d5294..f8dfe1f4 100755
--- a/var/mongoose/lib/rsv.class
+++ b/var/mongoose/lib/rsv.class
@@ -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} {
diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class
index e41b94b9..02620ee7 100644
--- a/var/mongoose/lib/system.class
+++ b/var/mongoose/lib/system.class
@@ -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}} {