Add custom input and cleanup supportedOptions() method
This commit is contained in:
Ad Schellevis 2018-11-19 21:58:14 +01:00
parent 94f49e3627
commit 0b028c1799
5 changed files with 20 additions and 17 deletions

View File

@ -45,21 +45,10 @@
<help>Verify the server certificate Common Name (CN) when the client connects</help>
</field>
<field>
<id>openvpn_export.testxx1</id>
<label>TestXX1</label>
<id>openvpn_export.plain_config</id>
<label>Custom config</label>
<style>export_option</style>
<type>text</type>
</field>
<field>
<id>openvpn_export.testxx2</id>
<label>TestXX2</label>
<style>export_option</style>
<type>text</type>
</field>
<field>
<id>openvpn_export.testxx3</id>
<label>TestXX3</label>
<style>export_option</style>
<type>text</type>
<type>textbox</type>
<help>Custom configuration, which will be returned in the output file without modifications</help>
</field>
</form>

View File

@ -37,6 +37,6 @@ class ArchiveOpenVPN extends PlainOpenVPN
public function supportedOptions()
{
return array("testxx2");
return array("plain_config");
}
}

View File

@ -37,7 +37,7 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
public function supportedOptions()
{
return array("testxx1", "testxx3");
return array("plain_config");
}
/**
@ -107,6 +107,14 @@ class PlainOpenVPN extends BaseExporter implements IExportProvider
$conf[] = "auth-user-pass";
}
if (!empty($this->config['plain_config'])) {
foreach (preg_split('/\r\n|\r|\n/', $this->config['plain_config']) as $line) {
if (!empty($line)) {
$conf[] = $line;
}
}
}
return $conf;
}

View File

@ -26,6 +26,7 @@
<default>1</default>
<Required>Y</Required>
</validate_server_cn>
<plain_config type="TextField"/>
</server>
</servers>
</items>

View File

@ -29,6 +29,11 @@
margin-top: 5px;
margin-bottom: 5px;
}
textarea {
white-space: nowrap;
overflow: auto;
}
</style>
<script>