appnavigation.php 4.2 KB

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