<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
<packagegui>
        <copyright>
        <![CDATA[
/* $Id$ */
/* ========================================================================== */
/*
    tinydns_domains.xml
    part of pfSense (http://www.pfSense.com)
    Copyright (C) 2008-2011 Scott Ullrich
    All rights reserved.
                                                                              */
/* ========================================================================== */
/*
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

     1. Redistributions of source code must retain the above copyright notice,
        this list of conditions and the following disclaimer.

     2. Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
                                                                              */
/* ========================================================================== */
        ]]>
	</copyright>
    <description>Describe your package here</description>
    <requirements>Describe your package requirements here</requirements>
    <faq>Currently there are no FAQ items provided.</faq>
	<name>tinydnsdomains</name>
	<version>none</version>
	<title>TinyDNS: Domains</title>
	<include_file>/usr/local/pkg/tinydns.inc</include_file>
	<tabs>
		<tab>
			<text>Settings</text>
			<url>/pkg_edit.php?xml=tinydns.xml&amp;id=0</url>
		</tab>
		<tab>
			<text>Add/Edit Record</text>
			<url>/tinydns_filter.php</url>
			<active/>
		</tab>
		<tab>
			<text>Failover Status</text>
			<url>/tinydns_status.php</url>
		</tab>
		<tab>
			<text>Logs</text>
			<url>/tinydns_view_logs.php</url>
		</tab>
		<tab>
			<text>Sync</text>
			<url>/pkg_edit.php?xml=tinydns_sync.xml&amp;id=0</url>
		</tab>
		<tab>
			<text>New domain wizard</text>
			<url>/wizard.php?xml=new_zone_wizard.xml</url>
		</tab>			
	</tabs>
	<configpath>installedpackages->package->tinydnsdomains</configpath>
	<adddeleteeditpagefields>
		<columnitem>
			<fielddescr>Record Name</fielddescr>
			<fieldname>hostname</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>Record Type</fielddescr>
			<fieldname>recordtype</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>Prio</fielddescr>
			<fieldname>dist</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>rDNS</fielddescr>
			<fieldname>rdns</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>Record Data</fielddescr>
			<fieldname>ipaddress</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>TTL</fielddescr>
			<fieldname>ttl</fieldname>
		</columnitem>
		<columnitem>
			<fielddescr>monitoring</fielddescr>
			<fieldname>monitorip</fieldname>
		</columnitem>
	</adddeleteeditpagefields>
	<fields>
		<field>
			<type>sorting</type>
			<include_filtering_inputbox/>
			<display_maximum_rows>50</display_maximum_rows>
			<sortablefields>
				<item>
					<name>Domain</name>
					<fieldname>hostname</fieldname>
					<regex>
						<![CDATA[
							/^.*\.%FILTERTEXT%.*$/i
						]]>
					</regex>
				</item>
				<item>
					<name>Hostname</name>
					<fieldname>hostname</fieldname>
					<regex>
						<![CDATA[
							/^%FILTERTEXT%.*$/i
						]]>
					</regex>
				</item>
				<item>
					<name>Record type</name>
					<fieldname>recordtype</fieldname>
					<regex>
						<![CDATA[
							/^%FILTERTEXT%$/i
						]]>
					</regex>
				</item>
				<item>
					<name>TTL</name>
					<fieldname>ttl</fieldname>
					<regex>
						<![CDATA[
							/^%FILTERTEXT%$/i
						]]>
					</regex>
				</item>				
				<item>
					<name>Record data</name>
					<fieldname>ipaddress</fieldname>
					<regex>
						<![CDATA[
							/%FILTERTEXT%/i
						]]>
					</regex>
				</item>				
			</sortablefields>
		</field>
		<field>
			<type>listtopic</type>
			<name>General</name>
			<fieldname>temp</fieldname>			
		</field>		
		<field>
			<fielddescr>Record Name (Hostname or FQDN.  E.g. www.exampledomain.com)</fielddescr>
			<fieldname>hostname</fieldname>
			<description>The DNS server will supply Records for the Fully Qualified Domain Name that is entered</description>
			<type>input</type>
			<size>35</size>
			<required/>
		</field>
		<field>
			<fielddescr>Record Type</fielddescr>
			<fieldname>recordtype</fieldname>
			<description>Supported Record types: A, AAAA, PTR, MX, NS, SOA, SRV, TXT, CNAME, and raw  ("raw" allows direct entry of a complete TinyDNS record in the FQDN field below)</description>
			<type>select</type>
			<size>1</size>
			<required/>
			<options>
			    <option><name></name><value></value></option>
			    <option><name>A</name><value>A</value></option>
			    <option><name>AAAA</name><value>AAAA</value></option>
			    <option><name>MX</name><value>MX</value></option>
			    <option><name>NS</name><value>NS</value></option>
			    <option><name>SOA</name><value>SOA</value></option>
			    <option><name>SRV</name><value>SRV</value></option>
			    <option><name>PTR</name><value>PTR</value></option>
			    <option><name>CNAME</name><value>CNAME</value></option>
			    <option><name>TXT</name><value>TXT</value></option>
			    <option><name>raw</name><value>raw</value></option>
			</options>
		</field>
		<field>
			<fielddescr>Record Data (FQDN, IP Address, or "raw" TinyDNS record)</fielddescr>
			<fieldname>ipaddress</fieldname>
			<description>Enter the record data here. Use IP Address for (A) and (PTR) records. Use FQDN or Hostname for (SOA) and (CNAME) Records. (MX) records can be an IP, FQDN, or both separated by a colon, e.g. 1.2.3.4, mail.example.com, or 1.2.3.4:mail.example.com. (NS) Records use colon-separated IP and FQDN, e.g. 1.2.3.4:example.com.  IPV6 (AAAA) records should be formatted in 128 bit format.  Example (AAAA) Record: 0000:0000:0000:0000:0000:0000:0000:0000</description>
			<type>input</type>
			<size>80</size>
			<required/>
		</field>
		<field>
			<fielddescr>DNS record time to live (in seconds)</fielddescr>
			<fieldname>ttl</fieldname>
			<type>input</type>
			<size>35</size>
		</field>
		<field>
			<fielddescr>(MX) priority (only used for MX records)</fielddescr>
			<fieldname>dist</fieldname>
			<type>input</type>
			<size>4</size>
		</field>				
		<field>
			<fielddescr>(SRV) Server record port</fielddescr>
			<fieldname>srv_port</fieldname>
			<type>input</type>
			<size>35</size>
		</field>
		<field>
			<fielddescr>(SRV) Server record priority (optional)</fielddescr>
			<fieldname>srv_priority</fieldname>
			<type>input</type>
			<size>35</size>
		</field>
		<field>
			<fielddescr>(SRV) Server record weight (optional)</fielddescr>
			<fieldname>srv_weight</fieldname>
			<type>input</type>
			<size>35</size>
		</field>
		<field>
			<fielddescr>(SRV) Server record timestamp (optional)</fielddescr>
			<fieldname>srv_timestamp</fieldname>
			<type>input</type>
			<size>35</size>
		</field>
		<field>
			<type>listtopic</type>
			<name>Reverse lookup</name>
			<fieldname>temp</fieldname>						
		</field>
		<field>
		 	<fielddescr>Automatic PTR entry</fielddescr>
			<fieldname>rdns</fieldname>
			<description>Create a reverse DNS (PTR) entry for this (A) Record?</description>
			<type>checkbox</type>
		</field>		
		<field>
			<type>listtopic</type>
			<name>Failover</name>
			<fieldname>temp</fieldname>						
		</field>
		<field>
			<fielddescr>Monitor IP</fielddescr>
			<description>IP to ping to determine host availability</description>
			<fieldname>monitorip</fieldname>
			<type>input</type>
			<size>35</size>
		</field>
		<field>
			<fielddescr>Interface</fielddescr>
			<description>interface to ping via</description>
			<fieldname>interface</fieldname>
			<type>interfaces_selection</type>
			<size>1</size>
		</field>
		<field>
			<fielddescr>Failover hold time</fielddescr>
			<description>Time in minutes before DNS switches to backup host</description>
			<fieldname>threshhold</fieldname>
			<type>input</type>
			<size>35</size>
		</field>
		<field>
			<fielddescr>Failover Records</fielddescr>
			<fieldname>none</fieldname>
		    <type>rowhelper</type>
		    <rowhelper>
				<rowhelperfield>
				    <fielddescr>Failover IP</fielddescr>
				    <fieldname>failoverip</fieldname>
				    <description>Failover IP when host is not responding to ICMP/PING traffic</description>
				    <type>input</type>
				    <size>25</size>
				</rowhelperfield>
				<rowhelperfield>
				    <fielddescr>Load balance</fielddescr>
				    <fieldname>loadbalance</fieldname>
				    <description>Adds this member to active group when host is alive.</description>
				    <type>checkbox</type>
				</rowhelperfield>
				<rowhelperfield>
				    <fielddescr>Ping threshold</fielddescr>
				    <fieldname>pingthreshold</fieldname>
				    <description>When the MS time is surpassed, item will failover to next host</description>
				    <type>input</type>
				    <size>7</size>
				</rowhelperfield>
				<rowhelperfield>
				    <fielddescr>Wan ping threshold</fielddescr>
				    <fieldname>wanpingthreshold</fieldname>
				    <description>When the WAN MS ping time is surpassed, item will failover to next host</description>
				    <type>input</type>
				    <size>7</size>
				</rowhelperfield>
				<rowhelperfield>
				    <fielddescr>IP to ping to ensure service is up</fielddescr>
				    <fieldname>monitorip</fieldname>
				    <description>When the WAN MS ping time is surpassed, item will failover to next host</description>
				    <type>input</type>
				    <size>15</size>
				</rowhelperfield>
				<rowhelperfield>
				    <fielddescr>interface</fielddescr>
				    <fieldname>interface</fieldname>
				    <description>interface to ping via</description>
				    <type>interfaces_selection</type>
				    <size>1</size>
				</rowhelperfield>
		    </rowhelper>
		</field>
	</fields>
	<custom_delete_php_command>
		$dnssync = true;		
		tinydns_create_zone_file();
		tinydns_setup_ping_items();
		tinydns_sync_on_changes();
	</custom_delete_php_command>
	<custom_php_validation_command>
		if(function_exists("tinydns_cleanup_addedit_form_record"))
			tinydns_cleanup_addedit_form_record();
		else {
			require_once("/usr/local/pkg/tinydns.inc");
		}
	</custom_php_validation_command>
	<custom_add_php_command>
	</custom_add_php_command>
	<custom_php_resync_config_command>
		log_error("Begin tinydns resync");
		tinydns_create_zone_file();
		log_error("Zone file done.");
		tinydns_setup_ping_items();
		log_error("Ping items done.");
		tinydns_sync_on_changes();
		log_error("Sync items done.");
	</custom_php_resync_config_command>
	<custom_php_command_before_form>	
		unset($_POST['temp']);
	</custom_php_command_before_form>
</packagegui>