Changes for XHTML and accessibility compatibility.

General code cleanup.
This commit is contained in:
moodler 2005-01-21 04:23:38 +00:00
parent 79dd93a920
commit b1b1705aa4
2 changed files with 129 additions and 117 deletions

View file

@ -1,12 +1,12 @@
<?php
if (!isset($form->name)) {
$form->name = "";
$form->name = '';
}
if (!isset($form->type)) {
$form->type = "";
$form->type = '';
}
if (!isset($form->intro)) {
$form->intro = "";
$form->intro = '';
}
if (!isset($form->open)) {
$form->open = 2;
@ -42,73 +42,71 @@
<form name="form" method="post" action="mod.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string("forumname", "forum")?>:</b></td>
<td align="right"><b><?php print_string('forumname', 'forum')?>:</b></td>
<td>
<input type="text" name="name" size="30" value="<?php p($form->name) ?>" />
<input type="text" name="name" size="30" alt="<?php print_string('forumname', 'forum')?>" value="<?php p($form->name) ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("forumtype", "forum")?>:</b></td>
<td align="right"><b><?php print_string('forumtype', 'forum')?>:</b></td>
<td>
<?php
$student = strtolower($course->student);
require("$CFG->dirroot/mod/forum/lib.php");
asort($FORUM_TYPES);
if (! $form->type) {
$form->type = "general";
$form->type = 'general';
}
if ($form->type == "news") {
print_string("namenews", "forum");
echo "<input type=\"hidden\" name=\"type\" value=\"news\" />";
} else if ($form->type == "social") {
print_string("namesocial", "forum");
echo "<input type=\"hidden\" name=\"type\" value=\"social\" />";
if ($form->type == 'news') {
print_string('namenews', 'forum');
echo '<input type="hidden" name="type" value="news" />';
} else if ($form->type == 'social') {
print_string('namesocial', 'forum');
echo '<input type="hidden" name="type" value="social" />';
} else {
choose_from_menu($FORUM_TYPES, "type", $form->type, "");
helpbutton("forumtype", get_string("forumtype", "forum"), "forum");
choose_from_menu($FORUM_TYPES, 'type', $form->type, '');
helpbutton('forumtype', get_string('forumtype', 'forum'), 'forum');
}
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("forumintro", "forum")?>:</b><br />
<font size="1">
<td align="right"><b><?php print_string('forumintro', 'forum')?>:</b><br />
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
echo "<br />";
emoticonhelpbutton("form", "intro");
echo " <br />";
helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
echo '<br />';
helpbutton('questions', get_string('helpquestions'), 'moodle', true, true);
echo '<br />';
emoticonhelpbutton('form', 'intro');
echo '<br />';
?>
</font>
</td>
<td>
<?php print_textarea($usehtmleditor, 20, 50, 680, 400, "intro", $form->intro); ?>
<?php print_textarea($usehtmleditor, 20, 50, 680, 400, 'intro', $form->intro); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("allowdiscussions", "forum", strtolower("$course->student")) ?>:</b></td>
<td align="right"><b><?php print_string('allowdiscussions', 'forum', strtolower("$course->student")) ?>:</b></td>
<td>
<?php
choose_from_menu($FORUM_OPEN_MODES, "open", $form->open, "");
helpbutton("allowdiscussions", get_string("allowdiscussions",
"forum", moodle_strtolower("$course->student")), "forum");
choose_from_menu($FORUM_OPEN_MODES, 'open', $form->open, '');
helpbutton('allowdiscussions', get_string('allowdiscussions',
'forum', moodle_strtolower("$course->student")), 'forum');
?>
</td>
</tr>
<tr>
<td align="right"><b><?php print_string("forcesubscribeq", "forum") ?>:</b></td>
<td align="right"><b><?php print_string('forcesubscribeq', 'forum') ?>:</b></td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[0] = get_string('no');
$options[1] = get_string('yesforever', 'forum');
$options[FORUM_INITIALSUBSCRIBE] = get_string('yesinitially', 'forum');
choose_from_menu($options, "forcesubscribe", $form->forcesubscribe, "");
helpbutton("subscription2", get_string("forcesubscribeq", "forum"), "forum");
choose_from_menu($options, 'forcesubscribe', $form->forcesubscribe, '');
helpbutton('subscription2', get_string('forcesubscribeq', 'forum'), 'forum');
?>
</td>
</tr>
@ -127,123 +125,139 @@
<?php
//Only show rss parameters if rss is activated at site and forum levels
if ($CFG->enablerssfeeds && $CFG->forum_enablerssfeeds) {
echo "<tr valign=\"top\">";
echo "<td align=\"right\"><b>".get_string("rsstype").":</b></td>";
echo "<td>";
echo '<tr valign="top">';
echo '<td align="right"><b>'.get_string('rsstype').':</b></td>';
echo '<td>';
unset($choices);
$choices[0] = get_string("none");
$choices[1] = get_string("discussions", "forum");
$choices[2] = get_string("posts", "forum");
choose_from_menu ($choices, "rsstype", $form->rsstype, "");
helpbutton("rsstype", get_string("rsstype"), "forum");
echo "</td>";
echo "</tr>";
$choices[0] = get_string('none');
$choices[1] = get_string('discussions', 'forum');
$choices[2] = get_string('posts', 'forum');
choose_from_menu ($choices, 'rsstype', $form->rsstype, '');
helpbutton('rsstype', get_string('rsstype'), 'forum');
echo '</td>';
echo '</tr>';
echo "<tr valign=\"top\">";
echo "<td align=\"right\"><b>".get_string("rssarticles").":</b></td>";
echo "<td>";
echo '<tr valign="top">';
echo '<td align="right"><b>'.get_string('rssarticles').':</b></td>';
echo '<td>';
unset($choices);
$choices[0] = "0";
$choices[1] = "1";
$choices[2] = "2";
$choices[3] = "3";
$choices[4] = "4";
$choices[5] = "5";
$choices[10] = "10";
$choices[15] = "15";
$choices[20] = "20";
$choices[25] = "25";
$choices[30] = "30";
$choices[40] = "40";
$choices[50] = "50";
choose_from_menu ($choices, "rssarticles", $form->rssarticles, "");
helpbutton("rssarticles", get_string("rssarticles"), "forum");
echo "</td>";
echo "</tr>";
$choices[0] = '0';
$choices[1] = '1';
$choices[2] = '2';
$choices[3] = '3';
$choices[4] = '4';
$choices[5] = '5';
$choices[10] = '10';
$choices[15] = '15';
$choices[20] = '20';
$choices[25] = '25';
$choices[30] = '30';
$choices[40] = '40';
$choices[50] = '50';
choose_from_menu ($choices, 'rssarticles', $form->rssarticles, '');
helpbutton('rssarticles', get_string('rssarticles'), 'forum');
echo '</td>';
echo '</tr>';
}
?>
<tr>
<td align="right" valign="top"><b><?php print_string("allowratings", "forum") ?>:</b></td>
<td>
<table cellpadding="1">
<tr>
<td colspan="2">
<?php
echo "<script type=\"text/javascript\">";
echo '<script type="text/javascript">';
echo " var subitemstime = ['startday','startmonth','startyear','starthour', 'startminute',".
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
echo " var subitemsall = ['assessed', 'assesspublic', 'ratingtime', 'scale', ".
"'startday','startmonth','startyear','starthour', 'startminute',".
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
echo "</script>";
echo '</script>';
echo "<input name=\"userating\" type=\"checkbox\" value=\"1\" ";
echo '<input name="userating" type="checkbox" alt="'.get_string('ratingsuse', 'forum').'" value="1" ';
echo " onclick=\"return lockoptions('form','userating', subitemsall)\" ";
if ($form->assessed) {
echo " checked ";
echo ' checked="checked" ';
}
echo " />";
echo get_string("ratingsuse", "forum").":";
echo "<br />";
echo ' />';
echo '&nbsp;'.get_string('ratingsuse', 'forum').':';
echo '</td></tr>';
echo '<tr><td>';
// The odd order below was to maintain backward compatibility
unset($options);
$options[2] = get_string("ratingonlyteachers", "forum", moodle_strtolower($course->teachers));
$options[1] = get_string("ratingeveryone", "forum");
echo get_string("users").":";
choose_from_menu($options, "assessed", $form->assessed, "");
echo "<br />";
$options[2] = get_string('ratingonlyteachers', 'forum', moodle_strtolower($course->teachers));
$options[1] = get_string('ratingeveryone', 'forum');
echo get_string('users').': ';
echo '</td><td>';
choose_from_menu($options, 'assessed', $form->assessed, '');
echo '</td></tr>';
echo '<tr><td>';
unset($options);
$options[0] = get_string("ratingpublicnot", "forum", $course->students);
$options[1] = get_string("ratingpublic", "forum", $course->students);
echo get_string("view").":";
choose_from_menu($options, "assesspublic", $form->assesspublic, "");
echo "<br />";
$options[0] = get_string('ratingpublicnot', 'forum', $course->students);
$options[1] = get_string('ratingpublic', 'forum', $course->students);
echo get_string('view').': ';
echo '</td><td>';
choose_from_menu($options, 'assesspublic', $form->assesspublic, '');
echo '</td></tr>';
echo get_string("grade").":";
print_grade_menu($course->id, "scale", $form->scale, false);
echo "<br />";
echo '<tr><td>';
echo get_string('grade').': ';
echo '</td><td>';
print_grade_menu($course->id, 'scale', $form->scale, false);
echo '</td></tr>';
echo "<input name=\"ratingtime\" type=\"checkbox\" value=\"1\" ";
echo '<tr><td colspan="2">';
echo '<input name="ratingtime" type="checkbox" alt="'.get_string('ratingtime', 'forum').'"value="1" ';
echo " onclick=\"return lockoptions('form','ratingtime', subitemstime)\" ";
if ($form->assesstimestart and $form->assesstimefinish and $form->assessed) {
$form->ratingtime = 1;
echo " checked ";
echo ' checked="checked" ';
}
echo " />";
echo ' /> ';
print_string('ratingtime', 'forum');
print_string("ratingtime", "forum");
echo "<table align=\"left\"><tr><td align=\"right\" nowrap=\"nowrap\">";
echo get_string("from").":";
print_date_selector("startday", "startmonth", "startyear", $form->assesstimestart);
print_time_selector("starthour", "startminute", $form->assesstimestart);
echo "<br />";
echo get_string("to").":";
print_date_selector("finishday", "finishmonth", "finishyear", $form->assesstimefinish);
print_time_selector("finishhour", "finishminute", $form->assesstimefinish);
echo "<br />";
echo "</td></tr></table>";
echo "<input type=\"hidden\" name=\"hratingtime\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hassessed\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hassesspublic\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hscale\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hstartday\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hstartmonth\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hstartyear\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hstarthour\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hstartminute\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hfinishday\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hfinishmonth\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hfinishyear\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hfinishhour\" value=\"0\" />";
echo "<input type=\"hidden\" name=\"hfinishminute\" value=\"0\" />";
echo '</td></tr>';
echo '<tr><td>&nbsp</td><td>';
echo "<script type=\"text/javascript\">";
echo '<table align="left"><tr><td align="right" nowrap="nowrap">';
echo get_string('from').': ';
print_date_selector('startday', 'startmonth', 'startyear', $form->assesstimestart);
print_time_selector('starthour', 'startminute', $form->assesstimestart);
echo '<br />';
echo get_string('to').': ';
print_date_selector('finishday', 'finishmonth', 'finishyear', $form->assesstimefinish);
print_time_selector('finishhour', 'finishminute', $form->assesstimefinish);
echo '<br />';
echo '</td></tr></table>';
echo '</td></tr></table>';
echo '<input type="hidden" name="hratingtime" value="0" />';
echo '<input type="hidden" name="hassessed" value="0" />';
echo '<input type="hidden" name="hassesspublic" value="0" />';
echo '<input type="hidden" name="hscale" value="0" />';
echo '<input type="hidden" name="hstartday" value="0" />';
echo '<input type="hidden" name="hstartmonth" value="0" />';
echo '<input type="hidden" name="hstartyear" value="0" />';
echo '<input type="hidden" name="hstarthour" value="0" />';
echo '<input type="hidden" name="hstartminute" value="0" />';
echo '<input type="hidden" name="hfinishday" value="0" />';
echo '<input type="hidden" name="hfinishmonth" value="0" />';
echo '<input type="hidden" name="hfinishyear" value="0" />';
echo '<input type="hidden" name="hfinishhour" value="0" />';
echo '<input type="hidden" name="hfinishminute" value="0" />';
echo '<script type="text/javascript">';
echo "lockoptions('form','userating', subitemsall);";
echo "</script>";
echo '</script>';
if (empty($form->ratingtime)) {
echo "<script type=\"text/javascript\">";
echo '<script type="text/javascript">';
echo "lockoptions('form','ratingtime', subitemstime);";
echo "</script>";
echo '</script>';
}
?>
</td>

View file

@ -17,7 +17,6 @@
<tr valign="top">
<td align="right" valign="middle" nowrap="nowrap">
<font size="1">
<?php
helpbutton("reading", get_string("helpreading"), "moodle", true, true);
echo "<br />";
@ -32,7 +31,6 @@
}
?>
<br />
</font>
</td>
</tr>