appnavigation.php 4.2 KB

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