2011-06-09 21:16:30 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require cgi
|
2011-07-01 22:56:53 +00:00
|
|
|
source /mod/var/mongoose/lib/setup
|
|
|
|
require settings.class
|
|
|
|
require plugin
|
2011-06-09 21:16:30 +00:00
|
|
|
|
|
|
|
puts "Content-Type: text/html"
|
|
|
|
puts ""
|
|
|
|
|
|
|
|
cgi_input
|
|
|
|
#cgi_dump
|
|
|
|
|
2011-06-14 11:48:55 +00:00
|
|
|
set settings [settings new]
|
2011-06-09 21:16:30 +00:00
|
|
|
|
2011-06-14 11:48:55 +00:00
|
|
|
set hostname [$settings hostname]
|
2011-06-16 23:49:48 +00:00
|
|
|
set smtp_server [$settings smtp_server]
|
2011-06-14 11:48:55 +00:00
|
|
|
set channel_group [$settings channel_group]
|
2011-07-11 23:29:21 +00:00
|
|
|
set pkgdev [$settings pkgdev]
|
2011-06-09 21:16:30 +00:00
|
|
|
|
|
|
|
# Handle updates
|
|
|
|
|
2011-07-01 22:56:53 +00:00
|
|
|
if {![dict exists $env REQUEST_URI]} { set env(REQUEST_URI) "" }
|
2011-06-16 23:49:48 +00:00
|
|
|
|
2011-06-14 11:48:55 +00:00
|
|
|
proc _handle_update {class var old text} {
|
|
|
|
global _cgi
|
|
|
|
global settings
|
|
|
|
|
|
|
|
if {[dict exists $_cgi $var]} {
|
|
|
|
set new [string trim [dict get $_cgi $var]]
|
|
|
|
if {$new == $old} {
|
|
|
|
puts "$text unchanged."
|
|
|
|
} elseif [string is $class -strict $new] {
|
|
|
|
$settings $var $new
|
|
|
|
puts "$text updated."
|
|
|
|
} else {
|
|
|
|
puts "Invalid value for $var."
|
|
|
|
}
|
|
|
|
exit
|
2011-06-09 21:16:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-14 11:48:55 +00:00
|
|
|
proc handle_int_update {var old {text "Value"}} {
|
|
|
|
_handle_update digit $var $old $text
|
|
|
|
}
|
|
|
|
|
|
|
|
proc handle_str_update {var old {text "Value"}} {
|
|
|
|
_handle_update alnum $var $old $text
|
|
|
|
}
|
|
|
|
|
|
|
|
handle_str_update hostname $hostname Hostname
|
2011-06-16 23:49:48 +00:00
|
|
|
_handle_update ascii smtp_server $smtp_server "SMTP Server"
|
2011-06-14 11:48:55 +00:00
|
|
|
handle_int_update channel_group $channel_group "Channel Group"
|
2011-07-11 23:29:21 +00:00
|
|
|
if {[dict exists $_cgi pkgdevoff] && ![dict exists $_cgi pkgdev]} {
|
|
|
|
set _cgi(pkgdev) 0
|
|
|
|
}
|
|
|
|
handle_int_update pkgdev $pkgdev "Development Package Display"
|
2011-06-14 11:48:55 +00:00
|
|
|
|
2011-07-01 22:56:53 +00:00
|
|
|
header
|
|
|
|
|
2011-06-09 21:16:30 +00:00
|
|
|
puts {<script type="text/javascript" src="/js/jquery.form.js"></script>}
|
|
|
|
|
|
|
|
puts {
|
|
|
|
<script type=text/javascript>
|
|
|
|
$(document).ready(function () {
|
2011-06-25 20:59:50 +00:00
|
|
|
$(":submit").button();
|
2011-07-01 22:56:53 +00:00
|
|
|
$('form.auto').each(function(i, el) {
|
2011-06-09 21:16:30 +00:00
|
|
|
var id = $(this).attr('id');
|
|
|
|
var output = '#' + id + '_output'
|
|
|
|
$(this).ajaxForm({
|
|
|
|
target: output,
|
|
|
|
success: function() {
|
|
|
|
$(output).css('font-style', 'italic');
|
|
|
|
$(output).show('slow');
|
|
|
|
$(output).delay(2000).fadeOut('slow');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
}
|
|
|
|
|
|
|
|
puts "
|
2011-07-11 23:29:21 +00:00
|
|
|
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
|
|
|
|
<script type=\"text/javascript\" src=\"/js/iphone-style-checkboxes.js\">
|
|
|
|
</script>
|
2011-06-25 20:59:50 +00:00
|
|
|
<fieldset style=\"display: inline\">
|
|
|
|
<legend>
|
|
|
|
General Settings
|
|
|
|
</legend>
|
|
|
|
<table>
|
|
|
|
"
|
|
|
|
|
|
|
|
puts "
|
2011-06-09 21:16:30 +00:00
|
|
|
<tr>
|
2011-07-01 22:56:53 +00:00
|
|
|
<form class=auto id=hostname method=get action=$env(REQUEST_URI)>
|
2011-06-25 20:59:50 +00:00
|
|
|
<th class=key>Hostname</th>
|
2011-06-09 21:16:30 +00:00
|
|
|
<td><input name=hostname value=\"$hostname\"
|
2011-06-25 20:59:50 +00:00
|
|
|
class=\"text ui-widget-content ui-corner-all\"
|
2011-06-09 21:16:30 +00:00
|
|
|
length=20 maxlength=50>
|
2011-07-08 20:39:57 +00:00
|
|
|
<small>
|
2011-06-09 21:16:30 +00:00
|
|
|
<input id=hostname_submit value=\"change\" type=submit>
|
2011-07-08 20:39:57 +00:00
|
|
|
</small>
|
2011-06-09 21:16:30 +00:00
|
|
|
<div id=hostname_output></div>
|
|
|
|
</td>
|
2011-06-14 11:48:55 +00:00
|
|
|
</form>
|
|
|
|
</tr>
|
|
|
|
"
|
|
|
|
|
|
|
|
puts "
|
|
|
|
<tr>
|
2011-07-01 22:56:53 +00:00
|
|
|
<form class=auto id=channel_group method=get action=$env(REQUEST_URI)>
|
2011-06-25 20:59:50 +00:00
|
|
|
<th class=key>Channel Group for EPG</th>
|
2011-06-14 11:48:55 +00:00
|
|
|
<td><select id=channel_group name=channel_group
|
2011-06-25 20:59:50 +00:00
|
|
|
class=\"text ui-widget-content ui-corner-all\"
|
2011-06-14 11:48:55 +00:00
|
|
|
value=[$settings channel_group]>
|
|
|
|
"
|
|
|
|
|
|
|
|
set i 0
|
|
|
|
puts "<option value=0>-- None --"
|
|
|
|
foreach grp [$settings channel_groups] {
|
|
|
|
incr i
|
|
|
|
puts -nonewline "<option value=$i"
|
|
|
|
if {$channel_group == $i} {
|
|
|
|
puts -nonewline " selected"
|
|
|
|
}
|
|
|
|
puts ">$grp"
|
|
|
|
}
|
|
|
|
|
|
|
|
puts "
|
|
|
|
</select>
|
2011-07-08 20:39:57 +00:00
|
|
|
<small>
|
2011-06-25 20:59:50 +00:00
|
|
|
<input name=channel_group value=\"set\" type=submit>
|
2011-07-08 20:39:57 +00:00
|
|
|
</small>
|
2011-06-14 11:48:55 +00:00
|
|
|
<div id=channel_group_output></div>
|
|
|
|
</td>
|
|
|
|
</form>
|
2011-06-09 21:16:30 +00:00
|
|
|
</tr>
|
2011-06-14 11:48:55 +00:00
|
|
|
"
|
|
|
|
|
|
|
|
puts "
|
2011-06-09 21:16:30 +00:00
|
|
|
</table>
|
2011-06-25 20:59:50 +00:00
|
|
|
</fieldset>
|
|
|
|
<br><br>
|
|
|
|
<fieldset style=\"display: inline\">
|
|
|
|
<legend> Email Settings </legend>
|
|
|
|
<table>
|
|
|
|
"
|
|
|
|
|
|
|
|
puts "
|
|
|
|
<tr>
|
2011-07-01 22:56:53 +00:00
|
|
|
<form class=auto id=smtp_server method=get action=$env(REQUEST_URI)>
|
2011-06-25 20:59:50 +00:00
|
|
|
<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>
|
2011-07-08 20:39:57 +00:00
|
|
|
<small>
|
2011-06-25 20:59:50 +00:00
|
|
|
<input id=smtp_server_submit value=\"change\" type=submit>
|
2011-07-08 20:39:57 +00:00
|
|
|
</small>
|
2011-06-25 20:59:50 +00:00
|
|
|
<div id=smtp_server_output></div>
|
|
|
|
</td>
|
2011-06-09 21:16:30 +00:00
|
|
|
</form>
|
2011-06-25 20:59:50 +00:00
|
|
|
</tr>
|
2011-06-09 21:16:30 +00:00
|
|
|
"
|
2011-06-25 20:59:50 +00:00
|
|
|
|
2011-07-11 23:29:21 +00:00
|
|
|
puts "
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
<br><br>
|
|
|
|
<fieldset style=\"display: inline\">
|
|
|
|
<legend> Advanced Settings </legend>
|
|
|
|
<table>
|
|
|
|
"
|
|
|
|
|
|
|
|
puts "
|
|
|
|
<tr>
|
|
|
|
<form class=auto id=pkgdev method=get action=$env(REQUEST_URI)>
|
|
|
|
<th class=key>Show development and advanced packages?</th>
|
|
|
|
<td><input name=pkgdevoff value=0 type=hidden>
|
|
|
|
<input name=pkgdev id=pkgdev value=1 type=checkbox
|
|
|
|
"
|
|
|
|
if {$pkgdev} { puts " checked" }
|
|
|
|
puts {
|
|
|
|
>
|
|
|
|
<small>
|
|
|
|
<input id=pkgdev_submit value="save" type=submit>
|
|
|
|
</small>
|
|
|
|
<div id=pkgdev_output></div>
|
|
|
|
</td>
|
|
|
|
</form>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
|
2011-06-25 20:59:50 +00:00
|
|
|
puts "
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
"
|
|
|
|
|
2011-07-01 22:56:53 +00:00
|
|
|
eval_plugins settings
|
|
|
|
|
|
|
|
footer
|
2011-06-09 21:16:30 +00:00
|
|
|
|