Only show "up one level" if we're not at the root path
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 27 Aug 2005 21:37:33 +0000 (21:37 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 27 Aug 2005 21:37:33 +0000 (21:37 +0000)
browse.php
includes/paths.php

index ecdd9fca78db372aebb54e0c90c3281cbd75a30f..221722fe872fac7f34b1d656bde0206e5f488150 100644 (file)
@@ -18,13 +18,14 @@ $relpath = $viewsvn->paths->fetch_path($path);
 
 $listing = $viewsvn->svn->ls($repos, $relpath, 0);
 
-print_r($listing);
-
 echo '<ul>';
 echo "\n";
 
-echo '<li><a href="/viewsvn/' . $viewsvn->paths->out('browse.php', $path . '..') . '">Up One Level</a></li>';
-echo "\n";
+if (!$viewsvn->paths->is_root_path($path))
+{
+       echo '<li><a href="/viewsvn/' . $viewsvn->paths->out('browse.php', $path . '..') . '">Up One Level</a></li>';
+       echo "\n";
+}
 
 foreach ($listing AS $item)
 {
index dc91cb9012ff1bb3441fbec828e9509943f7b241..210b76a7975a447043a8ff09b66f914263f05988 100644 (file)
@@ -179,6 +179,29 @@ class Paths
                return $return;
        }
        
+       /**
+       * Determines if the root path has been reached
+       *
+       * @access       public
+       *
+       * @param        string  Universal path
+       *
+       * @return       bool    Root of path?
+       */
+       function is_root_path($path)
+       {
+               $path = $this->fetch_path($path);
+               $temp = preg_split('#/#', $path, 0, PREG_SPLIT_NO_EMPTY);
+               if (count($temp) > 0)
+               {
+                       return false;
+               }
+               else
+               {
+                       return true;
+               }
+       }
+       
        /**
        * Sanitizes a path for passing
        *