[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /auth lonroles.pm

raeburn raeburn at source.lon-capa.org
Sun May 4 18:24:44 EDT 2014


raeburn		Sun May  4 22:24:44 2014 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/auth	lonroles.pm 
  Log:
  - For 2.11
    - Backport 1.293, 1.294, 1.302
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.269.2.17 loncom/auth/lonroles.pm:1.269.2.18
--- loncom/auth/lonroles.pm:1.269.2.17	Sat Apr  5 12:25:19 2014
+++ loncom/auth/lonroles.pm	Sun May  4 22:24:44 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.269.2.17 2014/04/05 12:25:19 raeburn Exp $
+# $Id: lonroles.pm,v 1.269.2.18 2014/05/04 22:24:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -598,7 +598,7 @@
 				# Check to see if the user is a CC entering a course 
 				# for the first time
 				if ((($role eq 'cc') || ($role eq 'co')) 
-                                    && ($env{'course.' .$cdom.'_'.$cnum.'.course.helper.not.run'})) { 
+                                    && ($env{'course.'.$cdom.'_'.$cnum.'.course.helper.not.run'})) { 
 				    $furl = "/adm/helper/course.initialization.helper";
 				    # Send the user to the course they selected
 				} elsif ($env{'request.course.id'}) {
@@ -752,7 +752,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 />';
 
@@ -895,7 +900,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'},'"<>&'); 
@@ -907,7 +912,7 @@
                    ,'<a href="/adm/coursecatalog?showdom='.$esc_dom.'">'
                    ,'</a>'
                    ,'</b>'
-                   ,'"'. $domdesc.'"')
+                   ,'"'.$domdesc.'"')
                .'<br />'
                .&mt('If a course or community is [_1]not[_2] in your list of current courses and communities below,'
                    .' you may be able to enroll if self-enrollment is permitted.'
@@ -924,8 +929,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));
@@ -1413,7 +1417,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'})) {
@@ -1428,15 +1432,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);
@@ -1484,6 +1490,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;
 }
@@ -2464,7 +2472,7 @@
                 if ($desc) {
                     $newmsg .= '<li>'.
                                &mt('[_1] with status: [_2].',
-                               $desc,$newrole{$item}).'</li>';
+                               $desc,&mt($newrole{$item})).'</li>';
                 }
             }
             if ($newmsg) {
@@ -2710,7 +2718,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'}) {
@@ -2736,7 +2744,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();
@@ -2807,7 +2815,7 @@
             if (($status eq 'approval') || ($status eq 'approved')) {
                 $output .= '<p><b>'.&mt('Author role request').'</b><br />';
                 if ($status eq 'approval') {
-                    $output .= &mt('A request for authoring space submitted on [_1] is awaiting approval',
+                    $output .= &mt('A request for Authoring Space submitted on [_1] is awaiting approval',
                                   &Apache::lonlocal::locallocaltime($timestamp));
                 } elsif ($status eq 'approved') {
                     my %roleshash =




More information about the LON-CAPA-cvs mailing list