    [% META title = 'Admin &raquo; Application Settings' -%]
<!-- BEGIN [% template.name %] -->
    <h2 align="center">Edit Application Settings</h2>

    [% # PROCESS dumper.tt dump = settings %]
    [% # PROCESS dumper.tt dump = sysadmin %]

	[% PROCESS site/form_validator.tt profile = 'settings' %]

    [% js_config_settings_dfv_js %]

    [% # PROCESS site/js/jquery.tt # already loaded in html_wrapper %]
	<script type="text/javascript" src="/js/jquery.textarea-expander.js"></script>

	[% INCLUDE admin/menu/balloontips.tt %]

	[% BLOCK Td %]
		<td class="content">
            <input type="text" name="[% param %]" id="[% param %]" size="[% size %]"
                value="[% settings.$param %]" [% site.html.onfocus %] /> [% notes %]
			[% site.html.invalid IF form_validator.error($param) %]
		</td>
	[% END %]

	<form method="post" action="[% app_url %]/config/settings/edit"
        [% js_config_settings_onsubmit %] name="config_settings"
          id="config_settings">

        <h4>1) Diagnostic service settings:</h4>
		<table class="indent">
			<tr>
				<td class="label">Service name:</td>
				[% INCLUDE Td param = 'service_name' size = 50; %]
			</tr>
			<tr>
				<td class="label">Service address:</td>
				<td class="content">
                    <textarea name="service_address" rows="2" cols="50"
						class="expand20-200">[% settings.service_address %]</textarea>
					[% site.html.invalid IF form_validator.error('service_address') %]
				</td>
			</tr>
			<tr>
				<td class="label">Service telephone:</td>
				[% INCLUDE Td param = 'service_telno' size = 50; %]
			</tr>
			<tr>
				<td class="label">
					<span rel="service_email" class="acronym">
						Service email address</span>:
				</td>
				[% INCLUDE Td param = 'service_email' size = 50; %]
			</tr>
			<!-- // sysadmin only now
			<tr>
				<td class="label">Service web address:</td>
				[% INCLUDE Td param = 'service_url' size = 50; %]
			</tr>
			-->
            <tr>
				<td class="label">Lab. name abbreviation:</td>
				[% INCLUDE Td param = 'lab_name_abbreviation' %]
			</tr>
			<tr>
				<td class="label">
					<span rel="org_prefix" class="acronym">Local prefix</span>:</td>
				[% INCLUDE Td param = 'local_prefix' %]
			</tr>
        </table>

        <h4>2) Application settings:</h4>
		<table class="indent">
			<tr>
				<td class="label">
					<span rel="app_name" class="acronym">
						Application name:</span>
				</td>
				[% INCLUDE Td param = 'application_name' size = 50; %]
			</tr>
			<tr>
				<td class="label">
                    <span rel="server_username" class="acronym">
                        Application server name</span>:
                </td>
				[% INCLUDE Td param = 'server_username' size = 10 %]
			</tr>
			<tr>
				<td class="label">Lab. number prefix:</td>
				[% INCLUDE Td param = 'lab_number_prefix' %]
			</tr>
			<tr>
				<td class="label">Auto-increment requests:</td>
				[% INCLUDE Td param = 'autoincrement_requests' %]
			</tr>
			<tr>
				<td class="label">Force report spell-check:</td>
				<td class="content">
					<select name="require_spell_check">
						[% FOREACH opt IN ['yes', 'no'] %]
						<option value="[% opt %]" [% 'selected' IF opt ==
								( c.query.param('require_spell_check')
								|| settings.require_spell_check ) %]>
							[% opt %]
						</option>
						[% END %]
					</select>
					[% site.html.invalid IF form_validator.error('require_spell_check') %]
				</td>
			</tr>
			<tr>
				<td class="label">
					<span rel="notes_display" class="acronym">
						Report display notes</span>:
				</td>
				<td class="content">
					<select name="report_display_notes">
						[% FOREACH opt IN ['yes', 'no'] %]
						<option value="[% opt %]" [% 'selected' IF opt ==
								( c.query.param('report_display_notes')
								|| settings.report_display_notes ) %]>
							[% opt %]
						</option>
						[% END %]
					</select>
					[% site.html.invalid IF form_validator.error('report_display_notes') %]
				</td>
			</tr>
			[% IF c.cfg('settings').have_label_printer %]
			<tr>
				<td class="label">Label printer address:</td>
				[% INCLUDE Td param = 'label_printer_addr' %]
			</tr>
			[% END %]
			<tr>
				<td class="label">Admin timeout:</td>
				[% INCLUDE Td param = 'admin_timeout' notes = '[seconds]' %]
			</tr>
			<tr>
				<td class="label">Default user timeout:</td>
				[% INCLUDE Td param = 'default_user_timeout' notes = '[seconds]' %]
			</tr>
			<tr>
				<td class="label">
                    <span rel="network_restriction" class="acronym">
                        Local network restriction
                    </span>:
                </td>
				[% INCLUDE Td param = 'local_network_restriction' notes = '[0 or 1]' %]
			</tr>
			<tr>
				<td class="label">
                    <span rel="display_all_cases" class="acronym">
                        Display all cases at login
                    </span>:
                </td>
				[% INCLUDE Td param = 'login_display_all_cases' notes = '[0 or 1]' %]
			</tr>
			<tr>
				<td class="label">
                    <span rel="request_audit" class="acronym">
                        Have request audit</span>:
                </td>
				[% INCLUDE Td param = 'have_request_audit' notes = '[0 or 1]' %]
			</tr>

			<tr>
				<td class="label">
                    <span rel="specimen_filter" class="acronym">
                        Use specimen filter</span>:
                </td>
				[% INCLUDE Td param = 'use_specimen_filter' notes = '[0 or 1]' %]
			</tr>
			<tr>
				<td class="label">
                    <span rel="clinical_trial_filter" class="acronym">
                        Use clinical trial filter</span>:
                </td>
				[% INCLUDE Td param = 'use_clinical_trial_filter' notes = '[0 or 1]' %]
			</tr>

			<tr>
				<td class="label">
                    <span rel="search_hits" class="acronym">
						Search hits per page</span>:
                </td>
				[% INCLUDE Td param = 'entries_per_page' %]
			</tr>
			<tr>
				<td class="label">Max. print run size:</td>
				[% INCLUDE Td param = 'print_run_max' notes = '[records per run]' %]
			</tr>
			<tr>
				<td class="label">
					<span rel="min_length" class="acronym">
						AJAX min. char. length</span>:
				</td>
				[% INCLUDE Td param = 'min_char_length' %]
			</tr>
			<tr>
				<td class="label">
					<span rel="unreported_duration" class="acronym">Unreported requests</span>:
				[% INCLUDE Td param = 'unreported_duration' notes = '[days]' %]
			</tr>
			<tr>
				<td class="label">Max. request number length:</td>
				[% INCLUDE Td param = 'max_request_number_length' notes = '[digits]' %]
			</tr>
        </table>

        <h4>3) E-mail settings:</h4>
		<table class="indent">
			<tr>
				<td class="label">
					<span rel="smtp" class="acronym">SMTP server address</span>:
				</td>
				[% INCLUDE Td param = 'smtp' %]
			</tr>
			<tr>
				<td class="label">SMTP username:</td>
				[% INCLUDE Td param = 'smtp_user' notes = '[optional]' %]
			</tr>
			<tr>
				<td class="label">SMTP password:</td>
				[% INCLUDE Td param = 'smtp_pwd' notes = '[optional]' %]
			</tr>
			<tr>
				<td class="label">Admin email address:</td>
				[% INCLUDE Td param = 'admin_contact' size = 40; %]
			</tr>
			<tr>
				<td class="label">
					<span rel="domains" class="acronym">Valid recipient domains</span>:
				</td>
				[% INCLUDE Td param = 'valid_recipient_domains' size = 40 %]
			</tr>
         </table>

      [% IF cfg.item('_centre') == cfg.sysadmin_centre %]
        <h4>4) Sysadmin settings:</h4>

		<table class="indent">
            [% FOREACH entry IN sysadmin; # PROCESS dumper.tt dump = entry;
                name = entry.key;
                value = entry.value;
            %]
			<tr>
				<td class="label">
                    [% name.replace('_', ' ' ) %]:
                </td>
                <td class="content">
                    <input type="text" name="[% name %]" id="[% name %]"
                      size="40" value="[% value %]" [% site.html.onfocus %] />
                      [% site.html.invalid IF form_validator.error(name) %]
                </td>
			</tr>
        [% END %]
<!-- // edit() function not ready
            <tr>
                <th colspan="2">Add new param:</th>
            </tr>
            <tr>
                <td class="content">
                    <input type="text" name="new_param_name" size="40"
                           [% site.html.onfocus %] />
                </td>
                <td class="content">
                    <input type="text" name="new_param_value" size="40"
                        [% site.html.onfocus %] />
                </td>
            </tr>
-->
        </table>
      [% END %]
        <p class="indent">[% site.html.submit %]</p>
    </form>
<!-- END [% template.name %] -->
