[LON-CAPA-cvs] cvs: loncom /interface lonuserutils.pm selfenroll.pm
raeburn
raeburn at source.lon-capa.org
Fri Apr 4 19:06:32 EDT 2014
raeburn Fri Apr 4 23:06:32 2014 EDT
Modified files:
/loncom/interface lonuserutils.pm selfenroll.pm
Log:
- Include course description amongst fields which can be POSTed to
external site used for validation of self-enrollment request.
- Include URL for enrollqueued.pl script in POSTed form elements.
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.165 loncom/interface/lonuserutils.pm:1.166
--- loncom/interface/lonuserutils.pm:1.165 Mon Mar 31 01:09:11 2014
+++ loncom/interface/lonuserutils.pm Fri Apr 4 23:06:31 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.165 2014/03/31 01:09:11 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.166 2014/04/04 23:06:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6095,7 +6095,7 @@
button => 'Text for validation button',
markup => 'Validation description (HTML)',
);
- my @fields = ('username','domain','uniquecode','course','token','coursetype');
+ my @fields = ('username','domain','uniquecode','course','token','coursetype','description');
return (\@items,\%names,\@fields);
}
Index: loncom/interface/selfenroll.pm
diff -u loncom/interface/selfenroll.pm:1.29 loncom/interface/selfenroll.pm:1.30
--- loncom/interface/selfenroll.pm:1.29 Wed Apr 2 16:51:11 2014
+++ loncom/interface/selfenroll.pm Fri Apr 4 23:06:32 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Allow users to self-enroll in a course
#
-# $Id: selfenroll.pm,v 1.29 2014/04/02 16:51:11 raeburn Exp $
+# $Id: selfenroll.pm,v 1.30 2014/04/04 23:06:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -562,7 +562,7 @@
});
my $token;
if ($status eq 'pending') {
- $token = &Apache::lonnet::tmpput(\%selfenroll,$lonhost);;
+ $token = &Apache::lonnet::tmpput(\%selfenroll,$lonhost);
$userenroll{$cdom.'_'.$cnum}{'token'} = $token;
$userenroll{$cdom.'_'.$cnum}{'lonhost'} = $lonhost;
$userenroll{$cdom.'_'.$cnum}{'handle'} = $handle;
@@ -583,11 +583,13 @@
'token' => $token,
);
my %domconfig = &Apache::lonnet::get_dom('configuration',['selfenrollment'],$cdom);
+
if (ref($domconfig{'selfenrollment'}) eq 'HASH') {
my ($url,$buttontext,$code, at fields);
if (ref($domconfig{'selfenrollment'}{'validation'}) eq 'HASH') {
my %courseinfo = &Apache::lonnet::coursedescription($cdom.'_'.$cnum,{ 'one_time' => 1});
$postvalues{'uniquecode'} = $courseinfo{'internal.uniquecode'};
+ $postvalues{'description'} = $courseinfo{'description'};
$url = $domconfig{'selfenrollment'}{'validation'}{'url'};
if (ref($domconfig{'selfenrollment'}{'validation'}{'fields'}) eq 'ARRAY') {
@fields = @{$domconfig{'selfenrollment'}{'validation'}{'fields'}};
@@ -602,15 +604,21 @@
$output .= '<input type="hidden" name="'.$field.'" value="'.$postvalues{$field}.'" />'."\n";
}
}
- }
- if ($buttontext eq '') {
- $buttontext = &mt('Complete my enrollment');
- }
- $output .= '<input type="submit" name="validate" value="'.$buttontext.'" />'."\n".
- '</form>'."\n";
+ if ($buttontext eq '') {
+ $buttontext = &mt('Complete my enrollment');
+ }
+ my $protocol = $Apache::lonnet::protocol{$lonhost};
+ $protocol = 'http' if ($protocol ne 'https');
+ my $enroller = $protocol.'://'.&Apache::lonnet::hostname($lonhost).'/cgi-bin/enrollqueued.pl';
+ $output .= '<input type="hidden" name="enroller" value="'.$enroller.'" />'."\n".
+ '<input type="submit" name="validate" value="'.$buttontext.'" />'."\n".
+ '</form>'."\n";
+ } else {
+ $status = 'request';
+ }
}
} else {
- $status eq 'request';
+ $status = 'request';
}
}
if ($status eq 'request') {
More information about the LON-CAPA-cvs
mailing list