From: moodler Date: Tue, 26 Aug 2003 06:01:13 +0000 (+0000) Subject: Some fixes so that navmenus don't jump out of frames any more. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=16ef5e7812e00d1fabbada996740aee456e7416e;p=moodle.git Some fixes so that navmenus don't jump out of frames any more. The navmenu function now takes a third parameter that specifies the window to change location of (default 'self', but could be "parent" or "top") --- diff --git a/lib/weblib.php b/lib/weblib.php index 0cecd60315..b8bb95dbc3 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -326,7 +326,7 @@ function choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc } } -function popup_form ($common, $options, $formname, $selected="", $nothing="choose", $help="", $helptext="", $return=false) { +function popup_form ($common, $options, $formname, $selected="", $nothing="choose", $help="", $helptext="", $return=false, $targetwindow="self") { /// Implements a complete little popup form /// $common = the URL up to the point of the variable that changes /// $options = A list of value-label pairs for the popup list @@ -343,7 +343,7 @@ function popup_form ($common, $options, $formname, $selected="", $nothing="choos } $startoutput = "
framename}\" name=$formname>"; - $output = "\n"; if ($nothing != "") { $output .= " \n"; @@ -1291,7 +1291,7 @@ function update_categories_button() { } } -function navmenu($course, $cm=NULL) { +function navmenu($course, $cm=NULL, $targetwindow="self") { // Given a course and a (current) coursemodule // This function returns a small popup menu with all the // course activity modules in it, as a navigation menu @@ -1337,7 +1337,8 @@ function navmenu($course, $cm=NULL) { } } - return popup_form("$CFG->wwwroot/mod/", $menu, "navmenu", $selected, get_string("jumpto"), "", "", true); + return popup_form("$CFG->wwwroot/mod/", $menu, "navmenu", $selected, get_string("jumpto"), + "", "", true, $targetwindow); } diff --git a/mod/resource/view.php b/mod/resource/view.php index ae339f9681..61a89e9326 100644 --- a/mod/resource/view.php +++ b/mod/resource/view.php @@ -64,7 +64,7 @@ print_header($pagetitle, "$course->fullname", "$navigation framename}\" href=\"$resource->reference\" title=\"$resource->reference\">$resource->name", "", "", true, - update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm)); + update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm, "parent")); echo "
".text_to_html($resource->summary, true, false)."
"; } else { @@ -98,10 +98,16 @@ // (could check for more embeddable media here...) if ($frameset == "top" or $embedded) { + if ($frameset == "top") { + $targetwindow = "parent"; + } else { + $targetwindow = "self"; + } + print_header($pagetitle, "$course->fullname", "$navigation framename\" HREF=\"$fullurl\">$resource->name", "", "", true, update_module_button($cm->id, $course->id, $strresource), - navmenu($course, $cm)); + navmenu($course, $cm, $targetwindow)); echo "
".text_to_html($resource->summary, true, false)."
"; add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id"); }