version 1.531.2.24.2.7, 2025/01/15 18:09:02
|
version 1.531.2.25, 2024/07/04 15:50:20
|
Line 768 sub init_safespace {
|
Line 768 sub init_safespace {
|
$safeeval->reval('use LONCAPA::LCMathComplex;'); |
$safeeval->reval('use LONCAPA::LCMathComplex;'); |
$safeeval->permit_only(":default"); |
$safeeval->permit_only(":default"); |
$safeeval->permit("entereval"); |
$safeeval->permit("entereval"); |
$safeeval->permit("hintseval"); |
|
$safeeval->permit(":base_math"); |
$safeeval->permit(":base_math"); |
$safeeval->permit("sort"); |
$safeeval->permit("sort"); |
$safeeval->permit("time"); |
$safeeval->permit("time"); |
Line 1709 FULLPAGE
|
Line 1708 FULLPAGE
|
my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit', |
my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit', |
'vi' => 'Save and View', |
'vi' => 'Save and View', |
'dv' => 'Discard Edits and View', |
'dv' => 'Discard Edits and View', |
'un' => 'Undo', |
'un' => 'undo', |
'ed' => 'Edit', |
'ed' => 'Edit'); |
'ew' => 'Edit with Daxe'); |
|
my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
my $textarea_events = &Apache::edit::element_change_detection(); |
my $textarea_events = &Apache::edit::element_change_detection(); |
my $form_events = &Apache::edit::form_change_detection(); |
my $form_events = &Apache::edit::form_change_detection(); |
Line 1727 FULLPAGE
|
Line 1725 FULLPAGE
|
} |
} |
} |
} |
} |
} |
my ($undo,$daxebutton,%onclick); |
my ($undo,%onclick); |
foreach my $item ('discard','undo','daxe') { |
foreach my $item ('discard','undo') { |
$onclick{$item} = 'onclick="still_ask=true;setmode(this.form,'."'$item'".')"'; |
$onclick{$item} = 'onclick="still_ask=true;setmode(this.form,'."'$item'".')"'; |
} |
} |
foreach my $item ('saveedit','saveview') { |
foreach my $item ('saveedit','saveview') { |
$onclick{$item} = 'onclick="is_submit=true;setmode(this.form,'."'$item'".')"'; |
$onclick{$item} = 'onclick="is_submit=true;setmode(this.form,'."'$item'".')"'; |
} |
} |
unless ($uri =~ m{^/uploaded/}) { |
unless ($uri =~ m{^/uploaded/}) { |
$undo = '<input type="button" name="undo" accesskey="u" value="'.$lt{'un'}.'" '. |
$undo = '<input type="submit" name="Undo" accesskey="u" value="'.$lt{'un'}.'" '. |
$onclick{'undo'}.' />'."\n"; |
$onclick{'undo'}.' />'."\n"; |
} |
} |
$initialize .= &setmode_javascript(); |
$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); |
my $editfooter=(<<ENDFOOTER); |
$initialize |
$initialize |
<a name="editsection" /> |
<a name="editsection" /> |
Line 1764 $initialize
|
Line 1755 $initialize
|
</div> |
</div> |
<div> |
<div> |
<input type="button" name="discardview" accesskey="d" value="$lt{'dv'}" $onclick{'discard'} /> |
<input type="button" name="discardview" accesskey="d" value="$lt{'dv'}" $onclick{'discard'} /> |
$undo $deps_button $daxebutton $dragmath_button $htmlerror |
$undo $deps_button $dragmath_button $htmlerror |
</div> |
</div> |
</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 />$spelllink |
Line 1777 ENDFOOTER
|
Line 1768 ENDFOOTER
|
return ($editfooter,$add_to_onload,$add_to_onresize); |
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®ister=1'; |
|
if (querystr) { |
|
form.action += '&'+querystr; |
|
} |
|
} |
|
if (editor == 'edit') { |
|
form.editmode.value = editor; |
|
} else { |
|
form.editmode.value = ''; |
|
} |
|
form.submit(); |
|
} |
|
} |
|
// ]]> |
|
</script> |
|
ENDSCRIPT |
|
} |
|
|
|
sub get_target { |
sub get_target { |
my $viewgrades=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $viewgrades=&Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
if ( $env{'request.state'} eq 'published') { |
if ( $env{'request.state'} eq 'published') { |
Line 2016 ENDNOTFOUND
|
Line 1917 ENDNOTFOUND
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['editmode']); |
['editmode']); |
} |
} |
if ((!$env{'form.editmode'}) || |
if ((!$env{'form.editmode'}) || |
($env{'form.problemmode'} eq 'saveview') || |
($env{'form.problemmode'} eq 'saveview') || |
($env{'form.problemmode'} eq 'discard')) { |
($env{'form.problemmode'} eq 'discard')) { |
if ($filetype eq 'html' || $filetype eq 'sty') { |
if ($filetype eq 'html' || $filetype eq 'sty') { |
Line 2086 ENDNOTFOUND
|
Line 1987 ENDNOTFOUND
|
# Edit action? Insert editing commands |
# Edit action? Insert editing commands |
# |
# |
unless (($env{'request.state'} eq 'published') || ($inhibit_menu)) { |
unless (($env{'request.state'} eq 'published') || ($inhibit_menu)) { |
if (($env{'form.editmode'}) && |
if (($env{'form.editmode'}) && |
(!($env{'form.problemmode'} eq 'saveview')) && |
(!($env{'form.problemmode'} eq 'saveview')) && |
(!($env{'form.problemmode'} eq 'discard'))) { |
(!($env{'form.problemmode'} eq 'discard'))) { |
my ($displayfile,$url,$symb,$itemtitle,$action); |
my ($displayfile,$url,$symb,$itemtitle,$action); |
$displayfile=$request->uri; |
$displayfile=$request->uri; |
if ($request->uri =~ m{^/uploaded/}) { |
if ($request->uri =~ m{^/uploaded/}) { |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/\E(docs|supplemental)/}) { |
if ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/supplemental/\E}) { |
if ($1 eq 'supplemental') { |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['folderpath','title']); |
['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(.+)$}) { |
} elsif ($request->uri =~ m{^\Q/uploaded/$cdom/$cnum/portfolio/syllabus/\E(.+)$}) { |
my $filename = $1; |
my $filename = $1; |
if ($1 eq 'loncapa.html') { |
if ($1 eq 'loncapa.html') { |