version 1.122, 2001/08/21 17:21:50
|
version 1.129, 2001/09/14 20:18:13
|
Line 13
|
Line 13
|
# 6/12,6/13 H. K. Ng |
# 6/12,6/13 H. K. Ng |
# 6/16 Gerd Kortemeyer |
# 6/16 Gerd Kortemeyer |
# 7/27 H. K. Ng |
# 7/27 H. K. Ng |
# 8/7,8/9,8/10,8/11,8/15,8/16,8/17,8/18,8/20 Gerd Kortemeyer |
# 8/7,8/9,8/10,8/11,8/15,8/16,8/17,8/18,8/20,8/23,8/24 Gerd Kortemeyer |
|
|
package Apache::lonxml; |
package Apache::lonxml; |
use vars |
use vars |
Line 260 sub fontsettings() {
|
Line 260 sub fontsettings() {
|
|
|
sub registerurl { |
sub registerurl { |
my $forcereg=shift; |
my $forcereg=shift; |
if ($Apache::lonxml::registered) { return ''; } |
if ($Apache::lonxml::registered && !$forcereg) { return ''; } |
$Apache::lonxml::registered=1; |
$Apache::lonxml::registered=1; |
if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) { |
if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) { |
my $hwkadd=''; |
my $hwkadd=''; |
Line 323 ENDPARM
|
Line 323 ENDPARM
|
menu=window.open("","LONCAPAmenu"); |
menu=window.open("","LONCAPAmenu"); |
menu.currentStale=1; |
menu.currentStale=1; |
menu.switchbutton |
menu.switchbutton |
(3,1,'reload.gif','return','location','go(currentURL)'); |
(3,1,'reload.gif','return','location','go(currentURL)'); |
menu.clearbut(7,1); |
menu.clearbut(7,1); |
menu.clearbut(7,2); |
menu.clearbut(7,2); |
menu.clearbut(7,3); |
menu.clearbut(7,3); |
Line 408 sub xmlparse {
|
Line 408 sub xmlparse {
|
|
|
my $finaloutput = &inner_xmlparse($target,\@stack,\@parstack,\@pars, |
my $finaloutput = &inner_xmlparse($target,\@stack,\@parstack,\@pars, |
$safeeval,\%style_for_target); |
$safeeval,\%style_for_target); |
|
if ($ENV{'request.uri'}) { |
|
&writeallows($ENV{'request.uri'}); |
|
} |
return $finaloutput; |
return $finaloutput; |
} |
} |
|
|
Line 656 sub setup_globals {
|
Line 658 sub setup_globals {
|
my ($target)=@_; |
my ($target)=@_; |
$Apache::lonxml::registered = 0; |
$Apache::lonxml::registered = 0; |
@Apache::lonxml::pwd=(); |
@Apache::lonxml::pwd=(); |
|
@Apache::lonxml::extlinks=(); |
if ($target eq 'meta') { |
if ($target eq 'meta') { |
$Apache::lonxml::redirection = 0; |
$Apache::lonxml::redirection = 0; |
$Apache::lonxml::metamode = 1; |
$Apache::lonxml::metamode = 1; |
$Apache::lonxml::evaluate = 1; |
$Apache::lonxml::evaluate = 1; |
$Apache::lonxml::import = 0; |
$Apache::lonxml::import = 0; |
|
} elsif ($target eq 'answer') { |
|
$Apache::lonxml::redirection = 0; |
|
$Apache::lonxml::metamode = 1; |
|
$Apache::lonxml::evaluate = 1; |
|
$Apache::lonxml::import = 1; |
} elsif ($target eq 'grade') { |
} elsif ($target eq 'grade') { |
&startredirection; |
&startredirection; |
$Apache::lonxml::metamode = 0; |
$Apache::lonxml::metamode = 0; |
Line 738 sub init_safespace {
|
Line 746 sub init_safespace {
|
# $safeeval->deny(":base_orig"); |
# $safeeval->deny(":base_orig"); |
$safeinit .= ';$external::target="'.$target.'";'; |
$safeinit .= ';$external::target="'.$target.'";'; |
my $rndseed; |
my $rndseed; |
if (defined(&Apache::lonhomework::whichuser)) { |
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
my ($symb,$courseid,$domain,$name) = &Apache::lonhomework::whichuser(); |
$rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name); |
$rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name); |
|
} else { |
|
$rndseed=&Apache::lonnet::rndseed(); |
|
} |
|
$safeinit .= ';$external::randomseed='.$rndseed.';'; |
$safeinit .= ';$external::randomseed='.$rndseed.';'; |
&Apache::run::run($safeinit,$safeeval); |
&Apache::run::run($safeinit,$safeeval); |
} |
} |
Line 879 sub parstring {
|
Line 883 sub parstring {
|
} |
} |
|
|
sub writeallows { |
sub writeallows { |
|
unless ($#extlinks>=0) { return; } |
my $thisurl='/res/'.&Apache::lonnet::declutter(shift); |
my $thisurl='/res/'.&Apache::lonnet::declutter(shift); |
if ($ENV{'httpref.'.$thisurl}) { |
if ($ENV{'httpref.'.$thisurl}) { |
$thisurl=$ENV{'httpref.'.$thisurl}; |
$thisurl=$ENV{'httpref.'.$thisurl}; |
Line 888 sub writeallows {
|
Line 893 sub writeallows {
|
my %httpref=(); |
my %httpref=(); |
map { |
map { |
$httpref{'httpref.'. |
$httpref{'httpref.'. |
&Apache::lonnet::hreflocation($thisdir,$_)}=$thisurl; } @extlinks; |
&Apache::lonnet::hreflocation($thisdir,$_)}=$thisurl; |
|
} @extlinks; |
|
@extlinks=(); |
&Apache::lonnet::appenv(%httpref); |
&Apache::lonnet::appenv(%httpref); |
} |
} |
|
|
Line 1037 ENDNOTFOUND
|
Line 1044 ENDNOTFOUND
|
unless ($ENV{'request.state'} eq 'published') { |
unless ($ENV{'request.state'} eq 'published') { |
$result=&inserteditinfo($result,$filecontents); |
$result=&inserteditinfo($result,$filecontents); |
} |
} |
|
|
|
writeallows($request->uri); |
|
|
$request->print($result); |
$request->print($result); |
|
|
writeallows($request->uri); |
|
return OK; |
return OK; |
} |
} |
|
|
Line 1125 sub description {
|
Line 1133 sub description {
|
my ($token)=@_; |
my ($token)=@_; |
return $insertlist{$insertlist{"$token->[1].num"}.'.description'}; |
return $insertlist{$insertlist{"$token->[1].num"}.'.description'}; |
} |
} |
|
|
|
# ----------------------------------------------------------------- whichuser |
|
# returns a list of $symb, $courseid, $domain, $name that is correct for |
|
# calls to lonnet functions for this setup. |
|
# - looks for form.grade_ parameters |
|
sub whichuser { |
|
my $symb=&Apache::lonnet::symbread(); |
|
my $courseid=$ENV{'request.course.id'}; |
|
my $domain=$ENV{'user.domain'}; |
|
my $name=$ENV{'user.name'}; |
|
if (defined($ENV{'form.grade_symb'})) { |
|
my $tmp_courseid=$ENV{'form.grade_courseid'}; |
|
my $allowed=&Apache::lonnet::allowed('mgr',$tmp_courseid); |
|
if ($allowed) { |
|
$symb=$ENV{'form.grade_symb'}; |
|
$courseid=$ENV{'form.grade_courseid'}; |
|
$domain=$ENV{'form.grade_domain'}; |
|
$name=$ENV{'form.grade_username'}; |
|
} |
|
} |
|
return ($symb,$courseid,$domain,$name); |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|