Diff for /loncom/auth/lonroles.pm between versions 1.137 and 1.138

version 1.137, 2005/11/21 19:08:24 version 1.138, 2005/12/15 23:31:22
Line 636  ENDHEADER Line 636  ENDHEADER
     if (defined($roletext{'user.role.'.$_})) {      if (defined($roletext{'user.role.'.$_})) {
  $output.=$roletext{'user.role.'.$_};   $output.=$roletext{'user.role.'.$_};
                 if ($_ =~ m-dc\./(\w+)/- && $dcroles{$1}) {                  if ($_ =~ m-dc\./(\w+)/- && $dcroles{$1}) {
     $output .= &allcourses_row($1);      $output .= &allcourses_row($1,'recent');
                 }                  }
     } elsif ($numdc > 0) {      } elsif ($numdc > 0) {
                 unless ($_ =~/^error\:/) {                  unless ($_ =~/^error\:/) {
Line 664  ENDHEADER Line 664  ENDHEADER
  $output.=$roletext{$sortrole{$which}};   $output.=$roletext{$sortrole{$which}};
                 if ($sortrole{$which} =~ m-dc\./(\w+)/-) {                  if ($sortrole{$which} =~ m-dc\./(\w+)/-) {
                     if ($dcroles{$1}) {                      if ($dcroles{$1}) {
                         $output .= &allcourses_row($1);                          $output .= &allcourses_row($1,'');
                     }                      }
                 }                  }
     }      }
Line 876  sub check_fordc { Line 876  sub check_fordc {
 }  }
   
 sub courselink {  sub courselink {
     my ($dcdom) = @_;      my ($dcdom,$rowtype) = @_;
     my $courseform=&Apache::loncommon::selectcourse_link      my $courseform=&Apache::loncommon::selectcourse_link
                      ('rolechoice','dccourse_'.$dcdom,'dcdomain_'.$dcdom,'coursedesc_'.$dcdom,$dcdom);                       ('rolechoice','dccourse'.$rowtype.'_'.$dcdom,'dcdomain'.$rowtype.'_'.$dcdom,'coursedesc'.$rowtype.'_'.$dcdom,$dcdom);
     my $hiddenitems = '<input type="hidden" name="dcdomain_'.$dcdom.'" value="'.$dcdom.'" />'.      my $hiddenitems = '<input type="hidden" name="dcdomain'.$rowtype.'_'.$dcdom.'" value="'.$dcdom.'" />'.
                       '<input type="hidden" name="origdom_'.$dcdom.'" value="'.$dcdom.'" />'.                        '<input type="hidden" name="origdom'.$rowtype.'_'.$dcdom.'" value="'.$dcdom.'" />'.
                       '<input type="hidden" name="dccourse_'.$dcdom.'" value="" />'.                        '<input type="hidden" name="dccourse'.$rowtype.'_'.$dcdom.'" value="" />'.
                       '<input type="hidden" name="coursedesc_'.$dcdom.'" value="" />';                        '<input type="hidden" name="coursedesc'.$rowtype.'_'.$dcdom.'" value="" />';
     return $courseform.$hiddenitems;      return $courseform.$hiddenitems;
 }  }
   
Line 923  END Line 923  END
 }  }
   
 sub processpick {  sub processpick {
     my $dcdom = shift;  
     my $process_pick = <<"END";      my $process_pick = <<"END";
 <script>  <script>
 function process_pick(dom) {  function process_pick(dom) {
     var numbutton = getIndex(dom)      var pickedCourse=opener.document.rolechoice.$env{'form.cnumelement'}.value;
     var pickedCourse = opener.document.rolechoice.dccourse_$dcdom.value      var pickedDomain=opener.document.rolechoice.$env{'form.cdomelement'}.value;
     var pickedDomain = opener.document.rolechoice.dcdomain_$dcdom.value      var okDomain = 0;
     if (opener.document.rolechoice.dcdomain_$dcdom.value == opener.document.rolechoice.origdom_$dcdom.value) {  
       if (pickedDomain == dom) {
         if (pickedCourse != '') {          if (pickedCourse != '') {
             if (numbutton != -1) {              var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse
                 var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse              opener.document.title='Role selected. Please stand by.';
                 opener.document.rolechoice.elements[numbutton].name = courseTarget              opener.status='Role selected. Please stand by.';
                 opener.document.rolechoice.submit()      opener.document.rolechoice.newrole.value=courseTarget
             }              opener.document.rolechoice.submit()
         }          }
       } else {
           alert("You may only use this screen to select courses in the current domain: "+dom+"\\nPlease return to the roles page window and click the 'Select Course' link for domain: "+pickedDomain+",\\n if you are a Domain Coordinator in that domain, and wish to become a Course Coordinator in a course in the domain");
     }      }
 }  }
     
 function getIndex(dom) {  
     var callername = 'ccpick_'+dom  
     for (var i=0;i<opener.document.rolechoice.elements.length;i++) {  
         var elemname = opener.document.rolechoice.elements[i].name  
         if (elemname == callername) {  
             return i;  
         }  
     }  
     return -1;  
 }  
 </script>  </script>
 END  END
     return $process_pick;      return $process_pick;
Line 987  sub display_cc_role { Line 979  sub display_cc_role {
 }  }
   
 sub allcourses_row {  sub allcourses_row {
     my $dcdom = shift;      my ($dcdom,$rowtype) = @_;
     my $ccrole = Apache::lonnet::plaintext('cc');      my $ccrole = Apache::lonnet::plaintext('cc');
     my $selectlink = &courselink($dcdom);      my $selectlink = &courselink($dcdom,$rowtype);
     my $output = '<tr bgcolor="#77FF77">'.      my $output = '<tr bgcolor="#77FF77">'.
  '<input type="hidden" name="ccpick_'.$dcdom.'" />'.  
  '<input type="hidden" name="pick_'.$dcdom.'" value="1" />'.  
  '<td colspan="5">'.   '<td colspan="5">'.
  '<font color="#002200">'.$ccrole.'</font>'.   '<font color="#002200">'.$ccrole.'</font>'.
  ' <b>'.$selectlink.'</b>'.   ' <b>'.$selectlink.'</b>'.

Removed from v.1.137  
changed lines
  Added in v.1.138


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>