Permalink
Browse files

Fix for bug 2491:

Implementing a "parent folder" icon in the file manager.
  • Loading branch information...
1 parent f760a27 commit f28fd7a6afc9818988b287d6b7975330939efa5a defacer committed Feb 8, 2005
Showing with 25 additions and 14 deletions.
  1. +25 −14 files/index.php
View
@@ -712,29 +712,40 @@ function displaydir ($wdir) {
if ($wdir == "/") {
$wdir = "";
}
+ if (!empty($wdir)) {
+ $dirlist[] = '..';
+ }
$count = 0;
if (!empty($dirlist)) {
asort($dirlist);
foreach ($dirlist as $dir) {
- $count++;
-
- $filename = $fullpath."/".$dir;
- $fileurl = rawurlencode($wdir."/".$dir);
- $filesafe = rawurlencode($dir);
- $filesize = display_size(get_directory_size("$fullpath/$dir"));
- $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
-
echo "<tr>";
- print_cell("center", "<input type=\"checkbox\" name=\"file$count\" value=\"$fileurl\" />");
- print_cell("left", "<a href=\"index.php?id=$id&amp;wdir=$fileurl&amp;choose=$choose\"><img src=\"$CFG->pixpath/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /></a> <a href=\"index.php?id=$id&amp;wdir=$fileurl&amp;choose=$choose\">".htmlspecialchars($dir)."</a>");
- print_cell("right", "<b>$filesize</b>");
- print_cell("right", $filedate);
- print_cell("right", "<a href=\"index.php?id=$id&amp;wdir=$wdir&amp;file=$filesafe&amp;action=rename&amp;choose=$choose\">$strrename</a>");
-
+ if($dir == '..') {
+ $fileurl = rawurlencode(dirname($wdir));
+ print_cell();
+ print_cell('left', '<a href="index.php?id='.$id.'&amp;wdir='.$fileurl.'"><img src="'.$CFG->pixpath.'/f/parent.gif" height="16" width="16" alt="'.get_string('parentfolder').'" /></a> <a href="index.php?id='.$id.'&amp;wdir='.$fileurl.'">'.get_string('parentfolder').'</a>');
+ print_cell();
+ print_cell();
+ print_cell();
+ }
+ else {
+ $count++;
+ $filename = $fullpath."/".$dir;
+ $fileurl = rawurlencode($wdir."/".$dir);
+ $filesafe = rawurlencode($dir);
+ $filesize = display_size(get_directory_size("$fullpath/$dir"));
+ $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
+ print_cell("center", "<input type=\"checkbox\" name=\"file$count\" value=\"$fileurl\" />");
+ print_cell("left", "<a href=\"index.php?id=$id&amp;wdir=$fileurl&amp;choose=$choose\"><img src=\"$CFG->pixpath/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /></a> <a href=\"index.php?id=$id&amp;wdir=$fileurl&amp;choose=$choose\">".htmlspecialchars($dir)."</a>");
+ print_cell("right", "<b>$filesize</b>");
+ print_cell("right", $filedate);
+ print_cell("right", "<a href=\"index.php?id=$id&amp;wdir=$wdir&amp;file=$filesafe&amp;action=rename&amp;choose=$choose\">$strrename</a>");
+ }
+
echo "</tr>";
}
}

0 comments on commit f28fd7a

Please sign in to comment.