From 66a51452d900064e3a9afceb8ae5f3fa2ed5efdf Mon Sep 17 00:00:00 2001
From: moodler
Date: Sun, 21 Sep 2003 15:45:24 +0000
Subject: [PATCH] Changes from Mad Alex and Gustav Delius:
- make more of the HTML into XHTML
- add a $usexml parameter to print_header that sets up the page as XML
(in the first case, for MathML)
---
lib/weblib.php | 172 +++++++++++++++++++++++++++----------------------
1 file changed, 96 insertions(+), 76 deletions(-)
diff --git a/lib/weblib.php b/lib/weblib.php
index 08661a7574..02f0873cb3 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -273,7 +273,7 @@ function close_window_button() {
echo "\n";
@@ -298,11 +298,11 @@ function choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc
$javascript = "";
}
- $output = "\n";
+ $output = "\n";
if ($nothing) {
$output .= " $label) {
$output .= " framename}\" name=$formname>";
- $output = "\n";
+ $startoutput = "
";
$course = get_site();
$homepage = true;
} else {
@@ -834,14 +854,14 @@ function user_login_string($course, $user=NULL) {
if (isset($user->realuser)) {
if ($realuser = get_record("user", "id", $user->realuser)) {
- $realuserinfo = " [framename}\" href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=$realuser->id\">$realuser->firstname $realuser->lastname ] ";
+ $realuserinfo = " [framename}\" href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=$realuser->id\">$realuser->firstname $realuser->lastname ] ";
}
} else {
$realuserinfo = "";
}
if (isset($user->id) and $user->id) {
- $username = "framename}\" href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname ";
+ $username = "framename}\" href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname ";
$loggedinas = $realuserinfo.get_string("loggedinas", "moodle", "$username").
" (framename}\" href=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")." )";
} else {
@@ -915,15 +935,15 @@ function print_single_button($link, $options, $label="OK", $method="get") {
echo "";
+ echo " ";
}
function print_spacer($height=1, $width=1, $br=true) {
global $CFG;
- echo " wwwroot/pix/spacer.gif\" alt=\"\">";
+ echo " wwwroot/pix/spacer.gif\" alt=\"\" />";
if ($br) {
echo " \n";
}
@@ -944,16 +964,16 @@ function print_file_picture($path, $courseid=0, $height="", $width="", $link="")
echo "";
}
if (substr(strtolower($path), 0, 7) == "http://") {
- echo " ";
+ echo " ";
} else if ($courseid) {
- echo " slasharguments) { // Use this method if possible for better caching
echo "$CFG->wwwroot/file.php/$courseid/$path";
} else {
echo "$CFG->wwwroot/file.php?file=/$courseid/$path";
}
- echo "\">";
+ echo "\" />";
} else {
echo "Error: must pass URL or course";
}
@@ -966,7 +986,7 @@ function print_user_picture($userid, $courseid, $picture, $large=false, $returns
global $CFG, $THEME;
if ($link) {
- $output = " wwwroot/user/view.php?id=$userid&course=$courseid\">";
+ $output = " wwwroot/user/view.php?id=$userid&course=$courseid\">";
} else {
$output = "";
}
@@ -980,14 +1000,14 @@ function print_user_picture($userid, $courseid, $picture, $large=false, $returns
if ($picture) { // Print custom user picture
if ($CFG->slasharguments) { // Use this method if possible for better caching
$output .= " wwwroot/user/pix.php/$userid/$file.jpg\"".
- " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
+ " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
} else {
$output .= " wwwroot/user/pix.php?file=/$userid/$file.jpg\"".
- " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
+ " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
}
} else { // Print default user pictures (use theme version if available)
$output .= " pixpath/u/$file.png\"".
- " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\">";
+ " border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
}
if ($link) {
$output .= " ";
@@ -1033,7 +1053,7 @@ function print_table($table) {
if (isset($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
- $wrap[$key] = " nowrap ";
+ $wrap[$key] = " nowrap=\"nowrap\" ";
} else {
$wrap[$key] = "";
}
@@ -1053,7 +1073,7 @@ function print_table($table) {
}
print_simple_box_start("center", "$table->width", "#ffffff", 0);
- echo "cellpadding\" cellspacing=\"$table->cellspacing\" class=\"generaltable\">\n";
if (!empty($table->head)) {
@@ -1065,13 +1085,13 @@ function print_table($table) {
if (!isset($align[$key])) {
$align[$key] = "";
}
- echo "";
+ echo "";
}
- echo "\n";
+ echo "\n";
}
foreach ($table->data as $row) {
- echo "";
+ echo " ";
foreach ($row as $key => $item) {
if (!isset($size[$key])) {
$size[$key] = "";
@@ -1128,7 +1148,7 @@ function make_table($table) {
if (isset($table->wrap)) {
foreach ($table->wrap as $key => $ww) {
if ($ww) {
- $wrap[$key] = " nowrap ";
+ $wrap[$key] = " nowrap=\"nowrap\" ";
} else {
$wrap[$key] = "";
}
@@ -1161,7 +1181,7 @@ function make_table($table) {
$fontsize = "fontsize\">";
}
- $output = "width\" valign=top align=\"$table->tablealign\" ";
+ $output = "width\" valign=\"top\" align=\"$table->tablealign\" ";
$output .= " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" class=\"$table->class\">\n";
if (!empty($table->head)) {
@@ -1173,13 +1193,13 @@ function make_table($table) {
if (!isset($align[$key])) {
$align[$key] = "";
}
- $output .= "class}header\">$fontsize$heading ";
+ $output .= "class}header\">$fontsize$heading ";
}
$output .= "\n";
}
foreach ($table->data as $row) {
- $output .= "";
+ $output .= " ";
foreach ($row as $key => $item) {
if (!isset($size[$key])) {
$size[$key] = "";
@@ -1204,15 +1224,15 @@ function print_textarea($richedit, $rows, $cols, $width, $height, $name, $value=
global $CFG, $THEME;
if ($richedit) {
- echo "wwwroot/lib/rte/richedit.html\"";
echo " width=\"$width\" height=\"$height\" ";
- echo " type=\"text/x-scriptlet\" VIEWASTEXT> \n";
- echo "