version 1.72, 2003/09/18 20:10:18
|
version 1.78, 2003/12/05 14:18:00
|
Line 56 use Apache::lonlocal;
|
Line 56 use Apache::lonlocal;
|
sub redirect_user { |
sub redirect_user { |
my ($r,$title,$url,$msg) = @_; |
my ($r,$title,$url,$msg) = @_; |
$msg = $title if (! defined($msg)); |
$msg = $title if (! defined($msg)); |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
my $swinfo=&Apache::lonmenu::rawconfig(); |
my $swinfo=&Apache::lonmenu::rawconfig(); |
Line 131 sub handler {
|
Line 131 sub handler {
|
# student attempts to register a new key |
# student attempts to register a new key |
} else { |
} else { |
# print form to enter a new key |
# print form to enter a new key |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
my $swinfo=&Apache::lonmenu::rawconfig(); |
my $swinfo=&Apache::lonmenu::rawconfig(); |
Line 202 ENDENTERKEY
|
Line 202 ENDENTERKEY
|
} |
} |
# |
# |
# Send the user to the course they selected |
# Send the user to the course they selected |
&redirect_user($r,'Entering Course', |
&redirect_user($r,&mt('Entering Course'), |
$furl,$msg); |
$furl,$msg); |
return OK; |
return OK; |
} |
} |
Line 218 ENDENTERKEY
|
Line 218 ENDENTERKEY
|
$redirect_url .= $1; |
$redirect_url .= $1; |
} |
} |
$redirect_url .= '/'; |
$redirect_url .= '/'; |
&redirect_user($r,'Entering Construction Space', |
&redirect_user($r,&mt('Entering Construction Space'), |
$redirect_url); |
$redirect_url); |
return OK; |
return OK; |
} |
} |
Line 230 ENDENTERKEY
|
Line 230 ENDENTERKEY
|
|
|
# =============================================================== No Roles Init |
# =============================================================== No Roles Init |
|
|
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
Line 327 ENDHEADER
|
Line 327 ENDHEADER
|
'</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th><th>'. |
'</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th><th>'. |
&mt('Remark').'</th></tr>'."\n"); |
&mt('Remark').'</th></tr>'."\n"); |
|
|
|
my (%roletext,%sortrole,%roleclass); |
foreach $envkey (sort keys %ENV) { |
foreach $envkey (sort keys %ENV) { |
my $button = 1; |
my $button = 1; |
my $switchserver=''; |
my $switchserver=''; |
|
my $roletext; |
|
my $sortkey; |
if ($envkey=~/^user\.role\./) { |
if ($envkey=~/^user\.role\./) { |
my (undef,undef,$role,@pwhere)=split(/\./,$envkey); |
my (undef,undef,$role,@pwhere)=split(/\./,$envkey); |
next if (!defined($role) || $role eq ''); |
next if (!defined($role) || $role eq ''); |
Line 346 ENDHEADER
|
Line 349 ENDHEADER
|
$tstatus='future'; |
$tstatus='future'; |
if ($tstart<$now) { $tstatus='will'; } |
if ($tstart<$now) { $tstatus='will'; } |
} |
} |
$tpstart=localtime($tstart); |
$tpstart=&Apache::lonlocal::locallocaltime($tstart); |
} |
} |
if ($tend) { |
if ($tend) { |
if ($tend<$then) { |
if ($tend<$then) { |
Line 354 ENDHEADER
|
Line 357 ENDHEADER
|
} elsif ($tend<$now) { |
} elsif ($tend<$now) { |
$tstatus='will_not'; |
$tstatus='will_not'; |
} |
} |
$tpend=localtime($tend); |
$tpend=&Apache::lonlocal::locallocaltime($tend); |
} |
} |
if ($ENV{'request.role'} eq $trolecode) { |
if ($ENV{'request.role'} eq $trolecode) { |
$tstatus='selected'; |
$tstatus='selected'; |
Line 409 ENDHEADER
|
Line 412 ENDHEADER
|
} |
} |
#next if ($home eq 'no_host'); |
#next if ($home eq 'no_host'); |
$home = $Apache::lonnet::hostname{$home}; |
$home = $Apache::lonnet::hostname{$home}; |
$ttype=&mt('Construction Space'); |
$ttype='Construction Space'; |
$twhere=&mt('User').': '.$trest.'<br />'.&mt('Domain'). |
$twhere=&mt('User').': '.$trest.'<br />'.&mt('Domain'). |
': '.$tdom.'<br />'. |
': '.$tdom.'<br />'. |
' '.&mt('Server').': '.$home; |
' '.&mt('Server').': '.$home; |
$ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca'; |
$ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca'; |
|
$sortkey=$role."$trest:$tdom"; |
} elsif ($role eq 'au') { |
} elsif ($role eq 'au') { |
# Authors |
# Authors |
my $home = &Apache::lonnet::homeserver |
my $home = &Apache::lonnet::homeserver |
Line 428 ENDHEADER
|
Line 432 ENDHEADER
|
} |
} |
#next if ($home eq 'no_host'); |
#next if ($home eq 'no_host'); |
$home = $Apache::lonnet::hostname{$home}; |
$home = $Apache::lonnet::hostname{$home}; |
$ttype=&mt('Construction Space'); |
$ttype='Construction Space'; |
$twhere=&mt('Domain').': '.$tdom.'<br />'.&mt('Server'). |
$twhere=&mt('Domain').': '.$tdom.'<br />'.&mt('Server'). |
': '.$home; |
': '.$home; |
$ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca'; |
$ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca'; |
|
$sortkey=$role; |
} elsif ($trest) { |
} elsif ($trest) { |
$ttype=&mt('Course'); |
$ttype='Course'; |
if ($tsection) { |
if ($tsection) { |
$ttype.='<br>'.&mt('Section/Group').': '.$tsection; |
$ttype.='<br>'.&mt('Section/Group').': '.$tsection; |
} |
} |
my $tcourseid=$tdom.'_'.$trest; |
my $tcourseid=$tdom.'_'.$trest; |
if ($ENV{'course.'.$tcourseid.'.description'}) { |
if ($ENV{'course.'.$tcourseid.'.description'}) { |
$twhere=$ENV{'course.'.$tcourseid.'.description'}; |
$twhere=$ENV{'course.'.$tcourseid.'.description'}; |
|
$sortkey=$tdom."\0".$twhere."\0".$envkey; |
unless ($twhere eq &mt('Currently not available')) { |
unless ($twhere eq &mt('Currently not available')) { |
$twhere.=' <font size="-2">'. |
$twhere.=' <font size="-2">'. |
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom,$tfont). |
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom,$tfont). |
Line 449 ENDHEADER
|
Line 455 ENDHEADER
|
my %newhash=Apache::lonnet::coursedescription |
my %newhash=Apache::lonnet::coursedescription |
($tcourseid); |
($tcourseid); |
if (%newhash) { |
if (%newhash) { |
|
$sortkey=$tdom."\0".$newhash{'description'}. |
|
"\0".$envkey; |
$twhere=$newhash{'description'}. |
$twhere=$newhash{'description'}. |
' <font size="-2">'. |
' <font size="-2">'. |
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom,$tfont). |
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom,$tfont). |
Line 456 ENDHEADER
|
Line 464 ENDHEADER
|
} else { |
} else { |
$twhere=&mt('Currently not available'); |
$twhere=&mt('Currently not available'); |
$ENV{'course.'.$tcourseid.'.description'}=$twhere; |
$ENV{'course.'.$tcourseid.'.description'}=$twhere; |
|
$sortkey=$tdom."\0".$twhere."\0".$envkey; |
} |
} |
} |
} |
if ($role ne 'st') { $twhere.="<br />".&mt('Domain').":".$tdom; } |
if ($role ne 'st') { $twhere.="<br />".&mt('Domain').":".$tdom; } |
} elsif ($tdom) { |
} elsif ($tdom) { |
$ttype=&mt('Domain'); |
$ttype='Domain'; |
$twhere=$tdom; |
$twhere=$tdom; |
|
$sortkey=$role.$twhere; |
} else { |
} else { |
$ttype=&mt('System'); |
$ttype='System'; |
$twhere=&mt('system wide'); |
$twhere=&mt('system wide'); |
|
$sortkey=$role.$twhere; |
} |
} |
|
|
$r->print('<tr bgcolor='.$tbg.'>'); |
$roletext.='<tr bgcolor='.$tbg.'>'; |
unless ($nochoose) { |
unless ($nochoose) { |
if (!$button) { |
if (!$button) { |
if ($switchserver) { |
if ($switchserver) { |
$r->print('<td><a href="/adm/logout?handover='. |
$roletext.='<td><a href="/adm/logout?handover='. |
$switchserver.'">'.&mt('Switch Server').'</a></td>'); |
$switchserver.'">'.&mt('Switch Server').'</a></td>'; |
} else { |
} else { |
$r->print('<td> </td>'); |
$roletext.=('<td> </td>'); |
} |
} |
} elsif ($tstatus eq 'is') { |
} elsif ($tstatus eq 'is') { |
$r->print('<td><input type=submit value="'. |
$roletext.=('<td><input type=submit value="'. |
&mt('Select').'" name="'. |
&mt('Select').'" name="'. |
$trolecode.'"></td>'); |
$trolecode.'"></td>'); |
} elsif ($tryagain) { |
} elsif ($tryagain) { |
$r->print |
$roletext.= |
('<td><input type=submit value="'. |
'<td><input type=submit value="'. |
&mt('Try Selecting Again').'" name="'.$trolecode.'"></td>'); |
&mt('Try Selecting Again').'" name="'.$trolecode.'"></td>'; |
} elsif ($advanced) { |
} elsif ($advanced) { |
$r->print |
$roletext.= |
('<td><input type=submit value="'. |
'<td><input type=submit value="'. |
&mt('Re-Initialize').'" name="'.$trolecode.'"></td>'); |
&mt('Re-Initialize').'" name="'.$trolecode.'"></td>'; |
} else { |
} else { |
$r->print('<td> </td>'); |
$roletext.='<td> </td>'; |
} |
} |
} |
} |
$tremark.=&Apache::lonannounce::showday(time,1, |
$tremark.=&Apache::lonannounce::showday(time,1, |
&Apache::lonannounce::readcalendar($tdom.'_'.$trest)); |
&Apache::lonannounce::readcalendar($tdom.'_'.$trest)); |
|
|
$r->print('<td><font color="'.$tfont.'">'.$trole. |
$roletext.='<td><font color="'.$tfont.'">'.$trole. |
'</font></td><td><font color="'.$tfont.'">'.$ttype. |
'</font></td><td><font color="'.$tfont.'">'.$ttype. |
'</font></td><td><font color="'.$tfont.'">'.$twhere. |
'</font></td><td><font color="'.$tfont.'">'.$twhere. |
'</font></td><td><font color="'.$tfont.'">'.$tpstart. |
'</font></td><td><font color="'.$tfont.'">'.$tpstart. |
'</font></td><td><font color="'.$tfont.'">'.$tpend. |
'</font></td><td><font color="'.$tfont.'">'.$tpend. |
'</font></td><td><font color="'.$tfont.'">'.$tremark. |
'</font></td><td><font color="'.$tfont.'">'.$tremark. |
' </font></td></tr>'."\n"); |
' </font></td></tr>'."\n"; |
|
$roletext{$envkey}=$roletext; |
|
if (!$sortkey) {$sortkey=$twhere."\0".$envkey;} |
|
$sortrole{$sortkey}=$envkey; |
|
$roleclass{$envkey}=$ttype; |
} |
} |
} |
} |
} |
} |
|
my $doheaders=-1; |
|
foreach my $type ('Construction Space','Course','Domain','System') { |
|
my $haverole=0; |
|
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) { |
|
if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { |
|
$haverole=1; |
|
} |
|
} |
|
if ($haverole) { $doheaders++; } |
|
} |
|
foreach my $type ('Construction Space','Course','Domain','System') { |
|
my $output; |
|
foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) { |
|
if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { |
|
$output.=&mt($roletext{$sortrole{$which}}); |
|
} |
|
} |
|
if ($output) { |
|
if ($doheaders > 0) { |
|
$r->print("<tr bgcolor='#BBffBB'>". |
|
"<td align='center' colspan='7'>$type</td>"); |
|
} |
|
$r->print($output); |
|
} |
|
} |
my $tremark=''; |
my $tremark=''; |
my $tfont='#003300'; |
my $tfont='#003300'; |
if ($ENV{'request.role'} eq 'cm') { |
if ($ENV{'request.role'} eq 'cm') { |