1
0

appnavigation.php 4.1 KB

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