Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#3 [PATCH] Display directories on the top of the tree-page

pending
nobody
None
5
2012-01-21
2010-02-12
Bost
No

Hi

IMO in case of a directory with many entries it's more convenient to display all sub-directories on the top of the tree-page than to scroll down for them.

Bost

---
templates/tree.php | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/templates/tree.php b/templates/tree.php
index 37c86c5..6348e98 100644
--- a/templates/tree.php
+++ b/templates/tree.php
@@ -8,7 +8,13 @@
</thead>
<tbody>
<?php
-foreach ($page['entries'] as $e) {
+function cmp($a, $b) {
+ // '-1' means 'reverse order', i.e. directories first
+ return (strcmp($a['type'], $b['type']) * -1);
+}
+$sorted_entries = $page['entries'];
+usort($sorted_entries, "cmp");
+foreach ($sorted_entries as $e) {
$tr_class = $tr_class=="odd" ? "even" : "odd";

if (strlen($page['path']) > 0) {
--
1.6.5.1.1367.gcd48

Discussion

  • Could you make this a config item, and use git format-patch to create the patch?

     
    • status: open --> pending