version 1.245, 2005/02/12 03:43:06
|
version 1.246, 2005/02/12 15:18:41
|
Line 2651 sub split_part_type {
|
Line 2651 sub split_part_type {
|
# |
# |
#--- Javascript to handle csv upload |
#--- Javascript to handle csv upload |
sub csvupload_javascript_reverse_associate { |
sub csvupload_javascript_reverse_associate { |
|
my $error1=&mt('You need to specify the username or ID'); |
|
my $error2=&mt('You need to specify at least one grading field'); |
return(<<ENDPICK); |
return(<<ENDPICK); |
function verify(vf) { |
function verify(vf) { |
var foundsomething=0; |
var foundsomething=0; |
var founduname=0; |
var founduname=0; |
var foundID=0; |
var foundID=0; |
var founddomain=0; |
|
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
tw=eval('vf.f'+i+'.selectedIndex'); |
tw=eval('vf.f'+i+'.selectedIndex'); |
if (i==0 && tw!=0) { foundID=1; } |
if (i==0 && tw!=0) { foundID=1; } |
if (i==1 && tw!=0) { founduname=1; } |
if (i==1 && tw!=0) { founduname=1; } |
if (i==2 && tw!=0) { founddomain=1; } |
|
if (i!=0 && i!=1 && i!=2 && tw!=0) { foundsomething=1; } |
if (i!=0 && i!=1 && i!=2 && tw!=0) { foundsomething=1; } |
} |
} |
if ((founduname==0 && foundID==0) || founddomain==0) { |
if (founduname==0 && foundID==0) { |
alert('You need to specify the domain and either the username or ID'); |
alert('$error1'); |
return; |
return; |
} |
} |
if (foundsomething==0) { |
if (foundsomething==0) { |
alert('You need to specify at least one grading field'); |
alert('$error2'); |
return; |
return; |
} |
} |
vf.submit(); |
vf.submit(); |
} |
} |
Line 2691 ENDPICK
|
Line 2691 ENDPICK
|
} |
} |
|
|
sub csvupload_javascript_forward_associate { |
sub csvupload_javascript_forward_associate { |
|
my $error1=&mt('You need to specify the username or ID'); |
|
my $error2=&mt('You need to specify at least one grading field'); |
return(<<ENDPICK); |
return(<<ENDPICK); |
function verify(vf) { |
function verify(vf) { |
var foundsomething=0; |
var foundsomething=0; |
var founduname=0; |
var founduname=0; |
var foundID=0; |
var foundID=0; |
var founddomain=0; |
|
for (i=0;i<=vf.nfields.value;i++) { |
for (i=0;i<=vf.nfields.value;i++) { |
tw=eval('vf.f'+i+'.selectedIndex'); |
tw=eval('vf.f'+i+'.selectedIndex'); |
if (tw==1) { foundID=1; } |
if (tw==1) { foundID=1; } |
if (tw==2) { founduname=1; } |
if (tw==2) { founduname=1; } |
if (tw==3) { founddomain=1; } |
|
if (tw>3) { foundsomething=1; } |
if (tw>3) { foundsomething=1; } |
} |
} |
if ((founduname==0 && foundID==0) || founddomain==0) { |
if (founduname==0 && foundID==0) { |
alert('You need to specify the domain and either the username or ID'); |
alert('$error1'); |
return; |
return; |
} |
} |
if (foundsomething==0) { |
if (foundsomething==0) { |
alert('You need to specify at least one grading field'); |
alert('$error2'); |
return; |
return; |
} |
} |
vf.submit(); |
vf.submit(); |
} |
} |
Line 2761 to this page if the data selected is ins
|
Line 2761 to this page if the data selected is ins
|
<input type="hidden" name="url" value="$url" /> |
<input type="hidden" name="url" value="$url" /> |
<input type="hidden" name="saveState" value="$ENV{'form.saveState'}" /> |
<input type="hidden" name="saveState" value="$ENV{'form.saveState'}" /> |
<input type="hidden" name="probTitle" value="$ENV{'form.probTitle'}" /> |
<input type="hidden" name="probTitle" value="$ENV{'form.probTitle'}" /> |
<input type="hidden" name="command" value="csvuploadassign" /> |
<input type="hidden" name="command" value="csvuploadoptions" /> |
<hr /> |
<hr /> |
<script type="text/javascript" language="Javascript"> |
<script type="text/javascript" language="Javascript"> |
$javascript |
$javascript |
Line 2885 sub csvuploadmap {
|
Line 2885 sub csvuploadmap {
|
return ''; |
return ''; |
} |
} |
|
|
sub csvuploadassign { |
sub csvuploadoptions { |
my ($request)= @_; |
my ($request)= @_; |
my ($symb,$url)=&get_symb_and_url($request); |
my ($symb,$url)=&get_symb_and_url($request); |
if (!$symb) {return '';} |
my $checked=(($ENV{'form.noFirstLine'})?'1':'0'); |
&Apache::loncommon::load_tmp_file($request); |
my $ignore=&mt('Ignore First Line'); |
my @gradedata = &Apache::loncommon::upfile_record_sep(); |
$request->print(<<ENDPICK); |
if ($ENV{'form.noFirstLine'}) { shift(@gradedata); } |
<form method="post" enctype="multipart/form-data" action="/adm/grades" name="gradesupload"> |
|
<h3><font color="#339933">Uploading Class Grade Options</font></h3> |
|
<input type="hidden" name="command" value="csvuploadassign" /> |
|
<input type="submit" value="Assign Grades" /><br /> |
|
<p> |
|
<label> |
|
<input type="checkbox" name="show_full_results" /> |
|
Show a table of all changes |
|
</label> |
|
</p> |
|
<p> |
|
<label> |
|
<input type="checkbox" name="overwite_scores" checked="checked" /> |
|
Overwrite any existing score |
|
</label> |
|
</p> |
|
ENDPICK |
|
my %fields=&get_fields(); |
|
if (!defined($fields{'domain'})) { |
|
my $domform = &Apache::loncommon::select_dom_form($ENV{'request.role.domain'},'default_domain'); |
|
$request->print("\n<p> Users are in domain: ".$domform."</p>\n"); |
|
} |
|
foreach my $key (sort(keys(%ENV))) { |
|
if ($key !~ /^form\.(.*)$/) { next; } |
|
my $cleankey=$1; |
|
if ($cleankey eq 'command') { next; } |
|
$request->print('<input type="hidden" name="'.$cleankey. |
|
'" value="'.$ENV{$key}.'" />'."\n"); |
|
} |
|
# FIXME do a check for any duplicated user ids... |
|
# FIXME do a check for any invalid user ids?... |
|
$request->print("<hr /></form>\n"); |
|
$request->print(&show_grading_menu_form($symb,$url)); |
|
return ''; |
|
} |
|
|
|
sub get_fields { |
|
my %fields; |
my @keyfields = split(/\,/,$ENV{'form.keyfields'}); |
my @keyfields = split(/\,/,$ENV{'form.keyfields'}); |
my %fields=(); |
|
for (my $i=0; $i<=$ENV{'form.nfields'}; $i++) { |
for (my $i=0; $i<=$ENV{'form.nfields'}; $i++) { |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
if ($ENV{'form.upfile_associate'} eq 'reverse') { |
if ($ENV{'form.f'.$i} ne 'none') { |
if ($ENV{'form.f'.$i} ne 'none') { |
Line 2905 sub csvuploadassign {
|
Line 2941 sub csvuploadassign {
|
} |
} |
} |
} |
} |
} |
|
return %fields; |
|
} |
|
|
|
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(); |
|
if ($ENV{'form.noFirstLine'}) { shift(@gradedata); } |
|
my %fields=&get_fields(); |
$request->print('<h3>Assigning Grades</h3>'); |
$request->print('<h3>Assigning Grades</h3>'); |
my $courseid=$ENV{'request.course.id'}; |
my $courseid=$ENV{'request.course.id'}; |
my ($classlist) = &getclasslist('all',0); |
my ($classlist) = &getclasslist('all',0); |
Line 2913 sub csvuploadassign {
|
Line 2960 sub csvuploadassign {
|
my $countdone=0; |
my $countdone=0; |
foreach my $grade (@gradedata) { |
foreach my $grade (@gradedata) { |
my %entries=&Apache::loncommon::record_sep($grade); |
my %entries=&Apache::loncommon::record_sep($grade); |
my $domain=$entries{$fields{'domain'}}; |
my $domain; |
|
if ($entries{$fields{'domain'}}) { |
|
$domain=$entries{$fields{'domain'}}; |
|
} else { |
|
$domain=$ENV{'form.default_domain'}; |
|
} |
$domain=~s/\s//g; |
$domain=~s/\s//g; |
my $username=$entries{$fields{'username'}}; |
my $username=$entries{$fields{'username'}}; |
$username=~s/\s//g; |
$username=~s/\s//g; |
Line 5144 sub handler {
|
Line 5196 sub handler {
|
$request->print(&csvupload($request)); |
$request->print(&csvupload($request)); |
} elsif ($command eq 'csvuploadmap' && $perm{'mgr'} ) { |
} elsif ($command eq 'csvuploadmap' && $perm{'mgr'} ) { |
$request->print(&csvuploadmap($request)); |
$request->print(&csvuploadmap($request)); |
} elsif ($command eq 'csvuploadassign' && $perm{'mgr'}) { |
} elsif ($command eq 'csvuploadoptions' && $perm{'mgr'}) { |
if ($ENV{'form.associate'} ne 'Reverse Association') { |
if ($ENV{'form.associate'} ne 'Reverse Association') { |
$request->print(&csvuploadassign($request)); |
$request->print(&csvuploadoptions($request)); |
} else { |
} else { |
if ( $ENV{'form.upfile_associate'} ne 'reverse' ) { |
if ( $ENV{'form.upfile_associate'} ne 'reverse' ) { |
$ENV{'form.upfile_associate'} = 'reverse'; |
$ENV{'form.upfile_associate'} = 'reverse'; |
Line 5155 sub handler {
|
Line 5207 sub handler {
|
} |
} |
$request->print(&csvuploadmap($request)); |
$request->print(&csvuploadmap($request)); |
} |
} |
|
} elsif ($command eq 'csvuploadassign' && $perm{'mgr'} ) { |
|
$request->print(&csvuploadassign($request)); |
} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) { |
} elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) { |
$request->print(&scantron_selectphase($request)); |
$request->print(&scantron_selectphase($request)); |
} elsif ($command eq 'scantron_warning' && $perm{'mgr'}) { |
} elsif ($command eq 'scantron_warning' && $perm{'mgr'}) { |