tried to make editing a lesson look nicer. Added generalbox class to tables and used tabs for selecting question types

This commit is contained in:
michaelpenne 2005-05-03 23:30:40 +00:00
parent f5c864efff
commit 9638a1f496
5 changed files with 27 additions and 36 deletions

View file

@ -39,8 +39,7 @@
<input type="hidden" name="pageid" value="<?PHP echo $pageid ?>" /> <input type="hidden" name="pageid" value="<?PHP echo $pageid ?>" />
<input type="hidden" name="qtype" value="<?PHP echo LESSON_BRANCHTABLE ?>" /> <input type="hidden" name="qtype" value="<?PHP echo LESSON_BRANCHTABLE ?>" />
<input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>" /> <input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>" />
<center><table cellpadding=5 border=1> <center><table class="generalbox" cellpadding=5 border=1>
<tr><td align="center">
<tr valign="top"> <tr valign="top">
<td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br /> <td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br />
<!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value="" /></td></tr> <!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value="" /></td></tr>

View file

@ -51,10 +51,9 @@
<input type="hidden" name="action" value="insertpage"> <input type="hidden" name="action" value="insertpage">
<input type="hidden" name="pageid" value="<?PHP echo $pageid ?>"> <input type="hidden" name="pageid" value="<?PHP echo $pageid ?>">
<input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>"> <input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>">
<center><table cellpadding=5 border=1> <center>
<?php <?php
echo "<tr><td align=\"center\"><b>"; echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
echo get_string("questiontype", "lesson").":</b> \n";
echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br>"; echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br>";
if (isset($_GET['qtype'])) { if (isset($_GET['qtype'])) {
$qtype = clean_param($_GET['qtype'], PARAM_INT); $qtype = clean_param($_GET['qtype'], PARAM_INT);
@ -62,13 +61,15 @@
"lesson.php?id=$cm->id&action=addpage&pageid=".$pageid.$linkadd); "lesson.php?id=$cm->id&action=addpage&pageid=".$pageid.$linkadd);
// NoticeFix rearraged // NoticeFix rearraged
if ( $qtype == LESSON_SHORTANSWER || $qtype == LESSON_MULTICHOICE ) { // only display this option for Multichoice and shortanswer if ( $qtype == LESSON_SHORTANSWER || $qtype == LESSON_MULTICHOICE ) { // only display this option for Multichoice and shortanswer
echo '<p>';
if ($qtype == LESSON_SHORTANSWER) { if ($qtype == LESSON_SHORTANSWER) {
echo "<br><br><b>".get_string("casesensitive", "lesson").":</b> \n"; echo "<b>".get_string("casesensitive", "lesson").":</b> \n";
} else { } else {
echo "<br><br><b>".get_string("multianswer", "lesson").":</b> \n"; echo "<b>".get_string("multianswer", "lesson").":</b> \n";
} }
echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added. echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo '</p>';
} }
} else { } else {
lesson_qtype_menu($LESSON_QUESTION_TYPE, LESSON_MULTICHOICE, lesson_qtype_menu($LESSON_QUESTION_TYPE, LESSON_MULTICHOICE,
@ -77,9 +78,8 @@
echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added. echo " <label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
} }
echo "</td></tr>\n";
?> ?>
<tr><td align="center"> <table cellpadding="5" class="generalbox" border="1">
<tr valign="top"> <tr valign="top">
<td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br /> <td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br />
<!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value=""></td></tr> <!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value=""></td></tr>

View file

@ -60,56 +60,52 @@
<input type="hidden" name="pageid" value="<?PHP echo $pageid ?>"> <input type="hidden" name="pageid" value="<?PHP echo $pageid ?>">
<input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>"> <input type="hidden" name="sesskey" value="<?PHP echo $USER->sesskey ?>">
<input type="hidden" name="redisplay" value="0"> <input type="hidden" name="redisplay" value="0">
<center><table cellpadding=5 border=1> <center>
<?php <?php
switch ($page->qtype) { switch ($page->qtype) {
case LESSON_MULTICHOICE : case LESSON_MULTICHOICE :
echo "<tr><td align=\"center\"><b>"; echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
echo get_string("questiontype", "lesson").":</b> \n";
echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br>"; echo helpbutton("questiontypes", get_string("questiontype", "lesson"), "lesson")."<br>";
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype, lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id", "lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
"document.editpage.redisplay.value=1;document.editpage.submit();"); "document.editpage.redisplay.value=1;document.editpage.submit();");
echo "<br><br><b>".get_string("multianswer", "lesson").":</b> \n"; echo "<p><b>".get_string("multianswer", "lesson").":</b> \n";
if ($page->qoption) { if ($page->qoption) {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\"/>"; //CDC hidden label added. echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\"/>"; //CDC hidden label added.
} else { } else {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added. echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
} }
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo "</td></tr>\n"; echo "</p>\n";
break; break;
case LESSON_SHORTANSWER : case LESSON_SHORTANSWER :
echo "<tr><td align=\"center\"><b>"; echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
echo get_string("questiontype", "lesson").":</b> \n";
echo helpbutton("questiontype", get_string("questiontype", "lesson"), "lesson")."<br>"; echo helpbutton("questiontype", get_string("questiontype", "lesson"), "lesson")."<br>";
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype, lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id", "lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
"document.editpage.redisplay.value=1;document.editpage.submit();"); "document.editpage.redisplay.value=1;document.editpage.submit();");
echo "<br><br><b>".get_string("casesensitive", "lesson").":</b> \n"; echo "<p><b>".get_string("casesensitive", "lesson").":</b> \n";
if ($page->qoption) { if ($page->qoption) {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\"/>"; //CDC hidden label added. echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\" checked=\"checked\"/>"; //CDC hidden label added.
} else { } else {
echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added. echo "<label for=\"qoption\" class=\"hidden-label\">Question Option</label><input type=\"checkbox\" id=\"qoption\" name=\"qoption\" value=\"1\"/>"; //CDC hidden label added.
} }
helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson"); helpbutton("questionoption", get_string("questionoption", "lesson"), "lesson");
echo "</td></tr>\n"; echo "</p>\n";
break; break;
case LESSON_TRUEFALSE : case LESSON_TRUEFALSE :
case LESSON_ESSAY : case LESSON_ESSAY :
case LESSON_MATCHING : case LESSON_MATCHING :
case LESSON_NUMERICAL : case LESSON_NUMERICAL :
echo "<tr><td align=\"center\"><b>"; echo '<b>'.get_string("questiontype", "lesson").":</b> \n";
echo get_string("questiontype", "lesson").":</b> \n";
echo helpbutton("questiontype", get_string("questiontype", "lesson"), "lesson")."<br>"; echo helpbutton("questiontype", get_string("questiontype", "lesson"), "lesson")."<br>";
lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype, lesson_qtype_menu($LESSON_QUESTION_TYPE, $page->qtype,
"lesson.php?id=$cm->id&action=editpage&pageid=$page->id", "lesson.php?id=$cm->id&action=editpage&pageid=$page->id",
"document.editpage.redisplay.value=1;document.editpage.submit();"); "document.editpage.redisplay.value=1;document.editpage.submit();");
echo "</td></tr>\n";
break; break;
} }
?> ?>
<tr><td align="center"> <table cellpadding="5" class="generalbox" border="1">
<tr valign="top"> <tr valign="top">
<td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br /> <td><b><?php print_string("pagetitle", "lesson"); ?>:</b><br />
<!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value="<?php p($page->title) ?>"></td> <!-- //CDC hidden-label added.--><label for="title" class="hidden-label">Title</label><input type="text" id="title" name="title" size="80" maxsize="255" value="<?php p($page->title) ?>"></td>

View file

@ -1113,20 +1113,16 @@ function lesson_calculate_ongoing_score($lesson, $userid, $retries, $return=fals
/*******************************************************************/ /*******************************************************************/
function lesson_qtype_menu($qtypes, $selected="", $link="", $onclick="") { function lesson_qtype_menu($qtypes, $selected="", $link="", $onclick="") {
// prints the question types for when editing and adding a page // prints the question types for when editing and adding a page
$tabs = array();
$output = ""; $tabrows = array();
foreach ($qtypes as $value => $label) {
if ($value == $selected) { foreach ($qtypes as $qtype => $qtypename) {
$output .= "<b>$label</b>"; $tabrows[] = new tabobject($qtype, "$link&amp;qtype=$qtype\" onClick=\"$onclick\"", $qtypename);
$output .= "<input type=\"hidden\" name=\"qtype\" value=\"$value\" /> \n";
} else {
$output .= "<a onClick=\"$onclick\" href=\"$link"."&qtype=$value\">$label</a>";
}
if ($label != end($qtypes)) {
$output .= " | ";
}
} }
echo $output; $tabs[] = $tabrows;
print_tabs($tabs, $selected);
echo "<input type=\"hidden\" name=\"qtype\" value=\"$selected\" /> \n";
} }
/*******************************************************************/ /*******************************************************************/

View file

@ -1296,7 +1296,7 @@
/// CDC-FLAG /// end tree code (note, there is an "}" below for an else above) /// CDC-FLAG /// end tree code (note, there is an "}" below for an else above)
while (true) { while (true) {
echo "<tr><td>\n"; echo "<tr><td>\n";
echo "<table width=\"100%\" border=\"1\"><tr><th colspan=\"2\">".format_string($page->title)."&nbsp;&nbsp;\n"; echo "<table width=\"100%\" border=\"1\" class=\"generalbox\"><tr><th colspan=\"2\">".format_string($page->title)."&nbsp;&nbsp;\n";
if (isteacheredit($course->id)) { if (isteacheredit($course->id)) {
if ($npages > 1) { if ($npages > 1) {
echo "<a title=\"".get_string("move")."\" href=\"lesson.php?id=$cm->id&amp;action=move&amp;pageid=$page->id\">\n". echo "<a title=\"".get_string("move")."\" href=\"lesson.php?id=$cm->id&amp;action=move&amp;pageid=$page->id\">\n".