version 1.85, 2002/08/07 18:20:29
|
version 1.90, 2002/09/24 12:39:42
|
Line 59 BEGIN {
|
Line 59 BEGIN {
|
|
|
sub get_target { |
sub get_target { |
if ( $ENV{'request.state'} eq "published") { |
if ( $ENV{'request.state'} eq "published") { |
if ( defined($ENV{'form.grade_target'}) |
if ( defined($ENV{'form.grade_target'} ) |
|
&& ($ENV{'form.grade_target'} eq 'tex')) { |
|
return ($ENV{'form.grade_target'}); |
|
} elsif ( defined($ENV{'form.grade_target'} ) |
&& ($Apache::lonhomework::viewgrades == 'F' )) { |
&& ($Apache::lonhomework::viewgrades == 'F' )) { |
return ($ENV{'form.grade_target'}); |
return ($ENV{'form.grade_target'}); |
} |
} |
|
|
if ( defined($ENV{'form.submitted'})) { |
if ( defined($ENV{'form.submitted'})) { |
return ('grade', 'web'); |
return ('grade', 'web'); |
} else { |
} else { |
Line 79 sub get_target {
|
Line 83 sub get_target {
|
return ('web'); |
return ('web'); |
} |
} |
} else { |
} else { |
if ( $ENV{'form.problemmode'} eq 'View' ) { |
if ( $ENV{'form.problemmode'} eq 'View' || |
|
$ENV{'form.problemmode'} eq 'Discard Edits and View') { |
if ( defined($ENV{'form.submitted'}) && |
if ( defined($ENV{'form.submitted'}) && |
(!defined($ENV{'form.resetdata'})) ) { |
(!defined($ENV{'form.resetdata'})) ) { |
return ('grade', 'web','answer'); |
return ('grade', 'web','answer'); |
Line 120 sub createmenu {
|
Line 125 sub createmenu {
|
my ($which,$request)=@_; |
my ($which,$request)=@_; |
if ($which eq 'grade') { |
if ($which eq 'grade') { |
$request->print('<script language="JavaScript"> |
$request->print('<script language="JavaScript"> |
hwkmenu=window.open("/res/adm/pages/homeworkmenu.html","homeworkremote", |
hwkmenu=window.open("/res/adm/pages/homeworkmenu.html","homeworkremote", |
"height=350,width=150,menubar=no"); |
"height=350,width=150,menubar=no"); |
</script>'); |
</script>'); |
} |
} |
Line 148 sub check_access {
|
Line 153 sub check_access {
|
foreach $temp ("opendate","duedate","answerdate") { |
foreach $temp ("opendate","duedate","answerdate") { |
$lastdate = $date; |
$lastdate = $date; |
$date = &Apache::lonnet::EXT("resource.$id.$temp"); |
$date = &Apache::lonnet::EXT("resource.$id.$temp"); |
|
my $thistype = &Apache::lonnet::EXT("resource.$id.$temp.type"); |
|
if ($thistype eq 'date_interval') { |
|
if ($temp eq 'opendate') { |
|
$date=&Apache::lonnet::EXT("resource.$id.duedate")-$date; |
|
} |
|
if ($temp eq 'answerdate') { |
|
$date=&Apache::lonnet::EXT("resource.$id.duedate")+$date; |
|
} |
|
} |
&Apache::lonxml::debug("found :$date: for :$temp:"); |
&Apache::lonxml::debug("found :$date: for :$temp:"); |
if ($date eq '') { |
if ($date eq '') { |
$date = "an unknown date"; $passed = 0; |
$date = "an unknown date"; $passed = 0; |
Line 190 sub check_access {
|
Line 204 sub check_access {
|
|
|
&Apache::lonxml::debug("sending back :$status:$datemsg:"); |
&Apache::lonxml::debug("sending back :$status:$datemsg:"); |
if (($Apache::lonhomework::browse eq 'F') && ($status eq 'CLOSED')) { |
if (($Apache::lonhomework::browse eq 'F') && ($status eq 'CLOSED')) { |
&Apache::lonxml::debug("should be allowed to browse a resource when closed"); |
&Apache::lonxml::debug("should be allowed to browse a resource when closed"); |
$status='CAN_ANSWER'; |
$status='CAN_ANSWER'; |
$datemsg='is closed but you are allowed to view it'; |
$datemsg='is closed but you are allowed to view it'; |
} |
} |
Line 325 sub editxmlmode {
|
Line 339 sub editxmlmode {
|
my ($rows,$cols) = &Apache::edit::textarea_sizes(\$problem); |
my ($rows,$cols) = &Apache::edit::textarea_sizes(\$problem); |
my $xml_help = Apache::loncommon::help_open_topic("Problem_Editor_XML_Index"); |
my $xml_help = Apache::loncommon::help_open_topic("Problem_Editor_XML_Index"); |
if ($cols > 80) { $cols = 80; } |
if ($cols > 80) { $cols = 80; } |
|
if ($cols < 70) { $cols = 70; } |
|
if ($rows < 20) { $rows = 20; } |
$result.='<html><body bgcolor="#FFFFFF"> |
$result.='<html><body bgcolor="#FFFFFF"> |
<form name="lonhomework" method="POST" action="'. |
<form name="lonhomework" method="POST" action="'. |
$ENV{'request.uri'}.'"> |
$ENV{'request.uri'}.'"> |
Line 377 sub renderpage {
|
Line 393 sub renderpage {
|
if ($target eq 'answer') { &showhash(%Apache::lonhomework::history); } |
if ($target eq 'answer') { &showhash(%Apache::lonhomework::history); } |
if ($target eq 'web') {&Apache::lonhomework::showhashsubset(\%ENV,'^form');} |
if ($target eq 'web') {&Apache::lonhomework::showhashsubset(\%ENV,'^form');} |
|
|
my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm'); |
my $default=&Apache::lonnet::getfile('/home/httpd/html/res/adm/includes/default_homework.lcpm'); |
if ($default == -1) { |
if ($default == -1) { |
&Apache::lonxml::error("<b>Unable to find <i>default_homework.lcpm</i></b>"); |
&Apache::lonxml::error("<b>Unable to find <i>default_homework.lcpm</i></b>"); |
$default=''; |
$default=''; |
} |
} |
&Apache::lonxml::debug("Should be parsing now"); |
&Apache::lonxml::debug("Should be parsing now"); |
Line 413 sub get_template_list {
|
Line 429 sub get_template_list {
|
my $result; |
my $result; |
my @allnames; |
my @allnames; |
&Apache::lonxml::debug("Looking for :$extension:"); |
&Apache::lonxml::debug("Looking for :$extension:"); |
foreach my $file (</home/httpd/html/res/adm/includes/templates/*.$extension>) { |
foreach my $file (</home/httpd/html/res/adm/includes/templates/*.$extension>) |
|
{ |
my $name=&Apache::lonnet::metadata($file,'title'); |
my $name=&Apache::lonnet::metadata($file,'title'); |
if ($namewanted && ($name eq $namewanted)) { |
if ($namewanted && ($name eq $namewanted)) { |
$result=$file; |
$result=$file; |
Line 422 sub get_template_list {
|
Line 439 sub get_template_list {
|
push (@allnames, $name); |
push (@allnames, $name); |
} |
} |
} |
} |
if (@allnames) { |
if (@allnames && !$result) { |
$result="<option>Select a $extension type</option>\n<option>". |
$result="<option>Select a $extension type</option>\n<option>". |
join('</option><option>',sort(@allnames)).'</option>'; |
join('</option><option>',sort(@allnames)).'</option>'; |
} |
} |
Line 488 sub handler {
|
Line 505 sub handler {
|
#my $t0 = [&gettimeofday()]; |
#my $t0 = [&gettimeofday()]; |
my $request=$_[0]; |
my $request=$_[0]; |
|
|
if ( $ENV{'user.name'} eq 'albertel' ) {$Apache::lonxml::debug=1;} |
# if ( $ENV{'user.name'} eq 'physnet' ) {$Apache::lonxml::debug=1;} |
|
|
if (&setupheader($request)) { return OK; } |
if (&setupheader($request)) { return OK; } |
$ENV{'request.uri'}=$request->uri; |
$ENV{'request.uri'}=$request->uri; |