appnavigation.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. script(\OCA\Files\AppInfo\Application::APP_ID, 'dist/files-app-settings');
  3. ?>
  4. <div id="app-navigation">
  5. <ul class="with-icon">
  6. <?php
  7. $pinned = 0;
  8. foreach ($_['navigationItems'] as $item) {
  9. $pinned = NavigationListElements($item, $l, $pinned);
  10. }
  11. ?>
  12. <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
  13. <li id="quota" class="pinned <?php p($pinned === 0 ? 'first-pinned ' : '') ?>">
  14. <a href="#" class="icon-quota svg">
  15. <p><?php p($l->t('%s used', [$_['usage']])); ?></p>
  16. </a>
  17. </li>
  18. <?php else: ?>
  19. <li id="quota" class="has-tooltip pinned <?php p($pinned === 0 ? 'first-pinned ' : '') ?>"
  20. title="<?php p($l->t('%s%% of %s used', [$_['usage_relative'], $_['total_space']])); ?>">
  21. <a href="#" class="icon-quota svg">
  22. <p id="quotatext"><?php p($l->t('%1$s of %2$s used', [$_['usage'], $_['total_space']])); ?></p>
  23. <div class="quota-container">
  24. <progress value="<?php p($_['usage_relative']); ?>" max="100" class="<?= ($_['usage_relative'] > 80) ? 'warn' : '' ?>"></progress>
  25. </div>
  26. </a>
  27. </li>
  28. <?php endif; ?>
  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-app-settings"></div>
  39. <div id="files-setting-showhidden">
  40. <input class="checkbox" id="showhiddenfilesToggle"
  41. checked="checked" type="checkbox">
  42. <label for="showhiddenfilesToggle"><?php p($l->t('Show hidden files')); ?></label>
  43. </div>
  44. <label for="webdavurl"><?php p($l->t('WebDAV')); ?></label>
  45. <input id="webdavurl" type="text" readonly="readonly"
  46. value="<?php p($_['webdav_url']); ?>"/>
  47. <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>
  48. </div>
  49. </div>
  50. </div>
  51. <?php
  52. /**
  53. * Prints the HTML for a single Entry.
  54. *
  55. * @param $item The item to be added
  56. * @param $l Translator
  57. * @param $pinned IntegerValue to count the pinned entries at the bottom
  58. *
  59. * @return int Returns the pinned value
  60. */
  61. function NavigationListElements($item, $l, $pinned) {
  62. strpos($item['classes'] ?? '', 'pinned') !== false ? $pinned++ : ''; ?>
  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'])) {
  70. p($item['classes']);
  71. } ?>
  72. <?php p($pinned === 1 ? 'first-pinned' : '') ?>
  73. <?php if (isset($item['defaultExpandedState']) && $item['defaultExpandedState']) { ?> open<?php } ?>"
  74. <?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?php } ?>>
  75. <a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>"
  76. class="nav-icon-<?php p(isset($item['icon']) && $item['icon'] !== '' ? $item['icon'] : $item['id']) ?> svg"><?php p($item['name']); ?></a>
  77. <?php
  78. NavigationElementMenu($item);
  79. if (isset($item['sublist'])) {
  80. ?>
  81. <button class="collapse app-navigation-noclose" <?php if (sizeof($item['sublist']) == 0) { ?> style="display: none" <?php } ?>></button>
  82. <ul id="sublist-<?php p($item['id']); ?>">
  83. <?php
  84. foreach ($item['sublist'] as $item) {
  85. $pinned = NavigationListElements($item, $l, $pinned);
  86. } ?>
  87. </ul>
  88. <?php
  89. } ?>
  90. </li>
  91. <?php
  92. return $pinned;
  93. }
  94. /**
  95. * Prints the HTML for a dotmenu.
  96. *
  97. * @param $item The item to be added
  98. *
  99. * @return void
  100. */
  101. function NavigationElementMenu($item) {
  102. if (isset($item['menubuttons']) && $item['menubuttons'] === 'true') {
  103. ?>
  104. <div id="dotmenu-<?php p($item['id']); ?>"
  105. class="app-navigation-entry-utils" <?php if (isset($item['enableMenuButton']) && $item['enableMenuButton'] === 0) { ?> style="display: none"<?php } ?>>
  106. <ul>
  107. <li class="app-navigation-entry-utils-menu-button svg">
  108. <button id="dotmenu-button-<?php p($item['id']) ?>"></button>
  109. </li>
  110. </ul>
  111. </div>
  112. <div id="dotmenu-content-<?php p($item['id']) ?>"
  113. class="app-navigation-entry-menu">
  114. <ul>
  115. </ul>
  116. </div>
  117. <?php
  118. }
  119. }