version 1.419, 2006/09/26 04:26:15
|
version 1.438, 2007/02/18 02:07:11
|
Line 88 use Apache::loncommon();
|
Line 88 use Apache::loncommon();
|
use Apache::lonfeedback(); |
use Apache::lonfeedback(); |
use Apache::lonmsg(); |
use Apache::lonmsg(); |
use Apache::loncacc(); |
use Apache::loncacc(); |
|
use Apache::lonmaxima(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
|
#================================================== Main subroutine: xmlparse |
#================================================== Main subroutine: xmlparse |
Line 251 sub printtokenheader {
|
Line 252 sub printtokenheader {
|
my ($target,$token,$tsymb,$tcrsid,$tudom,$tuname)=@_; |
my ($target,$token,$tsymb,$tcrsid,$tudom,$tuname)=@_; |
unless ($token) { return ''; } |
unless ($token) { return ''; } |
|
|
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
my ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser(); |
unless ($tsymb) { |
unless ($tsymb) { |
$tsymb=$symb; |
$tsymb=$symb; |
} |
} |
Line 342 sub xmlparse {
|
Line 343 sub xmlparse {
|
my $finaloutput = &inner_xmlparse($target,\@stack,\@parstack,\@pars, |
my $finaloutput = &inner_xmlparse($target,\@stack,\@parstack,\@pars, |
$safeeval,\%style_for_target,1); |
$safeeval,\%style_for_target,1); |
|
|
|
if (@stack) { |
|
&warning("At end of file some tags were still left unclosed, ". |
|
'<tt><'.join('></tt>, <tt><',reverse(@stack)). |
|
'></tt>'); |
|
} |
if ($env{'request.uri'}) { |
if ($env{'request.uri'}) { |
&writeallows($env{'request.uri'}); |
&writeallows($env{'request.uri'}); |
} |
} |
Line 544 sub callsub {
|
Line 550 sub callsub {
|
} |
} |
|
|
my $deleted=0; |
my $deleted=0; |
$Apache::lonxml::curdepth=join('_',@Apache::lonxml::depthcounter); |
|
if (($token->[0] eq 'S') && ($target eq 'modified')) { |
if (($token->[0] eq 'S') && ($target eq 'modified')) { |
$deleted=&Apache::edit::handle_delete($space,$target,$token,$tagstack, |
$deleted=&Apache::edit::handle_delete($space,$target,$token,$tagstack, |
$parstack,$parser,$safeeval, |
$parstack,$parser,$safeeval, |
Line 669 sub init_safespace {
|
Line 674 sub init_safespace {
|
'&chem_standard_order'); |
'&chem_standard_order'); |
$safehole->wrap(\&Apache::response::check_status,$safeeval,'&check_status'); |
$safehole->wrap(\&Apache::response::check_status,$safeeval,'&check_status'); |
|
|
|
$safehole->wrap(\&Apache::lonmaxima::maxima_eval,$safeeval,'&maxima_eval'); |
|
$safehole->wrap(\&Apache::lonmaxima::maxima_check,$safeeval,'&maxima_check'); |
|
$safehole->wrap(\&Apache::lonmaxima::maxima_cas_formula_fix,$safeeval, |
|
'&maxima_cas_formula_fix'); |
|
|
|
$safehole->wrap(\&Apache::caparesponse::capa_formula_fix,$safeeval, |
|
'&capa_formula_fix'); |
|
|
$safehole->wrap(\&Math::Cephes::asin,$safeeval,'&asin'); |
$safehole->wrap(\&Math::Cephes::asin,$safeeval,'&asin'); |
$safehole->wrap(\&Math::Cephes::acos,$safeeval,'&acos'); |
$safehole->wrap(\&Math::Cephes::acos,$safeeval,'&acos'); |
$safehole->wrap(\&Math::Cephes::atan,$safeeval,'&atan'); |
$safehole->wrap(\&Math::Cephes::atan,$safeeval,'&atan'); |
Line 772 sub init_safespace {
|
Line 785 sub init_safespace {
|
$safehole->wrap(\&Math::Random::random_set_seed,$safeeval,'&random_set_seed'); |
$safehole->wrap(\&Math::Random::random_set_seed,$safeeval,'&random_set_seed'); |
$safehole->wrap(\&Apache::lonxml::error,$safeeval,'&LONCAPA_INTERNAL_ERROR'); |
$safehole->wrap(\&Apache::lonxml::error,$safeeval,'&LONCAPA_INTERNAL_ERROR'); |
$safehole->wrap(\&Apache::lonxml::debug,$safeeval,'&LONCAPA_INTERNAL_DEBUG'); |
$safehole->wrap(\&Apache::lonxml::debug,$safeeval,'&LONCAPA_INTERNAL_DEBUG'); |
|
$safehole->wrap(\&Apache::lonnet::logthis,$safeeval,'&LONCAPA_INTERNAL_LOGTHIS'); |
|
$safehole->wrap(\&Apache::inputtags::finalizeawards,$safeeval,'&LONCAPA_INTERNAL_FINALIZEAWARDS'); |
$safehole->wrap(\&Apache::caparesponse::get_sigrange,$safeeval,'&LONCAPA_INTERNAL_get_sigrange'); |
$safehole->wrap(\&Apache::caparesponse::get_sigrange,$safeeval,'&LONCAPA_INTERNAL_get_sigrange'); |
|
# use Data::Dumper; |
|
# $safehole->wrap(\&Data::Dumper::Dumper,$safeeval,'&LONCAPA_INTERNAL_Dumper'); |
#need to inspect this class of ops |
#need to inspect this class of ops |
# $safeeval->deny(":base_orig"); |
# $safeeval->deny(":base_orig"); |
$safeeval->permit("require"); |
$safeeval->permit("require"); |
Line 813 sub delete_package_recurse {
|
Line 829 sub delete_package_recurse {
|
sub initialize_rndseed { |
sub initialize_rndseed { |
my ($safeeval)=@_; |
my ($safeeval)=@_; |
my $rndseed; |
my $rndseed; |
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
my ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser(); |
$rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name); |
$rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name); |
my $safeinit = '$external::randomseed="'.$rndseed.'";'; |
my $safeinit = '$external::randomseed="'.$rndseed.'";'; |
&Apache::lonxml::debug("Setting rndseed to $rndseed"); |
&Apache::lonxml::debug("Setting rndseed to $rndseed"); |
Line 889 sub initdepth {
|
Line 905 sub initdepth {
|
$Apache::lonxml::olddepth=-1; |
$Apache::lonxml::olddepth=-1; |
} |
} |
|
|
|
|
my @timers; |
my @timers; |
my $lasttime; |
my $lasttime; |
|
# $Apache::lonxml::depth -> current stack depth |
|
# @Apache::lonxml::depthcounter -> count of tags that exist so |
|
# far at each level |
|
# $Apache::lonxml::olddepth -> when ascending, need to remember the count for the level below the current level (for example going from 1_2 -> 1 -> 1_3 need to rember that ) |
|
|
sub increasedepth { |
sub increasedepth { |
my ($token) = @_; |
my ($token) = @_; |
$Apache::lonxml::depth++; |
$Apache::lonxml::depth++; |
Line 905 sub increasedepth {
|
Line 927 sub increasedepth {
|
$lasttime=[&gettimeofday()]; |
$lasttime=[&gettimeofday()]; |
} |
} |
my $spacing=' 'x($Apache::lonxml::depth-1); |
my $spacing=' 'x($Apache::lonxml::depth-1); |
my $curdepth=join('_',@Apache::lonxml::depthcounter); |
$Apache::lonxml::curdepth=join('_',@Apache::lonxml::depthcounter); |
&Apache::lonxml::debug("s$spacing$Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1] : $time : \n"); |
&Apache::lonxml::debug("s$spacing$Apache::lonxml::depth : $Apache::lonxml::olddepth : $Apache::lonxml::curdepth : $token->[1] : $time"); |
#print "<br />s $Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1]\n"; |
#print "<br />s $Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1]\n"; |
} |
} |
|
|
Line 928 sub decreasedepth {
|
Line 950 sub decreasedepth {
|
$lasttime=[&gettimeofday()]; |
$lasttime=[&gettimeofday()]; |
} |
} |
my $spacing=' 'x$Apache::lonxml::depth; |
my $spacing=' 'x$Apache::lonxml::depth; |
my $curdepth=join('_',@Apache::lonxml::depthcounter); |
$Apache::lonxml::curdepth= |
&Apache::lonxml::debug("e$spacing$Apache::lonxml::depth : $Apache::lonxml::olddepth : $curdepth : $token->[1] : $time : ".&tv_interval($timer)."\n"); |
join('_',@Apache::lonxml::depthcounter[0..$Apache::lonxml::depth]); |
|
&Apache::lonxml::debug("e$spacing$Apache::lonxml::depth : $Apache::lonxml::olddepth : $Apache::lonxml::curdepth : $token->[1] : $time : ".&tv_interval($timer)); |
#print "<br />e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n"; |
#print "<br />e $Apache::lonxml::depth : $Apache::lonxml::olddepth : $token->[1] : $curdepth\n"; |
} |
} |
|
|
Line 1014 sub store_counter {
|
Line 1037 sub store_counter {
|
} |
} |
|
|
sub remember_problem_counter { |
sub remember_problem_counter { |
&Apache::lonnet::transfer_profile_to_env(); |
&Apache::lonnet::transfer_profile_to_env(undef,undef,1); |
$state = $env{'form.counter'}; |
$state = $env{'form.counter'}; |
} |
} |
|
|
Line 1025 sub store_counter {
|
Line 1048 sub store_counter {
|
} |
} |
sub get_problem_counter { |
sub get_problem_counter { |
if ($Apache::lonxml::counter_changed) { &store_counter() } |
if ($Apache::lonxml::counter_changed) { &store_counter() } |
&Apache::lonnet::transfer_profile_to_env(); |
&Apache::lonnet::transfer_profile_to_env(undef,undef,1); |
return $env{'form.counter'}; |
return $env{'form.counter'}; |
} |
} |
} |
} |
Line 1324 FULLPAGE
|
Line 1347 FULLPAGE
|
my $cleanbut = ''; |
my $cleanbut = ''; |
|
|
my $titledisplay=&display_title(); |
my $titledisplay=&display_title(); |
my %lt=&Apache::lonlocal::texthash('st' => 'Save this', |
my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit', |
'vi' => 'View', |
'vi' => 'Save and View', |
|
'dv' => 'Discard Edits and View', |
|
'un' => 'undo', |
'ed' => 'Edit'); |
'ed' => 'Edit'); |
my $buttons=(<<BUTTONS); |
my $buttons=(<<BUTTONS); |
$cleanbut |
$cleanbut |
|
<input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" /> |
|
<input type="submit" name="Undo" accesskey="u" value="$lt{'un'}" /><hr> |
<input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" /> |
<input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" /> |
<input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" /> |
<input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" /> |
BUTTONS |
BUTTONS |
$buttons.=&Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
$buttons.=&Apache::lonhtmlcommon::spelllink('xmledit','filecont'); |
$buttons.=&Apache::lonhtmlcommon::htmlareaselectactive('filecont'); |
|
my $editfooter=(<<ENDFOOTER); |
my $editfooter=(<<ENDFOOTER); |
$initialize |
$initialize |
<hr /> |
<hr /> |
Line 1409 sub handler {
|
Line 1435 sub handler {
|
# |
# |
# Edit action? Save file. |
# Edit action? Save file. |
# |
# |
unless ($env{'request.state'} eq 'published') { |
if (!($env{'request.state'} eq 'published')) { |
if ($env{'form.savethisfile'}) { |
if ($env{'form.savethisfile'} || $env{'form.viewmode'} || $env{'form.Undo'}) { |
if (&storefile($file,$env{'form.filecont'})) { |
my $html_file=&Apache::lonnet::getfile($file); |
&Apache::lonxml::info("<font COLOR=\"#0000FF\">". |
my $error = &Apache::lonhomework::handle_save_or_undo($request, \$html_file, \$env{'form.filecont'}); |
&mt('Updated').": ". |
|
&Apache::lonlocal::locallocaltime(time). |
|
" </font>"); |
|
} |
|
} |
} |
} |
} |
my %mystyle; |
my %mystyle; |
Line 1450 ENDNOTFOUND
|
Line 1472 ENDNOTFOUND
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['editmode']); |
['editmode']); |
} |
} |
if (!$env{'form.editmode'} || $env{'form.viewmode'}) { |
if (!$env{'form.editmode'} || $env{'form.viewmode'} || $env{'form.discardview'}) { |
$result = &Apache::lonxml::xmlparse($request,$target,$filecontents, |
$result = &Apache::lonxml::xmlparse($request,$target,$filecontents, |
'',%mystyle); |
'',%mystyle); |
undef($Apache::lonhomework::parsing_a_task); |
undef($Apache::lonhomework::parsing_a_task); |
Line 1464 ENDNOTFOUND
|
Line 1486 ENDNOTFOUND
|
# Edit action? Insert editing commands |
# Edit action? Insert editing commands |
# |
# |
unless ($env{'request.state'} eq 'published') { |
unless ($env{'request.state'} eq 'published') { |
if ($env{'form.editmode'} && (!($env{'form.viewmode'}))) { |
if ($env{'form.editmode'} && (!($env{'form.viewmode'})) && (!($env{'form.discardview'}))) |
|
{ |
my $displayfile=$request->uri; |
my $displayfile=$request->uri; |
$displayfile=~s/^\/[^\/]*//; |
$displayfile=~s/^\/[^\/]*//; |
my %options = (); |
my %options = (); |
Line 1554 sub error {
|
Line 1577 sub error {
|
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my (undef,%users)=&Apache::lonfeedback::decide_receiver(undef,0,1,1,1); |
my (undef,%users)=&Apache::lonfeedback::decide_receiver(undef,0,1,1,1); |
my $declutter=&Apache::lonnet::declutter($env{'request.filename'}); |
my $declutter=&Apache::lonnet::declutter($env{'request.filename'}); |
|
my $baseurl = &Apache::lonnet::clutter($declutter); |
my @userlist; |
my @userlist; |
foreach (keys %users) { |
foreach (keys %users) { |
my ($user,$domain) = split(/:/, $_); |
my ($user,$domain) = split(/:/, $_); |
Line 1564 sub error {
|
Line 1588 sub error {
|
$cdom,$cnum); |
$cdom,$cnum); |
my $now=time; |
my $now=time; |
if ($now-$lastnotified{$key}>86400) { |
if ($now-$lastnotified{$key}>86400) { |
|
my $title = &Apache::lonnet::gettitle($symb); |
|
my $sentmessage; |
&Apache::lonmsg::user_normal_msg($user,$domain, |
&Apache::lonmsg::user_normal_msg($user,$domain, |
"Error [$declutter]",$msg); |
"Error [$title]",$msg,'',$baseurl,'','', |
|
\$sentmessage,$symb,$title,1); |
&Apache::lonnet::put('nohist_xmlerrornotifications', |
&Apache::lonnet::put('nohist_xmlerrornotifications', |
{$key => $now}, |
{$key => $now}, |
$cdom,$cnum); |
$cdom,$cnum); |
Line 1673 sub get_param_var {
|
Line 1700 sub get_param_var {
|
} |
} |
} |
} |
|
|
sub register_insert { |
sub register_insert_tab { |
my @data = split /\n/, &Apache::lonnet::getfile('/home/httpd/lonTabs/insertlist.tab'); |
my @data = split /\n/, &Apache::lonnet::getfile('/home/httpd/lonTabs/insertlist.tab'); |
my $i; |
my $i; |
my $tagnum=0; |
my $tagnum=0; |
Line 1685 sub register_insert {
|
Line 1712 sub register_insert {
|
my ($tag,$descrip,$color,$function,$show,$helpfile,$helpdesc) = split(/,/, $line); |
my ($tag,$descrip,$color,$function,$show,$helpfile,$helpdesc) = split(/,/, $line); |
if ($tag) { |
if ($tag) { |
$insertlist{"$tagnum.tag"} = $tag; |
$insertlist{"$tagnum.tag"} = $tag; |
$insertlist{"$tagnum.description"} = $descrip; |
$insertlist{"$tag.description"} = $descrip; |
$insertlist{"$tagnum.color"} = $color; |
$insertlist{"$tag.color"} = $color; |
$insertlist{"$tagnum.function"} = $function; |
$insertlist{"$tag.function"} = $function; |
if (!defined($show)) { $show='yes'; } |
if (!defined($show)) { $show='yes'; } |
$insertlist{"$tagnum.show"}= $show; |
$insertlist{"$tag.show"}= $show; |
$insertlist{"$tagnum.helpfile"} = $helpfile; |
$insertlist{"$tag.helpfile"} = $helpfile; |
$insertlist{"$tagnum.helpdesc"} = $helpdesc; |
$insertlist{"$tag.helpdesc"} = $helpdesc; |
$insertlist{"$tag.num"}=$tagnum; |
$insertlist{"$tag.num"}=$tagnum; |
$tagnum++; |
$tagnum++; |
} |
} |
Line 1705 sub register_insert {
|
Line 1732 sub register_insert {
|
for (my $j=0;$j <=$#which;$j++) { |
for (my $j=0;$j <=$#which;$j++) { |
if ( $which[$j] eq 'Y' ) { |
if ( $which[$j] eq 'Y' ) { |
if ($insertlist{"$j.show"} ne 'no') { |
if ($insertlist{"$j.show"} ne 'no') { |
push(@{ $insertlist{"$tag.which"} },$j); |
push(@{ $insertlist{"$tag.which"} },$insertlist{"$j.tag"}); |
} |
} |
} |
} |
} |
} |
Line 1713 sub register_insert {
|
Line 1740 sub register_insert {
|
} |
} |
} |
} |
|
|
|
sub register_insert_xml { |
|
my $parser = HTML::LCParser->new($Apache::lonnet::perlvar{'lonTabDir'} |
|
.'/insertlist.xml'); |
|
my ($tagnum,$in_help)=(0,0); |
|
my $tag; |
|
while (my $token = $parser->get_token()) { |
|
if ($token->[0] eq 'S') { |
|
my $key; |
|
if ($token->[1] eq 'tag') { |
|
$tag = $token->[2]{'name'}; |
|
$insertlist{"$tagnum.tag"} = $tag; |
|
$insertlist{"$tag.num"} = $tagnum; |
|
} elsif ($in_help && $token->[1] eq 'file') { |
|
$key = $tag.'.helpfile'; |
|
} elsif ($in_help && $token->[1] eq 'description') { |
|
$key = $tag.'.helpdesc'; |
|
} elsif ($token->[1] eq 'description' || |
|
$token->[1] eq 'color' || |
|
$token->[1] eq 'show' ) { |
|
$key = $tag.'.'.$token->[1]; |
|
} elsif ($token->[1] eq 'insert_sub') { |
|
$key = $tag.'.function'; |
|
} elsif ($token->[1] eq 'help') { |
|
$in_help=1; |
|
} elsif ($token->[1] eq 'allow') { |
|
my $allow = $parser->get_text(); |
|
foreach my $element (split(',',$allow)) { |
|
$element =~ s/(^\s*|\s*$ )//gx; |
|
push(@{ $insertlist{$tag.'.which'} },$element); |
|
} |
|
} |
|
if (defined($key)) { |
|
$insertlist{$key} = $parser->get_text(); |
|
$insertlist{$key} =~ s/(^\s*|\s*$ )//gx; |
|
} |
|
} elsif ($token->[0] eq 'E') { |
|
if ($token->[1] eq 'tag') { |
|
undef($tag); |
|
$tagnum++; |
|
} elsif ($token->[1] eq 'help') { |
|
undef($in_help); |
|
} |
|
} |
|
} |
|
} |
|
|
|
sub register_insert { |
|
# ®ister_insert_tab(@_); |
|
# &dump_insertlist('1'); |
|
# undef(%insertlist); |
|
return ®ister_insert_xml(@_); |
|
# &dump_insertlist('2'); |
|
} |
|
|
|
sub dump_insertlist { |
|
my ($ext) = @_; |
|
open(XML,">/tmp/insertlist.xml.$ext"); |
|
print XML ("<insertlist>"); |
|
my $i=0; |
|
|
|
while (exists($insertlist{"$i.tag"})) { |
|
my $tag = $insertlist{"$i.tag"}; |
|
print XML (" |
|
\t<tag name=\"$tag\">"); |
|
if (defined($insertlist{"$tag.description"})) { |
|
print XML (" |
|
\t\t<description>".$insertlist{"$tag.description"}."</description>"); |
|
} |
|
if (defined($insertlist{"$tag.color"})) { |
|
print XML (" |
|
\t\t<color>".$insertlist{"$tag.color"}."</color>"); |
|
} |
|
if (defined($insertlist{"$tag.function"})) { |
|
print XML (" |
|
\t\t<insert_sub>".$insertlist{"$tag.function"}."</insert_sub>"); |
|
} |
|
if (defined($insertlist{"$tag.show"}) |
|
&& $insertlist{"$tag.show"} ne 'yes') { |
|
print XML (" |
|
\t\t<show>".$insertlist{"$tag.show"}."</show>"); |
|
} |
|
if (defined($insertlist{"$tag.helpfile"})) { |
|
print XML (" |
|
\t\t<help> |
|
\t\t\t<file>".$insertlist{"$tag.helpfile"}."</file>"); |
|
if ($insertlist{"$tag.helpdesc"} ne '') { |
|
print XML (" |
|
\t\t\t<description>".$insertlist{"$tag.helpdesc"}."</description>"); |
|
} |
|
print XML (" |
|
\t\t</help>"); |
|
} |
|
if (defined($insertlist{"$tag.which"})) { |
|
print XML (" |
|
\t\t<allow>".join(',',sort(@{ $insertlist{"$tag.which"} }))."</allow>"); |
|
} |
|
print XML (" |
|
\t</tag>"); |
|
$i++; |
|
} |
|
print XML ("\n</insertlist>\n"); |
|
close(XML); |
|
} |
|
|
sub description { |
sub description { |
my ($token)=@_; |
my ($token)=@_; |
my $tagnum; |
my $tag = &get_tag($token); |
my $tag=$token->[1]; |
return $insertlist{$tag.'.description'}; |
foreach my $namespace (reverse @Apache::lonxml::namespace) { |
|
my $testtag=$namespace.'::'.$tag; |
|
$tagnum=$insertlist{"$testtag.num"}; |
|
if (defined($tagnum)) { last; } |
|
} |
|
if (!defined ($tagnum)) { $tagnum=$Apache::lonxml::insertlist{"$tag.num"}; } |
|
return $insertlist{$tagnum.'.description'}; |
|
} |
} |
|
|
# Returns a list containing the help file, and the description |
# Returns a list containing the help file, and the description |
sub helpinfo { |
sub helpinfo { |
my ($token)=@_; |
my ($token)=@_; |
my $tagnum; |
my $tag = &get_tag($token); |
my $tag=$token->[1]; |
return ($insertlist{$tag.'.helpfile'}, $insertlist{$tag.'.helpdesc'}); |
foreach my $namespace (reverse @Apache::lonxml::namespace) { |
|
my $testtag=$namespace.'::'.$tag; |
|
$tagnum=$insertlist{"$testtag.num"}; |
|
if (defined($tagnum)) { last; } |
|
} |
|
if (!defined ($tagnum)) { $tagnum=$Apache::lonxml::insertlist{"$tag.num"}; } |
|
return ($insertlist{$tagnum.'.helpfile'}, $insertlist{$tagnum.'.helpdesc'}); |
|
} |
} |
|
|
# ----------------------------------------------------------------- whichuser |
sub get_tag { |
# returns a list of $symb, $courseid, $domain, $name that is correct for |
my ($token)=@_; |
# calls to lonnet functions for this setup. |
my $tagnum; |
# - looks for form.grade_ parameters |
my $tag=$token->[1]; |
sub whichuser { |
foreach my $namespace (reverse(@Apache::lonxml::namespace)) { |
my ($passedsymb)=@_; |
my $testtag = $namespace.'::'.$tag; |
my ($symb,$courseid,$domain,$name,$publicuser); |
$tagnum = $insertlist{"$testtag.num"}; |
if (defined($env{'form.grade_symb'})) { |
last if (defined($tagnum)); |
my ($tmp_courseid)= |
} |
&Apache::loncommon::get_env_multiple('form.grade_courseid'); |
if (!defined($tagnum)) { |
my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid); |
$tagnum = $Apache::lonxml::insertlist{"$tag.num"}; |
if (!$allowed && |
} |
exists($env{'request.course.sec'}) && |
return $insertlist{"$tagnum.tag"}; |
$env{'request.course.sec'} !~ /^\s*$/) { |
|
$allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid. |
|
'/'.$env{'request.course.sec'}); |
|
} |
|
if ($allowed) { |
|
($symb)=&Apache::loncommon::get_env_multiple('form.grade_symb'); |
|
$courseid=$tmp_courseid; |
|
($domain)=&Apache::loncommon::get_env_multiple('form.grade_domain'); |
|
($name)=&Apache::loncommon::get_env_multiple('form.grade_username'); |
|
return ($symb,$courseid,$domain,$name,$publicuser); |
|
} |
|
} |
|
if (!$passedsymb) { |
|
$symb=&Apache::lonnet::symbread(); |
|
} else { |
|
$symb=$passedsymb; |
|
} |
|
$courseid=$env{'request.course.id'}; |
|
$domain=$env{'user.domain'}; |
|
$name=$env{'user.name'}; |
|
if ($name eq 'public' && $domain eq 'public') { |
|
if (!defined($env{'form.username'})) { |
|
$env{'form.username'}.=time.rand(10000000); |
|
} |
|
$name.=$env{'form.username'}; |
|
} |
|
return ($symb,$courseid,$domain,$name,$publicuser); |
|
} |
} |
|
|
1; |
1; |