[LON-CAPA-cvs] cvs: loncom /interface lonpickcourse.pm

raeburn raeburn at source.lon-capa.org
Wed Nov 2 18:41:19 EDT 2016


raeburn		Wed Nov  2 22:41:19 2016 EDT

  Modified files:              
    /loncom/interface	lonpickcourse.pm 
  Log:
  - "Enter the course with one of the available ad hoc roles" radio button only
    displayed to user with Domain Heldesk role if custom ad hoc roles assigned. 
  
  
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.121 loncom/interface/lonpickcourse.pm:1.122
--- loncom/interface/lonpickcourse.pm:1.121	Tue Nov  1 15:47:11 2016
+++ loncom/interface/lonpickcourse.pm	Wed Nov  2 22:41:18 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Pick a course
 #
-# $Id: lonpickcourse.pm,v 1.121 2016/11/01 15:47:11 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.122 2016/11/02 22:41:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -410,15 +410,17 @@
             my $cctitle = &Apache::lonnet::plaintext($ccrole,$type);
             my $dctitle = &Apache::lonnet::plaintext('dc');
             my $ccrolechk = ' ';
+            my $possrole;
             my $menuchk = ' checked="checked" ';
             $r->print(
                 '<div class="LC_left_float">'
                .'<fieldset>'
-               .'<legend>'.&mt('Pick action').'</legend>'
-               .'<span class="LC_nobreak"><label>'
-               .'<input type="radio" name="phase" value="adhocrole"'.$ccrolechk.'/>'
-               .' ');
+               .'<legend>'.&mt('Pick action').'</legend>');
+            my $roleradio = '<span class="LC_nobreak"><label>'.
+                            '<input type="radio" name="phase" value="adhocrole"'.$ccrolechk.'/>'.' ';
             if (&Apache::lonnet::allowed('ccc',$crsdom)) {
+                $possrole = 1;
+                $r->print($roleradio);
                 if ($type eq 'Community') {
                     $r->print(&mt('Enter the community with the role of [_1].',$cctitle));
                 } elsif ($type eq 'Placement') {
@@ -429,7 +431,9 @@
             } elsif (&Apache::lonnet::allowed('rar',$crsdom)) {
                 my %adhocroles = &Apache::lonnet::userenvironment($env{'user.domain'},$env{'user.name'},
                                                                   'adhocroles.'.$crsdom);
-                if (keys(%adhocroles)) {
+                if ($adhocroles{'adhocroles.'.$crsdom} ne '') {
+                    $possrole = 1;
+                    $r->print($roleradio);
                     my @adhoc = split(/,/,$adhocroles{'adhocroles.'.$crsdom});
                     if (@adhoc > 1) {
                         my %adhochash;
@@ -457,9 +461,11 @@
                     }
                 }
             }
-            $r->print('</label></span><br />'
-               .'<span class="LC_nobreak"><label>'
-               .'<input type="radio" name="phase" value="menu"'.$menuchk.'/> ');
+            if ($possrole) { 
+                $r->print('</label></span><br />');
+            }
+            $r->print('<span class="LC_nobreak"><label>'
+                     .'<input type="radio" name="phase" value="menu"'.$menuchk.'/> ');
             if (&Apache::lonnet::allowed('ccc',$crsdom)) {
                 if ($type eq 'Community') {
                     $r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle));




More information about the LON-CAPA-cvs mailing list