Commit 067ffd68 authored by Ad Schellevis's avatar Ad Schellevis

cleanup js code in services_dyndns_edit.php for https://github.com/opnsense/core/issues/1005

parent 527566bc
...@@ -175,46 +175,26 @@ include("head.inc"); ...@@ -175,46 +175,26 @@ include("head.inc");
<body> <body>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ $( document ).ready(function() {
function _onTypeChange(type){ $("#type").change(function(){
switch(type) { $(".opt_field").hide();
case "custom": switch ($(this).val()) {
case "custom-v6": case "custom":
document.getElementById("_resulttr").style.display = ''; case "custom-v6":
document.getElementById("_urltr").style.display = ''; $(".type_custom").show();
document.getElementById("_requestiftr").style.display = ''; break;
document.getElementById("_curloptions").style.display = ''; case "route53":
document.getElementById("_hostnametr").style.display = ''; $(".type_route53").show();
document.getElementById("_mxtr").style.display = 'none'; break;
document.getElementById("_wildcardtr").style.display = 'none'; default:
document.getElementById("r53_zoneid").style.display='none'; $(".type_default").show();
document.getElementById("r53_ttl").style.display='none'; break;
break; }
case "route53": $(window).resize(); // force zebra re-stripe (opnsense_standard_table_form)
document.getElementById("_resulttr").style.display = 'none'; });
document.getElementById("_urltr").style.display = 'none'; $("#type").change();
document.getElementById("_requestiftr").style.display = 'none'; });
document.getElementById("_curloptions").style.display = 'none';
document.getElementById("_hostnametr").style.display = '';
document.getElementById("_mxtr").style.display = '';
document.getElementById("_wildcardtr").style.display = '';
document.getElementById("r53_zoneid").style.display='';
document.getElementById("r53_ttl").style.display='';
break;
default:
document.getElementById("_resulttr").style.display = 'none';
document.getElementById("_urltr").style.display = 'none';
document.getElementById("_requestiftr").style.display = 'none';
document.getElementById("_curloptions").style.display = 'none';
document.getElementById("_hostnametr").style.display = '';
document.getElementById("_mxtr").style.display = '';
document.getElementById("_wildcardtr").style.display = '';
document.getElementById("r53_zoneid").style.display='none';
document.getElementById("r53_ttl").style.display='none';
}
}
//]]>
</script> </script>
<section class="page-content-main"> <section class="page-content-main">
...@@ -242,7 +222,7 @@ include("head.inc"); ...@@ -242,7 +222,7 @@ include("head.inc");
<tr> <tr>
<td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Service type") ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Service type") ?></td>
<td> <td>
<select name="type" class="selectpicker" id="type" onchange="_onTypeChange(this.options[this.selectedIndex].value);"> <select name="type" class="selectpicker" id="type">
<?php <?php
foreach (services_dyndns_list() as $value => $type):?> foreach (services_dyndns_list() as $value => $type):?>
<option value="<?= $value ?>" <?= $value == $pconfig['type'] ? 'selected="selected"' : '' ?>> <option value="<?= $value ?>" <?= $value == $pconfig['type'] ? 'selected="selected"' : '' ?>>
...@@ -270,7 +250,7 @@ include("head.inc"); ...@@ -270,7 +250,7 @@ include("head.inc");
</select> </select>
</td> </td>
</tr> </tr>
<tr id="_requestiftr"> <tr class="opt_field type_custom">
<td><a id="help_for_requestif" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Interface to send update from") ?></td> <td><a id="help_for_requestif" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Interface to send update from") ?></td>
<td> <td>
<select name="requestif" class="selectpicker" id="requestif"> <select name="requestif" class="selectpicker" id="requestif">
...@@ -290,7 +270,7 @@ include("head.inc"); ...@@ -290,7 +270,7 @@ include("head.inc");
</div> </div>
</td> </td>
</tr> </tr>
<tr id="_hostnametr"> <tr>
<td><a id="help_for_host" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Hostname") ?></td> <td><a id="help_for_host" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Hostname") ?></td>
<td> <td>
<input name="host" type="text" id="host" value="<?= $pconfig['host'] ?>" /> <input name="host" type="text" id="host" value="<?= $pconfig['host'] ?>" />
...@@ -300,7 +280,7 @@ include("head.inc"); ...@@ -300,7 +280,7 @@ include("head.inc");
</div> </div>
</td> </td>
</tr> </tr>
<tr id="_mxtr"> <tr class="opt_field type_default type_route53">
<td><a id="help_for_mx" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("MX") ?></td> <td><a id="help_for_mx" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("MX") ?></td>
<td> <td>
<input name="mx" type="text" id="mx" value="<?= $pconfig['mx'] ?>" /> <input name="mx" type="text" id="mx" value="<?= $pconfig['mx'] ?>" />
...@@ -311,21 +291,21 @@ include("head.inc"); ...@@ -311,21 +291,21 @@ include("head.inc");
</div> </div>
</td> </td>
</tr> </tr>
<tr id="_wildcardtr"> <tr class="opt_field type_default type_route53">
<td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Wildcards") ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Wildcards") ?></td>
<td> <td>
<input name="wildcard" type="checkbox" id="wildcard" value="yes" <?= empty($pconfig['wildcard']) ? '' : 'checked="checked"' ?> /> <input name="wildcard" type="checkbox" id="wildcard" value="yes" <?= empty($pconfig['wildcard']) ? '' : 'checked="checked"' ?> />
<strong><?= gettext("Enable Wildcard") ?></strong> <strong><?= gettext("Enable Wildcard") ?></strong>
</td> </td>
</tr> </tr>
<tr id="_verboselogtr"> <tr>
<td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Verbose logging") ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?= gettext("Verbose logging") ?></td>
<td> <td>
<input name="verboselog" type="checkbox" id="verboselog" value="yes" <?= empty($pconfig['verboselog']) ? '' : 'checked="checked"' ?> /> <input name="verboselog" type="checkbox" id="verboselog" value="yes" <?= empty($pconfig['verboselog']) ? '' : 'checked="checked"' ?> />
<strong><?= gettext("Enable verbose logging") ?></strong> <strong><?= gettext("Enable verbose logging") ?></strong>
</td> </td>
</tr> </tr>
<tr id="_curloptions"> <tr class="opt_field type_custom">
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext("CURL options"); ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext("CURL options"); ?></td>
<td> <td>
<input name="curl_ipresolve_v4" type="checkbox" id="curl_ipresolve_v4" value="yes" <?= empty($pconfig['curl_ipresolve_v4']) ? '' : 'checked="checked"' ?> /> <input name="curl_ipresolve_v4" type="checkbox" id="curl_ipresolve_v4" value="yes" <?= empty($pconfig['curl_ipresolve_v4']) ? '' : 'checked="checked"' ?> />
...@@ -334,7 +314,7 @@ include("head.inc"); ...@@ -334,7 +314,7 @@ include("head.inc");
<?= gettext("Verify SSL peer") ?> <?= gettext("Verify SSL peer") ?>
</td> </td>
</tr> </tr>
<tr id="_usernametr"> <tr>
<td><a id="help_for_username" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Username") ?></td> <td><a id="help_for_username" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Username") ?></td>
<td> <td>
<input name="username" type="text" id="username" value="<?= $pconfig['username'] ?>" /> <input name="username" type="text" id="username" value="<?= $pconfig['username'] ?>" />
...@@ -357,7 +337,7 @@ include("head.inc"); ...@@ -357,7 +337,7 @@ include("head.inc");
</div> </div>
</td> </td>
</tr> </tr>
<tr id="r53_zoneid" style="display:none"> <tr class="opt_field type_route53">
<td><a id="help_for_zoneid" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Zone ID") ?></td> <td><a id="help_for_zoneid" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Zone ID") ?></td>
<td> <td>
<input name="zoneid" type="text" id="zoneid" value="<?= $pconfig['zoneid'] ?>" /> <input name="zoneid" type="text" id="zoneid" value="<?= $pconfig['zoneid'] ?>" />
...@@ -366,7 +346,7 @@ include("head.inc"); ...@@ -366,7 +346,7 @@ include("head.inc");
</div> </div>
</td> </td>
</tr> </tr>
<tr id="_urltr"> <tr class="opt_field type_custom">
<td><a id="help_for_updateurl" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Update URL") ?></td> <td><a id="help_for_updateurl" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Update URL") ?></td>
<td> <td>
<input name="updateurl" type="text" id="updateurl" value="<?= $pconfig['updateurl'] ?>" /> <input name="updateurl" type="text" id="updateurl" value="<?= $pconfig['updateurl'] ?>" />
...@@ -377,7 +357,7 @@ include("head.inc"); ...@@ -377,7 +357,7 @@ include("head.inc");
</div> </div>
</td> </td>
</tr> </tr>
<tr id="_resulttr"> <tr class="opt_field type_custom">
<td><a id="help_for_resultmatch" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Result Match") ?></td> <td><a id="help_for_resultmatch" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext("Result Match") ?></td>
<td> <td>
<textarea name="resultmatch" class="formpre" id="resultmatch" cols="65" rows="7"><?= $pconfig['resultmatch'] ?></textarea> <textarea name="resultmatch" class="formpre" id="resultmatch" cols="65" rows="7"><?= $pconfig['resultmatch'] ?></textarea>
...@@ -394,7 +374,7 @@ include("head.inc"); ...@@ -394,7 +374,7 @@ include("head.inc");
</div> </div>
</td> </td>
</tr> </tr>
<tr id="r53_ttl" style="display:none"> <tr class="opt_field type_route53">
<td><a id="help_for_ttl" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("TTL");?></td> <td><a id="help_for_ttl" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("TTL");?></td>
<td> <td>
<input name="ttl" type="text" id="ttl" value="<?= $pconfig['ttl'] ?>" /> <input name="ttl" type="text" id="ttl" value="<?= $pconfig['ttl'] ?>" />
...@@ -438,9 +418,4 @@ include("head.inc"); ...@@ -438,9 +418,4 @@ include("head.inc");
</div> </div>
</div> </div>
</section> </section>
<script type="text/javascript">
//<![CDATA[
_onTypeChange("<?= $pconfig['type'] ?>");
//]]>
</script>
<?php include("foot.inc"); ?> <?php include("foot.inc"); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment