--- loncom/xml/lonxml.pm 2018/09/14 21:41:13 1.531.2.24
+++ loncom/xml/lonxml.pm 2024/12/28 22:47:34 1.531.2.28
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.531.2.24 2018/09/14 21:41:13 raeburn Exp $
+# $Id: lonxml.pm,v 1.531.2.28 2024/12/28 22:47:34 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");
@@ -1633,6 +1634,21 @@ sub renderingoptions {
return $output;
}
+sub setmode_javascript {
+ return <<"ENDSCRIPT";
+
+ENDSCRIPT
+}
+
sub inserteditinfo {
my ($filecontents,$filetype,$filename,$symb,$itemtitle,$folderpath,$uri,$action) = @_;
$filecontents = &HTML::Entities::encode($filecontents,'<>&"');
@@ -1708,7 +1724,7 @@ FULLPAGE
my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',
'vi' => 'Save and View',
'dv' => 'Discard Edits and View',
- 'un' => 'undo',
+ 'un' => 'Undo',
'ed' => 'Edit');
my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont');
my $textarea_events = &Apache::edit::element_change_detection();
@@ -1717,7 +1733,7 @@ FULLPAGE
if ($filetype eq 'html') {
$htmlerror=&verify_html($filecontents);
if ($htmlerror) {
- $htmlerror=''.$htmlerror.'';
+ $htmlerror=(' 'x3).' '.$htmlerror.'';
}
if (&Apache::lonhtmlcommon::htmlareabrowser()) {
unless ($textareaclass) {
@@ -1725,14 +1741,23 @@ FULLPAGE
}
}
}
- my $undo;
+ my ($undo,%onclick);
+ foreach my $item ('discard','undo') {
+ $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 = ''."\n";
+ $undo = ''."\n";
}
+ $initialize .= &setmode_javascript();
my $editfooter=(<