<%include file="/pageheader.html"/>
<%!
from kaithem.src import config,geolocation,settings, settings_overrides
import yaml,os


location = geolocation.getLocation('default')

%>
<h2>Options</h2>


<title>Options</title>
<div class="window paper">
<a href="/settings/save">Flush Logs</a><br>

</div>

<h2>New Config Keys</h2>
<p>These are set through entries in modules</p>
<section class="window paper">

<dl>
    %for i in settings_overrides.list_keys():
    <dt><b>${i|h}</b></dt>
    <dd>${settings_overrides.get_val(i)|h}</dd>
    %endfor
</dl>
</section>



<h2>Server Location</h2>
<section class="window paper">
<details class="help"><summary><i class="mdi mdi-help-circle-outline"></i></summary>
This is mostly used for astronomical calculations. All are optional.
Get Location uses <a href="http://ip-api.com/">ip-api.com</a>
</details>
<form method="POST" action="/settings/changesettingstarget">
<table border=1>
<tr>

<td>Country Code</td>
    <td><input name="country" value="${location['countryCode']}"></td>
</tr>

<tr>
    <td>Region</td>
    <td><input name="region" value="${location['regionName']}"></td>
</tr>

<tr>
    <td>Timezone</td>
    <td><input name="timezone" value="${location['timezone']}"></td>
</tr>


<tr>
    <td>City</td>
    <td><input name="city" value="${location['city']}"></td>
</tr>

<tr>
<td>Lattitude</td>
    <td><input name="lat" value="${location['lat']}"></td>
</tr>

<tr>
<td>Longitude</td>
    <td><input name="lon" value="${location['lon']}"></td>
</tr>
</table>
<input type="submit" >
</form>
<form method="post" action="/settings/ip_geolocate">
<button type="submit">Get Location now</button>
</form>
</section>


<h2>Current Configuration Settings</h2>
<div class="window paper">
<details class="help"><summary><i class="mdi mdi-help-circle-outline"></i></summary>
Because some of these settings could cause instabilty if set incorrectly, they can currently only be
changed by actually changing the configuration file and resetting the server.</details>

<details>
    <summary>Open</summary>

        <pre>
        ${yaml.dump(config.config,width=120,indent=4,default_flow_style=False)|h}
        </pre>
</details>

</div>
<%include file="/pagefooter.html"/>
