--- loncom/xml/lonxml.pm 2023/12/29 23:40:37 1.531.2.24.2.1 +++ loncom/xml/lonxml.pm 2025/01/15 18:09:02 1.531.2.24.2.7 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.531.2.24.2.1 2023/12/29 23:40:37 raeburn Exp $ +# $Id: lonxml.pm,v 1.531.2.24.2.7 2025/01/15 18:09:02 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -768,6 +768,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"); @@ -1708,8 +1709,9 @@ 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'); my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont'); my $textarea_events = &Apache::edit::element_change_detection(); my $form_events = &Apache::edit::form_change_detection(); @@ -1717,7 +1719,7 @@ FULLPAGE if ($filetype eq 'html') { $htmlerror=&verify_html($filecontents); if ($htmlerror) { - $htmlerror=''.$htmlerror.''; + $htmlerror=(' 'x3).' '.$htmlerror.''; } if (&Apache::lonhtmlcommon::htmlareabrowser()) { unless ($textareaclass) { @@ -1725,7 +1727,7 @@ FULLPAGE } } } - my ($undo,%onclick); + my ($undo,$daxebutton,%onclick); foreach my $item ('discard','undo','daxe') { $onclick{$item} = 'onclick="still_ask=true;setmode(this.form,'."'$item'".')"'; } @@ -1733,10 +1735,17 @@ FULLPAGE $onclick{$item} = 'onclick="is_submit=true;setmode(this.form,'."'$item'".')"'; } unless ($uri =~ m{^/uploaded/}) { - $undo = ''."\n"; } $initialize .= &setmode_javascript(); + if ($filetype eq 'html') { + my %editors = &Apache::loncommon::permitted_editors($uri); + if ($editors{'daxe'}) { + $daxebutton = ''."\n"; + } + } my $editfooter=(< @@ -1755,7 +1764,7 @@ $initialize
- $undo $htmlerror $deps_button $dragmath_button + $undo $deps_button $daxebutton $dragmath_button $htmlerror

$spelllink @@ -1773,10 +1782,15 @@ sub setmode_javascript { @@ -1784,12 +1798,69 @@ 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"; @@ -2022,9 +2093,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') {