git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1524 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2013-04-05 20:07:42 +00:00
parent cf0a6b5028
commit 38a079b0ba
7 changed files with 99 additions and 191 deletions

View File

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

View File

@ -39,5 +39,7 @@ if [ ! -f /mod/webif/.strip-updated ]; then
touch /mod/webif/.strip-updated
fi
/mod/webif/lib/bin/diskattrs
exit 0

View File

@ -7,7 +7,8 @@ require settings.class plugin system.class
httpheader
if {[cgi_get act] eq "https"} {
if {[cgi_get val off] eq "off"} {
set val [cgi_get val off]
if {$val in {0 off}} {
file delete /mod/etc/mongoose.cert
puts "HTTPS Server will be disabled after next reboot."
} else {
@ -18,7 +19,8 @@ if {[cgi_get act] eq "https"} {
}
if {[cgi_get act] eq "xtelnet"} {
if {[cgi_get val off] eq "off"} {
set val [cgi_get val off]
if {$val in {0 off}} {
file delete /mod/boot/xtelnet
puts "Telnet server expert mode will be disabled after next reboot."
} else {
@ -37,6 +39,7 @@ set epg_style [$settings epg_style]
set pkgdev [$settings pkgdev]
set notoolbar [$settings notoolbar]
set nomobile [$settings nomobile]
set nohelplinks [$settings nohelplinks]
set xepghours [$settings xepghours]
if {$xepghours == 0} { set xepghours 4 }
set genrededup [$settings genrededup]
@ -80,6 +83,7 @@ handle_str_update epg_style $epg_style "EPG Type"
handle_int_update pkgdev $pkgdev "Development Package Display"
handle_int_update notoolbar $notoolbar "Disable toolbar"
handle_int_update nomobile $nomobile "Disable mobile link"
handle_int_update nohelplinks $nohelplinks "Disable help links"
handle_int_update genrededup $genrededup "Genre search dedup"
handle_int_update autolog $autolog "Auto-processing log level"
@ -122,6 +126,22 @@ puts {
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
}
proc setting_toggle {name attr checked {invert 0} {val 0}} {
puts -nonewline "
<tr>
<th class=key>$name</th>
<td><input class=setting_toggle type=checkbox value=yes"
if {$checked} { puts -nonewline " checked" }
puts -nonewline " attr=$attr"
if {$invert} { puts -nonewline " invert=1" }
if {$val} { puts -nonewline " useval=1" }
puts -nonewline ">
<div id=${attr}_output></div>
</td>
</tr>
"
}
puts "
<fieldset style=\"display: inline\">
<legend>
@ -146,40 +166,14 @@ puts "
</tr>
"
puts -nonewline "
<tr>
<th class=key>HTTPS web server?</th>
<td><input id=https_toggle name=https type=checkbox value=yes"
if {[file exists /mod/etc/mongoose.cert]} { puts -nonewline " checked" }
puts ">
<div id=https_output></div>
</td>
</tr>
"
setting_toggle "HTTPS web server?" "https" \
[file exists /mod/etc/mongoose.cert] 0 1
setting_toggle "Slide-down toolbar?" "notoolbar" $(!$notoolbar) 1
setting_toggle "Mobile link on main page?" "nomobile" $(!$nomobile) 1
setting_toggle "Help links on main page?" "nohelplinks" $(!$nohelplinks) 1
puts -nonewline "
<tr>
<th class=key>Slide-down toolbar?</th>
<td><input id=toolbar_toggle name=toolbar type=checkbox value=yes"
if {$notoolbar == 0} { puts -nonewline " checked" }
puts ">
<div id=toolbar_output></div>
</td>
</tr>
"
puts -nonewline "
<tr>
<th class=key>Mobile link on main page?</th>
<td><input id=mobile_toggle name=mobile type=checkbox value=yes"
if {$nomobile == 0} { puts -nonewline " checked" }
puts ">
<div id=mobile_output></div>
</td>
</tr>
"
puts -nonewline "
<form class=auto id=autolog method=get action=$env(REQUEST_URI)>
<th class=key>Auto-processing log level</th>
<td><select id=autolog name=autolog
@ -202,6 +196,7 @@ puts "
<div id=autolog_output></div>
</td>
</form>
</tr>
"
puts "
@ -295,49 +290,43 @@ puts "
</tr>
"
puts -nonewline "
<tr>
<th class=key>De-duplicate genre search results?</th>
<td><input id=genrededup_toggle name=genrededup type=checkbox value=yes"
if {$genrededup == 1} { puts -nonewline " checked" }
puts ">
<div id=genrededup_output></div>
</td>
</tr>
"
setting_toggle "De-duplicate genre search results?" genrededup $genrededup
puts "
</table>
</fieldset>
<br><br>
<fieldset style=\"display: inline\">
<legend> Email Settings </legend>
<table>
"
puts "
<tr>
<form class=auto id=smtp_server method=get action=$env(REQUEST_URI)>
<th class=key>SMTP Server for outbound email</th>
<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>
</tr>
"
#puts "
# <fieldset style=\"display: inline\">
# <legend> Email Settings </legend>
# <table>
#"
#
#puts "
# <tr>
# <form class=auto id=smtp_server method=get action=$env(REQUEST_URI)>
# <th class=key>SMTP Server for outbound email</th>
# <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>
# </tr>
#"
#
#puts "
# </table>
# </fieldset>
# <br><br>
#"
puts "
</table>
</fieldset>
"
puts "
<br><br>
<fieldset style=\"display: inline\">
<legend> Web Interface User Access Control </legend>
<table>
@ -432,34 +421,16 @@ puts -nonewline "
<fieldset style=\"display: inline\">
<legend> Advanced Settings </legend>
<table>
<tr>
<th class=key>Show development and advanced packages?</th>
<td><input name=pkgdev id=pkgdev value=1 type=checkbox
"
if {$pkgdev} { puts -nonewline " checked" }
puts ">
</td>
</tr>
"
setting_toggle "Show development and advanced packages?" "pkgdev" $pkgdev
if {[system modversion 1] >= 214} {
puts -nonewline "
<tr>
<th class=key>Expert mode telnet server?</th>
<td><input id=xtelnet_toggle name=xtelnet type=checkbox value=yes"
if {[file exists /mod/boot/xtelnet]} { puts -nonewline " checked" }
puts ">
<div id=xtelnet_output></div>
</td>
</tr>
"
setting_toggle "Expert mode telnet server?" "xtelnet" \
[file exists /mod/boot/xtelnet] 0 1
}
puts "
</table>
<div id=pkgdev_output></div>
</fieldset>
"

View File

@ -41,117 +41,33 @@ $(document).ready(function () {
});
});
$('#pkgdev').change(function() {
$('.setting_toggle').change(function() {
var arg = '0';
var urlargs;
if ($(this).attr('checked'))
arg = '1';
$(this).disable();
if ($(this).attr('invert'))
arg = arg == "0" ? "1" : "0";
$('#pkgdev_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?pkgdev=' + arg,
function() {
$('#pkgdev').enable();
$('#pkgdev_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
var el = $(this);
var attr = $(this).attr('attr');
var output = '#' + attr + '_output';
$('#https_toggle').change(function() {
var arg = 'off';
if ($(this).attr('checked'))
arg = 'on';
if ($(this).attr('useval'))
urlargs = 'act=' + attr + '&val=' + arg;
else
urlargs = attr + '=' + arg;
$(this).disable();
$('#https_output')
.empty()
.html('<img src=/img/loading.gif>Please Wait...')
.show('slow')
.load('/cgi-bin/settings.jim?act=https&val=' + arg,
function() {
$('#https_toggle').enable();
$('#https_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#xtelnet_toggle').change(function() {
var arg = 'off';
if ($(this).attr('checked'))
arg = 'on';
$(this).disable();
$('#xtelnet_output')
.empty()
.html('<img src=/img/loading.gif>Please Wait...')
.show('slow')
.load('/cgi-bin/settings.jim?act=xtelnet&val=' + arg,
function() {
$('#xtelnet_toggle').enable();
$('#xtelnet_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#toolbar_toggle').change(function() {
var arg = '1';
if ($(this).attr('checked'))
arg = '0';
$(this).disable();
$('#toolbar_output')
$(output)
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?notoolbar=' + arg,
.load('/cgi-bin/settings.jim?' + urlargs,
function() {
$('#toolbar_toggle').enable();
$('#toolbar_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#mobile_toggle').change(function() {
var arg = '1';
if ($(this).attr('checked'))
arg = '0';
$(this).disable();
$('#mobile_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?nomobile=' + arg,
function() {
$('#mobile_toggle').enable();
$('#mobile_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
$('#genrededup_toggle').change(function() {
var arg = '0';
if ($(this).attr('checked'))
arg = '1';
$(this).disable();
$('#genrededup_output')
.empty()
.show('slow')
.load('/cgi-bin/settings.jim?genrededup=' + arg,
function() {
$('#genrededup_toggle').enable();
$('#genrededup_output')
$(el).enable();
$(output)
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});

View File

@ -1,6 +1,10 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
if {[system model] eq "HDR"} {
require settings.class
set smartattrs {realloc pending offline}
@ -58,8 +62,11 @@ this device.
} else {
puts "
<br>
Don't panic; for help and assistance, visit
<a target=_blank href=http://hummy.tv/>hummy.tv</a>
Don't panic; for help, visit
<a target=_blank
href=http://wiki.hummy.tv/wiki/Disk_Problem>
wiki.hummy.tv
</a>
"
}
puts "
@ -67,3 +74,5 @@ this device.
"
}
}

View File

@ -34,7 +34,9 @@ proc menuitem {title icon link {width 217} {height 0} {extra ""}} {{num 0}} {
"
}
if {[[settings] epg_style] eq "grid"} {
set settings [settings]
if {[$settings epg_style] eq "grid"} {
set epglink "/cgi-bin/xepg.jim"
} else {
set epglink "/epg.shtml"
@ -69,6 +71,8 @@ menuitem "Diagnostics" "/img/diagnostics.png" \
eval_plugins menu
if {[$settings nohelplinks] == 0} {
menuitem "-reset" "" ""
puts {</div><div style="clear: both; padding-top: 3em">}
@ -85,4 +89,5 @@ menuitem "Twitter<br>Feed" "/img/silver-twitter-bird-button.png" \
"http://twitter.com/HummyPkg target=_blank" 0 100 \
"style=\"padding: 1em\""
}

View File

@ -24,6 +24,7 @@ class settings {
pkgdev 0
notoolbar 0
nomobile 0
nohelplinks 0
xepghours 4
genrededup 0
autolog 0
@ -160,6 +161,10 @@ settings method nomobile {{val -1}} {
return [$self _nval_setting nomobile $val]
}
settings method nohelplinks {{val -1}} {
return [$self _nval_setting nohelplinks $val]
}
settings method sortorder {{val -1}} {
return [$self _nval_setting sortorder $val]
}