appnavigation.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <div id="app-navigation" role="navigation">
  2. <ul class="with-icon" tabindex="0">
  3. <?php
  4. $pinned = 0;
  5. foreach ($_['navigationItems'] as $item) {
  6. $pinned = NavigationListElements($item, $l, $pinned);
  7. }
  8. ?>
  9. <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
  10. <li id="quota" class="pinned <?php p($pinned === 0 ? 'first-pinned ' : '') ?>">
  11. <a href="#" class="icon-quota svg quota-navigation-item">
  12. <p id="quotatext" class="quota-navigation-item__text"><?php p($l->t('%s used', [$_['usage']])); ?></p>
  13. </a>
  14. </li>
  15. <?php else: ?>
  16. <li id="quota" class="has-tooltip pinned <?php p($pinned === 0 ? 'first-pinned ' : '') ?>"
  17. title="<?php p($l->t('%s%%', [round($_['usage_relative'])])); ?>">
  18. <a href="#" class="icon-quota svg quota-navigation-item">
  19. <p id="quotatext" class="quota-navigation-item__text"><?php p($l->t('%1$s of %2$s used', [$_['usage'], $_['total_space']])); ?></p>
  20. <div class="quota-navigation-item__container">
  21. <progress value="<?php p($_['usage_relative']); ?>" max="100" class="<?= ($_['usage_relative'] > 80) ? 'warn' : '' ?>"></progress>
  22. </div>
  23. </a>
  24. </li>
  25. <?php endif; ?>
  26. </ul>
  27. <div id="app-settings">
  28. <div id="app-settings-header">
  29. <button class="settings-button"
  30. aria-expanded="false"
  31. aria-controls="app-settings-content"
  32. data-apps-slide-toggle="#app-settings-content">
  33. <?php p($l->t('Files settings')); ?>
  34. </button>
  35. </div>
  36. <div id="app-settings-content" role="region" aria-labelledby="app-settings-header">
  37. <div id="files-app-settings"></div>
  38. <div id="files-setting-showhidden">
  39. <input class="checkbox" id="showhiddenfilesToggle"
  40. checked="checked" type="checkbox">
  41. <label for="showhiddenfilesToggle"><?php p($l->t('Show hidden files')); ?></label>
  42. </div>
  43. <div id="files-setting-cropimagepreviews">
  44. <input class="checkbox" id="cropimagepreviewsToggle"
  45. checked="checked" type="checkbox">
  46. <label for="cropimagepreviewsToggle"><?php p($l->t('Crop image previews')); ?></label>
  47. </div>
  48. <label for="webdavurl"><?php p($l->t('WebDAV')); ?></label>
  49. <input id="webdavurl" type="text" readonly="readonly"
  50. value="<?php p($_['webdav_url']); ?>"/>
  51. <em><a href="<?php echo link_to_docs('user-webdav') ?>" target="_blank" rel="noreferrer noopener"><?php p($l->t('Use this address to access your Files via WebDAV')) ?> ↗</a></em>
  52. </div>
  53. </div>
  54. </div>
  55. <?php
  56. /**
  57. * Prints the HTML for a single Entry.
  58. *
  59. * @param $item The item to be added
  60. * @param $l Translator
  61. * @param $pinned IntegerValue to count the pinned entries at the bottom
  62. *
  63. * @return int Returns the pinned value
  64. */
  65. function NavigationListElements($item, $l, $pinned) {
  66. strpos($item['classes'] ?? '', 'pinned') !== false ? $pinned++ : ''; ?>
  67. <li
  68. data-id="<?php p($item['id']) ?>"
  69. <?php if (isset($item['dir'])) { ?> data-dir="<?php p($item['dir']); ?>" <?php } ?>
  70. <?php if (isset($item['view'])) { ?> data-view="<?php p($item['view']); ?>" <?php } ?>
  71. <?php if (isset($item['expandedState'])) { ?> data-expandedstate="<?php p($item['expandedState']); ?>" <?php } ?>
  72. class="nav-<?php p($item['id']) ?>
  73. <?php if (isset($item['classes'])) {
  74. p($item['classes']);
  75. } ?>
  76. <?php p($pinned === 1 ? 'first-pinned' : '') ?>
  77. <?php if (isset($item['defaultExpandedState']) && $item['defaultExpandedState']) { ?> open<?php } ?>"
  78. <?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?php } ?>>
  79. <a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>"
  80. class="nav-icon-<?php p(isset($item['icon']) && $item['icon'] !== '' ? $item['icon'] : $item['id']) ?> svg"><?php p($item['name']); ?></a>
  81. <?php
  82. NavigationElementMenu($item);
  83. if (isset($item['sublist'])) {
  84. ?>
  85. <button class="collapse app-navigation-noclose" aria-expanded="<?= !empty($item['defaultExpandedState']) ? 'true' : 'false' ?>"
  86. aria-label="<?php p($l->t('Toggle %1$s sublist', $item['name'])) ?>"
  87. <?php if (sizeof($item['sublist']) == 0) { ?> style="display: none" <?php } ?>>
  88. </button>
  89. <ul id="sublist-<?php p($item['id']); ?>">
  90. <?php
  91. foreach ($item['sublist'] as $item) {
  92. $pinned = NavigationListElements($item, $l, $pinned);
  93. } ?>
  94. </ul>
  95. <?php
  96. } ?>
  97. </li>
  98. <?php
  99. return $pinned;
  100. }
  101. /**
  102. * Prints the HTML for a dotmenu.
  103. *
  104. * @param $item The item to be added
  105. *
  106. * @return void
  107. */
  108. function NavigationElementMenu($item) {
  109. if (isset($item['menubuttons']) && $item['menubuttons'] === 'true') {
  110. ?>
  111. <div id="dotmenu-<?php p($item['id']); ?>"
  112. class="app-navigation-entry-utils" <?php if (isset($item['enableMenuButton']) && $item['enableMenuButton'] === 0) { ?> style="display: none"<?php } ?>>
  113. <ul>
  114. <li class="app-navigation-entry-utils-menu-button svg">
  115. <button id="dotmenu-button-<?php p($item['id']) ?>"></button>
  116. </li>
  117. </ul>
  118. </div>
  119. <div id="dotmenu-content-<?php p($item['id']) ?>"
  120. class="app-navigation-entry-menu">
  121. <ul>
  122. </ul>
  123. </div>
  124. <?php
  125. }
  126. }