From a4ba0282e6cba7916e3955f2d44da9a902f80587 Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Thu, 10 Dec 2015 11:37:06 -0500 Subject: Fixed #5602 by dynamically updating hte help text based on the cert selected. --- src/usr/local/www/vpn_openvpn_server.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/usr/local/www/vpn_openvpn_server.php') diff --git a/src/usr/local/www/vpn_openvpn_server.php b/src/usr/local/www/vpn_openvpn_server.php index 746eac6..4a475b4 100644 --- a/src/usr/local/www/vpn_openvpn_server.php +++ b/src/usr/local/www/vpn_openvpn_server.php @@ -747,24 +747,29 @@ if($act=="new" || $act=="edit") : )); } - $certhelp = ""; + $certhelp = ''; if (count($a_cert)) { if (!empty(trim($pconfig['certref']))) { $thiscert = lookup_cert($pconfig['certref']); $purpose = cert_get_purpose($thiscert['crt'], true); if ($purpose['server'] != "Yes") { - $certhelp = gettext("Warning: The previously saved server was not created as an SSL Server certificate and may not work properly."); + $certhelp = '' . gettext("Warning: The selected server certificate was not created as an SSL Server certificate and may not work as expected") . ' '; } } } else { - $certhelp = sprintf('No Certificates defined. You may create one here: %s', 'System > Cert Manager'); + $certhelp = sprintf('%s%s%s$s', '', gettext('No Certificates defined. You may create one here: '), 'System > Cert Manager', ''); } + $cl = openvpn_build_cert_list(false, true); + + //Save the number of server certs for use at run-time + $servercerts = count($cl['server']); + $section->addInput(new Form_Select( 'certref', 'Server certificate', $pconfig['certref'], - openvpn_build_cert_list(false, true) + $cl['server'] + $cl['non-server'] ))->setHelp($certhelp); $section->addInput(new Form_Select( @@ -1569,6 +1574,17 @@ events.push(function(){ tuntap_change(); }); + // Certref + $('#certref').on('change', function() { + var errmsg = ""; + + if ($(this).find(":selected").index() >= "") { + var errmsg = '' + "" + ''; + } + + $('#certtype').html(errmsg); + }); + // ---------- Set initial page display state ---------------------------------------------------------------------- mode_change(); autokey_change(); -- cgit v1.1