From f4b351a30efe8c5eab43cb76a8507f76fc4160c3 Mon Sep 17 00:00:00 2001 From: defacer Date: Tue, 8 Feb 2005 18:03:43 +0000 Subject: [PATCH] Fix for bug 2491: Implementing a "parent folder" icon in the file manager. --- files/index.php | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/files/index.php b/files/index.php index 3357e259c9..a7a4f6efe6 100644 --- a/files/index.php +++ b/files/index.php @@ -712,28 +712,38 @@ 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 ""; - print_cell("center", ""); - print_cell("left", "pixpath/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /> ".htmlspecialchars($dir).""); - print_cell("right", "$filesize"); - print_cell("right", $filedate); - print_cell("right", "$strrename"); + if($dir == '..') { + $fileurl = rawurlencode(dirname($wdir)); + print_cell(); + print_cell('left', ''.get_string('parentfolder').' '.get_string('parentfolder').''); + 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", ""); + print_cell("left", "pixpath/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /> ".htmlspecialchars($dir).""); + print_cell("right", "$filesize"); + print_cell("right", $filedate); + print_cell("right", "$strrename"); + } echo ""; } @@ -771,7 +781,7 @@ function displaydir ($wdir) { link_to_popup_window ($ffurl, "display", "pixpath/f/$icon\" height=\"16\" width=\"16\" border=\"0\" alt=\"File\" />", 480, 640); - echo ""; + echo " "; link_to_popup_window ($ffurl, "display", htmlspecialchars($file), 480, 640); -- 2.39.5