Skip to content

Commit

Permalink
Changes for XHTML, accessibility compatibility.
Browse files Browse the repository at this point in the history
Removed THEME variable, inserted CSS classes where appropriate. (SE)
  • Loading branch information
moodler committed Mar 24, 2005
1 parent 0137684 commit 6aed9d1
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 102 deletions.
30 changes: 13 additions & 17 deletions mod/journal/edit.html
@@ -1,38 +1,34 @@
<form name="theform" method="post" action="edit.php">
<table cellpadding="10" cellspacing="0" class="generalbox">
<tr><td align="right" bgcolor="<?php echo $THEME->cellheading2 ?>">
<font size="1">
<?php
helpbutton("reading", get_string("helpreading"), "moodle", true, true);
echo "<br />";
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton('reading', get_string('helpreading'), 'moodle', true, true);
echo '<br />';
helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
echo '<br />';
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true);
} else {
emoticonhelpbutton("theform", "text");
emoticonhelpbutton('theform', 'text');
}
echo '<br />';
?>
<br />
</font>
</td></tr>
<tr><td align="center" bgcolor="<?php echo $THEME->cellheading2 ?>">
<?php print_textarea($usehtmleditor, 20, 60, 630, 400, "text", $entry->text); ?>
</td></tr>
<tr><td align="center" bgcolor="<?php echo $THEME->cellheading2 ?>">
<?php
print_string("formattexttype");
echo ":&nbsp;";
choose_from_menu(format_text_menu(), "format", $entry->format, "");
echo "<font size=\"1\">";
helpbutton("textformat", get_string("helpformatting"));
echo "</font>";
print_string('formattexttype');
echo ':&nbsp;';
choose_from_menu(format_text_menu(), 'format', $entry->format, '');
helpbutton('textformat', get_string('helpformatting'));
?>
</td></tr>
<tr><td align="center" bgcolor="<?php echo $THEME->cellheading2 ?>" class="generalboxcontent">
<input type="hidden" name="id" value="<?php echo $cm->id ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
<input type="reset" value="<?php print_string("revert") ?>" />
<input type="submit" value="<?php print_string('savechanges') ?>" />
<input type="reset" value="<?php print_string('revert') ?>" />
</td></tr></table>
</form>

44 changes: 24 additions & 20 deletions mod/journal/lib.php
Expand Up @@ -516,35 +516,39 @@ function journal_delete_instance($id) {
function journal_print_feedback($course, $entry, $grades) {
global $CFG, $THEME;

if (! $teacher = get_record("user", "id", $entry->teacher)) {
error("Weird journal error");
if (! $teacher = get_record('user', 'id', $entry->teacher)) {
error('Weird journal error');
}

echo "\n<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\" align=\"center\"><tr><td bgcolor=#888888>";
echo "\n<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" valign=\"top\">";
// echo "\n<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" valign=\"top\">";
echo '<table cellspacing="0" class="feedbackbox"';

echo "\n<tr>";
echo "\n<td rowspan=\"3\" bgcolor=\"$THEME->body\" width=\"35\" valign=\"top\">";
echo '<tr>';
echo '<td class="left picture">';
print_user_picture($teacher->id, $course->id, $teacher->picture);
echo "</td>";
echo "<td nowrap=\"nowrap\" width=\"100%\" bgcolor=\"$THEME->cellheading\">".fullname($teacher);
echo "&nbsp;&nbsp;<font size=\"2\"><i>".userdate($entry->timemarked)."</i>";
echo "</tr>";

echo "\n<tr><td width=\"100%\" bgcolor=\"$THEME->cellcontent\">";

echo "<p align=\"right\"><font size=\"-1\"><i>";
if ($grades[$entry->rating]) {
echo get_string("grade").": ";
echo '</td>';
echo '<td class="entryheader">';
// echo "<td nowrap=\"nowrap\" width=\"100%\" bgcolor=\"$THEME->cellheading\">";
echo '<span class="author">'.fullname($teacher).'</span>';
echo '&nbsp;&nbsp;<span class="time">'.userdate($entry->timemarked).'</span>';
echo '</tr>';

echo '<tr>';
echo '<td class="left side">&nbsp;</td>';
echo '<td class="entrycontent">';

echo '<div class="grade">';

if (!empty($entry->rating) and !empty($grades[$entry->rating])) {
echo get_string('grade').': ';
echo $grades[$entry->rating];
} else {
print_string("nograde");
print_string('nograde');
}
echo "</i></font></p>";
echo '</div>';

echo format_text($entry->comment);
echo "</td></tr></table>";
echo "</td></tr></table>";
echo '</td></tr></table>';
}

?>
83 changes: 41 additions & 42 deletions mod/journal/mod.html
@@ -1,63 +1,62 @@
<?php
if (!isset($form->name)) {
$form->name = "";
$form->name = '';
}
if (!isset($form->intro)) {
$form->intro = "";
$form->intro = '';
}
if (!isset($form->assessed)) {
$form->assessed = "0";
$form->assessed = '0';
}
if (!isset($form->days)) {
if ($course->format == "weeks") {
$form->days = "7";
if ($course->format == 'weeks') {
$form->days = '7';
} else {
$form->days = "0";
$form->days = '0';
}
}
?>

<form name="form" method="post" action="mod.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><p><b><?php print_string("journalname", "journal") ?>:</b></p></td>
<td align="right"><strong><?php print_string('journalname', 'journal') ?>:</strong></td>
<td>
<input type="text" name="name" size="30" value="<?php p($form->name) ?>" />
<input type="text" name="name" size="30" value="<?php p($form->name) ?>" alt="<?php print_string('journalname', 'journal') ?>"/>
</td>
</tr>

<tr valign="top">
<td align="right"><p><b><?php print_string("journalquestion", "journal") ?>:</b></p>
<font size="1">
<td align="right"><strong><?php print_string('journalquestion', 'journal') ?>:</strong>
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
echo "<br />";
echo '<br />';
helpbutton('writing', get_string('helpwriting'), 'moodle', true, true);
echo '<br />';
helpbutton('questions', get_string('helpquestions'), 'moodle', true, true);
echo '<br />';
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
helpbutton('richtext', get_string('helprichtext'), 'moodle', true, true);
} else {
emoticonhelpbutton("form", "intro");
emoticonhelpbutton('form', 'intro');
}
echo '<br />';
?>
<br />
</font>
</td>
<td>
<?php
print_textarea($usehtmleditor, 20, 60, 680, 400, "intro", $form->intro);
print_textarea($usehtmleditor, 20, 60, 680, 400, 'intro', $form->intro);

if ($usehtmleditor) {
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
} else {
echo "<p align=\"right\">";
helpbutton("textformat", get_string("formattexttype"));
print_string("formattexttype");
echo ":&nbsp;";
echo '<p align="right">';
helpbutton('textformat', get_string('formattexttype'));
print_string('formattexttype');
echo ':&nbsp;';
if (!$form->introformat) {
$form->introformat = $defaultformat;
}
choose_from_menu(format_text_menu(), "introformat", $form->introformat, "");
choose_from_menu(format_text_menu(), 'introformat', $form->introformat, '');
echo "</p>";
}
?>
Expand All @@ -66,43 +65,43 @@


<tr valign="top">
<td align="right"><p><b><?php print_string("grade") ?>:</b></p></td>
<td align="right"><strong><?php print_string('grade') ?>:</strong></td>
<td>
<?php
print_grade_menu($course->id, "assessed", "$form->assessed");
print_grade_menu($course->id, 'assessed', "$form->assessed");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("daysavailable", "journal") ?>:</b></p></td>
<td align="right"><strong><?php print_string('daysavailable', 'journal') ?>:</strong></td>
<td>
<?php
$options = array();
$options[0] = get_string("alwaysopen", "journal");
$options[0] = get_string('alwaysopen', 'journal');
for ($i=1;$i<=13;$i++) {
$options[$i] = get_string("numdays", "", $i);
$options[$i] = get_string('numdays', '', $i);
}
for ($i=2;$i<=16;$i++) {
$days = $i * 7;
$options[$days] = get_string("numweeks", "", $i);
$options[$days] = get_string('numweeks', '', $i);
}
$options[365] = get_string("numweeks", "", 52);
choose_from_menu($options, "days", "$form->days");
$options[365] = get_string('numweeks', '', 52);
choose_from_menu($options, 'days', "$form->days");
?>
</td>
</tr>
<?php print_standard_coursemodule_settings($form); ?>
</table>
<center>
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
<input type="hidden" name="section" value="<?php p($form->section) ?>" />
<input type="hidden" name="module" value="<?php p($form->module) ?>" />
<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
<input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
</form>
<input type="hidden" name="section" value="<?php p($form->section) ?>" />
<input type="hidden" name="module" value="<?php p($form->module) ?>" />
<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
<input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
<input type="submit" value="<?php print_string('savechanges') ?>" />
<input type="submit" name="cancel" value="<?php print_string('cancel') ?>" />
</center>
</form>
48 changes: 25 additions & 23 deletions mod/journal/view.php
Expand Up @@ -43,25 +43,25 @@
$entrycount = journal_count_entries($journal, $currentgroup);

echo "<p align=\"right\"><a href=\"report.php?id=$cm->id\">".
get_string("viewallentries","journal", $entrycount)."</a>$groupname</p>";
get_string('viewallentries','journal', $entrycount)."</a>$groupname</p>";

} else if (!$cm->visible) {
notice(get_string("activityiscurrentlyhidden"));
notice(get_string('activityiscurrentlyhidden'));
}

echo "<center>\n";
echo '<center>';

$journal->intro = trim($journal->intro);

if (!empty($journal->intro)) {
print_simple_box( format_text($journal->intro, $journal->introformat), 'center', '70%', '', 5, 'generalbox', 'intro');
}

echo "<br />";
echo '<br />';

$timenow = time();

if ($course->format == "weeks" and $journal->days) {
if ($course->format == 'weeks' and $journal->days) {
$timestart = $course->startdate + (($cw->section - 1) * 604800);
if ($journal->days) {
$timefinish = $timestart + (3600 * 24 * $journal->days);
Expand All @@ -77,60 +77,62 @@

if ($timenow > $timestart) {

print_simple_box_start("center");
print_simple_box_start('center');

if ($timenow < $timefinish) {
$options = array ("id" => "$cm->id");
echo "<center>";
$options = array ('id' => "$cm->id");
echo '<center>';
if (!isguest()) {
print_single_button("edit.php", $options, get_string("startoredit","journal"));
print_single_button('edit.php', $options, get_string('startoredit','journal'));
}
echo "</center>";
echo '</center>';
}


if ($entry = get_record("journal_entries", "userid", $USER->id, "journal", $journal->id)) {
if ($entry = get_record('journal_entries', 'userid', $USER->id, 'journal', $journal->id)) {

if (empty($entry->text)) {
echo "<p align=\"center\"><b>".get_string("blankentry","journal")."</b></p>";
echo '<p align="center"><b>'.get_string('blankentry','journal').'</b></p>';
} else {
echo format_text($entry->text, $entry->format);
}

} else {
echo "<b><i>".get_string("notstarted","journal")."</i></b>";
echo '<span class="warning">'.get_string('notstarted','journal').'</span>';
}

print_simple_box_end();

if ($timenow < $timefinish) {
if ($entry->modified) {
echo "<p><font size=\"-2\"><b>".get_string("lastedited").":</b> ";
echo '<div class="lastedit"><strong>'.get_string('lastedited').':</strong> ';
echo userdate($entry->modified);
echo " (".get_string("numwords", "", count_words($entry->text)).")";
echo "</font></p>";
echo ' ('.get_string('numwords', '', count_words($entry->text)).')';
echo "</div>";
}
if ($journal->days) {
echo "<p><font size=\"-2\"><b>".get_string("editingends", "journal").":</b> ";
echo userdate($timefinish)."</font></p>";
echo '<div class="editend"><strong>'.get_string('editingends', 'journal').':</strong> ';
echo userdate($timefinish).'</div>';
}
} else {
echo "<p><font size=\"-2\"><b>".get_string("editingended", "journal").":</b> ";
echo userdate($timefinish)."</p>";
echo '<div class="editend"><strong>'.get_string('editingended', 'journal').':</strong> ';
echo userdate($timefinish).'</div>';
}

if ($entry->comment or $entry->rating) {
$grades = make_grades_menu($journal->assessed);
print_heading(get_string("feedback"));
print_heading(get_string('feedback'));
journal_print_feedback($course, $entry, $grades);
}


} else {
echo "<p><b>".get_string("notopenuntil", "journal").": ";
echo userdate($timestart)."</b></p>";
echo '<div class="warning">'.get_string('notopenuntil', 'journal').': ';
echo userdate($timestart).'</div>';
}

echo '</center>';

print_footer($course);

?>

0 comments on commit 6aed9d1

Please sign in to comment.