settings.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <form id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
  2. <h2><?php p($l->t('External Storage')); ?></h2>
  3. <?php if (isset($_['dependencies']) and ($_['dependencies']<>'')) print_unescaped(''.$_['dependencies'].''); ?>
  4. <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['isAdminPage'])); ?>'>
  5. <thead>
  6. <tr>
  7. <th></th>
  8. <th><?php p($l->t('Folder name')); ?></th>
  9. <th><?php p($l->t('External storage')); ?></th>
  10. <th><?php p($l->t('Configuration')); ?></th>
  11. <?php if ($_['isAdminPage']) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?>
  12. <th>&nbsp;</th>
  13. <th>&nbsp;</th>
  14. </tr>
  15. </thead>
  16. <tbody>
  17. <?php $_['mounts'] = array_merge($_['mounts'], array('' => array('id' => ''))); ?>
  18. <?php foreach ($_['mounts'] as $mount): ?>
  19. <tr <?php print_unescaped(isset($mount['mountpoint']) ? 'class="'.OC_Util::sanitizeHTML($mount['class']).'"' : 'id="addMountPoint"'); ?> data-id="<?php p($mount['id']) ?>">
  20. <td class="status">
  21. <span></span>
  22. </td>
  23. <td class="mountPoint"><input type="text" name="mountPoint"
  24. value="<?php p(isset($mount['mountpoint']) ? $mount['mountpoint'] : ''); ?>"
  25. data-mountpoint="<?php p(isset($mount['mountpoint']) ? $mount['mountpoint'] : ''); ?>"
  26. placeholder="<?php p($l->t('Folder name')); ?>" />
  27. </td>
  28. <?php if (!isset($mount['mountpoint'])): ?>
  29. <td class="backend">
  30. <select id="selectBackend" class="selectBackend" data-configurations='<?php p(json_encode($_['backends'])); ?>'>
  31. <option value="" disabled selected
  32. style="display:none;"><?php p($l->t('Add storage')); ?></option>
  33. <?php foreach ($_['backends'] as $class => $backend): ?>
  34. <option value="<?php p($class); ?>"><?php p($backend['backend']); ?></option>
  35. <?php endforeach; ?>
  36. </select>
  37. </td>
  38. <?php else: ?>
  39. <td class="backend" data-class="<?php p($mount['class']); ?>"><?php p($mount['backend']); ?>
  40. </td>
  41. <?php endif; ?>
  42. <td class ="configuration">
  43. <?php if (isset($mount['options'])): ?>
  44. <?php foreach ($mount['options'] as $parameter => $value): ?>
  45. <?php if (isset($_['backends'][$mount['class']]['configuration'][$parameter])): ?>
  46. <?php
  47. $placeholder = $_['backends'][$mount['class']]['configuration'][$parameter];
  48. $is_optional = FALSE;
  49. if (strpos($placeholder, '&') === 0) {
  50. $is_optional = TRUE;
  51. $placeholder = substr($placeholder, 1);
  52. }
  53. ?>
  54. <?php if (strpos($placeholder, '*') === 0): ?>
  55. <input type="password"
  56. <?php if ($is_optional): ?> class="optional"<?php endif; ?>
  57. data-parameter="<?php p($parameter); ?>"
  58. value="<?php p($value); ?>"
  59. placeholder="<?php p(substr($placeholder, 1)); ?>" />
  60. <?php elseif (strpos($placeholder, '!') === 0): ?>
  61. <label><input type="checkbox"
  62. data-parameter="<?php p($parameter); ?>"
  63. <?php if ($value == 'true'): ?> checked="checked"<?php endif; ?>
  64. /><?php p(substr($placeholder, 1)); ?></label>
  65. <?php elseif (strpos($placeholder, '#') === 0): ?>
  66. <input type="hidden"
  67. data-parameter="<?php p($parameter); ?>"
  68. value="<?php p($value); ?>" />
  69. <?php else: ?>
  70. <input type="text"
  71. <?php if ($is_optional): ?> class="optional"<?php endif; ?>
  72. data-parameter="<?php p($parameter); ?>"
  73. value="<?php p($value); ?>"
  74. placeholder="<?php p($placeholder); ?>" />
  75. <?php endif; ?>
  76. <?php endif; ?>
  77. <?php endforeach; ?>
  78. <?php if (isset($_['backends'][$mount['class']]['custom'])): ?>
  79. <?php OCP\Util::addScript('files_external', $_['backends'][$mount['class']]['custom']); ?>
  80. <?php endif; ?>
  81. <?php endif; ?>
  82. </td>
  83. <?php if ($_['isAdminPage']): ?>
  84. <td class="applicable"
  85. align="right"
  86. data-applicable-groups='<?php if (isset($mount['applicable']['groups']))
  87. print_unescaped(json_encode($mount['applicable']['groups'])); ?>'
  88. data-applicable-users='<?php if (isset($mount['applicable']['users']))
  89. print_unescaped(json_encode($mount['applicable']['users'])); ?>'>
  90. <input type="hidden" class="applicableUsers" style="width:20em;" value=""/>
  91. </td>
  92. <?php endif; ?>
  93. <td class="mountOptionsToggle <?php if (!isset($mount['mountpoint'])) { p('hidden'); } ?>"
  94. ><img
  95. class="svg action"
  96. title="<?php p($l->t('Advanced settings')); ?>"
  97. alt="<?php p($l->t('Advanced settings')); ?>"
  98. src="<?php print_unescaped(image_path('core', 'actions/settings.svg')); ?>" />
  99. <input type="hidden" class="mountOptions" value="<?php isset($mount['mountOptions']) ? p(json_encode($mount['mountOptions'])) : '' ?>" />
  100. <?php if ($_['isAdminPage']): ?>
  101. <?php if (isset($mount['priority'])): ?>
  102. <input type="hidden" class="priority" value="<?php p($mount['priority']) ?>" />
  103. <?php endif; ?>
  104. <?php endif; ?>
  105. </td>
  106. <td <?php if (isset($mount['mountpoint'])): ?>class="remove"
  107. <?php else: ?>class="hidden"
  108. <?php endif ?>><img alt="<?php p($l->t('Delete')); ?>"
  109. title="<?php p($l->t('Delete')); ?>"
  110. class="svg action"
  111. src="<?php print_unescaped(image_path('core', 'actions/delete.svg')); ?>" /></td>
  112. </tr>
  113. <?php endforeach; ?>
  114. </tbody>
  115. </table>
  116. <br />
  117. <?php if ($_['isAdminPage']): ?>
  118. <br />
  119. <input type="checkbox" name="allowUserMounting" id="allowUserMounting"
  120. value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> />
  121. <label for="allowUserMounting"><?php p($l->t('Enable User External Storage')); ?></label> <span id="userMountingMsg" class="msg"></span>
  122. <p id="userMountingBackends"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>>
  123. <?php p($l->t('Allow users to mount the following external storage')); ?><br />
  124. <?php $i = 0; foreach ($_['personal_backends'] as $class => $backend): ?>
  125. <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($class); ?>" <?php if ($backend['enabled']) print_unescaped(' checked="checked"'); ?> />
  126. <label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend['backend']); ?></label> <br />
  127. <?php $i++; ?>
  128. <?php endforeach; ?>
  129. </p>
  130. <?php endif; ?>
  131. </form>