aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2014-03-28 10:02:28 +0000
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2014-03-28 10:02:28 +0000
commite806b6d9a0cfff46e1859868f71b150024e93e32 (patch)
tree1997b78ecd972e5bf8be45acd9bb505d4ab4712b /apps
parent04364533534456d23d9a1deb0e963370f6f95424 (diff)
parent690c31ec20cc15129576fe64140d8733f9daf640 (diff)
downloadnextcloud-server-e806b6d9a0cfff46e1859868f71b150024e93e32.tar.gz
nextcloud-server-e806b6d9a0cfff46e1859868f71b150024e93e32.zip
Merge pull request #7842 from Xenopathic/files_external_config_optional
Enable the use of 'optional' on password fields for mount configuration
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/js/settings.js19
-rw-r--r--apps/files_external/templates/settings.php23
2 files changed, 25 insertions, 17 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index cd2a3103eb7..00793a614c2 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -181,16 +181,21 @@ $(document).ready(function() {
$.each(configurations, function(backend, parameters) {
if (backend == backendClass) {
$.each(parameters['configuration'], function(parameter, placeholder) {
- if (placeholder.indexOf('*') != -1) {
- td.append('<input type="password" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
- } else if (placeholder.indexOf('!') != -1) {
+ var is_optional = false;
+ if (placeholder.indexOf('&') === 0) {
+ is_optional = true;
+ placeholder = placeholder.substring(1);
+ }
+ if (placeholder.indexOf('*') === 0) {
+ var class_string = is_optional ? ' class="optional"' : '';
+ td.append('<input type="password"' + class_string + ' data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
+ } else if (placeholder.indexOf('!') === 0) {
td.append('<label><input type="checkbox" data-parameter="'+parameter+'" />'+placeholder.substring(1)+'</label>');
- } else if (placeholder.indexOf('&') != -1) {
- td.append('<input type="text" class="optional" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
- } else if (placeholder.indexOf('#') != -1) {
+ } else if (placeholder.indexOf('#') === 0) {
td.append('<input type="hidden" data-parameter="'+parameter+'" />');
} else {
- td.append('<input type="text" data-parameter="'+parameter+'" placeholder="'+placeholder+'" />');
+ var class_string = is_optional ? ' class="optional"' : '';
+ td.append('<input type="text"' + class_string + ' data-parameter="'+parameter+'" placeholder="'+placeholder+'" />');
}
});
if (parameters['custom'] && $('#externalStorage tbody tr.'+backendClass.replace(/\\/g, '\\\\')).length == 1) {
diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php
index 5e84fa8a252..80238666376 100644
--- a/apps/files_external/templates/settings.php
+++ b/apps/files_external/templates/settings.php
@@ -44,29 +44,32 @@
<?php if (isset($mount['options'])): ?>
<?php foreach ($mount['options'] as $parameter => $value): ?>
<?php if (isset($_['backends'][$mount['class']]['configuration'][$parameter])): ?>
- <?php $placeholder = $_['backends'][$mount['class']]['configuration'][$parameter]; ?>
- <?php if (strpos($placeholder, '*') !== false): ?>
+ <?php
+ $placeholder = $_['backends'][$mount['class']]['configuration'][$parameter];
+ $is_optional = FALSE;
+ if (strpos($placeholder, '&') === 0) {
+ $is_optional = TRUE;
+ $placeholder = substr($placeholder, 1);
+ }
+ ?>
+ <?php if (strpos($placeholder, '*') === 0): ?>
<input type="password"
+ <?php if ($is_optional): ?> class="optional"<?php endif; ?>
data-parameter="<?php p($parameter); ?>"
value="<?php p($value); ?>"
placeholder="<?php p(substr($placeholder, 1)); ?>" />
- <?php elseif (strpos($placeholder, '!') !== false): ?>
+ <?php elseif (strpos($placeholder, '!') === 0): ?>
<label><input type="checkbox"
data-parameter="<?php p($parameter); ?>"
<?php if ($value == 'true'): ?> checked="checked"<?php endif; ?>
/><?php p(substr($placeholder, 1)); ?></label>
- <?php elseif (strpos($placeholder, '&') !== false): ?>
- <input type="text"
- class="optional"
- data-parameter="<?php p($parameter); ?>"
- value="<?php p($value); ?>"
- placeholder="<?php p(substr($placeholder, 1)); ?>" />
- <?php elseif (strpos($placeholder, '#') !== false): ?>
+ <?php elseif (strpos($placeholder, '#') === 0): ?>
<input type="hidden"
data-parameter="<?php p($parameter); ?>"
value="<?php p($value); ?>" />
<?php else: ?>
<input type="text"
+ <?php if ($is_optional): ?> class="optional"<?php endif; ?>
data-parameter="<?php p($parameter); ?>"
value="<?php p($value); ?>"
placeholder="<?php p($placeholder); ?>" />