appnavigation.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. data-apps-slide-toggle="#app-settings-content">
  31. <?php p($l->t('Files settings')); ?>
  32. </button>
  33. </div>
  34. <div id="app-settings-content">
  35. <div id="files-app-settings"></div>
  36. <div id="files-setting-showhidden">
  37. <input class="checkbox" id="showhiddenfilesToggle"
  38. checked="checked" type="checkbox">
  39. <label for="showhiddenfilesToggle"><?php p($l->t('Show hidden files')); ?></label>
  40. </div>
  41. <div id="files-setting-cropimagepreviews">
  42. <input class="checkbox" id="cropimagepreviewsToggle"
  43. checked="checked" type="checkbox">
  44. <label for="cropimagepreviewsToggle"><?php p($l->t('Crop image previews')); ?></label>
  45. </div>
  46. <label for="webdavurl"><?php p($l->t('WebDAV')); ?></label>
  47. <input id="webdavurl" type="text" readonly="readonly"
  48. value="<?php p($_['webdav_url']); ?>"/>
  49. <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>
  50. </div>
  51. </div>
  52. </div>
  53. <?php
  54. /**
  55. * Prints the HTML for a single Entry.
  56. *
  57. * @param $item The item to be added
  58. * @param $l Translator
  59. * @param $pinned IntegerValue to count the pinned entries at the bottom
  60. *
  61. * @return int Returns the pinned value
  62. */
  63. function NavigationListElements($item, $l, $pinned) {
  64. strpos($item['classes'] ?? '', 'pinned') !== false ? $pinned++ : ''; ?>
  65. <li
  66. data-id="<?php p($item['id']) ?>"
  67. <?php if (isset($item['dir'])) { ?> data-dir="<?php p($item['dir']); ?>" <?php } ?>
  68. <?php if (isset($item['view'])) { ?> data-view="<?php p($item['view']); ?>" <?php } ?>
  69. <?php if (isset($item['expandedState'])) { ?> data-expandedstate="<?php p($item['expandedState']); ?>" <?php } ?>
  70. class="nav-<?php p($item['id']) ?>
  71. <?php if (isset($item['classes'])) {
  72. p($item['classes']);
  73. } ?>
  74. <?php p($pinned === 1 ? 'first-pinned' : '') ?>
  75. <?php if (isset($item['defaultExpandedState']) && $item['defaultExpandedState']) { ?> open<?php } ?>"
  76. <?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?php } ?>>
  77. <a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>"
  78. class="nav-icon-<?php p(isset($item['icon']) && $item['icon'] !== '' ? $item['icon'] : $item['id']) ?> svg"><?php p($item['name']); ?></a>
  79. <?php
  80. NavigationElementMenu($item);
  81. if (isset($item['sublist'])) {
  82. ?>
  83. <button class="collapse app-navigation-noclose" aria-expanded="<?= !empty($item['defaultExpandedState']) ? 'true' : 'false' ?>"
  84. aria-label="<?php p($l->t('Toggle %1$s sublist', $item['name'])) ?>"
  85. <?php if (sizeof($item['sublist']) == 0) { ?> style="display: none" <?php } ?>>
  86. </button>
  87. <ul id="sublist-<?php p($item['id']); ?>">
  88. <?php
  89. foreach ($item['sublist'] as $item) {
  90. $pinned = NavigationListElements($item, $l, $pinned);
  91. } ?>
  92. </ul>
  93. <?php
  94. } ?>
  95. </li>
  96. <?php
  97. return $pinned;
  98. }
  99. /**
  100. * Prints the HTML for a dotmenu.
  101. *
  102. * @param $item The item to be added
  103. *
  104. * @return void
  105. */
  106. function NavigationElementMenu($item) {
  107. if (isset($item['menubuttons']) && $item['menubuttons'] === 'true') {
  108. ?>
  109. <div id="dotmenu-<?php p($item['id']); ?>"
  110. class="app-navigation-entry-utils" <?php if (isset($item['enableMenuButton']) && $item['enableMenuButton'] === 0) { ?> style="display: none"<?php } ?>>
  111. <ul>
  112. <li class="app-navigation-entry-utils-menu-button svg">
  113. <button id="dotmenu-button-<?php p($item['id']) ?>"></button>
  114. </li>
  115. </ul>
  116. </div>
  117. <div id="dotmenu-content-<?php p($item['id']) ?>"
  118. class="app-navigation-entry-menu">
  119. <ul>
  120. </ul>
  121. </div>
  122. <?php
  123. }
  124. }