{% extends "base.html" %}

{% block pagebanner %}
  <div class="header">
      <h2>dns info for {{ host.hostname }}</h2>
  </div>
  <br/>
{% endblock %}

{% block sidebar %}
{% include "navbar.tmpl" %}
<ul class="sidebar">
   <li><a href="/hostbase/{{ host.id }}/" class="sidebar">host info</a></li>
   <li><a href="/hostbase/{{ host.id }}/edit/" class="sidebar">edit host info</a></li>
   <li><a href="/hostbase/{{ host.id }}/dns/" class="sidebar">see dns info</a></li>
   <li><a href="/hostbase/{{ host.id }}/logs/" class="sidebar">change logs</a></li>
</ul>
{% include "logout.tmpl" %}
{% endblock %}

{% block content %}

<form name="dns" action="?sub=true" method="post">
<input type="hidden" name="host" value="{{ host.id }}">
<table border="0" width="100%">
   <colgroup>
   <col width="150">
   <col width="*">
   {% for interface in interfaces %}
       <tr><td><br></td></tr>
       <tr> <td> <b>interface type</b> </td>
       <td> {{ interface.hdwr_type }} </td></tr>
       <tr> <td> <b>mac_addr</b> </td>
       <td> {{ interface.mac_addr }} </td></tr>
       <tr><td><hr></td><td><hr></td></tr>
       {% for ip in info %}
       {% ifequal ip.0.interface interface %}
           <tr> <td> <b>ip_addr</b></td>
	   <td>{{ ip.0.ip_addr }}</td></tr>
           {% for name in ip.1 %}
	       <tr> <td><b>name(dns)</b></td>
	       <td> <input name="name{{ name.id }}" type="text" value="{{ name.name }}">
	       <select name="dns_view{{ name.id }}">
	       {% for choice in DNS_CHOICES %}
	       {% ifequal name.dns_view choice.0 %}
	       <option value="{{ choice.0 }}" selected="selected">{{ choice.1 }}
	       {% else %}
	       <option value="{{ choice.0 }}">{{ choice.1 }}
	       {% endifequal %}
	       {% endfor %}
	       </select>
	       <a style="font-size:75%" href="/hostbase/{{ host.id }}/name/{{ name.id }}/confirm">remove</a></td></tr>
	       {% for cname in cnames %}
	       {% ifequal name cname.name %}
	       <tr> <td> <b>cname</b></td>
	       <td> <input name="cname{{ cname.id }}" type="text" value="{{ cname.cname }}">
	       <a style="font-size:75%" href="/hostbase/{{ host.id }}/cname/{{ cname.id }}/confirm">remove</a></td></tr>
	       {% endifequal %}
	       {% endfor %}
	       <tr> <td> <b>cname</b></td>
	       <td> <input name="{{ name.id }}cname" type="text"></td></tr>
	       {% for mx in mxs %}
	       {% ifequal mx.0 name.id %}
	       {% for record in mx.1 %}
	       <tr> <td> <b>mx</b></td>
	       <td> <input name="priority{{ record.id }}" type="text" size="6" value="{{ record.priority }}">
	       <input name="mx{{ record.id }}" type="text" value="{{ record.mx }}">
	       <a style="font-size:75%" href="/hostbase/{{ host.id }}/mx/{{ record.id }}/{{ name.id }}/confirm">remove</a></td></tr>
	       {% endfor %}
	       {% endifequal %}
	       {% endfor %}
	       <tr> <td> <b>mx</b></td>
	       <td> <input name="{{ name.id }}priority" type="text" size="6">
	       <input name="{{ name.id }}mx" type="text"></td></tr>
	   {% endfor %}
	   <tr> <td> <b>name</b></td>
	   <td> <input name="{{ ip.0.ip_addr }}name" type="text">
	   <select name="{{ ip.0.ip_addr }}dns_view">
	   {% for choice in DNS_CHOICES %}
	   <option value="{{ choice.0 }}">{{ choice.1 }}
	   {% endfor %}
	   </select></td></tr>
	   <tr> <td> <b>cname</b></td>
	   <td> <input name="{{ ip.0.ip_addr }}cname" type="text"></td></tr>
	   <tr> <td> <b>mx</b></td>
	   <td> <input name="{{ ip.0.ip_addr }}priority" type="text" size="6">
	   <input name="{{ ip.0.ip_addr }}mx" type="text"></td></tr>
	   <tr><td></td></tr>
	   <tr><td><hr></td><td><hr></td></tr>
       {% endifequal %}
       {% endfor %}
   {% endfor %}
   </table>

<p><input type="submit" value="Submit">
</form>

{% endblock %}
