
######################################################################
# Auto-Processing Settings

puts "
	<h4>Auto-Processing Settings</h4>
	<div><fieldset style=\"display: inline\">
		<legend>
			Auto-Processing Settings
		</legend>
	<table>
"

puts -nonewline "
	<tr>
	<form class=auto id=autolog method=get action=$env(SCRIPT_NAME)>
		<th class=key>Auto-processing log level</th>
		<td><select id=autolog name=autolog
		    class=\"text ui-widget-content ui-corner-all\">
"
puts "<option value=0"
if {$autolog == 0} { puts " selected" }
puts ">Actions and errors only\n"
puts "<option value=1"
if {$autolog == 1} { puts " selected" }
puts ">Actions, errors and scan information\n"
puts "<option value=2"
if {$autolog == 2} { puts " selected" }
puts ">Debugging information\n"
puts "
		</select>
		<small>
		<input name=autolog value=\"set\" type=submit>
		</small>
		<div id=autolog_output></div>
		</td>
	</form>
	</tr>
"

setting_number autofreq "How often should auto-processing run (in minutes)?" \
    $autofreq 5 60

setting_toggle "Suspend automatic processing whilst recording?" \
    "noautorec" $noautorec
setting_toggle "Suspend automatic processing if will record soon?" \
    "noautorecimm" $noautorecimm

setting_number autorecperiod "...how many minutes is soon?" $autorecperiod \
    1 $(60 * 24)

puts -nonewline "
	<tr>
	<form class=auto id=noautohours method=get action=$env(SCRIPT_NAME)>
		<th class=key>Choose hours during which
		    automatic processing runs:
		</th>
		<td>
		<input class=hidden name=\"noautohours\[]\" value=dummy>
		<select name=\"noautohours\[]\" id=s_noautohours
		    multiple size=8
		    class=\"text ui-widget-content ui-corner-all\">
"
loop h 0 24 {
	puts -nonewline "<option value=$h"
	if {$h in $noautohours} { puts -nonewline " selected" }
	puts ">[format "%02d:00 - %02d:59" $h $h]</option>"
}
puts "
		</select>
		<small>
		<input name=noautohours value=\"set\" type=submit>
		</small>
		<div id=noautohours_output></div>
		</td>
	</form>
	</tr>
"

setting_number autokeep \
    "How many days should completed entries stay in the queue?" $autokeep \
    1 365

setting_toggle "Show queue icon in menu/toolbar?" "toolbarqueue" $toolbarqueue
if {[system pkginst undelete]} {
	setting_toggle "Create backup files in dustbin for decrypt and shrink?" autoskipbin \
	    $(!$autoskipbin) 1
}

puts {
</table></fieldset></div>

<script type=text/javascript>
$('#s_noautohours').multiSelect({
	selectableHeader: '<div class=odd>Enable during</div>',
	selectionHeader: '<div class=odd>Disable during</div>'
});
</script>
}

