Diff for /loncom/auth/lonroles.pm between versions 1.121 and 1.131

version 1.121, 2005/06/05 07:57:28 version 1.131, 2005/11/01 21:59:24
Line 50  sub redirect_user { Line 50  sub redirect_user {
     my $swinfo=&Apache::lonmenu::rawconfig();      my $swinfo=&Apache::lonmenu::rawconfig();
     my $navwindow;      my $navwindow;
     if ($launch_nav eq 'on') {      if ($launch_nav eq 'on') {
  $navwindow.=&Apache::lonnavmaps::launch_win('now');   $navwindow.=&Apache::lonnavmaps::launch_win('now',undef,undef,
       ($url eq '/adm/whatsnew'));
     } else {      } else {
  $navwindow.=&Apache::lonnavmaps::close();   $navwindow.=&Apache::lonnavmaps::close();
     }      }
Line 227  ENDENTERKEY Line 228  ENDENTERKEY
                     my $tadv=0;                      my $tadv=0;
     my $msg=&mt('Entering course ...');      my $msg=&mt('Entering course ...');
   
     if (($cnum) && ($role ne 'ca')) {      if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) {
  my ($furl,$ferr)=   my ($furl,$ferr)=
     &Apache::lonuserstate::readmap($cdom.'/'.$cnum);      &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
  if (($env{'form.orgurl'}) &&    if (($env{'form.orgurl'}) && 
Line 243  ENDENTERKEY Line 244  ENDENTERKEY
       "request.course.id"  => $cdom.'_'.$cnum);        "request.course.id"  => $cdom.'_'.$cnum);
  $furl='/adm/roles?tryagain=1';   $furl='/adm/roles?tryagain=1';
  $msg=   $msg=
     '<h1><font color=red>'.      '<h1><font color="red">'.
  &mt('Could not initialize course at this time.').   &mt('Could not initialize course at this time.').
     '</font></h1><h3>'.&mt('Please try again.').'</h3>'.$ferr;      '</font></h1><h3>'.&mt('Please try again.').'</h3>'.$ferr;
     }      }
Line 260  ENDENTERKEY Line 261  ENDENTERKEY
     if ($role eq 'cc' && $env{'course.' . $courseid .       if ($role eq 'cc' && $env{'course.' . $courseid . 
   '.course.helper.not.run'}) {    '.course.helper.not.run'}) {
  $furl = "/adm/helper/course.initialization.helper";   $furl = "/adm/helper/course.initialization.helper";
    # Send the user to the course they selected
       } elsif (($env{'request.course.fn'}) 
        && ($role eq 'cc' && ($env{'environment.course_init_display'} ne 'firstres')))  {
    $msg = &mt('Entering course ....');
    &redirect_user($r,&mt('New in course'),
          '/adm/whatsnew',$msg,
          $env{'environment.remotenavmap'});
    return OK;
     }      }
                             # Send the user to the course they selected      &redirect_user($r,&mt('Entering Course'),
                             &redirect_user($r,&mt('Entering Course'),  
                                            $furl,$msg,                                             $furl,$msg,
    $env{'environment.remotenavmap'});     $env{'environment.remotenavmap'});
                             return OK;      return OK;
  }   }
     }      }
                     #                      #
                     # Send the user to the construction space they selected                      # Send the user to the construction space they selected
                     if ($role =~ /^(au|ca)$/) {                      if ($role =~ /^(au|ca|aa)$/) {
                         my $redirect_url = '/priv/';                          my $redirect_url = '/priv/';
                         if ($role eq 'au') {                          if ($role eq 'au') {
                             $redirect_url.=$env{'user.name'};                              $redirect_url.=$env{'user.name'};
Line 336  ENDHEADER Line 344  ENDHEADER
 # --------------------------------------------------------------- Error Header?  # --------------------------------------------------------------- Error Header?
     if ($error) {      if ($error) {
  $r->print("<h1>LON-CAPA Access Control</h1>");   $r->print("<h1>LON-CAPA Access Control</h1>");
         $r->print("<hr><pre>Access  : ".          $r->print("<!-- LONCAPAACCESSCONTROLERRORSCREEN --><hr /><pre>Access  : ".
                   Apache::lonnet::plaintext($priv)."\n");                    Apache::lonnet::plaintext($priv)."\n");
         $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");          $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");
         $r->print("Action  : $msg\n</pre><hr />");          $r->print("Action  : $msg\n</pre><hr />");
Line 354  ENDHEADER Line 362  ENDHEADER
     } else {      } else {
         if ($env{'user.error.msg'}) {          if ($env{'user.error.msg'}) {
     $r->print(      $r->print(
  '<h3><font color=red>'.   '<h3><font color="red">'.
  &mt('You need to choose another user role or enter a specific course for this function').'</font></h3>');   &mt('You need to choose another user role or enter a specific course for this function').'</font></h3>');
  }   }
     }      }
Line 380  ENDHEADER Line 388  ENDHEADER
                       ($env{'user.name'},$env{'user.domain'})}.                        ($env{'user.name'},$env{'user.domain'})}.
       "<br />\n");        "<br />\n");
     $r->print(&mt(      $r->print(&mt(
       "Author and Co-Author roles may not be available on servers other than your home server."));        "Author and Co-Author roles are not available on servers other than their respective home servers."));
         }          }
         if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {          if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
        $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};         $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
Line 453  ENDHEADER Line 461  ENDHEADER
                 my $trole;                  my $trole;
                 if ($role =~ /^cr\//) {                  if ($role =~ /^cr\//) {
                     my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role);                      my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role);
                     $tremark.='<br>'.&mt('Defined by ').$rauthor.                      $tremark.='<br />'.&mt('Defined by ').$rauthor.
  &mt(' at ').$rdomain.'.';   &mt(' at ').$rdomain.'.';
                     $trole=$rrole;                      $trole=$rrole;
                 } else {                  } else {
Line 464  ENDHEADER Line 472  ENDHEADER
                 my ($tdom,$trest,$tsection)=                  my ($tdom,$trest,$tsection)=
                     split(/\//,Apache::lonnet::declutter($where));                      split(/\//,Apache::lonnet::declutter($where));
                 # First, Co-Authorship roles                  # First, Co-Authorship roles
                 if ($role eq 'ca') {                  if (($role eq 'ca') || ($role eq 'aa')) {
                     my $home = &Apache::lonnet::homeserver($trest,$tdom);                      my $home = &Apache::lonnet::homeserver($trest,$tdom);
     my $allowed=0;      my $allowed=0;
     my @ids=&Apache::lonnet::current_machine_ids();      my @ids=&Apache::lonnet::current_machine_ids();
     foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }      foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
                     if (!$allowed) {                      if (!$allowed) {
  $button=0;   $button=0;
                         $switchserver=&Apache::lonnet::escape('http://'.                          $switchserver='otherserver='.$home.'&role='.$trolecode;
                          $Apache::lonnet::hostname{$home}.  
                          '/adm/login?domain='.$env{'user.domain'}.  
   '&username='.$env{'user.name'}.  
                           '&firsturl=/priv/'.$trest.'/');  
                     }                      }
                     #next if ($home eq 'no_host');                      #next if ($home eq 'no_host');
                     $home = $Apache::lonnet::hostname{$home};                      $home = $Apache::lonnet::hostname{$home};
Line 588  ENDHEADER Line 592  ENDHEADER
          '</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th><th>'.           '</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th><th>'.
       &mt('Remarks and Calendar Announcements').'</th></tr>'."\n");        &mt('Remarks and Calendar Announcements').'</th></tr>'."\n");
     my $doheaders=-1;      my $doheaders=-1;
     foreach my $type ('Construction Space','Course','Domain','System') {      foreach my $type ('Domain','Construction Space','Course','System') {
  my $haverole=0;   my $haverole=0;
  foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {   foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
     if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {       if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { 
Line 612  ENDHEADER Line 616  ENDHEADER
             }               } 
  }   }
  if ($output) {   if ($output) {
     $r->print("<tr bgcolor='#BBffBB'><td align='center' colspan='6'>".      $r->print("<tr><td align='center' colspan='6'><font face='arial'>".
       &mt('Recent Roles')."</td>");        &mt('Recent Roles')."</font></td>");
     $r->print($output);      $r->print($output);
     $r->print("</tr>");      $r->print("</tr>");
             $doheaders ++;              $doheaders ++;
Line 638  ENDHEADER Line 642  ENDHEADER
  }   }
  if ($output) {   if ($output) {
     if ($doheaders > 0) {      if ($doheaders > 0) {
  $r->print("<tr bgcolor='#BBffBB'>".   $r->print("<tr>".
   "<td align='center' colspan='6'>".&mt($type)."</td></tr>");    "<td align='center' colspan='6'><font face='arial'>".&mt($type)."</font></td></tr>");
     }      }
     $r->print($output);      $r->print($output);
  }   }
Line 671  ENDHEADER Line 675  ENDHEADER
     }      }
 # ------------------------------------------------------------ Privileges Info  # ------------------------------------------------------------ Privileges Info
     if (($advanced) && (($env{'user.error.msg'}) || ($error))) {      if (($advanced) && (($env{'user.error.msg'}) || ($error))) {
  $r->print('<hr><h2>Current Privileges</h2>');   $r->print('<hr /><h2>Current Privileges</h2>');
   
  foreach $envkey (sort keys %env) {   foreach $envkey (sort keys %env) {
     if ($envkey=~/^user\.priv\.$env{'request.role'}\./) {      if ($envkey=~/^user\.priv\.$env{'request.role'}\./) {
Line 764  sub build_roletext { Line 768  sub build_roletext {
     unless ($nochoose) {      unless ($nochoose) {
         if (!$button) {          if (!$button) {
             if ($switchserver) {              if ($switchserver) {
                 $roletext.='<td><a href="/adm/logout?handover='.                  $roletext.='<td><a href="/adm/switchserver?'.
                 $switchserver.'">'.&mt('Switch Server').'</a></td>';                  $switchserver.'">'.&mt('Switch Server').'</a></td>';
             } else {              } else {
                 $roletext.=('<td>&nbsp;</td>');                  $roletext.=('<td>&nbsp;</td>');
Line 947  sub allcourses_row { Line 951  sub allcourses_row {
     my $dcdom = shift;      my $dcdom = shift;
     my $ccrole = Apache::lonnet::plaintext('cc');      my $ccrole = Apache::lonnet::plaintext('cc');
     my $selectlink = &courselink($dcdom);      my $selectlink = &courselink($dcdom);
     my $output = '<tr bgcolor="#77FF77">'.      my $output = '<tr bgcolor="#99FF99">'.
               '<td><input type="button" value="'.                '<td><input type="button" value="'.
               &mt('Select').'" name="ccpick_'.$dcdom.'"'.                &mt('Select').'" name="ccpick_'.$dcdom.'"'.
               'onClick="verifyCoursePick(this)">'.                'onClick="verifyCoursePick(this)">'.

Removed from v.1.121  
changed lines
  Added in v.1.131


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