Diff for /loncom/auth/lonroles.pm between versions 1.177 and 1.181.2.2

version 1.177, 2007/04/17 15:44:58 version 1.181.2.2, 2008/03/22 03:52:04
Line 201  sub handler { Line 201  sub handler {
  }   }
  $r->print(<<ENDENTEREDKEY);   $r->print(<<ENDENTEREDKEY);
 $start_page  $start_page
 <script>  <script type="text/javascript">
 $swinfo  $swinfo
 </script>  </script>
 <form method="post">  <form method="post">
Line 224  ENDENTEREDKEY Line 224  ENDENTEREDKEY
  my $end_page=&Apache::loncommon::end_page();   my $end_page=&Apache::loncommon::end_page();
  $r->print(<<ENDENTERKEY);   $r->print(<<ENDENTERKEY);
 $start_page  $start_page
 <script>  <script type="text/javascript">
 $swinfo  $swinfo
 </script>  </script>
 <form method="post">  <form method="post">
Line 365  ENDENTERKEY Line 365  ENDENTERKEY
     my $start_page=&Apache::loncommon::start_page('User Roles');      my $start_page=&Apache::loncommon::start_page('User Roles');
     my $standby=&mt('Role selected. Please stand by.');      my $standby=&mt('Role selected. Please stand by.');
     $standby=~s/\n/\\n/g;      $standby=~s/\n/\\n/g;
       my $noscript='<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 />';
   
     $r->print(<<ENDHEADER);      $r->print(<<ENDHEADER);
 $start_page  $start_page
 <br />  <br />
 <script>  <noscript>
   $noscript
   </noscript>
   <script type="text/javascript">
 $swinfo  $swinfo
 window.focus();  window.focus();
   
Line 406  ENDHEADER Line 410  ENDHEADER
 # -------------------------------------------------------- Generate Page Output  # -------------------------------------------------------- Generate Page Output
 # --------------------------------------------------------------- Error Header?  # --------------------------------------------------------------- Error Header?
     if ($error) {      if ($error) {
  $r->print("<h1>LON-CAPA Access Control</h1>");          $r->print("<h1>".&mt('LON-CAPA Access Control')."</h1>");
  $r->print("<!-- LONCAPAACCESSCONTROLERRORSCREEN --><hr /><pre>");   $r->print("<!-- LONCAPAACCESSCONTROLERRORSCREEN --><hr /><pre>");
  if ($priv ne '') {   if ($priv ne '') {
     $r->print("Access  : ".&Apache::lonnet::plaintext($priv)."\n");              $r->print(&mt('Access  : ').&Apache::lonnet::plaintext($priv)."\n");
  }   }
  if ($fn ne '') {   if ($fn ne '') {
     $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");              $r->print(&mt('Resource: ').&Apache::lonenc::check_encrypt($fn)."\n");
  }   }
  if ($msg ne '') {   if ($msg ne '') {
     $r->print("Action  : $msg\n");              $r->print(&mt('Action  : ').$msg."\n");
  }   }
  $r->print("</pre><hr />");   $r->print("</pre><hr />");
  my $url=$fn;   my $url=$fn;
Line 443  ENDHEADER Line 447  ENDHEADER
   &Apache::loncommon::end_page());    &Apache::loncommon::end_page());
  return OK;   return OK;
     } else {      } else {
         if ($advanced) {  
     $r->print('<span class="LC_rolesinfo">'.&mt("Your home server is ").  
       &Apache::lonnet::hostname(&Apache::lonnet::homeserver  
                       ($env{'user.name'},$env{'user.domain'})).  
       "<br />\n");  
     $r->print(&mt(  
       "Author and Co-Author roles are not available on servers other than their respective home servers.").'</span>');  
         }  
         if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {          if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
        $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};         $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
         }          }
Line 636  ENDHEADER Line 632  ENDHEADER
 # Is there only one choice?  # Is there only one choice?
     } elsif (($countactive==1) && ($env{'request.role'} eq 'cm')) {      } elsif (($countactive==1) && ($env{'request.role'} eq 'cm')) {
  $r->print('<h3>'.&mt('Please stand by.').'</h3>'.   $r->print('<h3>'.&mt('Please stand by.').'</h3>'.
     '<input type="hidden" name="'.$possiblerole.'" value="1" />');      '<input type="hidden" name="'.$possiblerole.'" value="1" />'.
               '<noscript><br /><input type="submit" name="submit" value="'.&mt('Continue').'" /></noscript>');
  $r->print("</form>\n");   $r->print("</form>\n");
  $r->rflush();   $r->rflush();
  $r->print('<script>document.forms.rolechoice.submit();</script>');   $r->print('<script type="text/javascript">document.forms.rolechoice.submit();</script>');
  $r->print(&Apache::loncommon::end_page());   $r->print(&Apache::loncommon::end_page());
  return OK;   return OK;
     }      }
 # More than one possible role  # More than one possible role
 # ----------------------------------------------------------------------- Table  # ----------------------------------------------------------------------- Table
     unless (($advanced) || ($nochoose)) {      unless ((!&Apache::lonmenu::show_course()) || ($nochoose)) {
  $r->print("<h2>".&mt('Select a Course to Enter')."</h2>\n");   $r->print("<h2>".&mt('Select a Course to Enter')."</h2>\n");
     }      }
     $r->print('<br /><table id="LC_rolesmenu"><tr>');      $r->print('<br /><table id="LC_rolesmenu"><tr>');
Line 933  sub courselink { Line 930  sub courselink {
 }  }
   
 sub coursepick_jscript {  sub coursepick_jscript {
       my %lt = &Apache::lonlocal::texthash(
                     plsu => "Please use the 'Select Course' link to open a separate pick course window where you may select the course you wish to enter.",
                     youc => 'You can only use this screen to select courses in the current domain.',
               );
     my $verify_script = <<"END";      my $verify_script = <<"END";
 <script>  <script type="text/javascript">
 function verifyCoursePick(caller) {  function verifyCoursePick(caller) {
     var numbutton = getIndex(caller)      var numbutton = getIndex(caller)
     var pickedCourse = document.rolechoice.elements[numbutton+4].value      var pickedCourse = document.rolechoice.elements[numbutton+4].value
Line 948  function verifyCoursePick(caller) { Line 949  function verifyCoursePick(caller) {
             }              }
         }          }
         else {          else {
             alert("Please use the 'Select Course' link to open a separate pick course window where you may select the course you wish to enter.");              alert("$lt{'plsu'}");
         }          }
     }      }
     else {      else {
         alert("You can only use this screen to select courses in the current domain")          alert("$lt{'youc'}");
     }      }
 }  }
 function getIndex(caller) {  function getIndex(caller) {
Line 968  END Line 969  END
     return $verify_script;      return $verify_script;
 }  }
   
 sub processpick {  
     my $process_pick = <<"END";  
 <script>  
 function process_pick(dom) {  
     var pickedCourse=opener.document.rolechoice.$env{'form.cnumelement'}.value;  
     var pickedDomain=opener.document.rolechoice.$env{'form.cdomelement'}.value;  
     var okDomain = 0;  
   
     if (pickedDomain == dom) {  
         if (pickedCourse != '') {  
             var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse  
             opener.document.title='Role selected. Please stand by.';  
             opener.status='Role selected. Please stand by.';  
     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");  
     }  
 }  
    
 </script>  
 END  
     return $process_pick;  
 }  
   
 sub display_cc_role {  sub display_cc_role {
     my $rolekey = shift;      my $rolekey = shift;
     my $roletext;      my $roletext;

Removed from v.1.177  
changed lines
  Added in v.1.181.2.2


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