[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonrequestcourse.pm
raeburn
raeburn at source.lon-capa.org
Fri Jul 26 13:57:13 EDT 2019
raeburn Fri Jul 26 17:57:13 2019 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface lonrequestcourse.pm
Log:
- For 2.11
Backport 1.105, 1.107
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.95.2.3 loncom/interface/lonrequestcourse.pm:1.95.2.4
--- loncom/interface/lonrequestcourse.pm:1.95.2.3 Sun Sep 2 01:16:59 2018
+++ loncom/interface/lonrequestcourse.pm Fri Jul 26 17:57:12 2019
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.95.2.3 2018/09/02 01:16:59 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.95.2.4 2019/07/26 17:57:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -119,6 +119,10 @@
use Apache::lonuserutils;
use LONCAPA qw(:DEFAULT :match);
+my $registered_flush;
+my $registered_instcats;
+my $modified_dom;
+
sub handler {
my ($r) = @_;
&Apache::loncommon::content_type($r,'text/html');
@@ -127,6 +131,10 @@
return OK;
}
+ $registered_flush = 0;
+ $registered_instcats = 0;
+ $modified_dom = '';
+
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['action','showdom','cnum','state','crstype','queue','tabs']);
&Apache::lonhtmlcommon::clear_breadcrumbs();
@@ -3846,6 +3854,24 @@
}
$output .= '</p>';
$creationresult = 'created';
+ # Flush the course logs so reverse user roles immediately updated
+ unless ($registered_flush) {
+ my $handlers = $r->get_handlers('PerlCleanupHandler');
+ $r->set_handlers('PerlCleanupHandler' => [\&Apache::lonnet::flushcourselogs,@{$handlers}]);
+ $registered_flush=1;
+ }
+ if ($instcode ne '') {
+ &Apache::lonnet::devalidate_cache_new('instcats',$dom);
+ # Update cache of self-cataloging courses on institution's server(s).
+ if (&Apache::lonnet::shared_institution($dom)) {
+ unless ($registered_instcats) {
+ my $handlers = $r->get_handlers('PerlCleanupHandler');
+ $r->set_handlers('PerlCleanupHandler' => [\&devalidate_remote_instcats,@{$handlers}]);
+ $registered_instcats=1;
+ $modified_dom = $dom;
+ }
+ }
+ }
} else {
$output = '<span class="LC_error">';
if ($crstype eq 'community') {
@@ -3981,6 +4007,22 @@
}
}
+sub devalidate_remote_instcats {
+ if ($modified_dom ne '') {
+ my %servers = &Apache::lonnet::internet_dom_servers($modified_dom);
+ my %thismachine;
+ map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
+ if (keys(%servers)) {
+ foreach my $server (keys(%servers)) {
+ next if ($thismachine{$server});
+ &Apache::lonnet::remote_devalidate_cache($server,['instcats:'.$modified_dom]);
+ }
+ }
+ $modified_dom = '';
+ }
+ return;
+}
+
sub custom_formitems {
my ($preprocess,$customhash) = @_;
return unless ((ref($preprocess) eq 'HASH') && (ref($customhash) eq 'HASH'));
@@ -4289,9 +4331,10 @@
$buttontext = &mt('Create course');
}
}
+ my $hostname = &Apache::lonnet::hostname($lonhost);
my $protocol = $Apache::lonnet::protocol{$lonhost};
$protocol = 'http' if ($protocol ne 'https');
- my $crscreator = $protocol.'://'.&Apache::lonnet::hostname($lonhost).'/cgi-bin/createpending.pl';
+ my $crscreator = $protocol.'://'.$hostname.'/cgi-bin/createpending.pl';
$output .= '<input type="hidden" name="crscreator" value="'.$crscreator.'" />'."\n".
'<input type="hidden" name="token" value="'.$token.'" />'."\n".
'<input type="submit" name="validate" value="'.$buttontext.'" />'."\n".
More information about the LON-CAPA-cvs
mailing list