version 1.201, 2008/07/14 10:21:52
|
version 1.203, 2008/07/30 15:34:34
|
Line 336 ENDENTERKEY
|
Line 336 ENDENTERKEY
|
} elsif ($env{'request.course.id'}) { |
} elsif ($env{'request.course.id'}) { |
if ($env{'form.destinationurl'}) { |
if ($env{'form.destinationurl'}) { |
my $dest = $env{'form.destinationurl'}; |
my $dest = $env{'form.destinationurl'}; |
|
if ($env{'form.destsymb'} ne '') { |
|
my $esc_symb = &HTML::Entities::encode($env{'form.destsymb'},'"<>&'); |
|
$dest .= '?symb='.$esc_symb; |
|
} |
&redirect_user($r,&mt('Entering [_1]', |
&redirect_user($r,&mt('Entering [_1]', |
$env{'course.'.$courseid.'.description'}), |
$env{'course.'.$courseid.'.description'}), |
$dest,$msg, |
$dest,$msg, |
Line 714 ENDHEADER
|
Line 718 ENDHEADER
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
# Is there only one choice? |
# Is there only one choice? |
} elsif (($countactive==1) && ($env{'request.role'} eq 'cm')) { |
} elsif ($countactive==1) { |
$r->print('<h3>'.&mt('Please stand by.').'</h3>'. |
my $needs_switchserver; |
'<input type="hidden" name="'.$possiblerole.'" value="1" />'. |
if ($env{'user.author'}) { |
|
$needs_switchserver = &check_needs_switchserver($possiblerole); |
|
} |
|
if ((!$needs_switchserver) && ($env{'request.role'} eq 'cm')) { |
|
$r->print('<h3>'.&mt('Please stand by.').'</h3>'. |
|
'<input type="hidden" name="'.$possiblerole.'" value="1" />'. |
'<noscript><br /><input type="submit" name="submit" value="'.&mt('Continue').'" /></noscript>'); |
'<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 type="text/javascript">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; |
|
} |
|
if ($needs_switchserver) { |
|
$r->print("<h2>".&mt('Server Switch Required')."</h2>\n". |
|
&mt('Construction Space access is only available from '. |
|
'the home server of the corresponding Author.').'<br />'. |
|
&mt("Click the 'Switch Server' link to go there.").'<br />'); |
|
} |
} |
} |
# More than one possible role |
# More than one possible role |
# ----------------------------------------------------------------------- Table |
# ----------------------------------------------------------------------- Table |
unless ((!&Apache::lonmenu::show_course()) || ($nochoose)) { |
unless ((!&Apache::lonmenu::show_course()) || ($nochoose) || ($countactive==1)) { |
$r->print("<h2>".&mt('Select a Course to Enter')."</h2>\n"); |
$r->print("<h2>".&mt('Select a Course to Enter')."</h2>\n"); |
} |
} |
my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole,$nochoose); |
my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole,$nochoose); |
Line 761 ENDHEADER
|
Line 777 ENDHEADER
|
&Apache::loncommon::authorbrowser_javascript()); |
&Apache::loncommon::authorbrowser_javascript()); |
} |
} |
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles,\%roletext); |
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles,\%roletext); |
my $tremark=''; |
if ($countactive > 1) { |
my $tfont='#003300'; |
my $tremark=''; |
if ($env{'request.role'} eq 'cm') { |
my $tfont='#003300'; |
$r->print('<tr bgcolor="#11CC55">'); |
if ($env{'request.role'} eq 'cm') { |
$tremark=&mt('Currently selected. '); |
$r->print('<tr bgcolor="#11CC55">'); |
$tfont='#002200'; |
$tremark=&mt('Currently selected. '); |
} else { |
$tfont='#002200'; |
$r->print('<tr bgcolor="#77FF77">'); |
} else { |
} |
$r->print('<tr bgcolor="#77FF77">'); |
unless ($nochoose) { |
} |
if ($env{'request.role'} ne 'cm') { |
unless ($nochoose) { |
$r->print('<td><input type="submit" value="'. |
if ($env{'request.role'} ne 'cm') { |
&mt('Select').'" name="cm" /></td>'); |
$r->print('<td><input type="submit" value="'. |
} else { |
&mt('Select').'" name="cm" /></td>'); |
$r->print('<td> </td>'); |
} else { |
} |
$r->print('<td> </td>'); |
} |
} |
$r->print('<td colspan="3"><font color="'.$tfont.'"><span class="LC_rolesinfo">'.&mt('No role specified'). |
} |
'</span></font></td><td><font color="'.$tfont.'">'.$tremark. |
$r->print('<td colspan="3"><font color="'.$tfont.'"><span class="LC_rolesinfo">'.&mt('No role specified'). |
' </font></td></tr>'."\n"); |
'</span></font></td><td><font color="'.$tfont.'">'.$tremark. |
|
' </font></td></tr>'."\n"); |
|
} |
$r->print('</table>'); |
$r->print('</table>'); |
unless ($nochoose) { |
unless ($nochoose) { |
$r->print("</form>\n"); |
$r->print("</form>\n"); |
Line 1019 sub build_roletext {
|
Line 1036 sub build_roletext {
|
return $roletext; |
return $roletext; |
} |
} |
|
|
|
sub check_needs_switchserver { |
|
my ($possiblerole) = @_; |
|
my $needs_switchserver; |
|
my ($role,$where) = split(/\./,$possiblerole,2); |
|
my (undef,$tdom,$twho) = split(/\//,$where); |
|
my ($server_status,$home); |
|
if (($role eq 'ca') || ($role eq 'aa')) { |
|
($server_status,$home) = &check_author_homeserver($twho,$tdom); |
|
} else { |
|
($server_status,$home) = &check_author_homeserver($env{'user.name'}, |
|
$env{'user.domain'}); |
|
} |
|
if ($server_status eq 'switchserver') { |
|
$needs_switchserver = 1; |
|
} |
|
return $needs_switchserver; |
|
} |
|
|
sub check_author_homeserver { |
sub check_author_homeserver { |
my ($uname,$udom)=@_; |
my ($uname,$udom)=@_; |
if (($uname eq '') || ($udom eq '')) { |
if (($uname eq '') || ($udom eq '')) { |