--- loncom/xml/lonxml.pm	2024/07/07 21:43:24	1.531.2.26
+++ loncom/xml/lonxml.pm	2025/02/19 23:39:38	1.577
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
-# XML Parser Module 
+# XML Parser Module
 #
-# $Id: lonxml.pm,v 1.531.2.26 2024/07/07 21:43:24 raeburn Exp $
+# $Id: lonxml.pm,v 1.577 2025/02/19 23:39:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -25,13 +25,13 @@
 #
 # http://www.lon-capa.org/
 #
-# Copyright for TtHfunc and TtMfunc by Ian Hutchinson. 
-# TtHfunc and TtMfunc (the "Code") may be compiled and linked into 
-# binary executable programs or libraries distributed by the 
-# Michigan State University (the "Licensee"), but any binaries so 
+# Copyright for TtHfunc and TtMfunc by Ian Hutchinson.
+# TtHfunc and TtMfunc (the "Code") may be compiled and linked into
+# binary executable programs or libraries distributed by the
+# Michigan State University (the "Licensee"), but any binaries so
 # distributed are hereby licensed only for use in the context
-# of a program or computational system for which the Licensee is the 
-# primary author or distributor, and which performs substantial 
+# of a program or computational system for which the Licensee is the
+# primary author or distributor, and which performs substantial
 # additional tasks beyond the translation of (La)TeX into HTML.
 # The C source of the Code may not be distributed by the Licensee
 # to any other parties under any circumstances.
@@ -57,7 +57,7 @@ described at http://www.lon-capa.org.
 
 
 
-package Apache::lonxml; 
+package Apache::lonxml;
 use vars 
 qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace $errorcount $warningcount);
 use strict;
@@ -117,7 +117,7 @@ use Apache::lonhtmlcommon();
 use Apache::functionplotresponse();
 use Apache::lonnavmaps();
 
-#====================================   Main subroutine: xmlparse  
+#====================================   Main subroutine: xmlparse
 
 #debugging control, to turn on debugging modify the correct handler
 
@@ -208,7 +208,7 @@ sub xmlend {
     if ($Apache::lonhomework::parsing_a_problem ||
 	$Apache::lonhomework::parsing_a_task ) {
 	$mode='problem';
-	$status=$Apache::inputtags::status[-1]; 
+	$status=$Apache::inputtags::status[-1];
     }
     my $discussion;
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
@@ -230,103 +230,8 @@ sub xmlend {
     return $discussion;
 }
 
-sub tokeninputfield {
-    my $defhost=$Apache::lonnet::perlvar{'lonHostID'};
-    $defhost=~tr/a-z/A-Z/;
-    return (<<ENDINPUTFIELD)
-<script type="text/javascript">
-    function updatetoken() {
-        var comp=new Array;
-        var barcode=unescape(document.tokeninput.barcode.value);
-        comp=barcode.split('*');
-        if (typeof(comp[0])!="undefined") {
-            document.tokeninput.codeone.value=comp[0];
-        }
-        if (typeof(comp[1])!="undefined") {
-            document.tokeninput.codetwo.value=comp[1];
-        }
-        if (typeof(comp[2])!="undefined") {
-            comp[2]=comp[2].toUpperCase();
-            document.tokeninput.codethree.value=comp[2];
-        }
-        document.tokeninput.barcode.value='';
-    }
-</script>
-<form method="post" name="tokeninput" action="">
-<table border="2" bgcolor="#FFFFBB">
-<tr><th>DocID Checkin</th></tr>
-<tr><td>
-<table>
-<tr>
-<td>Scan in Barcode</td>
-<td><input type="text" size="22" name="barcode"
-onchange="updatetoken()"/></td>
-</tr>
-<tr><td><i>or</i> Type in DocID</td>
-<td>
-<input type="text" size="5" name="codeone" />
-<b><font size="+2">*</font></b>
-<input type="text" size="5" name="codetwo" />
-<b><font size="+2">*</font></b>
-<input type="text" size="10" name="codethree" value="$defhost"
-onchange="this.value=this.value.toUpperCase()" />
-</td></tr>
-</table>
-</td></tr>
-<tr><td><input type="submit" value="Check in DocID" /></td></tr>
-</table>
-</form>
-ENDINPUTFIELD
-}
-
-sub maketoken {
-    my ($symb,$tuname,$tudom,$tcrsid)=@_;
-    unless ($symb) {
-        $symb=&Apache::lonnet::symbread();
-    }
-    unless ($tuname) {
-        $tuname=$env{'user.name'};
-        $tudom=$env{'user.domain'};
-        $tcrsid=$env{'request.course.id'};
-    }
-    return &Apache::lonnet::checkout($symb,$tuname,$tudom,$tcrsid);
-}
-
-sub printtokenheader {
-    my ($target,$token,$tsymb,$tcrsid,$tudom,$tuname)=@_;
-    unless ($token) { return ''; }
-
-    my ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser();
-    unless ($tsymb) {
-        $tsymb=$symb;
-    }
-    unless ($tuname) {
-        $tuname=$name;
-        $tudom=$domain;
-        $tcrsid=$courseid;
-    }
-
-    my $plainname=&Apache::loncommon::plainname($tuname,$tudom);
-
-    if ($target eq 'web') {
-        my %idhash=&Apache::lonnet::idrget($tudom,($tuname));
-        return
- '<img align="right" src="/cgi-bin/barcode.png?encode='.$token.'" />'.
-               &mt('Checked out for').' '.$plainname.
-               '<br />'.&mt('User').': '.$tuname.' at '.$tudom.
-               '<br />'.&mt('ID').': '.$idhash{$tuname}.
-               '<br />'.&mt('CourseID').': '.$tcrsid.
-               '<br />'.&mt('Course').': '.$env{'course.'.$tcrsid.'.description'}.
-               '<br />'.&mt('DocID').': '.$token.
-               '<br />'.&mt('Time').': '.&Apache::lonlocal::locallocaltime().'<hr />';
-    } else {
-        return $token;
-    }
-}
-
 sub printalltags {
-    my $temp;
-    foreach $temp (sort keys %Apache::lonxml::alltags) {
+    foreach my $temp (sort(keys(%Apache::lonxml::alltags))) {
         &Apache::lonxml::debug("$temp -- ".
                                join(',',@{ $Apache::lonxml::alltags{$temp} }));
     }
@@ -412,7 +317,7 @@ sub xmlparse {
  }
  &init_state();
  if ($env{'form.return_only_error_and_warning_counts'}) {
-     if ($env{'request.filename'}=~/\.(html|htm|xml)$/i) { 
+     if ($env{'request.filename'}=~/\.(html|htm|xml)$/i) {
         my $error=&verify_html($content_file_string);
         if ($error) { $errorcount++; }
      }
@@ -438,7 +343,7 @@ sub latex_special_symbols {
         $string=~s/([^\\])\&/$1\\\&/g;
         $string=~s/([^\\])\#/$1\\\#/g;
 	$string =~ s/_/\\_/g;              # _ -> \_
-	$string =~ s/\^/\\\^{}/g;          # ^ -> \^{} 
+	$string =~ s/\^/\\\^{}/g;          # ^ -> \^{}
     } else {
 	$string=~s/\\/\\ensuremath{\\backslash}/g;
 	$string=~s/\\\%|\%/\\\%/g;
@@ -601,11 +506,11 @@ sub inner_xmlparse {
   if ($target eq 'modified') {
 # if modfied, handle startpart and endpart
      $finaloutput=~s/\<startpartmarker[^\>]*\>(.*)\<endpartmarker[^\>]*\>/<part>$1<\/part>/gs;
-  }	    
+  }
   return $finaloutput;
 }
 
-## 
+##
 ## Looks to see if there is a subroutine defined for this tag.  If so, call it,
 ## otherwise do not call it as we do not know what it is.
 ##
@@ -692,7 +597,7 @@ sub callsub {
     sub init_state {
 	undef(%state);
     }
-    
+
     sub set_state {
 	my ($key,$value) = @_;
 	$state{$key} = $value;
@@ -768,6 +673,7 @@ sub init_safespace {
   $safeeval->reval('use LONCAPA::LCMathComplex;');
   $safeeval->permit_only(":default");
   $safeeval->permit("entereval");
+  $safeeval->permit("hintseval");
   $safeeval->permit(":base_math");
   $safeeval->permit("sort");
   $safeeval->permit("time");
@@ -794,7 +700,7 @@ sub init_safespace {
   $safehole->wrap(\&Apache::lonr::r_check,$safeeval,'&r_check');
   $safehole->wrap(\&Apache::lonr::r_cas_formula_fix,$safeeval,
                   '&r_cas_formula_fix');
- 
+
   $safehole->wrap(\&Apache::caparesponse::capa_formula_fix,$safeeval,
 		  '&capa_formula_fix');
 
@@ -820,7 +726,7 @@ sub init_safespace {
   $safehole->wrap(\&Math::Cephes::y1,$safeeval,'&y1');
   $safehole->wrap(\&Math::Cephes::yn,$safeeval,'&yn');
   $safehole->wrap(\&Math::Cephes::yv,$safeeval,'&yv');
-  
+
   $safehole->wrap(\&Math::Cephes::bdtr  ,$safeeval,'&bdtr'  );
   $safehole->wrap(\&Math::Cephes::bdtrc ,$safeeval,'&bdtrc' );
   $safehole->wrap(\&Math::Cephes::bdtri ,$safeeval,'&bdtri' );
@@ -1091,7 +997,7 @@ sub decreasedepth {
 sub get_id {
     my ($parstack,$safeeval)=@_;
     my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
-    if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\s\-])/) { 
+    if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\s\-])/) {
 	&error(&mt('ID [_1] contains invalid characters. IDs are only allowed to contain letters, numbers, spaces and -','"<tt>'.$id.'</tt>"'));
     }
     if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }
@@ -1167,7 +1073,7 @@ sub increment_counter {
     }
     $Apache::lonxml::counter += $increment;
 
-    # If the caller supplied the response_id parameter, 
+    # If the caller supplied the response_id parameter,
     # Maintain its counter.. creating if necessary.
 
     if (defined($part_response)) {
@@ -1288,7 +1194,7 @@ sub set_bubble_lines {
 
 =item get_bubble_line_hash
 
-Returns the current bubble line hash.  This is assumed to 
+Returns the current bubble line hash.  This is assumed to
 be small so we return a copy
 
 
@@ -1314,8 +1220,8 @@ sub get_all_text {
     my $depth=0;
     my $token;
     my $result='';
-    if ( $tag =~ m:^/: ) { 
-	my $tag=substr($tag,1); 
+    if ( $tag =~ m:^/: ) {
+	my $tag=substr($tag,1);
 	#&Apache::lonxml::debug("have:$tag:");
 	my $top_empty=0;
 	while (($depth >=0) && ($#$pars > -1) && (!$top_empty)) {
@@ -1416,7 +1322,7 @@ sub newparser {
     push (@Apache::lonxml::pwd, $Apache::lonxml::pwd[$#Apache::lonxml::pwd]);
   } else {
     push (@Apache::lonxml::pwd, $dir);
-  } 
+  }
 }
 
 sub parstring {
@@ -1433,7 +1339,7 @@ sub parstring {
 	    push(@values,"\"$val\"");
 	}
     }
-    my $var_init = 
+    my $var_init =
 	(@vars) ? 'my ('.join(',',@vars).') = ('.join(',',@values).');'
 	        : '';
     return $var_init;
@@ -1633,21 +1539,6 @@ sub renderingoptions {
     return $output;
 }
 
-sub setmode_javascript {
-    return <<"ENDSCRIPT";
-<script type="text/javascript">
-// <![CDATA[
-function setmode(form,probmode) {
-    var initial = form.problemmode.value;
-    form.problemmode.value = probmode;
-    form.submit();
-    form.problemmode.value = initial;
-}
-// ]]>
-</script>
-ENDSCRIPT
-}
-
 sub inserteditinfo {
       my ($filecontents,$filetype,$filename,$symb,$itemtitle,$folderpath,$uri,$action) = @_;
       $filecontents = &HTML::Entities::encode($filecontents,'<>&"');
@@ -1723,8 +1614,10 @@ FULLPAGE
       my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',
 					 'vi' => 'Save and View',
 					 'dv' => 'Discard Edits and View',
-					 'un' => 'undo',
-					 'ed' => 'Edit');
+					 'un' => 'Undo',
+					 'ed' => 'Edit',
+					 'ew' => 'Edit with Daxe',
+					 'er' => 'Editor');
       my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont');
       my $textarea_events = &Apache::edit::element_change_detection();
       my $form_events     = &Apache::edit::form_change_detection();
@@ -1740,18 +1633,25 @@ FULLPAGE
               }
           }
       }
-      my ($undo,%onclick);
-      foreach my $item ('discard','undo') {
+      my ($undo,$daxebutton,%onclick);
+      foreach my $item ('discard','undo','daxe') {
           $onclick{$item} = 'onclick="still_ask=true;setmode(this.form,'."'$item'".')"';
       }
       foreach my $item ('saveedit','saveview') {
           $onclick{$item} = 'onclick="is_submit=true;setmode(this.form,'."'$item'".')"';
       }
       unless ($uri =~ m{^/uploaded/}) {
-          $undo = '<input type="submit" name="Undo" accesskey="u" value="'.$lt{'un'}.'" '.
-                  $onclick{'undo'}.' />'."\n"; 
+          $undo = '<input type="button" name="undo" accesskey="u" value="'.$lt{'un'}.'" '.
+                  $onclick{'undo'}.' />'."\n";
       }
       $initialize .= &setmode_javascript();
+      if ($filetype eq 'html') {
+          my %editors = &Apache::loncommon::permitted_editors($uri);
+          if ($editors{'daxe'}) {
+              $daxebutton = '<input type="button" name="editwithdaxe" accesskey="w" value="'.$lt{'ew'}.'" '.
+                            $onclick{'daxe'}.' />'."\n";
+          }
+      }
       my $editfooter=(<<ENDFOOTER);
 $initialize
 <a name="editsection" />
@@ -1770,10 +1670,10 @@ $initialize
     </div>
     <div>
       <input type="button" name="discardview" accesskey="d" value="$lt{'dv'}" $onclick{'discard'} />
-      $undo $deps_button $dragmath_button $htmlerror
+      $undo $deps_button $daxebutton $dragmath_button $htmlerror
     </div>
   </div>
-  <textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont" $textareaclass>$filecontents</textarea><br />$spelllink
+  <textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont" $textareaclass>$filecontents</textarea><br /><label for="filecont" class="LC_visually_hidden">$lt{'er'}</label>$spelllink
   <div id="LC_aftertextarea">
     <br />
     $titledisplay
@@ -1783,6 +1683,96 @@ ENDFOOTER
       return ($editfooter,$add_to_onload,$add_to_onresize);
 }
 
+sub setmode_javascript {
+    return <<"ENDSCRIPT";
+<script type="text/javascript">
+// <![CDATA[
+function setmode(form,probmode) {
+    if (probmode == 'daxe') {
+        var url = new URL(document.location.href);
+        window.location = url.protocol+'//'+url.hostname+'/daxepage'+url.pathname;
+    } else {
+        var initial = form.problemmode.value;
+        form.problemmode.value = probmode;
+        form.submit();
+        form.problemmode.value = initial;
+    }
+}
+// ]]>
+</script>
+ENDSCRIPT
+}
+
+sub seteditor_javascript {
+    my ($is_course_doc,$is_supp,$supp_path,$supp_title) = @_;
+    my $symb;
+    if ($is_course_doc) {
+        if (!$is_supp) {
+            ($symb) = &Apache::lonnet::whichuser();
+            if ($symb) {
+                $symb = &escape($symb);
+            }
+        }
+    }
+    return <<"ENDSCRIPT";
+<script type="text/javascript">
+// <![CDATA[
+function seteditmode(form,editor) {
+    var querystr = '';
+    var supplemental = '$is_supp';
+    var coursedoc = '$is_course_doc';
+    if (coursedoc)  {
+        if (supplemental) {
+            var supppath = '$supp_path';
+            var supptitle = '$supp_title';
+            if (supppath) {
+                querystr = 'folderpath='+supppath;
+            }
+            if (supptitle) {
+                if (querystr) {
+                    querystr += '&';
+                }
+                querystr += 'title='+supptitle;
+            }
+        }
+    }
+    if (editor == 'daxe') {
+        var url = new URL(document.location.href);
+        var newloc = url.protocol+'//'+url.hostname+'/daxepage'+url.pathname;
+        if (querystr) {
+            if (/\\?/.test(url.pathname)) {
+                newloc += '&';
+            } else {
+                newloc += '?';
+            }
+            newloc += querystr;
+        }
+        window.location = newloc;
+    } else {
+        if (coursedoc) {
+            var curraction = form.action;
+            var idx = curraction.indexOf('?');
+            if (idx !== -1) {
+                form.action = curraction.substring(0,idx);
+            }
+            form.action += '?forceedit=1&register=1';
+            if (querystr) {
+                form.action += '&'+querystr;
+            }
+        }
+        if (editor == 'edit') {
+            form.editmode.value = editor;
+        } else {
+            form.editmode.value = '';
+        }
+        form.submit();
+    }
+}
+// ]]>
+</script>
+ENDSCRIPT
+}
+
 sub get_target {
   my $viewgrades=&Apache::lonnet::allowed('vgr',$env{'request.course.id'});
   if ( $env{'request.state'} eq 'published') {
@@ -1815,7 +1805,7 @@ sub handler {
 
     my $target=&get_target();
     $Apache::lonxml::debug=$env{'user.debug'};
-    
+
     &Apache::loncommon::content_type($request,'text/html');
     &Apache::loncommon::no_cache($request);
     if ($env{'request.state'} eq 'published') {
@@ -1823,7 +1813,7 @@ sub handler {
 							      'lastrevisiondate'));
     }
     # Embedded Flash movies from Camtasia served from https will not display in IE
-    #   if XML config file has expired from cache.    
+    #   if XML config file has expired from cache.
     if ($ENV{'SERVER_PORT'} == 443) {
         if ($request->uri =~ /\.xml$/) {
             my ($httpbrowser,$clientbrowser) =
@@ -1838,7 +1828,7 @@ sub handler {
         }
     }
     $request->send_http_header;
-    
+ 
     return OK if $request->header_only;
 
 
@@ -1900,12 +1890,19 @@ sub handler {
     my $result = '';
     my $filecontents=&Apache::lonnet::getfile($file);
     if ($filecontents eq -1) {
-	my $start_page=&Apache::loncommon::start_page('File Error');
-	my $end_page=&Apache::loncommon::end_page();
-        my $errormsg='<p class="LC_error">'
-                    .&mt('File not found: [_1]'
-                        ,'<span class="LC_filename">'.$file.'</span>')
-                    .'</p>';
+	my ($start_page,$end_page,$errormsg);
+	$start_page=&Apache::loncommon::start_page('File Error');
+	if ($target eq 'web') {
+	    $start_page .= '<div class="LC_landmark" style="clear:both" role="menu">'.
+	                   '<h1 class="LC_visually_hidden">'.
+	                   &mt('File not found').'</h1>';
+	    $end_page = '</div>';
+	}
+	$end_page .= &Apache::loncommon::end_page();
+	$errormsg='<p class="LC_error">'
+	         .&mt('File not found: [_1]'
+	             ,'<span class="LC_filename">'.$file.'</span>')
+	         .'</p>';
 	$result=(<<ENDNOTFOUND);
 $start_page
 $errormsg
@@ -1961,7 +1958,7 @@ ENDNOTFOUND
                     $inhibit_menu = 1;
                 }
             }
-            if (($filetype ne 'html') && 
+            if (($filetype ne 'html') &&
                 (!$env{'form.return_only_error_and_warning_counts'}) &&
                 (!$inhibit_menu)) {
                 my $nochgview = 1;
@@ -1980,8 +1977,17 @@ ENDNOTFOUND
                 }
                 my $brcrum;
                 if ($env{'request.state'} eq 'construct') {
-                    $brcrum = [{'href' => &Apache::loncommon::authorspace($request->uri),
-                                'text' => 'Authoring Space'},
+                    my $text = 'Authoring Space';
+                    my $href = &Apache::loncommon::authorspace($request->uri);
+                    if ($env{'request.course.id'}) {
+                        my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+                        my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+                        if ($href eq "/priv/$cdom/$cnum/") {
+                            $text = 'Course Authoring Space';
+                        }
+                    }
+                    $brcrum = [{'href' => $href,
+                                'text' => $text,},
                                {'href' => '',
                                 'text' => $breadcrumbtext}];
                 } else {
@@ -2009,9 +2015,15 @@ ENDNOTFOUND
 	    $displayfile=$request->uri;
             if ($request->uri =~ m{^/uploaded/}) {
                 if ($env{'request.course.id'}) {
-                    if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/supplemental/\E}) {
-                        &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                                                ['folderpath','title']);
+                    if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/\E(docs|supplemental)/}) {
+                        if ($1 eq 'supplemental') {
+                            &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+                                                                    ['folderpath','title']);
+                        }
+                        if (($env{'request.state'} eq 'edit') && ($env{'form.editmode'} eq 'edit') &&
+                            ($filetype eq 'html')) {
+                            &Apache::lonhtmlcommon::clear_breadcrumbs();
+                        }
                     } elsif ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E(.+)$}) {
                         my $filename = $1;
                         if ($1 eq 'loncapa.html') {
@@ -2024,7 +2036,7 @@ ENDNOTFOUND
                     }
                 }
                 unless ($itemtitle) {
-                    ($symb,$itemtitle,$displayfile) = 
+                    ($symb,$itemtitle,$displayfile) =
                         &get_courseupload_hierarchy($request->uri,
                                                     $env{'form.folderpath'},
                                                     $env{'form.title'});
@@ -2037,15 +2049,24 @@ ENDNOTFOUND
 		&inserteditinfo($filecontents,$filetype,$displayfile,$symb,
                                 $itemtitle,$env{'form.folderpath'},$request->uri,$action);
 
-	    my %options = 
+	    my %options =
 		('add_entries' =>
                    {'onresize'     => $add_to_onresize,
                     'onload'       => $add_to_onload,   });
             my $header;
             if ($env{'request.state'} eq 'construct') {
+                my $text = 'Authoring Space';
+                my $href = &Apache::loncommon::authorspace($request->uri);
+                if ($env{'request.course.id'}) {
+                    my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+                    my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+                    if ($href eq "/priv/$cdom/$cnum/") {
+                        $text = 'Course Authoring Space';
+                    }
+                }
                 $options{'bread_crumbs'} = [{
-                            'href' => &Apache::loncommon::authorspace($request->uri),
-                            'text' => 'Authoring Space'},
+                            'href' => $href,
+                            'text' => $text},
                            {'href' => '',
                             'text' => $breadcrumbtext}];
                 $header = &Apache::loncommon::head_subbox(
@@ -2067,7 +2088,7 @@ ENDNOTFOUND
 
     &Apache::lonxml::add_messages(\$result);
     $request->print($result);
-    
+
     return OK;
 }
 
@@ -2100,6 +2121,7 @@ sub get_courseupload_hierarchy {
             }
             if ($title) {
                 push(@pathitems,&unescape($title));
+                $itemtitle = $title;
             }
             $displaypath = join(' &raquo; ',@pathitems);
         } else {
@@ -2137,7 +2159,7 @@ sub debug {
 }
 
 sub show_error_warn_msg {
-    if (($env{'request.filename'} eq 
+    if (($env{'request.filename'} eq
          $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/lib/templates/simpleproblem.problem') &&
         (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
 	return 1;
@@ -2232,7 +2254,7 @@ sub error {
 
 sub warning {
     $warningcount++;
-  
+
     if ($env{'form.grade_target'} ne 'tex') {
 	if ( &show_error_warn_msg() ) {
 	    push(@Apache::lonxml::warning_messages,
@@ -2247,7 +2269,7 @@ sub warning {
 }
 
 sub info {
-    if ($env{'form.grade_target'} ne 'tex' 
+    if ($env{'form.grade_target'} ne 'tex'
 	&& $env{'request.state'} eq 'construct') {
 	push(@Apache::lonxml::info_messages,join('<br />',@_)."<br />\n");
     }
@@ -2272,6 +2294,7 @@ sub add_messages {
 
 sub get_param {
     my ($param,$parstack,$safeeval,$context,$case_insensitive, $noelide) = @_;
+
     if ( ! $context ) { $context = -1; }
     my $args ='';
     if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }
@@ -2279,13 +2302,16 @@ sub get_param {
 	$args=$Apache::lonxml::style_values.$args;
     }
 
+
     if ($noelide) {
-        $args =~ s/'\$/'\\\$/g;
+#	$args =~ s/\\'/'/g;
+	$args =~ s/'\$/'\\\$/g;
     }
 
     if ( ! $args ) { return undef; }
     if ( $case_insensitive ) {
 	if ($args =~ s/(my (?:.*))(\$\Q$param\E[,\)])/$1.lc($2)/ei) {
+
 	    return &Apache::run::run("{$args;".'return $'.$param.'}',
                                      $safeeval); #'
 	} else {
@@ -2293,6 +2319,7 @@ sub get_param {
 	}
     } else {
 	if ( $args =~ /my .*\$\Q$param\E[,\)]/ ) {
+
 	    return &Apache::run::run("{$args;".'return $'.$param.'}',
                                      $safeeval); #'
 	} else {
@@ -2374,7 +2401,7 @@ sub register_insert_xml {
 	    }
 	}
     }
-    
+ 
     # parse the allows and ignore tags set to <show>no</show>
     foreach my $tag (@alltags) {	
         next if (!exists($insertlist{$tag.'.allow'}));
@@ -2480,7 +2507,7 @@ sub get_tag {
 =item &print_pdf_radiobutton(fieldname, value)
 
 Returns a latexline to generate a PDF-Form-Radiobutton.
-Note: Radiobuttons with equal names are automaticly grouped 
+Note: Radiobuttons with equal names are automaticly grouped
       in a selection-group.
 
 $fieldname: PDF internalname of the radiobutton(group)
@@ -2507,7 +2534,7 @@ sub print_pdf_start_combobox {
     my $result;
     my ($fieldName) = @_;
     $result .= '\begin{tabularx}{\textwidth}{p{2.5cm}X}'."\n";
-    $result .= '\comboBox[]{'.$fieldName.'}{2.3cm}{14bp}{'; # 
+    $result .= '\comboBox[]{'.$fieldName.'}{2.3cm}{14bp}{'; #
 
     return $result;
 }
@@ -2525,10 +2552,10 @@ $option: PDF internal name of the Combob
 sub print_pdf_add_combobox_option {
 
     my $result;
-    my ($option) = @_;  
+    my ($option) = @_;
 
     $result .= '('.$option.')';
-    
+ 
     return $result;
 }