version 1.422, 2006/10/04 19:48:36
|
version 1.429, 2006/11/30 08:53:35
|
Line 251 sub printtokenheader {
|
Line 251 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 342 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 776 sub init_safespace {
|
Line 781 sub init_safespace {
|
$safehole->wrap(\&Apache::inputtags::finalizeawards,$safeeval,'&LONCAPA_INTERNAL_FINALIZEAWARDS'); |
$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; |
use Data::Dumper; |
$safehole->wrap(\&Data::Dumper::Dumper,$safeeval,'&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 816 sub delete_package_recurse {
|
Line 821 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 1327 FULLPAGE
|
Line 1332 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 |
Line 1411 sub handler {
|
Line 1420 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 1452 ENDNOTFOUND
|
Line 1457 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'}) { |
&Apache::lonnet::logthis("edit mode is ".$env{'form.editmode'}); |
|
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 1466 ENDNOTFOUND
|
Line 1472 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 1742 sub helpinfo {
|
Line 1749 sub helpinfo {
|
return ($insertlist{$tagnum.'.helpfile'}, $insertlist{$tagnum.'.helpdesc'}); |
return ($insertlist{$tagnum.'.helpfile'}, $insertlist{$tagnum.'.helpdesc'}); |
} |
} |
|
|
# ----------------------------------------------------------------- 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 ($passedsymb)=@_; |
|
my ($symb,$courseid,$domain,$name,$publicuser); |
|
if (defined($env{'form.grade_symb'})) { |
|
my ($tmp_courseid)= |
|
&Apache::loncommon::get_env_multiple('form.grade_courseid'); |
|
my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid); |
|
if (!$allowed && |
|
exists($env{'request.course.sec'}) && |
|
$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; |
__END__ |
__END__ |
|
|