Recoded most of the left menu:

Got rid of a table
Restructured and added more div tags in the left menu (much more logical)
Reworked the styles for the left menu in the styles sheet (everything should be customizable via style sheet)
More compatible with MacIE5
Added styles to the individual links in the menu (allows styling the for currently selected page and for all the rest)
Cleaned up the left menu link generation in locallib.php
This commit is contained in:
michaelpenne 2005-10-05 22:45:38 +00:00
parent 0f24c257b6
commit d6941aff55
4 changed files with 65 additions and 54 deletions

View File

@ -6,20 +6,22 @@
// left menu code
if ($lesson->displayleft) {
if($firstpageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0)) {
echo '<table><tr valign="top"><td>';
// print the pages
echo '<form name="lessonpages2" method="post" action="view.php">';
echo '<input type="hidden" name="id" value="'. $cm->id .'" />';
echo '<input type="hidden" name="action" value="navigation" />';
echo '<input type="hidden" name="pageid" />';
echo "<table><tr><td valign=\"top\">";
echo "<div class=\"leftmenutable\">".get_string('lessonmenu', 'lesson')."<br />";
echo "<div class=\"main\">";
echo "<a href=\"../../course/view.php?id=$course->id\">".get_string("mainmenu", "lesson")."</a><br />"; echo "</div>";
echo '<div class="leftmenu">';
echo '<table><tr valign="top"><td>';
echo '<form name="lessonpages2" method="post" action="view.php">'."\n";
echo '<input type="hidden" name="id" value="'. $cm->id .'" />'."\n";
echo '<input type="hidden" name="action" value="navigation" />'."\n";
echo '<input type="hidden" name="pageid" />'."\n";
echo '<div class="leftmenu_container">'."\n";
echo '<div class="leftmenu_title">'.get_string('lessonmenu', 'lesson').'</div>'."\n";
echo '<div class="leftmenu_courselink">';
echo "<a href=\"../../course/view.php?id=$course->id\">".get_string("mainmenu", "lesson")."</a>";
echo '</div>'."\n";
echo '<div class="leftmenu_links">'."\n";
lesson_print_tree_menu($lesson->id, $firstpageid, $cm->id);
echo '</div></div></td></tr></table>'; //close lmlinks
echo '</form>';
echo '</div>'."\n";
echo '</div>'."\n";
echo '</form>'."\n";
echo '</td><td align="center" width="100%">';
}
}

View File

@ -894,10 +894,12 @@ function lesson_print_tree_menu($lessonid, $pageid, $id, $showpages=false) {
if(!$pages = get_records_select("lesson_pages", "lessonid = $lessonid")) {
error("Error: could not find lesson pages");
}
echo '<ul>';
while ($pageid != 0) {
lesson_print_tree_link_menu($pages[$pageid], $id, true);
$pageid = $pages[$pageid]->nextpageid;
}
echo '</ul>';
}
/*******************************************************************/
@ -918,28 +920,21 @@ function lesson_print_tree_link_menu($page, $id, $showpages=false) {
// set up some variables NoticeFix changed whole function
$output = "";
$close = false;
$link="id=$id&amp;action=navigation&amp;pageid=".$page->id;
$output = "<li>";
$class = ' class="leftmenu_not_selected_link" ';
if (isset($_REQUEST['pageid'])) {
if($page->id == $_REQUEST['pageid']) {
$close=true;
$output.="<em>";
$class = ' class="leftmenu_selected_link" ';
}
}
$output .= "<a href=\"view.php?id=$id&amp;action=navigation&amp;pageid=$page->id\">".format_string($page->title,true)."</a>\n";
$output .= '<li>';
if($close) {
$output.="</em>";
}
$output .= "</li>";
echo $output;
$output .= "<a $class href=\"view.php?id=$id&amp;action=navigation&amp;pageid=$page->id\">".format_string($page->title,true)."</a>\n";
$output .= "</li>";
echo $output;
}
/*******************************************************************/

View File

@ -10,28 +10,36 @@
*** Left Menu Styles
***/
.mod-lesson .leftmenutable {
.mod-lesson .leftmenu_container {
width:170px;
height:400px;
overflow:auto;
overflow:auto;
vertical-align:top;
padding-bottom: 15px; /* for the sake of MacIE5 only */
}
.mod-lesson .leftmenu_title {
}
.mod-lesson .leftmenu_courselink {
font-size:.9em;
}
.mod-lesson .leftmenu_links {
font-size:.85em;
font-style: none;
}
.mod-lesson .leftmenu_links ul {
list-style-type: none;
margin: 0px;
padding: 0px;
padding-top: 5px;
padding-left: 10px;
}
.mod-lesson .leftmenu a:link,
.mod-lesson .leftmenu a:active,
.mod-lesson .leftmenu a:visited,
.mod-lesson .leftmenu1 a:link,
.mod-lesson .leftmenu1 a:active,
.mod-lesson .leftmenu1 a:visited{
font-size:.7em;
vertical-align:top;
.mod-lesson .leftmenu_selected_link {
}
.mod-lesson .main a:link,
.mod-lesson .main a:active,
.mod-lesson .main a:visited{
font-size:.9em;
vertical-align:top;
.mod-lesson .leftmenu_not_selected_link {
}

View File

@ -436,20 +436,27 @@
echo '<table><tr valign="top"><td>';
if($firstpageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0)) {
// print the pages
echo '<form name="lessonpages2" method="post" action="view.php">';
echo '<input type="hidden" name="id" value="'. $cm->id .'" />';
echo '<input type="hidden" name="action" value="navigation" />';
echo '<input type="hidden" name="pageid" />';
echo "<table><tr><td valign=\"top\">";
echo "<div class=\"leftmenutable\">".get_string('lessonmenu', 'lesson')."<br />";
echo "<div class=\"main\">";
echo "<a href=\"../../course/view.php?id=$course->id\">".get_string("mainmenu", "lesson")."</a><br />"; echo "</div>";
echo '<div class="leftmenu">';
echo '<form name="lessonpages2" method="post" action="view.php">'."\n";
echo '<input type="hidden" name="id" value="'. $cm->id .'" />'."\n";
echo '<input type="hidden" name="action" value="navigation" />'."\n";
echo '<input type="hidden" name="pageid" />'."\n";
echo '<div class="leftmenu_container">'."\n";
echo '<div class="leftmenu_title">'.get_string('lessonmenu', 'lesson').'</div>'."\n";
echo '<div class="leftmenu_courselink">';
echo "<a href=\"../../course/view.php?id=$course->id\">".get_string("mainmenu", "lesson")."</a>";
echo '</div>'."\n";
echo '<div class="leftmenu_links">'."\n";
lesson_print_tree_menu($lesson->id, $firstpageid, $cm->id);
echo '</div></div></td></tr></table>'; //close lmlinks
echo '</form>';
echo '</div>'."\n";
echo '</div>'."\n";
echo '</form>'."\n";
}
echo '</td><td align="center" width="100%">';
if ($page->qtype == LESSON_BRANCHTABLE) {
$width = '';
} else {
$width = ' width="100%" ';
}
echo '</td><td align="center" '.$width.'>';
} elseif ($lesson->slideshow && $page->qtype == LESSON_BRANCHTABLE) {
echo '<table align="center"><tr><td>'; // only want this if no left menu
}
@ -461,7 +468,6 @@
height: ".$lesson->height."px;
width: ".$lesson->width."px;
overflow: auto;
border: 0px solid #ccc;
padding-right: 16px; /* for the benefit of macIE5 only */
/* \ commented backslash hack - recover from macIE5 workarounds, it will ignore the following rule */
padding-right: 0;