[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm /interface domainprefs.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Sun May 4 17:49:05 EDT 2014


raeburn		Sun May  4 21:49:05 2014 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/auth	lonroles.pm 
  Log:
  - Catalog type set for domain (authenticated and unauthenticated) included
    in domain defaults (cached).
  - Display of prompts on roles/courses screen for users without any active 
    roles depend on catalog type set for user's domain (or default domain,
    if unauthenticated).
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.238 loncom/interface/domainprefs.pm:1.239
--- loncom/interface/domainprefs.pm:1.238	Mon Apr 28 01:48:04 2014
+++ loncom/interface/domainprefs.pm	Sun May  4 21:48:56 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.238 2014/04/28 01:48:04 raeburn Exp $
+# $Id: domainprefs.pm,v 1.239 2014/05/04 21:48:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -622,7 +622,7 @@
     } elsif ($action eq 'scantron') {
         $output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig);
     } elsif ($action eq 'coursecategories') {
-        $output = &modify_coursecategories($dom,%domconfig);
+        $output = &modify_coursecategories($dom,$lastactref,%domconfig);
     } elsif ($action eq 'serverstatuses') {
         $output = &modify_serverstatuses($dom,%domconfig);
     } elsif ($action eq 'requestcourses') {
@@ -9364,7 +9364,7 @@
 }
 
 sub modify_coursecategories {
-    my ($dom,%domconfig) = @_;
+    my ($dom,$lastactref,%domconfig) = @_;
     my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors,
         $cathash);
     my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory');
@@ -9605,6 +9605,12 @@
                 }
             }
             $resulttext .= '</ul>';
+            if ($changes{'unauth'} || $changes{'auth'}) {
+                &Apache::loncommon::devalidate_domconfig_cache($dom);
+                if (ref($lastactref) eq 'HASH') {
+                    $lastactref->{'domainconfig'} = 1;
+                }
+            }
         } else {
             $resulttext = '<span class="LC_error">'.
                           &mt('An error occurred: [_1]',$putresult).'</span>';
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1257 loncom/lonnet/perl/lonnet.pm:1.1258
--- loncom/lonnet/perl/lonnet.pm:1.1257	Wed Apr 30 17:17:46 2014
+++ loncom/lonnet/perl/lonnet.pm	Sun May  4 21:49:00 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1257 2014/04/30 17:17:46 raeburn Exp $
+# $Id: lonnet.pm,v 1.1258 2014/05/04 21:49:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2011,7 +2011,8 @@
          &Apache::lonnet::get_dom('configuration',['defaults','quotas',
                                   'requestcourses','inststatus',
                                   'coursedefaults','usersessions',
-                                  'requestauthor','selfenrollment'],$domain);
+                                  'requestauthor','selfenrollment',
+                                  'coursecategories'],$domain);
     my @coursetypes = ('official','unofficial','community','textbook');
     if (ref($domconfig{'defaults'}) eq 'HASH') {
         $domdefaults{'lang_def'} = $domconfig{'defaults'}{'lang_def'}; 
@@ -2103,6 +2104,16 @@
             }
         }
     }
+    if (ref($domconfig{'coursecategories'}) eq 'HASH') {
+        $domdefaults{'catauth'} = 'std';
+        $domdefaults{'catunauth'} = 'std';
+        if ($domconfig{'coursecategories'}{'auth'}) { 
+            $domdefaults{'catauth'} = $domconfig{'coursecategories'}{'auth'};
+        }
+        if ($domconfig{'coursecategories'}{'unauth'}) {
+            $domdefaults{'catunauth'} = $domconfig{'coursecategories'}{'unauth'};
+        }
+    }
     &do_cache_new('domdefaults',$domain,\%domdefaults,$cachetime);
     return %domdefaults;
 }
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.301 loncom/auth/lonroles.pm:1.302
--- loncom/auth/lonroles.pm:1.301	Tue Mar 25 09:41:16 2014
+++ loncom/auth/lonroles.pm	Sun May  4 21:49:05 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.301 2014/03/25 09:41:16 raeburn Exp $
+# $Id: lonroles.pm,v 1.302 2014/05/04 21:49:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -746,7 +746,12 @@
 
     my $swinfo=&Apache::lonmenu::rawconfig();
     my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum});
-    my $funcs = &get_roles_functions($showcount);
+    my %domdefs=&Apache::lonnet::get_domain_defaults($env{'user.domain'}); 
+    my $cattype = 'std';
+    if ($domdefs{'catauth'}) {
+        $cattype = $domdefs{'catauth'};
+    }
+    my $funcs = &get_roles_functions($showcount,$cattype);
     $standby=~s/\n/\\n/g;
     my $noscript='<br /><span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />';
 
@@ -889,7 +894,7 @@
                       \%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev);
     $refresh = $now;
     &Apache::lonnet::appenv({'user.refresh.time'  => $refresh});
-    unless ($env{'user.adv'}) { 
+    if ((($cattype eq 'std') || ($cattype eq 'domonly')) && (!$env{'user.adv'})) {
         if ($countactive > 0) {
             my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
             my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); 
@@ -918,8 +923,7 @@
 	} else {
 	    $r->print('<h2>'.&mt('Currently no active roles, courses or communities').'</h2>');
 	}
-        &findcourse_advice($r);
-        &requestcourse_advice($r); 
+        &requestcourse_advice($r,$cattype); 
 	$r->print('</form>');
         if ($countfuture) {
             $r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture));
@@ -1407,7 +1411,7 @@
 }
 
 sub findcourse_advice {
-    my ($r) = @_;
+    my ($r,$cattype) = @_;
     my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
     my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
     if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) {
@@ -1422,15 +1426,17 @@
     } else {
         $r->print(&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'<br />');
     }
-    $r->print('<h3>'.&mt('Self-Enrollment').'</h3>'.
-              '<p>'.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','<a href="/adm/coursecatalog?showdom='.$esc_dom.'">','</a>',$domdesc).'<br />');
-    $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'</p>'.
-              &Apache::loncoursequeueadmin::queued_selfenrollment());
+    if (($cattype eq 'std') || ($cattype eq 'domonly')) {
+        $r->print('<h3>'.&mt('Self-Enrollment').'</h3>'.
+                  '<p>'.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','<a href="/adm/coursecatalog?showdom='.$esc_dom.'">','</a>',$domdesc).'<br />');
+        $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'</p>'.
+        &Apache::loncoursequeueadmin::queued_selfenrollment());
+    }
     return;
 }
 
 sub requestcourse_advice {
-    my ($r) = @_;
+    my ($r,$cattype) = @_;
     my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
     my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
     my (%can_request,%request_doms);
@@ -1478,6 +1484,8 @@
             } 
             $r->print('</ul>'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','<a href="'.$requrl.'">','</a>').'</p>');
         }
+    } elsif (!$env{'user.adv'}) {
+        &findcourse_advice($r,$cattype);
     }
     return;
 }
@@ -2704,7 +2712,7 @@
 }
 
 sub get_roles_functions {
-    my ($rolescount) = @_;
+    my ($rolescount,$cattype) = @_;
     my @links;
     push(@links,["javascript:rolesView('doupdate');",'start-here-22x22',&mt('Check for changes')]);
     if ($env{'environment.canrequest.author'}) {
@@ -2730,7 +2738,7 @@
             push(@links,["javascript:rolesView('showall');",'edit-undo-22x22',&mt('Include expired')]);
         }
     }
-    if (&Apache::loncommon::designparm('login.coursecatalog',$env{'user.domain'})) {
+    unless ($cattype eq 'none') {
         push(@links,['/adm/coursecatalog','ccat-22x22',&mt('Course catalog')]);
     }
     my $funcs = &Apache::lonhtmlcommon::start_funclist();


More information about the LON-CAPA-cvs mailing list