diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 285d4f7111809..5db9fe8fe5290 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -1021,14 +1021,6 @@ MountConfigListView.prototype = _.extend({ newElement = $(''); } - if (placeholder.defaultValue) { - if (placeholder.type === MountConfigListView.ParameterTypes.BOOLEAN) { - newElement.find('input').prop('checked', placeholder.defaultValue); - } else { - newElement.val(placeholder.defaultValue); - } - } - if (placeholder.tooltip) { newElement.attr('title', placeholder.tooltip); } diff --git a/apps/files_external/lib/Lib/Backend/AmazonS3.php b/apps/files_external/lib/Lib/Backend/AmazonS3.php index 4625880f4141f..d85ac3639dacf 100644 --- a/apps/files_external/lib/Lib/Backend/AmazonS3.php +++ b/apps/files_external/lib/Lib/Backend/AmazonS3.php @@ -47,8 +47,7 @@ public function __construct(IL10N $l, AccessKey $legacyAuth) { (new DefinitionParameter('region', $l->t('Region'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), (new DefinitionParameter('use_ssl', $l->t('Enable SSL'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN) - ->setDefaultValue(true), + ->setType(DefinitionParameter::VALUE_BOOLEAN), (new DefinitionParameter('use_path_style', $l->t('Enable Path Style'))) ->setType(DefinitionParameter::VALUE_BOOLEAN), (new DefinitionParameter('legacy_auth', $l->t('Legacy (v2) authentication'))) diff --git a/apps/files_external/lib/Lib/Backend/DAV.php b/apps/files_external/lib/Lib/Backend/DAV.php index 71c97e639ff8c..cf16677334d59 100644 --- a/apps/files_external/lib/Lib/Backend/DAV.php +++ b/apps/files_external/lib/Lib/Backend/DAV.php @@ -43,8 +43,7 @@ public function __construct(IL10N $l, Password $legacyAuth) { (new DefinitionParameter('root', $l->t('Remote subfolder'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), (new DefinitionParameter('secure', $l->t('Secure https://'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN) - ->setDefaultValue(true), + ->setType(DefinitionParameter::VALUE_BOOLEAN), ]) ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) ->setLegacyAuthMechanism($legacyAuth) diff --git a/apps/files_external/lib/Lib/Backend/FTP.php b/apps/files_external/lib/Lib/Backend/FTP.php index d7c6e3bebd69f..587f3e68535e7 100644 --- a/apps/files_external/lib/Lib/Backend/FTP.php +++ b/apps/files_external/lib/Lib/Backend/FTP.php @@ -43,8 +43,7 @@ public function __construct(IL10N $l, Password $legacyAuth) { (new DefinitionParameter('root', $l->t('Remote subfolder'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), (new DefinitionParameter('secure', $l->t('Secure ftps://'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN) - ->setDefaultValue(true), + ->setType(DefinitionParameter::VALUE_BOOLEAN), ]) ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) ->setLegacyAuthMechanism($legacyAuth) diff --git a/apps/files_external/lib/Lib/Backend/OwnCloud.php b/apps/files_external/lib/Lib/Backend/OwnCloud.php index 97297b6a977f7..8b33b98b5c49d 100644 --- a/apps/files_external/lib/Lib/Backend/OwnCloud.php +++ b/apps/files_external/lib/Lib/Backend/OwnCloud.php @@ -41,8 +41,7 @@ public function __construct(IL10N $l, Password $legacyAuth) { (new DefinitionParameter('root', $l->t('Remote subfolder'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), (new DefinitionParameter('secure', $l->t('Secure https://'))) - ->setType(DefinitionParameter::VALUE_BOOLEAN) - ->setDefaultValue(true), + ->setType(DefinitionParameter::VALUE_BOOLEAN), ]) ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) ->setLegacyAuthMechanism($legacyAuth) diff --git a/apps/files_external/lib/Lib/DefinitionParameter.php b/apps/files_external/lib/Lib/DefinitionParameter.php index 440750faca8ca..fbfbbfd4686a6 100644 --- a/apps/files_external/lib/Lib/DefinitionParameter.php +++ b/apps/files_external/lib/Lib/DefinitionParameter.php @@ -57,18 +57,13 @@ class DefinitionParameter implements \JsonSerializable { /** @var int flags, see self::FLAG_* constants */ private $flags = self::FLAG_NONE; - /** @var mixed */ - private $defaultValue; - /** - * @param string $name parameter name - * @param string $text parameter description - * @param mixed $defaultValue default value + * @param string $name + * @param string $text */ - public function __construct($name, $text, $defaultValue = null) { + public function __construct($name, $text) { $this->name = $name; $this->text = $text; - $this->defaultValue = $defaultValue; } /** @@ -105,22 +100,6 @@ public function setType($type) { return $this; } - /** - * @return mixed default value - */ - public function getDefaultValue() { - return $this->defaultValue; - } - - /** - * @param mixed $defaultValue default value - * @return self - */ - public function setDefaultValue($defaultValue) { - $this->defaultValue = $defaultValue; - return $this; - } - /** * @return string */ @@ -192,17 +171,12 @@ public function setTooltip(string $tooltip) { * @return string */ public function jsonSerialize() { - $result = [ + return [ 'value' => $this->getText(), 'flags' => $this->getFlags(), 'type' => $this->getType(), 'tooltip' => $this->getTooltip(), ]; - $defaultValue = $this->getDefaultValue(); - if ($defaultValue) { - $result['defaultValue'] = $defaultValue; - } - return $result; } public function isOptional() { diff --git a/apps/files_external/tests/DefinitionParameterTest.php b/apps/files_external/tests/DefinitionParameterTest.php index 04d5f6762c561..00df3e0aee143 100644 --- a/apps/files_external/tests/DefinitionParameterTest.php +++ b/apps/files_external/tests/DefinitionParameterTest.php @@ -36,18 +36,15 @@ public function testJsonSerialization() { ], $param->jsonSerialize()); $param->setType(Param::VALUE_BOOLEAN); - $param->setDefaultValue(true); $this->assertEquals([ 'value' => 'bar', 'flags' => 0, 'type' => Param::VALUE_BOOLEAN, 'tooltip' => '', - 'defaultValue' => true, ], $param->jsonSerialize()); $param->setType(Param::VALUE_PASSWORD); $param->setFlag(Param::FLAG_OPTIONAL); - $param->setDefaultValue(null); $this->assertEquals([ 'value' => 'bar', 'flags' => Param::FLAG_OPTIONAL,