--- loncom/xml/lonxml.pm	2011/12/01 04:14:12	1.525
+++ loncom/xml/lonxml.pm	2012/04/11 15:58:07	1.529
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.525 2011/12/01 04:14:12 raeburn Exp $
+# $Id: lonxml.pm,v 1.529 2012/04/11 15:58:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -113,6 +113,7 @@ use Apache::lonr();
 use Apache::lonlocal;
 use Apache::lonhtmlcommon();
 use Apache::functionplotresponse();
+use Apache::lonnavmaps();
 
 #====================================   Main subroutine: xmlparse  
 
@@ -210,8 +211,12 @@ sub xmlend {
     my $discussion;
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
 					   ['LONCAPA_INTERNAL_no_discussion']);
-    if (! exists($env{'form.LONCAPA_INTERNAL_no_discussion'}) ||
-        $env{'form.LONCAPA_INTERNAL_no_discussion'} ne 'true') {
+    if (
+           (   (!exists($env{'form.LONCAPA_INTERNAL_no_discussion'})) 
+            || ($env{'form.LONCAPA_INTERNAL_no_discussion'} ne 'true')
+           ) 
+        && ($env{'form.inhibitmenu'} ne 'yes')
+       ) {
         $discussion=&Apache::lonfeedback::list_discussion($mode,$status);
     }
     if ($target eq 'tex') {
@@ -301,7 +306,8 @@ sub xmlparse {
  &clean_safespace($safeeval);
 
  if (@script_var_displays) {
-     $finaloutput .= join('',@script_var_displays);
+     my $scriptoutput = join('',@script_var_displays);
+     $finaloutput=~s{(</body>\s*</html>)\s*$}{$scriptoutput$1}s;
      undef(@script_var_displays);
  }
  &init_state();
@@ -1496,7 +1502,8 @@ sub renderingoptions {
            {&Apache::lonlocal::texthash
                (''        => '',
                 'tth'     => 'tth (TeX to HTML)',
-                'jsMath'  => 'jsMath',
+                'MathJax' => 'MathJax',
+  		'jsMath'  => 'jsMath',
                 'mimetex' => 'mimetex (Convert to Images)')}).
      '</span>';
     return $output;
@@ -1783,7 +1790,22 @@ ENDNOTFOUND
 	if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'})))
 	{
 	    my $displayfile=$request->uri;
-	    $displayfile=~s/^\/[^\/]*//;
+            if ($displayfile =~ m{^/uploaded/}) {
+                if ($env{'request.course.id'}) {
+                    my $symb = &Apache::lonnet::symbread();
+                    my ($map,$id,$res)=&Apache::lonnet::decode_symb($symb);
+                    my $navmap=Apache::lonnavmaps::navmap->new;
+                    if (ref($navmap)) {
+                        my $res = $navmap->getBySymb($symb);
+                        my @pathitems = 
+                            &Apache::loncommon::get_folder_hierarchy($navmap,$map,1);
+                        push(@pathitems,$res->compTitle());
+                        $displayfile = join(' &raquo; ',@pathitems);
+                    }
+                }
+            } else {
+	        $displayfile=~s/^\/[^\/]*//;
+            }
 
 	    my ($edit_info, $add_to_onload, $add_to_onresize)=
 		&inserteditinfo($filecontents,$filetype,$displayfile);