[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / lond

raeburn raeburn at source.lon-capa.org
Tue Aug 16 13:45:02 EDT 2016


raeburn		Tue Aug 16 17:45:02 2016 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom	lond 
  Log:
  - For 2.11
    - Backport 1.522
  
  
Index: loncom/lond
diff -u loncom/lond:1.489.2.21 loncom/lond:1.489.2.22
--- loncom/lond:1.489.2.21	Thu Aug 11 16:37:54 2016
+++ loncom/lond	Tue Aug 16 17:45:01 2016
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.489.2.21 2016/08/11 16:37:54 raeburn Exp $
+# $Id: lond,v 1.489.2.22 2016/08/16 17:45:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -64,7 +64,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.489.2.21 $'; #' stupid emacs
+my $VERSION='$Revision: 1.489.2.22 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -5330,6 +5330,52 @@
 &register_handler("autocreatepassword", \&create_auto_enroll_password_handler, 
 		  0, 1, 0);
 
+sub auto_export_grades_handler {
+    my ($cmd, $tail, $client) = @_;
+    my $userinput = "$cmd:$tail";
+    my ($cdom,$cnum,$info,$data) = split(/:/,$tail);
+    my $inforef = &Apache::lonnet::thaw_unescape($info);
+    my $dataref = &Apache::lonnet::thaw_unescape($data);
+    my ($outcome,$result);;
+    eval {
+        local($SIG{__DIE__})='DEFAULT';
+        my %rtnhash;
+        $outcome=&localenroll::export_grades($cdom,$cnum,$inforef,$dataref,\%rtnhash);
+        if ($outcome eq 'ok') {
+            foreach my $key (keys(%rtnhash)) {
+                $result .= &escape($key).'='.&Apache::lonnet::freeze_escape($rtnhash{$key}).'&';
+            }
+            $result =~ s/\&$//;
+        }
+    };
+    if (!$@) {
+        if ($outcome eq 'ok') {
+            if ($cipher) {
+                my $cmdlength=length($result);
+                $result.="         ";
+                my $encresult='';
+                for (my $encidx=0;$encidx<=$cmdlength;$encidx+=8) {
+                    $encresult.= unpack("H16",
+                                        $cipher->encrypt(substr($result,
+                                                                $encidx,
+                                                                8)));
+                }
+                &Reply( $client, "enc:$cmdlength:$encresult\n", $userinput);
+            } else {
+                &Failure( $client, "error:no_key\n", $userinput);
+            }
+        } else {
+            &Reply($client, "$outcome\n", $userinput);
+        }
+    } else {
+        &Failure($client,"export_error\n",$userinput);
+    }
+    return 1;
+}
+&register_handler("autoexportgrades", \&auto_export_grades_handler,
+                  0, 1, 0);
+
+
 #   Retrieve and remove temporary files created by/during autoenrollment.
 #
 # Formal Parameters:




More information about the LON-CAPA-cvs mailing list