[LON-CAPA-cvs] cvs: loncom /homework grades.pm inputtags.pm /interface loncreatecourse.pm lonparmset.pm /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 24 Feb 2004 23:22:28 -0000
This is a MIME encoded message
--albertel1077664948
Content-Type: text/plain
albertel Tue Feb 24 18:22:28 2004 EDT
Modified files:
/loncom/homework inputtags.pm grades.pm
/loncom/lonnet/perl lonnet.pm
/loncom/interface lonparmset.pm loncreatecourse.pm
Log:
- add new receipt algorithm which uses parts in the receipt BUG#2752
- add new paramater to course which specifies which recipt alg to use
- new coureses are created to default to new alg
--albertel1077664948
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20040224182228.txt"
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.131 loncom/homework/inputtags.pm:1.132
--- loncom/homework/inputtags.pm:1.131 Tue Feb 24 17:34:51 2004
+++ loncom/homework/inputtags.pm Tue Feb 24 18:22:24 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.131 2004/02/24 22:34:51 albertel Exp $
+# $Id: inputtags.pm,v 1.132 2004/02/24 23:22:24 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -369,7 +369,7 @@
$ENV{'request.course.id'}.
'.disable_receipt_display'} eq 'yes') {
$message.=(($target eq 'web')?'<br />':' ').
- &mt('Your receipt is').' '.&Apache::lonnet::receipt().
+ &mt('Your receipt is').' '.&Apache::lonnet::receipt($Apache::inputtags::part).
(($target eq 'web')?&Apache::loncommon::help_open_topic('Receipt'):'');
}
}
@@ -396,7 +396,7 @@
$ENV{'request.course.id'}.
'.disable_receipt_display'} eq 'yes') {
$message.=(($target eq 'web')?'<br />':' ').
- 'Your receipt is '.&Apache::lonnet::receipt().
+ 'Your receipt is '.&Apache::lonnet::receipt($Apache::inputtags::part).
(($target eq 'web')?&Apache::loncommon::help_open_topic('Receipt'):'');
}
$bgcolor=$possiblecolors{'correct'};
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.176 loncom/homework/grades.pm:1.177
--- loncom/homework/grades.pm:1.176 Tue Feb 17 11:45:58 2004
+++ loncom/homework/grades.pm Tue Feb 24 18:22:24 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.176 2004/02/17 16:45:58 albertel Exp $
+# $Id: grades.pm,v 1.177 2004/02/24 23:22:24 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -526,18 +526,28 @@
my ($string,$contents,$matches) = ('','',0);
my (undef,undef,$fullname) = &getclasslist('all','0');
-
+
+ my $receiptparts=0;
+ if ($ENV{"course.$courseid.receiptalg"} eq 'receipt2') { $receiptparts=1; }
+ my $parts=['0'];
+ if ($receiptparts) { ($parts)=&response_type($url,$symb); }
+ $request->print("got Parts ".join(':',@$parts));
foreach (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) {
my ($uname,$udom)=split(/\:/);
- if ($receipt eq
- &Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb)) {
- $contents.='<tr bgcolor="#ffffe6"><td> '."\n".
- '<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom.
- '\')"; TARGET=_self>'.$$fullname{$_}.'</a> </td>'."\n".
- '<td> '.$uname.' </td>'.
- '<td> '.$udom.' </td></tr>'."\n";
-
- $matches++;
+ foreach my $part (@$parts) {
+ if ($receipt eq &Apache::lonnet::ireceipt($uname,$udom,$courseid,$symb,$part)) {
+ $contents.='<tr bgcolor="#ffffe6"><td> '."\n".
+ '<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom.
+ '\')"; TARGET=_self>'.$$fullname{$_}.'</a> </td>'."\n".
+ '<td> '.$uname.' </td>'.
+ '<td> '.$udom.' </td>';
+ if ($receiptparts) {
+ $contents.='<td> '.$part.' </td>';
+ }
+ $contents.='</tr>'."\n";
+
+ $matches++;
+ }
}
}
if ($matches == 0) {
@@ -550,8 +560,11 @@
'<table border="0"><tr bgcolor="#e6ffff">'."\n".
'<td><b> Fullname </b></td>'."\n".
'<td><b> Username </b></td>'."\n".
- '<td><b> Domain </b></td></tr>'."\n".
- $contents.
+ '<td><b> Domain </b></td>';
+ if ($receiptparts) {
+ $string.='<td> Problem Part </td>';
+ }
+ $string.='</tr>'."\n".$contents.
'</table></td></tr></table>'."\n";
}
return $string.&show_grading_menu_form($symb,$url);
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.473 loncom/lonnet/perl/lonnet.pm:1.474
--- loncom/lonnet/perl/lonnet.pm:1.473 Tue Feb 24 11:26:06 2004
+++ loncom/lonnet/perl/lonnet.pm Tue Feb 24 18:22:24 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.473 2004/02/24 16:26:06 matthew Exp $
+# $Id: lonnet.pm,v 1.474 2004/02/24 23:22:24 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4398,25 +4398,47 @@
}
}
+sub latest_receipt_algorithm_id {
+ return 'receipt2';
+}
+
sub ireceipt {
- my ($funame,$fudom,$fucourseid,$fusymb)=@_;
+ my ($funame,$fudom,$fucourseid,$fusymb,$part)=@_;
my $cuname=unpack("%32C*",$funame);
my $cudom=unpack("%32C*",$fudom);
my $cucourseid=unpack("%32C*",$fucourseid);
my $cusymb=unpack("%32C*",$fusymb);
my $cunique=unpack("%32C*",$perlvar{'lonReceipt'});
- return unpack("%32C*",$perlvar{'lonHostID'}).'-'.
- ($cunique%$cuname+
- $cunique%$cudom+
- $cusymb%$cuname+
- $cusymb%$cudom+
- $cucourseid%$cuname+
- $cucourseid%$cudom);
+ my $cpart=unpack("%32S*",$part);
+ my $return =unpack("%32C*",$perlvar{'lonHostID'}).'-';
+ if ($ENV{"course.$fucourseid.receiptalg"} eq 'receipt2' ||
+ $ENV{'request.state'} eq 'construct') {
+ &Apache::lonxml::debug("doing receipt2 using parts $cpart, uname $cuname and udom $cudom gets ".($cpart%$cuname).
+ " and ".($cpart%$cudom));
+
+ $return.= ($cunique%$cuname+
+ $cunique%$cudom+
+ $cusymb%$cuname+
+ $cusymb%$cudom+
+ $cucourseid%$cuname+
+ $cucourseid%$cudom+
+ $cpart%$cuname+
+ $cpart%$cudom);
+ } else {
+ $return.= ($cunique%$cuname+
+ $cunique%$cudom+
+ $cusymb%$cuname+
+ $cusymb%$cudom+
+ $cucourseid%$cuname+
+ $cucourseid%$cudom);
+ }
+ return $return;
}
sub receipt {
- my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
- return &ireceipt($name,$domain,$courseid,$symb);
+ my ($part)=@_;
+ my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
+ return &ireceipt($name,$domain,$courseid,$symb,$part);
}
# ------------------------------------------------------------ Serves up a file
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.150 loncom/interface/lonparmset.pm:1.151
--- loncom/interface/lonparmset.pm:1.150 Mon Feb 2 15:21:25 2004
+++ loncom/interface/lonparmset.pm Tue Feb 24 18:22:27 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.150 2004/02/02 20:21:25 www Exp $
+# $Id: lonparmset.pm,v 1.151 2004/02/24 23:22:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1589,6 +1589,9 @@
=> '<b>'.&mt('Randomization algorithm used').'</b> <br />'.
'<font color="red">'.&mt('Modifying this will make problems').' '.
&mt('have different numbers and answers').'</font>',
+ 'receiptalg'
+ => '<b>'.&mt('Receipt algorithm used').'</b> <br />'.
+ &mt('This controls how receipt numbers are generated.'),
'problem_stream_switch'
=> '<b>'.&mt('Allow problems to be split over pages').'</b><br />'.
' ("<tt>'.&mt('yes').'</tt>" '.&mt('if allowed, anything else if not').')',
@@ -1615,6 +1618,7 @@
'languages',
'nothideprivileged',
'rndseed',
+ 'receiptalg',
'problem_stream_switch',
'disable_receipt_display',
'spreadsheet_default_classcalc',
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.50 loncom/interface/loncreatecourse.pm:1.51
--- loncom/interface/loncreatecourse.pm:1.50 Fri Feb 13 10:24:00 2004
+++ loncom/interface/loncreatecourse.pm Tue Feb 24 18:22:27 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Create a course
#
-# $Id: loncreatecourse.pm,v 1.50 2004/02/13 15:24:00 www Exp $
+# $Id: loncreatecourse.pm,v 1.51 2004/02/24 23:22:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -671,6 +671,7 @@
# Use new Randomseed
#
$cenv{'rndseed'}=&Apache::lonnet::latest_rnd_algorithm_id();;
+ $cenv{'receiptalg'}=&Apache::lonnet::latest_receipt_algorithm_id();;
#
# By default, use standard grading
$cenv{'grading'} = 'standard';
--albertel1077664948--