version 1.26, 2002/05/21 02:29:22
|
version 1.27, 2002/05/24 21:45:22
|
Line 386 sub viewgrades {
|
Line 386 sub viewgrades {
|
'<table border=0><tr><td bgcolor="#999999">'."\n". |
'<table border=0><tr><td bgcolor="#999999">'."\n". |
'<table border=0>'."\n". |
'<table border=0>'."\n". |
'<tr><td bgcolor='.$headerclr.'>UserId</td><td bgcolor='.$headerclr.'>Domain</td>'."\n"; |
'<tr><td bgcolor='.$headerclr.'>UserId</td><td bgcolor='.$headerclr.'>Domain</td>'."\n"; |
foreach my $part (@parts) { |
foreach my $part (sort(@parts)) { |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } |
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); } |
$result.='<td bgcolor='.$headerclr.'>'.$display.'</td>'."\n"; |
$result.='<td bgcolor='.$headerclr.'>'.$display.'</td>'."\n"; |
Line 449 ENDUPFORM
|
Line 449 ENDUPFORM
|
return $result; |
return $result; |
} |
} |
|
|
|
sub csvupload_javascript_reverse_associate { |
|
return(<<ENDPICK); |
|
function verify(vf) { |
|
var foundsomething=0; |
|
var founduname=0; |
|
var founddomain=0; |
|
for (i=0;i<=vf.nfields.value;i++) { |
|
tw=eval('vf.f'+i+'.selectedIndex'); |
|
if (i==0 && tw!=0) { founduname=1; } |
|
if (i==1 && tw!=0) { founddomain=1; } |
|
if (i!=0 && i!=1 && tw!=0) { foundsomething=1; } |
|
} |
|
if (founduname==0 || founddomain==0) { |
|
alert('You need to specify at both the username and domain'); |
|
return; |
|
} |
|
if (foundsomething==0) { |
|
alert('You need to specify at least one grading field'); |
|
return; |
|
} |
|
vf.submit(); |
|
} |
|
function flip(vf,tf) { |
|
var nw=eval('vf.f'+tf+'.selectedIndex'); |
|
var i; |
|
for (i=0;i<=vf.nfields.value;i++) { |
|
//can not pick the same destination field for both name and domain |
|
if (((i ==0)||(i ==1)) && |
|
((tf==0)||(tf==1)) && |
|
(i!=tf) && |
|
(eval('vf.f'+i+'.selectedIndex')==nw)) { |
|
eval('vf.f'+i+'.selectedIndex=0;') |
|
} |
|
} |
|
} |
|
ENDPICK |
|
} |
|
|
|
sub csvupload_javascript_forward_associate { |
|
return(<<ENDPICK); |
|
function verify(vf) { |
|
var foundsomething=0; |
|
var founduname=0; |
|
var founddomain=0; |
|
for (i=0;i<=vf.nfields.value;i++) { |
|
tw=eval('vf.f'+i+'.selectedIndex'); |
|
if (tw==1) { founduname=1; } |
|
if (tw==2) { founddomain=1; } |
|
if (tw>2) { foundsomething=1; } |
|
} |
|
if (founduname==0 || founddomain==0) { |
|
alert('You need to specify at both the username and domain'); |
|
return; |
|
} |
|
if (foundsomething==0) { |
|
alert('You need to specify at least one grading field'); |
|
return; |
|
} |
|
vf.submit(); |
|
} |
|
function flip(vf,tf) { |
|
var nw=eval('vf.f'+tf+'.selectedIndex'); |
|
var i; |
|
//can not pick the same destination field twice |
|
for (i=0;i<=vf.nfields.value;i++) { |
|
if ((i!=tf) && (eval('vf.f'+i+'.selectedIndex')==nw)) { |
|
eval('vf.f'+i+'.selectedIndex=0;') |
|
} |
|
} |
|
} |
|
ENDPICK |
|
} |
|
|
sub csvuploadmap_header { |
sub csvuploadmap_header { |
my ($request,$symb,$url,$datatoken,$distotal)= @_; |
my ($request,$symb,$url,$datatoken,$distotal)= @_; |
my $result; |
my $result; |
my $javascript; |
my $javascript; |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
# $javascript=&csv_upload_javascript_reverse_associate(); |
$javascript=&csvupload_javascript_reverse_associate(); |
} else { |
} else { |
# $javascript=&csv_upload_javascript_forward_associate(); |
$javascript=&csvupload_javascript_forward_associate(); |
} |
} |
my $javascript_validations;#=&javascript_validations($krbdefdom); |
|
$request->print(<<ENDPICK); |
$request->print(<<ENDPICK); |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
<h3>Uploading Class Grades for resource $url</h3> |
<h3>Uploading Class Grades for resource $url</h3> |
Line 481 to this page if the data selected is ins
|
Line 553 to this page if the data selected is ins
|
<hr /> |
<hr /> |
<script type="text/javascript" language="Javascript"> |
<script type="text/javascript" language="Javascript"> |
$javascript |
$javascript |
$javascript_validations |
|
</script> |
</script> |
ENDPICK |
ENDPICK |
return ''; |
return ''; |
Line 491 ENDPICK
|
Line 562 ENDPICK
|
sub csvupload_fields { |
sub csvupload_fields { |
my ($url) = @_; |
my ($url) = @_; |
my (@parts) = &getpartlist($url); |
my (@parts) = &getpartlist($url); |
my @fields; |
my @fields=(['username','Student Username'],['domain','Student Domain']); |
foreach my $part (@parts) { |
foreach my $part (sort(@parts)) { |
my @datum; |
my @datum; |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
my $display=&Apache::lonnet::metadata($url,$part.'.display'); |
my $name=&Apache::lonnet::metadata($url,$part.'.name'); |
my $name=$part; |
if (!$display) { $display = $name; } |
if (!$display) { $display = $name; } |
@datum=($name,$display); |
@datum=($name,$display); |
push(@fields,\@datum); |
push(@fields,\@datum); |
Line 549 sub csvuploadmap {
|
Line 620 sub csvuploadmap {
|
return ''; |
return ''; |
} |
} |
|
|
|
sub csvuploadassign { |
|
my ($request)= @_; |
|
my ($symb,$url)=&get_symb_and_url($request); |
|
if (!$symb) {return '';} |
|
&Apache::loncommon::load_tmp_file($request); |
|
my @gradedata=&Apache::loncommon::upfile_record_sep(); |
|
my @keyfields = split(/\,/,$ENV{'form.keyfields'}); |
|
my %fields=(); |
|
for (my $i=0; $i<=$ENV{'form.nfields'}; $i++) { |
|
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
|
if ($ENV{'form.f'.$i} ne 'none') { |
|
$fields{$keyfields[$i]}=$ENV{'form.f'.$i}; |
|
} |
|
} else { |
|
if ($ENV{'form.f'.$i} ne 'none') { |
|
$fields{$ENV{'form.f'.$i}}=$keyfields[$i]; |
|
} |
|
} |
|
} |
|
$request->print('<h3>Assigning Grades</h3>'); |
|
&Apache::lonhomework::showhash(('1'=>\@keyfields)); |
|
&Apache::lonhomework::showhash(%fields); |
|
my $courseid=$ENV{'request.course.id'}; |
|
my $cdom=$ENV{"course.$courseid.domain"}; |
|
my $cnum=$ENV{"course.$courseid.num"}; |
|
my (%classlist) = &getclasslist($cdom,$cnum,'1'); |
|
foreach my $student ( sort(@{ $classlist{'allids'} }) ) { |
|
my %newhash; |
|
foreach my $grade (@gradedata) { |
|
my %entries=&Apache::loncommon::record_sep($grade); |
|
foreach my $dest (keys(%fields)) { |
|
|
|
} |
|
} |
|
} |
|
} |
|
|
sub send_header { |
sub send_header { |
my ($request)= @_; |
my ($request)= @_; |
$request->print(&Apache::lontexconvert::header()); |
$request->print(&Apache::lontexconvert::header()); |