Jim code cleanups (for 0.76)
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2283 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
35ed1a5db5
commit
f9bc928250
@ -1,10 +1,10 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 1.2.0-6
|
||||
Version: 1.3.0
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.0),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,mongoose,recmon(>=2.0.2)
|
||||
Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.0),hmt(>=2.0.3),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,mongoose,recmon(>=2.0.2)
|
||||
Suggests:
|
||||
Description: An evolving web interface for the Humax.
|
||||
Tags: http://hummy.tv/forum/threads/5866/
|
||||
|
@ -105,7 +105,11 @@ foreach record [lsort -command rsort $records] {
|
||||
|
||||
set ended [$record ended]
|
||||
|
||||
if $ended { puts "<td nowrap class=blood>" } else { puts "<td nowrap>"}
|
||||
if {$ended} {
|
||||
puts "<td nowrap class=blood>"
|
||||
} else {
|
||||
puts "<td nowrap>"
|
||||
}
|
||||
puts "
|
||||
[clock format [$record get start] -format "%a %d %b %Y"]<br>
|
||||
[clock format [$record get start] -format "%H:%M %Z"]"
|
||||
|
@ -45,7 +45,7 @@ puts {
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#progressbar').reportprogress(0);
|
||||
handle = setInterval("update()", 400);
|
||||
handle = setInterval("update()" , 400);
|
||||
$.get('/cgi-bin/restart.jim?now=yes');
|
||||
});
|
||||
</script>
|
||||
|
@ -83,7 +83,7 @@ set rec 0
|
||||
set output {}
|
||||
|
||||
set opfile ""
|
||||
if {[file exists "/mod/tmp/webif_auto/.op"} {
|
||||
if {[file exists "/mod/tmp/webif_auto/.op"]} {
|
||||
set fp [open "/mod/tmp/webif_auto/.op"]
|
||||
lassign [split [string trim [$fp read]] ":"] op opfile
|
||||
$fp close
|
||||
@ -284,6 +284,7 @@ foreach event $events {
|
||||
" [clock format [$event get nsttime] -format {%H:%M}]" \
|
||||
" </span>\n" \
|
||||
"</span>\n" \
|
||||
]
|
||||
} else {
|
||||
lappend output [concat \
|
||||
"Will record '[$event name]' " \
|
||||
|
@ -96,7 +96,7 @@ puts "<div id=buttons style=\"width: $eventpx; margin-left: ${chanpx}px;\">"
|
||||
but "<< -1 Week" $($stt - 3600 * 24 * 7) \
|
||||
$($stt - $now + 3600 >= 3600 * 24 * 7)
|
||||
but "<< -1 Day" $($stt - 3600 * 24) $($stt - $now >= 3600 * 23)
|
||||
but "<< Earlier", $($stt - 3600 * 4) $($stt > $now)
|
||||
but "<< Earlier" $($stt - 3600 * 4) $($stt > $now)
|
||||
#but "< Now >" $now $($current == 0)
|
||||
but "< Now >" $now
|
||||
but ">> Later" $ett;
|
||||
|
@ -31,7 +31,7 @@ puts { <li class=thm><a href=#vthm>View Thumbnail</a></li> }
|
||||
|
||||
puts { <li class=bookmark><a href=#bmarks>Bookmarks</a></li> }
|
||||
|
||||
if $nicesplice {
|
||||
if {$nicesplice} {
|
||||
puts {
|
||||
<li class="cut"><a href=#crop>Crop</a></li>
|
||||
<li class="cut"><a href=#chunk>Split (45m parts)</a></li>
|
||||
@ -96,7 +96,7 @@ if {$model eq "HDR"} {
|
||||
</a></li>
|
||||
}
|
||||
}
|
||||
if $flatten {
|
||||
if {$flatten} {
|
||||
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ switch $action {
|
||||
list {
|
||||
if {![$cb size]} {
|
||||
puts "<i>Clipboard is empty</i>"
|
||||
break
|
||||
exit
|
||||
}
|
||||
puts "<div class=cliplist>"
|
||||
foreach file [$cb get items] {
|
||||
|
@ -5,7 +5,7 @@ source /mod/webif/lib/setup
|
||||
|
||||
httpheader
|
||||
|
||||
if [file exists /mod/bin/ffmpeg] {
|
||||
if {[file exists /mod/bin/ffmpeg]} {
|
||||
set file [cgi_get file]
|
||||
puts [exec /mod/webif/lib/bin/ffmpeg -i $file]
|
||||
} else {
|
||||
|
@ -281,7 +281,7 @@ set stub ""
|
||||
foreach part [split $dir /] {
|
||||
if {$stub eq "/"} { set name $part } else { set name "/$part" }
|
||||
append stub $name
|
||||
puts "<a href=\"$env(SCRIPT_NAME)?dir=[cgi_quote_url $stub]\">$name</a>
|
||||
puts "<a href=\"$env(SCRIPT_NAME)?dir=[cgi_quote_url $stub]\">$name</a>"
|
||||
}
|
||||
puts "<span class=filesize id=dirsize></span>"
|
||||
puts "</legend>"
|
||||
|
@ -227,7 +227,7 @@ foreach e $records {
|
||||
}
|
||||
puts "
|
||||
<tr class=hour id=hour_$hour>
|
||||
<th class=hour>$hour:00</th>
|
||||
<th class=hour>${hour}:00</th>
|
||||
<td class=dayhour>
|
||||
"
|
||||
set currhour $hour
|
||||
|
@ -66,9 +66,17 @@ foreach record $records {
|
||||
if {[$record showing]} {
|
||||
puts "<td><img src=/images/111_1_00_Cursor_2R_Arrow.png></td>"
|
||||
} else { puts "<td></td>" }
|
||||
if $ended { puts "<td nowrap class=blood>" } else { puts "<td nowrap>" }
|
||||
if {$ended} {
|
||||
puts "<td nowrap class=blood>"
|
||||
} else {
|
||||
puts "<td nowrap>"
|
||||
}
|
||||
puts "[clock format [$record get start] -format "%a %d %b %Y"]</td>"
|
||||
if $ended { puts "<td nowrap class=blood>" } else { puts "<td nowrap>" }
|
||||
if {$ended} {
|
||||
puts "<td nowrap class=blood>"
|
||||
} else {
|
||||
puts "<td nowrap>"
|
||||
}
|
||||
puts "[clock format [$record get start] -format "%H:%M"]</td>"
|
||||
puts [$record cell]
|
||||
puts "<td>[$record get text]</td>"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,7 @@ puts {
|
||||
padding: 0 0 0 2em;">
|
||||
}
|
||||
source /mod/webif/include/model.jim
|
||||
source /mod/webif/include/upgrade.jim
|
||||
puts {
|
||||
</span>
|
||||
</div>
|
||||
|
@ -13,7 +13,7 @@ httpheader
|
||||
proc quote {s} {
|
||||
return [string map {
|
||||
{&} {&}
|
||||
{"} {"}
|
||||
"\"" {"}
|
||||
{<} {<}
|
||||
{>} {>}
|
||||
} $s]
|
||||
|
@ -37,7 +37,7 @@ puts {
|
||||
</head>
|
||||
}
|
||||
|
||||
if [dict exists $env SCRIPT_NAME] {
|
||||
if {[dict exists $env SCRIPT_NAME]} {
|
||||
set pageid [string range $env(SCRIPT_NAME) 3 end-4]
|
||||
} else {
|
||||
set pageid test
|
||||
@ -90,6 +90,7 @@ if {$_bare} {
|
||||
[_header]
|
||||
</div>
|
||||
<div data-role=content>
|
||||
"
|
||||
}
|
||||
|
||||
set renderstart [clock milliseconds]
|
||||
|
@ -14,7 +14,7 @@ foreach service $services {
|
||||
|
||||
if {[string tolower $name] eq "mongoose"} continue
|
||||
|
||||
if (!$installed) {
|
||||
if {!$installed} {
|
||||
puts "<li><h3>[string totitle $name]</h3>"
|
||||
puts "<p><i>Not installed.</i></p>"
|
||||
puts "</li>"
|
||||
@ -42,7 +42,7 @@ foreach service $services {
|
||||
<label class=va for=auto$i>Auto-start:</label>
|
||||
<select class=auto act=auto data-role=slider service=$name>
|
||||
"
|
||||
if ($auto) {
|
||||
if {$auto} {
|
||||
puts "<option value=off>Off</option>"
|
||||
puts "<option value=on selected>On</option>"
|
||||
} else {
|
||||
|
@ -61,17 +61,17 @@ foreach service $services {
|
||||
if {$name eq "mongoose"} continue
|
||||
|
||||
puts "<tr><td class=even>$name</td>"
|
||||
if (!$installed) {
|
||||
if {!$installed} {
|
||||
puts "<td colspan=2><i>Not installed</i></td></tr>"
|
||||
continue
|
||||
}
|
||||
|
||||
puts -nonewline "<td><input type=checkbox class=auto name=\"$name\""
|
||||
if ($auto) { puts -nonewline " checked" }
|
||||
if {$auto} { puts -nonewline " checked" }
|
||||
puts "></td>"
|
||||
|
||||
puts -nonewline "<td><input type=checkbox class=toggle name=\"$name\""
|
||||
if ($running) { puts -nonewline " checked" }
|
||||
if {$running} { puts -nonewline " checked" }
|
||||
puts "></td>"
|
||||
|
||||
puts "</tr>"
|
||||
|
@ -18,7 +18,7 @@ proc ip2x {ip {validate 0}} {
|
||||
set octets [split $ip .]
|
||||
if {[llength $octets] != 4} {
|
||||
error "Invalid IP address (octets)"
|
||||
set octets [lrange [concat $octets 0 0 0] 0 3]
|
||||
#set octets [lrange [concat $octets 0 0 0] 0 3]
|
||||
}
|
||||
if {$validate} {
|
||||
foreach oct $octets {
|
||||
@ -56,7 +56,7 @@ switch [cgi_get mode -] {
|
||||
exit
|
||||
}
|
||||
set fd [open $file w]
|
||||
puts $fd "setup:MENUCONFIG:ETHERNET_CONF_$tag:Value:1"
|
||||
puts $fd "setup:MENUCONFIG:ETHERNET_CONF_${tag}:Value:1"
|
||||
puts $fd "setup:MENUCONFIG:ETHERNET_CONF_${tag}_IP:Blob:[ip2x $ip]"
|
||||
puts $fd "setup:MENUCONFIG:ETHERNET_CONF_${tag}_NETMASK:Blob:[ip2x $mask]"
|
||||
puts $fd "setup:MENUCONFIG:ETHERNET_CONF_${tag}_GATEWAY:Blob:[ip2x $gw]"
|
||||
@ -68,7 +68,7 @@ switch [cgi_get mode -] {
|
||||
}
|
||||
dhcp {
|
||||
set fd [open $file w]
|
||||
puts $fd "setup:MENUCONFIG:ETHERNET_CONF_$tag:Value:0"
|
||||
puts $fd "setup:MENUCONFIG:ETHERNET_CONF_${tag}:Value:0"
|
||||
}
|
||||
default {
|
||||
puts "Unknown mode."
|
||||
|
@ -62,7 +62,7 @@ proc _handle_update {class var old text} {
|
||||
set new [string trim [dict get $_cgi $var]]
|
||||
if {$new == $old} {
|
||||
puts "$text unchanged."
|
||||
} elseif [string is $class -strict $new] {
|
||||
} elseif {[string is $class -strict $new]} {
|
||||
$settings $var $new
|
||||
puts "$text updated."
|
||||
} else {
|
||||
|
15
webif/include/upgrade.jim
Executable file
15
webif/include/upgrade.jim
Executable file
@ -0,0 +1,15 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
source /mod/webif/lib/setup
|
||||
require system.class
|
||||
|
||||
if {[system modversion 1] < 300} {
|
||||
puts {
|
||||
</span><br><span class=blood>
|
||||
Your custom firmware is out of date and will shortly stop receiving package updates -
|
||||
<a href=http://hummy.tv/forum/threads/5867/>
|
||||
click for details</a>
|
||||
</span>
|
||||
}
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ proc do_mp3 {ts} {
|
||||
|
||||
proc entries {dir callback} {
|
||||
foreach entry [readdir -nocomplain $dir] {
|
||||
if {![string match {*.ts} $entry} continue
|
||||
if {![string match {*.ts} $entry]} continue
|
||||
if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue
|
||||
if {$ts == 0} continue
|
||||
$callback $ts
|
||||
|
@ -37,10 +37,10 @@ proc {dir iconset} {dir} {
|
||||
set attrs {}
|
||||
|
||||
set noflat 0
|
||||
if $::_flatten {
|
||||
if {$::_flatten} {
|
||||
if {[string match {\[*\]} [file tail $dir]]} { set noflat 1 }
|
||||
if {[file exists "$dir/.noflatten"]} { set noflat 1 }
|
||||
if $noflat { lappend icons \
|
||||
if {$noflat} { lappend icons \
|
||||
[_addicon "/img/flat-tyre.png" "No-flatten"] }
|
||||
lappend attrs "noflat=$noflat"
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
if {![exists -proc cat]} {
|
||||
proc cat {file} {
|
||||
if {[catch {set fp [open $file r}]} { return }
|
||||
if {[catch {set fp [open $file r]}]} { return }
|
||||
puts -nonewline [read $fp]
|
||||
close $fp
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ proc {epg channeliconpath} {name} {
|
||||
proc {epg channelicon} {name {width 0} {style ""}} {
|
||||
set str "<img src=\"/img/channels/out/$name.png\"";
|
||||
if {$width > 0} { append str " width=$width" }
|
||||
if {$style ne ""} { append str " style=\"$style\" }
|
||||
if {$style ne ""} { append str " style=\"$style\"" }
|
||||
append str " alt=\"\">"
|
||||
return $str
|
||||
}
|
||||
@ -128,7 +128,7 @@ proc {epg channelicon} {name {width 0} {style ""}} {
|
||||
epg method channel_icon {{width 0} {style ""}} {
|
||||
set str "<img src=\"/img/channels/out/$channel_name.png\"";
|
||||
if {$width > 0} { append str " width=$width" }
|
||||
if {$style ne ""} { append str " style=\"$style\" }
|
||||
if {$style ne ""} { append str " style=\"$style\"" }
|
||||
append str " alt=\"\">"
|
||||
return $str
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ proc {pkg avail} {} {
|
||||
set inst_pkgs [pkg inst]
|
||||
set avail_pkgs {}
|
||||
foreach pkg [split [exec /bin/opkg list] "\n"] {
|
||||
if [regexp {^ } $pkg] { continue }
|
||||
if {[regexp {^ } $pkg]} { continue }
|
||||
if {[regexp {^([^ ]+)} $pkg name] == 0} { continue }
|
||||
if {$name ni $inst_pkgs && $name ni $avail_pkgs} {
|
||||
lappend avail_pkgs $name
|
||||
|
@ -111,8 +111,9 @@ rsv method name {} {
|
||||
if {$name == ""} {
|
||||
switch $ersvtype {
|
||||
1 { set name "--- Unnamed reminder ---" }
|
||||
2 { set name "--- Unnamed reminder ---" }
|
||||
2 { set name "--- Unnamed manual reminder ---" }
|
||||
3 { set name "--- Unnamed recording ---" }
|
||||
4 { set name "--- Unnamed manual recording ---" }
|
||||
5 { set name "--- Wake-up ---" }
|
||||
6 { set name "--- Sleep ---" }
|
||||
7 { set name "--- Auto Update ---" }
|
||||
@ -139,9 +140,10 @@ rsv method channel_name {} {
|
||||
rsv method icon {} {
|
||||
set rsvicon ""
|
||||
switch $ersvtype {
|
||||
1 { set rsvicon "175_1_00_Reservation_Watch.png" }
|
||||
1 -
|
||||
2 { set rsvicon "175_1_00_Reservation_Watch.png" }
|
||||
3 { set rsvicon "175_1_11_Reservation_Record.png" }
|
||||
3 -
|
||||
4 { set rsvicon "175_1_11_Reservation_Record.png" }
|
||||
5 { set rsvicon "745_1_10_Video_2Live.png" }
|
||||
6 { set rsvicon "745_1_11_Video_1REC.png" }
|
||||
7 { set rsvicon "345_6_08_ST_Ad_Hoc.png" }
|
||||
|
Loading…
x
Reference in New Issue
Block a user