[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / lond
raeburn
raeburn at source.lon-capa.org
Fri Jan 3 14:36:48 EST 2014
raeburn Fri Jan 3 19:36:48 2014 EDT
Modified files: (Branch: version_2_11_X)
/loncom lond
Log:
- For 2.11
- Backport 1.505, 1.506
Index: loncom/lond
diff -u loncom/lond:1.489.2.10 loncom/lond:1.489.2.11
--- loncom/lond:1.489.2.10 Fri Dec 13 17:30:30 2013
+++ loncom/lond Fri Jan 3 19:36:47 2014
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.489.2.10 2013/12/13 17:30:30 raeburn Exp $
+# $Id: lond,v 1.489.2.11 2014/01/03 19:36:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,7 +61,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.489.2.10 $'; #' stupid emacs
+my $VERSION='$Revision: 1.489.2.11 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -3830,7 +3830,9 @@
# creationcontext - include courses created in specified context
#
# domcloner - flag to indicate if user can create CCs in course's domain.
-# If so, ability to clone course is automatic.
+# If so, ability to clone course is automatic.
+# hasuniquecode - filter by courses for which a six character unique code has
+# been set.
#
# $client - The socket open on the client.
# Returns:
@@ -3844,7 +3846,7 @@
my ($udom,$since,$description,$instcodefilter,$ownerfilter,$coursefilter,
$typefilter,$regexp_ok,$rtn_as_hash,$selfenrollonly,$catfilter,$showhidden,
$caller,$cloner,$cc_clone_list,$cloneonly,$createdbefore,$createdafter,
- $creationcontext,$domcloner) =split(/:/,$tail);
+ $creationcontext,$domcloner,$hasuniquecode) =split(/:/,$tail);
my $now = time;
my ($cloneruname,$clonerudom,%cc_clone);
if (defined($description)) {
@@ -3917,6 +3919,9 @@
} else {
$creationcontext = '.';
}
+ unless ($hasuniquecode) {
+ $hasuniquecode = '.';
+ }
my $unpack = 1;
if ($description eq '.' && $instcodefilter eq '.' && $ownerfilter eq '.' &&
$typefilter eq '.') {
@@ -4005,6 +4010,9 @@
$selfenroll_end = $items->{'selfenroll_end_date'};
$created = $items->{'created'};
$context = $items->{'context'};
+ if ($hasuniquecode ne '.') {
+ next unless ($items->{'uniquecode'});
+ }
if ($selfenrollonly) {
next if (!$selfenroll_types);
if (($selfenroll_end > 0) && ($selfenroll_end <= $now)) {
@@ -5287,6 +5295,49 @@
}
®ister_handler("autocrsreqvalidation", \&validate_crsreq_handler, 0, 1, 0);
+sub crsreq_update_handler {
+ my ($cmd, $tail, $client) = @_;
+ my $userinput = "$cmd:$tail";
+ my ($cdom,$cnum,$crstype,$action,$ownername,$ownerdomain,$fullname,$title,$code,$infohashref) =
+ split(/:/, $tail);
+ $crstype = &unescape($crstype);
+ $action = &unescape($action);
+ $ownername = &unescape($ownername);
+ $ownerdomain = &unescape($ownerdomain);
+ $fullname = &unescape($fullname);
+ $title = &unescape($title);
+ $code = &unescape($code);
+ my $incoming = &Apache::lonnet::thaw_unescape($infohashref);
+ my ($result,$outcome);
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ my %rtnhash;
+ $outcome = &localenroll::crsreq_updates($cdom,$cnum,$crstype,$action,
+ $ownername,$ownerdomain,$fullname,
+ $title,$code,$incoming,\%rtnhash);
+ if ($outcome eq 'ok') {
+ my @posskeys = qw(createdweb createdmsg queuedweb queuedmsg formitems reviewweb);
+ foreach my $key (keys(%rtnhash)) {
+ if (grep(/^\Q$key\E/, at posskeys)) {
+ $result .= &escape($key).'='.&Apache::lonnet::freeze_escape($rtnhash{$key}).'&';
+ }
+ }
+ $result =~ s/\&$//;
+ }
+ };
+ if (!$@) {
+ if ($outcome eq 'ok') {
+ &Reply($client, \$result, $userinput);
+ } else {
+ &Reply($client, "format_error\n", $userinput);
+ }
+ } else {
+ &Failure($client,"unknown_cmd\n",$userinput);
+ }
+ return 1;
+}
+®ister_handler("autocrsrequpdate", \&crsreq_update_handler, 0, 1, 0);
+
#
# Read and retrieve institutional code format (for support form).
# Formal Parameters:
More information about the LON-CAPA-cvs
mailing list