version 1.136, 2005/11/15 21:39:28
|
version 1.141, 2005/12/20 19:07:10
|
Line 51 sub redirect_user {
|
Line 51 sub redirect_user {
|
my $navwindow; |
my $navwindow; |
if ($launch_nav eq 'on') { |
if ($launch_nav eq 'on') { |
$navwindow.=&Apache::lonnavmaps::launch_win('now',undef,undef, |
$navwindow.=&Apache::lonnavmaps::launch_win('now',undef,undef, |
($url eq '/adm/whatsnew')); |
($url =~ m-^/adm/whatsnew-)); |
} else { |
} else { |
$navwindow.=&Apache::lonnavmaps::close(); |
$navwindow.=&Apache::lonnavmaps::close(); |
} |
} |
Line 126 sub handler {
|
Line 126 sub handler {
|
if ($tstatus eq 'is') { |
if ($tstatus eq 'is') { |
$where=~s/^\///; |
$where=~s/^\///; |
my ($cdom,$cnum,$csec)=split(/\//,$where); |
my ($cdom,$cnum,$csec)=split(/\//,$where); |
|
# check for course groups |
|
my %coursegroups = &Apache::lonnet::get_active_groups( |
|
$env{'user.domain'},$env{'user.name'},$cdom, $cnum); |
|
my $cgrps = join(':',keys(%coursegroups)); |
|
|
# store role if recent_role list being kept |
# store role if recent_role list being kept |
if ($env{'environment.recentroles'}) { |
if ($env{'environment.recentroles'}) { |
&Apache::lonhtmlcommon::store_recent('roles', |
&Apache::lonhtmlcommon::store_recent('roles', |
Line 227 ENDENTERKEY
|
Line 232 ENDENTERKEY
|
&Apache::lonnet::appenv( |
&Apache::lonnet::appenv( |
'request.role' => $trolecode, |
'request.role' => $trolecode, |
'request.role.domain' => $cdom, |
'request.role.domain' => $cdom, |
'request.course.sec' => $csec); |
'request.course.sec' => $csec, |
|
'request.course.groups' => $cgrps); |
my $tadv=0; |
my $tadv=0; |
my $msg=&mt('Entering course ...'); |
my $msg=&mt('Entering course ...'); |
|
|
Line 265 ENDENTERKEY
|
Line 271 ENDENTERKEY
|
'.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 |
# Send the user to the course they selected |
} elsif (($env{'request.course.fn'}) |
} elsif ($env{'request.course.fn'}) { |
&& ($role eq 'cc' && ($env{'environment.course_init_display'} ne 'firstres'))) { |
if ($env{'request.role.adv'}) { |
$msg = &mt('Entering course ....'); |
my $startpage = &courseloadpage($courseid); |
&redirect_user($r,&mt('New in course'), |
unless ($startpage eq 'firstres') { |
'/adm/whatsnew',$msg, |
$msg = &mt('Entering course ....'); |
$env{'environment.remotenavmap'}); |
&redirect_user($r,&mt('New in course'), |
return OK; |
'/adm/whatsnew?refpage=start',$msg, |
|
$env{'environment.remotenavmap'}); |
|
return OK; |
|
} |
|
} |
} |
} |
&redirect_user($r,&mt('Entering Course'), |
&redirect_user($r,&mt('Entering Course'), |
$furl,$msg, |
$furl,$msg, |
Line 630 ENDHEADER
|
Line 640 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 658 ENDHEADER
|
Line 668 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 870 sub check_fordc {
|
Line 880 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 917 END
|
Line 927 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 981 sub display_cc_role {
|
Line 983 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>'. |
Line 1029 sub set_privileges {
|
Line 1029 sub set_privileges {
|
&Apache::lonnet::appenv('request.role.adv' => $tadv); |
&Apache::lonnet::appenv('request.role.adv' => $tadv); |
} |
} |
|
|
|
sub courseloadpage { |
|
my ($courseid) = @_; |
|
my $startpage; |
|
my %entry_settings = |
|
&Apache::lonnet::dump('nohist_whatsnew',$env{'user.domain'}, |
|
$env{'user.name'},$courseid.':courseinit'); |
|
my ($tmp) = %entry_settings; |
|
unless ($tmp =~ /^Error/) { |
|
$startpage = $entry_settings{$courseid.':courseinit'}; |
|
} |
|
if ($startpage eq '') { |
|
if (exists($env{'environment.course_init_display'})) { |
|
$startpage = $env{'environment.course_init_display'}; |
|
} |
|
} |
|
return $startpage; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|