[LON-CAPA-cvs] cvs: loncom /homework grades.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 23 Feb 2007 00:23:50 -0000


albertel		Thu Feb 22 19:23:50 2007 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/homework	grades.pm 
  Log:
  - switch to use MD% instead
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.834 loncom/lonnet/perl/lonnet.pm:1.835
--- loncom/lonnet/perl/lonnet.pm:1.834	Sat Feb 17 20:52:20 2007
+++ loncom/lonnet/perl/lonnet.pm	Thu Feb 22 19:23:46 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.834 2007/02/18 01:52:20 albertel Exp $
+# $Id: lonnet.pm,v 1.835 2007/02/23 00:23:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7085,13 +7085,14 @@
 }
 
 sub latest_receipt_algorithm_id {
-    return 'receipt2';
+    return 'receipt3';
 }
 
 sub recunique {
     my $fucourseid=shift;
     my $unique;
-    if ($env{"course.$fucourseid.receiptalg"} eq 'receipt2') {
+    if ($env{"course.$fucourseid.receiptalg"} eq 'receipt2' ||
+	$env{"course.$fucourseid.receiptalg"} eq 'receipt3' ) {
 	$unique=$env{"course.$fucourseid.internal.encseed"};
     } else {
 	$unique=$perlvar{'lonReceipt'};
@@ -7102,7 +7103,8 @@
 sub recprefix {
     my $fucourseid=shift;
     my $prefix;
-    if ($env{"course.$fucourseid.receiptalg"} eq 'receipt2') {
+    if ($env{"course.$fucourseid.receiptalg"} eq 'receipt2'||
+	$env{"course.$fucourseid.receiptalg"} eq 'receipt3' ) {
 	$prefix=$env{"course.$fucourseid.internal.encpref"};
     } else {
 	$prefix=$perlvar{'lonHostID'};
@@ -7112,15 +7114,23 @@
 
 sub ireceipt {
     my ($funame,$fudom,$fucourseid,$fusymb,$part)=@_;
+
+    my $return =&recprefix($fucourseid).'-';
+
+    if ($env{"course.$fucourseid.receiptalg"} eq 'receipt3' ||
+	$env{'request.state'} eq 'construct') {
+	$return .= (&digest("$funame,$fudom,$fucourseid,$fusymb,$part")%10000);
+	return $return;
+    }
+
     my $cuname=unpack("%32C*",$funame);
     my $cudom=unpack("%32C*",$fudom);
     my $cucourseid=unpack("%32C*",$fucourseid);
     my $cusymb=unpack("%32C*",$fusymb);
     my $cunique=&recunique($fucourseid);
     my $cpart=unpack("%32S*",$part);
-    my $return =&recprefix($fucourseid).'-';
-    if ($env{"course.$fucourseid.receiptalg"} eq 'receipt2' ||
-	$env{'request.state'} eq 'construct') {
+    if ($env{"course.$fucourseid.receiptalg"} eq 'receipt2') {
+
 	#&logthis("doing receipt2  using parts $cpart, uname $cuname and udom $cudom gets  ".($cpart%$cuname)." and ".($cpart%$cudom));
 			       
 	$return.= ($cunique%$cuname+
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.389 loncom/homework/grades.pm:1.390
--- loncom/homework/grades.pm:1.389	Mon Feb 12 18:09:14 2007
+++ loncom/homework/grades.pm	Thu Feb 22 19:23:49 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.389 2007/02/12 23:09:14 albertel Exp $
+# $Id: grades.pm,v 1.390 2007/02/23 00:23:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -599,7 +599,8 @@
     my (undef,undef,$fullname) = &getclasslist('all','0');
     
     my $receiptparts=0;
-    if ($env{"course.$courseid.receiptalg"} eq 'receipt2') { $receiptparts=1; }
+    if ($env{"course.$courseid.receiptalg"} eq 'receipt2' ||
+	$env{"course.$courseid.receiptalg"} eq 'receipt3') { $receiptparts=1; }
     my $parts=['0'];
     if ($receiptparts) { ($parts)=&response_type($symb); }
     foreach (sort