@@ -1,47 +1,47 @@ discard block |
||
1 | 1 | <?php |
2 | - use \OCA\Files_External\Lib\Backend\Backend; |
|
3 | - use \OCA\Files_External\Lib\Auth\AuthMechanism; |
|
4 | - use \OCA\Files_External\Lib\DefinitionParameter; |
|
5 | - use \OCA\Files_External\Service\BackendService; |
|
2 | + use \OCA\Files_External\Lib\Backend\Backend; |
|
3 | + use \OCA\Files_External\Lib\Auth\AuthMechanism; |
|
4 | + use \OCA\Files_External\Lib\DefinitionParameter; |
|
5 | + use \OCA\Files_External\Service\BackendService; |
|
6 | 6 | |
7 | - $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting']; |
|
7 | + $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting']; |
|
8 | 8 | |
9 | - $l->t("Enable encryption"); |
|
10 | - $l->t("Enable previews"); |
|
11 | - $l->t("Enable sharing"); |
|
12 | - $l->t("Check for changes"); |
|
13 | - $l->t("Never"); |
|
14 | - $l->t("Once every direct access"); |
|
9 | + $l->t("Enable encryption"); |
|
10 | + $l->t("Enable previews"); |
|
11 | + $l->t("Enable sharing"); |
|
12 | + $l->t("Check for changes"); |
|
13 | + $l->t("Never"); |
|
14 | + $l->t("Once every direct access"); |
|
15 | 15 | |
16 | - script('files_external', 'settings'); |
|
17 | - style('files_external', 'settings'); |
|
16 | + script('files_external', 'settings'); |
|
17 | + style('files_external', 'settings'); |
|
18 | 18 | |
19 | - // load custom JS |
|
20 | - foreach ($_['backends'] as $backend) { |
|
21 | - /** @var Backend $backend */ |
|
22 | - $scripts = $backend->getCustomJs(); |
|
23 | - foreach ($scripts as $script) { |
|
24 | - script('files_external', $script); |
|
25 | - } |
|
26 | - } |
|
27 | - foreach ($_['authMechanisms'] as $authMechanism) { |
|
28 | - /** @var AuthMechanism $authMechanism */ |
|
29 | - $scripts = $authMechanism->getCustomJs(); |
|
30 | - foreach ($scripts as $script) { |
|
31 | - script('files_external', $script); |
|
32 | - } |
|
33 | - } |
|
19 | + // load custom JS |
|
20 | + foreach ($_['backends'] as $backend) { |
|
21 | + /** @var Backend $backend */ |
|
22 | + $scripts = $backend->getCustomJs(); |
|
23 | + foreach ($scripts as $script) { |
|
24 | + script('files_external', $script); |
|
25 | + } |
|
26 | + } |
|
27 | + foreach ($_['authMechanisms'] as $authMechanism) { |
|
28 | + /** @var AuthMechanism $authMechanism */ |
|
29 | + $scripts = $authMechanism->getCustomJs(); |
|
30 | + foreach ($scripts as $script) { |
|
31 | + script('files_external', $script); |
|
32 | + } |
|
33 | + } |
|
34 | 34 | |
35 | - function writeParameterInput($parameter, $options, $classes = []) { |
|
36 | - $value = ''; |
|
37 | - if (isset($options[$parameter->getName()])) { |
|
38 | - $value = $options[$parameter->getName()]; |
|
39 | - } |
|
40 | - $placeholder = $parameter->getText(); |
|
41 | - $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL); |
|
35 | + function writeParameterInput($parameter, $options, $classes = []) { |
|
36 | + $value = ''; |
|
37 | + if (isset($options[$parameter->getName()])) { |
|
38 | + $value = $options[$parameter->getName()]; |
|
39 | + } |
|
40 | + $placeholder = $parameter->getText(); |
|
41 | + $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL); |
|
42 | 42 | |
43 | - switch ($parameter->getType()) { |
|
44 | - case DefinitionParameter::VALUE_PASSWORD: ?> |
|
43 | + switch ($parameter->getType()) { |
|
44 | + case DefinitionParameter::VALUE_PASSWORD: ?> |
|
45 | 45 | <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
46 | 46 | <input type="password" |
47 | 47 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | placeholder="<?php p($placeholder); ?>" |
51 | 51 | /> |
52 | 52 | <?php |
53 | - break; |
|
54 | - case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
53 | + break; |
|
54 | + case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
55 | 55 | <?php $checkboxId = uniqid("checkbox_"); ?> |
56 | 56 | <div> |
57 | 57 | <label> |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | </label> |
66 | 66 | </div> |
67 | 67 | <?php |
68 | - break; |
|
69 | - case DefinitionParameter::VALUE_HIDDEN: ?> |
|
68 | + break; |
|
69 | + case DefinitionParameter::VALUE_HIDDEN: ?> |
|
70 | 70 | <input type="hidden" |
71 | 71 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
72 | 72 | data-parameter="<?php p($parameter->getName()); ?>" |
73 | 73 | value="<?php p($value); ?>" |
74 | 74 | /> |
75 | 75 | <?php |
76 | - break; |
|
77 | - default: ?> |
|
76 | + break; |
|
77 | + default: ?> |
|
78 | 78 | <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
79 | 79 | <input type="text" |
80 | 80 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | placeholder="<?php p($placeholder); ?>" |
84 | 84 | /> |
85 | 85 | <?php |
86 | - } |
|
87 | - } |
|
86 | + } |
|
87 | + } |
|
88 | 88 | ?> |
89 | 89 | |
90 | 90 | <form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>"> |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | <?php p($l->t('Add storage')); ?> |
123 | 123 | </option> |
124 | 124 | <?php |
125 | - $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { |
|
126 | - return $backend->isVisibleFor($_['visibilityType']); |
|
127 | - }); |
|
128 | - uasort($sortedBackends, function($a, $b) { |
|
129 | - return strcasecmp($a->getText(), $b->getText()); |
|
130 | - }); |
|
131 | - ?> |
|
125 | + $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { |
|
126 | + return $backend->isVisibleFor($_['visibilityType']); |
|
127 | + }); |
|
128 | + uasort($sortedBackends, function($a, $b) { |
|
129 | + return strcasecmp($a->getText(), $b->getText()); |
|
130 | + }); |
|
131 | + ?> |
|
132 | 132 | <?php foreach ($sortedBackends as $backend): ?> |
133 | 133 | <?php if ($backend->getDeprecateTo()) continue; // ignore deprecated backends ?> |
134 | 134 | <option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option> |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | <p id="userMountingBackends"<?php if (!$_['allowUserMounting']): ?> class="hidden"<?php endif; ?>> |
176 | 176 | <?php p($l->t('Allow users to mount the following external storage')); ?><br /> |
177 | 177 | <?php |
178 | - $userBackends = array_filter($_['backends'], function($backend) { |
|
179 | - return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); |
|
180 | - }); |
|
181 | - ?> |
|
178 | + $userBackends = array_filter($_['backends'], function($backend) { |
|
179 | + return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); |
|
180 | + }); |
|
181 | + ?> |
|
182 | 182 | <?php $i = 0; foreach ($userBackends as $backend): ?> |
183 | 183 | <?php if ($deprecateTo = $backend->getDeprecateTo()): ?> |
184 | 184 | <input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" /> |
@@ -89,7 +89,10 @@ discard block |
||
89 | 89 | |
90 | 90 | <form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>"> |
91 | 91 | <h2 data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2> |
92 | - <?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
|
92 | + <?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) { |
|
93 | + print_unescaped(''.$_['dependencies'].''); |
|
94 | +} |
|
95 | +?> |
|
93 | 96 | <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> |
94 | 97 | <thead> |
95 | 98 | <tr> |
@@ -98,7 +101,10 @@ discard block |
||
98 | 101 | <th><?php p($l->t('External storage')); ?></th> |
99 | 102 | <th><?php p($l->t('Authentication')); ?></th> |
100 | 103 | <th><?php p($l->t('Configuration')); ?></th> |
101 | - <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?> |
|
104 | + <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) { |
|
105 | + print_unescaped('<th>'.$l->t('Available for').'</th>'); |
|
106 | +} |
|
107 | +?> |
|
102 | 108 | <th> </th> |
103 | 109 | <th> </th> |
104 | 110 | </tr> |
@@ -130,7 +136,10 @@ discard block |
||
130 | 136 | }); |
131 | 137 | ?> |
132 | 138 | <?php foreach ($sortedBackends as $backend): ?> |
133 | - <?php if ($backend->getDeprecateTo()) continue; // ignore deprecated backends ?> |
|
139 | + <?php if ($backend->getDeprecateTo()) { |
|
140 | + continue; |
|
141 | +} |
|
142 | +// ignore deprecated backends ?> |
|
134 | 143 | <option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option> |
135 | 144 | <?php endforeach; ?> |
136 | 145 | </select> |
@@ -169,7 +178,10 @@ discard block |
||
169 | 178 | |
170 | 179 | <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?> |
171 | 180 | <input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox" |
172 | - value="1" <?php if ($_['allowUserMounting']) print_unescaped(' checked="checked"'); ?> /> |
|
181 | + value="1" <?php if ($_['allowUserMounting']) { |
|
182 | + print_unescaped(' checked="checked"'); |
|
183 | +} |
|
184 | +?> /> |
|
173 | 185 | <label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span> |
174 | 186 | |
175 | 187 | <p id="userMountingBackends"<?php if (!$_['allowUserMounting']): ?> class="hidden"<?php endif; ?>> |
@@ -182,8 +194,14 @@ discard block |
||
182 | 194 | <?php $i = 0; foreach ($userBackends as $backend): ?> |
183 | 195 | <?php if ($deprecateTo = $backend->getDeprecateTo()): ?> |
184 | 196 | <input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" /> |
185 | - <?php else: ?> |
|
186 | - <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) print_unescaped(' checked="checked"'); ?> /> |
|
197 | + <?php else { |
|
198 | + : ?> |
|
199 | + <input type="checkbox" id="allowUserMountingBackends<?php p($i); |
|
200 | +} |
|
201 | +?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) { |
|
202 | + print_unescaped(' checked="checked"'); |
|
203 | +} |
|
204 | +?> /> |
|
187 | 205 | <label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend->getText()); ?></label> <br /> |
188 | 206 | <?php endif; ?> |
189 | 207 | <?php $i++; ?> |