settings.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <form id="files_external">
  2. <fieldset class="personalblock">
  3. <legend><strong><?php p($l->t('External Storage')); ?></strong></legend>
  4. <?php if (isset($_['dependencies']) and ($_['dependencies']<>'')) print_unescaped(''.$_['dependencies'].''); ?>
  5. <table id="externalStorage" data-admin='<?php print_unescaped(json_encode($_['isAdminPage'])); ?>'>
  6. <thead>
  7. <tr>
  8. <th></th>
  9. <th><?php p($l->t('Folder name')); ?></th>
  10. <th><?php p($l->t('External storage')); ?></th>
  11. <th><?php p($l->t('Configuration')); ?></th>
  12. <!--<th><?php p($l->t('Options')); ?></th> -->
  13. <?php if ($_['isAdminPage']) print_unescaped('<th>'.$l->t('Applicable').'</th>'); ?>
  14. <th>&nbsp;</th>
  15. </tr>
  16. </thead>
  17. <tbody width="100%">
  18. <?php $_['mounts'] = array_merge($_['mounts'], array('' => array())); ?>
  19. <?php foreach ($_['mounts'] as $mountPoint => $mount): ?>
  20. <tr <?php print_unescaped(($mountPoint != '') ? 'class="'.OC_Util::sanitizeHTML($mount['class']).'"' : 'id="addMountPoint"'); ?>>
  21. <td class="status">
  22. <?php if (isset($mount['status'])): ?>
  23. <span class="<?php p(($mount['status']) ? 'success' : 'error'); ?>"></span>
  24. <?php endif; ?>
  25. </td>
  26. <td class="mountPoint"><input type="text" name="mountPoint"
  27. value="<?php p($mountPoint); ?>"
  28. placeholder="<?php p($l->t('Folder name')); ?>" /></td>
  29. <?php if ($mountPoint == ''): ?>
  30. <td class="backend">
  31. <select id="selectBackend" data-configurations='<?php print_unescaped(json_encode($_['backends'])); ?>'>
  32. <option value="" disabled selected
  33. style="display:none;"><?php p($l->t('Add storage')); ?></option>
  34. <?php foreach ($_['backends'] as $class => $backend): ?>
  35. <option value="<?php p($class); ?>"><?php p($backend['backend']); ?></option>
  36. <?php endforeach; ?>
  37. </select>
  38. </td>
  39. <?php else: ?>
  40. <td class="backend"
  41. data-class="<?php p($mount['class']); ?>"><?php p($mount['backend']); ?></td>
  42. <?php endif; ?>
  43. <td class ="configuration" width="100%">
  44. <?php if (isset($mount['configuration'])): ?>
  45. <?php foreach ($mount['configuration'] as $parameter => $value): ?>
  46. <?php if (isset($_['backends'][$mount['class']]['configuration'][$parameter])): ?>
  47. <?php $placeholder = $_['backends'][$mount['class']]['configuration'][$parameter]; ?>
  48. <?php if (strpos($placeholder, '*') !== false): ?>
  49. <input type="password"
  50. data-parameter="<?php p($parameter); ?>"
  51. value="<?php p($value); ?>"
  52. placeholder="<?php p(substr($placeholder, 1)); ?>" />
  53. <?php elseif (strpos($placeholder, '!') !== false): ?>
  54. <label><input type="checkbox"
  55. data-parameter="<?php p($parameter); ?>"
  56. <?php if ($value == 'true'): ?> checked="checked"<?php endif; ?>
  57. /><?php p(substr($placeholder, 1)); ?></label>
  58. <?php elseif (strpos($placeholder, '&') !== false): ?>
  59. <input type="text"
  60. class="optional"
  61. data-parameter="<?php p($parameter); ?>"
  62. value="<?php p($value); ?>"
  63. placeholder="<?php p(substr($placeholder, 5)); ?>" />
  64. <?php elseif (strpos($placeholder, '#') !== false): ?>
  65. <input type="hidden"
  66. data-parameter="<?php p($parameter); ?>"
  67. value="<?php p($value); ?>" />
  68. <?php else: ?>
  69. <input type="text"
  70. data-parameter="<?php p($parameter); ?>"
  71. value="<?php p($value); ?>"
  72. placeholder="<?php p($placeholder); ?>" />
  73. <?php endif; ?>
  74. <?php endif; ?>
  75. <?php endforeach; ?>
  76. <?php if (isset($_['backends'][$mount['class']]['custom']) && !in_array('files_external/js/'.$_['backends'][$mount['class']]['custom'], \OC_Util::$scripts)): ?>
  77. <?php OCP\Util::addScript('files_external', $_['backends'][$mount['class']]['custom']); ?>
  78. <?php endif; ?>
  79. <?php endif; ?>
  80. </td>
  81. <?php if ($_['isAdminPage']): ?>
  82. <td class="applicable"
  83. align="right"
  84. data-applicable-groups='<?php if (isset($mount['applicable']['groups']))
  85. print_unescaped(json_encode($mount['applicable']['groups'])); ?>'
  86. data-applicable-users='<?php if (isset($mount['applicable']['users']))
  87. print_unescaped(json_encode($mount['applicable']['users'])); ?>'>
  88. <select class="chzn-select"
  89. multiple style="width:20em;"
  90. data-placeholder="<?php p($l->t('None set')); ?>">
  91. <option value="all" <?php if (isset($mount['applicable']['users']) && in_array('all', $mount['applicable']['users'])) print_unescaped('selected="selected"');?> ><?php p($l->t('All Users')); ?></option>
  92. <optgroup label="<?php p($l->t('Groups')); ?>">
  93. <?php foreach ($_['groups'] as $group): ?>
  94. <option value="<?php p($group); ?>(group)"
  95. <?php if (isset($mount['applicable']['groups']) && in_array($group, $mount['applicable']['groups'])): ?>
  96. selected="selected"
  97. <?php endif; ?>><?php p($group); ?></option>
  98. <?php endforeach; ?>
  99. </optgroup>
  100. <optgroup label="<?php p($l->t('Users')); ?>">
  101. <?php foreach ($_['users'] as $user): ?>
  102. <option value="<?php p($user); ?>"
  103. <?php if (isset($mount['applicable']['users']) && in_array($user, $mount['applicable']['users'])): ?>
  104. selected="selected"
  105. <?php endif; ?>><?php p($_['userDisplayNames'][$user]); ?></option>
  106. <?php endforeach; ?>
  107. </optgroup>
  108. </select>
  109. </td>
  110. <?php endif; ?>
  111. <td <?php if ($mountPoint != ''): ?>class="remove"
  112. <?php else: ?>style="visibility:hidden;"
  113. <?php endif ?>><img alt="<?php p($l->t('Delete')); ?>"
  114. title="<?php p($l->t('Delete')); ?>"
  115. class="svg action"
  116. src="<?php print_unescaped(image_path('core', 'actions/delete.svg')); ?>" /></td>
  117. </tr>
  118. <?php endforeach; ?>
  119. </tbody>
  120. </table>
  121. <br />
  122. <?php if ($_['isAdminPage']): ?>
  123. <br />
  124. <input type="checkbox"
  125. name="allowUserMounting"
  126. id="allowUserMounting"
  127. value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> />
  128. <label for="allowUserMounting"><?php p($l->t('Enable User External Storage')); ?></label><br/>
  129. <em><?php p($l->t('Allow users to mount their own external storage')); ?></em>
  130. <?php endif; ?>
  131. </fieldset>
  132. </form>
  133. <?php if ( ! $_['isAdminPage']): ?>
  134. <form id="files_external"
  135. method="post"
  136. enctype="multipart/form-data"
  137. action="<?php p(OCP\Util::linkTo('files_external', 'ajax/addRootCertificate.php')); ?>">
  138. <fieldset class="personalblock">
  139. <legend><strong><?php p($l->t('SSL root certificates'));?></strong></legend>
  140. <table id="sslCertificate" data-admin='<?php print_unescaped(json_encode($_['isAdminPage'])); ?>'>
  141. <tbody width="100%">
  142. <?php foreach ($_['certs'] as $rootCert): ?>
  143. <tr id="<?php p($rootCert) ?>">
  144. <td class="rootCert"><?php p($rootCert) ?></td>
  145. <td <?php if ($rootCert != ''): ?>class="remove"
  146. <?php else: ?>style="visibility:hidden;"
  147. <?php endif; ?>><img alt="<?php p($l->t('Delete')); ?>"
  148. title="<?php p($l->t('Delete')); ?>"
  149. class="svg action"
  150. src="<?php print_unescaped(image_path('core', 'actions/delete.svg')); ?>" /></td>
  151. </tr>
  152. <?php endforeach; ?>
  153. </tbody>
  154. </table>
  155. <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']); ?>">
  156. <input type="file" id="rootcert_import" name="rootcert_import">
  157. <input type="submit" name="cert_import" value="<?php p($l->t('Import Root Certificate')); ?>" />
  158. </fieldset>
  159. </form>
  160. <?php endif; ?>