From: martin Date: Fri, 30 Aug 2002 13:18:06 +0000 (+0000) Subject: Improved header now contains directory trail, and I internationalised X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0c377177eda562fca1fb60bd06ecfc28e1e9e8d9;p=moodle.git Improved header now contains directory trail, and I internationalised all the texts (buttons etc) --- diff --git a/files/index.php b/files/index.php index b638785b1f..007e62cf03 100644 --- a/files/index.php +++ b/files/index.php @@ -35,13 +35,29 @@ print_footer($course); } - function html_header($formfield=""){ - global $course; + function html_header($course, $wdir, $formfield=""){ $strfiles = get_string("files"); - print_header("$course->shortname: $strfiles", "$course->fullname", - "id\">$course->shortname -> $strfiles", $formfield); + if ($wdir == "/") { + print_header("$course->shortname: $strfiles", "$course->fullname", + "id\">$course->shortname + -> $strfiles", $formfield); + } else { + $dirs = explode("/", $wdir); + $numdirs = count($dirs); + $link = ""; + $navigation = ""; + for ($i=1; $i<$numdirs; $i++) { + $navigation .= " -> "; + $link .= "/".urlencode($dirs[$i]); + $navigation .= "id&wdir=$link\">".$dirs[$i].""; + } + + print_header("$course->shortname: $strfiles", "$course->fullname", + "id\">$course->shortname -> + id&wdir=/\">$strfiles $navigation", $formfield); + } echo ""; echo ""; echo "
"; @@ -80,7 +96,7 @@ switch ($action) { case "upload": - html_header(); + html_header($course, $wdir); if ($save) { if (!is_uploaded_file($userfile['tmp_name']) and $userfile['size'] > 0) { echo "

Error: That was not a valid file."; @@ -129,7 +145,7 @@ case "delete": if ($confirm) { - html_header(); + html_header($course, $wdir); foreach ($USER->filelist as $file) { $fullfile = $basedir.$file; if (! fulldelete($fullfile)) { @@ -141,7 +157,7 @@ html_footer(); } else { - html_header(); + html_header($course, $wdir); if (setfilelist($HTTP_POST_VARS)) { echo "

You are about to delete:

"; print_simple_box_start("center"); @@ -159,7 +175,7 @@ break; case "move": - html_header(); + html_header($course, $wdir); if ($count = setfilelist($HTTP_POST_VARS)) { $USER->fileop = $action; $USER->filesource = $wdir; @@ -171,7 +187,7 @@ break; case "paste": - html_header(); + html_header($course, $wdir); if ($USER->fileop == "move") { foreach ($USER->filelist as $file) { $shortfile = basename($file); @@ -189,7 +205,7 @@ case "rename": if ($name) { - html_header(); + html_header($course, $wdir); $name = clean_filename($name); if (file_exists($basedir.$wdir."/".$name)) { echo "Error: $name already exists!"; @@ -199,7 +215,7 @@ displaydir($wdir); } else { - html_header("form.name"); + html_header($course, $wdir, "form.name"); echo "

Rename $file to:"; echo "
"; echo "
"; @@ -224,7 +240,7 @@ case "mkdir": if ($name) { - html_header(); + html_header($course, $wdir); $name = clean_filename($name); if (file_exists($basedir.$wdir."/".$name)) { echo "Error: $name already exists!"; @@ -234,7 +250,7 @@ displaydir($wdir); } else { - html_header("form.name"); + html_header($course, $wdir, "form.name"); echo "

Create folder in $wdir:"; echo "
"; echo ""; @@ -257,7 +273,7 @@ break; case "edit": - html_header(); + html_header($course, $wdir); if (isset($text)) { $fileptr = fopen($basedir.$file,"w"); fputs($fileptr, stripslashes($text)); @@ -280,14 +296,14 @@ echo htmlspecialchars($contents); echo ""; echo "
"; - echo " "; + echo " "; echo ""; echo ""; echo "
"; echo " "; echo " "; echo " "; - echo " "; + echo " "; echo "
"; echo "
"; } @@ -296,7 +312,7 @@ case "zip": if ($name) { - html_header(); + html_header($course, $wdir); $name = clean_filename($name); $files = ""; foreach ($USER->filelist as $file) { @@ -309,7 +325,7 @@ displaydir($wdir); } else { - html_header("form.name"); + html_header($course, $wdir, "form.name"); if (setfilelist($HTTP_POST_VARS)) { echo "

You are about create a zip file containing:

"; print_simple_box_start("center"); @@ -342,7 +358,7 @@ break; case "unzip": - html_header(); + html_header($course, $wdir); if ($file) { echo "

Unzipping $file:

"; print_simple_box_start("center"); @@ -369,7 +385,7 @@ clearfilelist(); default: - html_header(); + html_header($course, $wdir); displaydir($wdir); html_footer(); break; @@ -506,30 +522,37 @@ function displaydir ($wdir) { } closedir($directory); + $strname = get_string("name"); + $strsize = get_string("size"); + $strmodified = get_string("modified"); + $straction = get_string("action"); + $strmakeafolder = get_string("makeafolder"); + $struploadafile = get_string("uploadafile"); + $strwithchosenfiles = get_string("withchosenfiles"); + $strmovetoanotherfolder = get_string("movetoanotherfolder"); + $strmovefilestohere = get_string("movefilestohere"); + $strdeletecompletely = get_string("deletecompletely"); + $strcreateziparchive = get_string("createziparchive"); + $strrename = get_string("rename"); + $stredit = get_string("edit"); + $strunzip = get_string("unzip"); + echo "
"; echo "
"; echo ""; - echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo "\n"; if ($wdir == "/") { $wdir = ""; - } else { - $updir = dirname($wdir); - echo ""; - print_cell("center", ""); - print_cell("left", "\"ParentUp to $updir"); - echo "\n"; } - $count = 0; if ($dirlist) { @@ -549,7 +572,7 @@ function displaydir ($wdir) { print_cell("left", "\"Folder\"".htmlspecialchars($dir).""); print_cell("right", "-"); print_cell("right", $filedate); - print_cell("right", "rename"); + print_cell("right", "$strrename"); echo ""; } @@ -590,13 +613,13 @@ function displaydir ($wdir) { print_cell("right", display_size($filename)); print_cell("right", $filedate); if ($icon == "text.gif" || $icon == "html.gif") { - $edittext = "edit"; + $edittext = "$stredit"; } else if ($icon == "zip.gif") { - $edittext = "unzip"; + $edittext = "$strunzip"; } else { $edittext = ""; } - print_cell("right", "$edittext rename"); + print_cell("right", "$edittext $strrename"); echo ""; } @@ -613,13 +636,12 @@ function displaydir ($wdir) { echo ""; echo " "; $options = array ( - "move" => "Move to another folder", - "delete" => "Delete completely", - "zip" => "Create zip archive" + "move" => "$strmovetoanotherfolder", + "delete" => "$strdeletecompletely", + "zip" => "$strcreateziparchive" ); if ($count) { - choose_from_menu ($options, "action", "", $nothing="With chosen files...", "javascript:document.dirform.submit()"); - //echo ""; + choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:document.dirform.submit()"); } echo ""; @@ -629,7 +651,7 @@ function displaydir ($wdir) { echo " "; echo " "; echo " "; - echo " "; + echo " "; echo ""; } echo ""; echo ""; echo "
 

Current folder: $wdir

"; echo "
NameSizeModifiedAction$strname$strsize$strmodified$straction
"; @@ -637,7 +659,7 @@ function displaydir ($wdir) { echo " "; echo " "; echo " "; - echo " "; + echo " "; echo ""; echo ""; @@ -645,7 +667,7 @@ function displaydir ($wdir) { echo " "; echo " "; echo " "; - echo " "; + echo " "; echo ""; echo "
";