version 1.124, 2005/06/16 22:25:34
|
version 1.139, 2005/12/19 21:39:33
|
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 =~ m-/^adm/whatsnew-)); |
} else { |
} else { |
$navwindow.=&Apache::lonnavmaps::close(); |
$navwindow.=&Apache::lonnavmaps::close(); |
} |
} |
Line 88 sub handler {
|
Line 89 sub handler {
|
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
if ($env{'form.selectrole'}) { |
if ($env{'form.selectrole'}) { |
|
if ($env{'form.newrole'}) { |
|
$env{'form.'.$env{'form.newrole'}}=1; |
|
} |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
my %temp=('logout_'.$env{'request.course.id'} => time); |
my %temp=('logout_'.$env{'request.course.id'} => time); |
&Apache::lonnet::put('email_status',\%temp); |
&Apache::lonnet::put('email_status',\%temp); |
Line 122 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 223 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 ...'); |
|
|
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 253 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 261 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{'user.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 277 ENDENTERKEY
|
Line 291 ENDENTERKEY
|
} |
} |
# |
# |
# 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 311 ENDENTERKEY
|
Line 325 ENDENTERKEY
|
|
|
my $swinfo=&Apache::lonmenu::rawconfig(); |
my $swinfo=&Apache::lonmenu::rawconfig(); |
my $bodytag=&Apache::loncommon::bodytag('User Roles'); |
my $bodytag=&Apache::loncommon::bodytag('User Roles'); |
|
my $standby=&mt('Role selected. Please stand by.'); |
|
$standby=~s/\n/\\n/g; |
my $helptag='<table><tr><td>'.&Apache::loncommon::help_open_menu('','General Intro','General_Intro','User Roles',1,undef,undef,undef,undef,,&mt("Click here for help")).'</td></td></tr></table>'; |
my $helptag='<table><tr><td>'.&Apache::loncommon::help_open_menu('','General Intro','General_Intro','User Roles',1,undef,undef,undef,undef,,&mt("Click here for help")).'</td></td></tr></table>'; |
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
<html> |
<html> |
Line 322 $helptag<br />
|
Line 338 $helptag<br />
|
<script> |
<script> |
$swinfo |
$swinfo |
window.focus(); |
window.focus(); |
|
|
|
active=true; |
|
|
|
function enterrole (thisform,rolecode,buttonname) { |
|
if (active) { |
|
active=false; |
|
document.title='$standby'; |
|
window.status='$standby'; |
|
thisform.newrole.value=rolecode; |
|
thisform.submit(); |
|
} else { |
|
alert('$standby'); |
|
} |
|
} |
</script> |
</script> |
ENDHEADER |
ENDHEADER |
|
|
Line 343 ENDHEADER
|
Line 373 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 361 ENDHEADER
|
Line 391 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 387 ENDHEADER
|
Line 417 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 395 ENDHEADER
|
Line 425 ENDHEADER
|
$r->print('<form method="post" name="rolechoice" action="'.(($fn)?$fn:$r->uri).'">'); |
$r->print('<form method="post" name="rolechoice" action="'.(($fn)?$fn:$r->uri).'">'); |
$r->print('<input type="hidden" name="orgurl" value="'.$fn.'" />'); |
$r->print('<input type="hidden" name="orgurl" value="'.$fn.'" />'); |
$r->print('<input type="hidden" name="selectrole" value="1" />'); |
$r->print('<input type="hidden" name="selectrole" value="1" />'); |
|
$r->print('<input type="hidden" name="newrole" value="" />'); |
} |
} |
if ($env{'user.adv'}) { |
if ($env{'user.adv'}) { |
$r->print( |
$r->print( |
Line 415 ENDHEADER
|
Line 446 ENDHEADER
|
if ($envkey=~/^user\.role\./) { |
if ($envkey=~/^user\.role\./) { |
my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont); |
my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont); |
&role_status($envkey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend); |
&role_status($envkey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend); |
next if (!defined($role) || $role eq ''); |
next if (!defined($role) || $role eq '' || $role =~ /^gr/); |
$tremark=''; |
$tremark=''; |
$tpstart=' '; |
$tpstart=' '; |
$tpend=' '; |
$tpend=' '; |
Line 460 ENDHEADER
|
Line 491 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. |
if ($tremark) { $tremark.='<br />'; } |
|
$tremark.=&mt('Defined by ').$rauthor. |
&mt(' at ').$rdomain.'.'; |
&mt(' at ').$rdomain.'.'; |
$trole=$rrole; |
$trole=$rrole; |
} else { |
} else { |
Line 471 ENDHEADER
|
Line 503 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 592 ENDHEADER
|
Line 620 ENDHEADER
|
$r->print('<br /><table><tr>'); |
$r->print('<br /><table><tr>'); |
unless ($nochoose) { $r->print('<th> </th>'); } |
unless ($nochoose) { $r->print('<th> </th>'); } |
$r->print('<th>'.&mt('User Role').'</th><th>'.&mt('Extent'). |
$r->print('<th>'.&mt('User Role').'</th><th>'.&mt('Extent'). |
'</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th><th>'. |
'</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</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 639 ENDHEADER
|
foreach (sort(keys(%recent_roles))) { |
foreach (sort(keys(%recent_roles))) { |
if (defined($roletext{'user.role.'.$_})) { |
if (defined($roletext{'user.role.'.$_})) { |
$output.=$roletext{'user.role.'.$_}; |
$output.=$roletext{'user.role.'.$_}; |
|
if ($_ =~ m-dc\./(\w+)/- && $dcroles{$1}) { |
|
$output .= &allcourses_row($1,'recent'); |
|
} |
} elsif ($numdc > 0) { |
} elsif ($numdc > 0) { |
unless ($_ =~/^error\:/) { |
unless ($_ =~/^error\:/) { |
$output.=&display_cc_role('user.role.'.$_); |
$output.=&display_cc_role('user.role.'.$_); |
Line 619 ENDHEADER
|
Line 649 ENDHEADER
|
} |
} |
} |
} |
if ($output) { |
if ($output) { |
$r->print("<tr bgcolor='#BBffBB'><td align='center' colspan='6'>". |
$r->print("<tr><td align='center' colspan='5'><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 631 ENDHEADER
|
Line 661 ENDHEADER
|
$r->print(&coursepick_jscript()); |
$r->print(&coursepick_jscript()); |
$r->print(&Apache::loncommon::coursebrowser_javascript()); |
$r->print(&Apache::loncommon::coursebrowser_javascript()); |
} |
} |
foreach my $type ('Construction Space','Course','Domain','System') { |
foreach my $type ('Construction Space','Domain','Course','System') { |
my $output; |
my $output; |
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/) { |
$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,''); |
} |
} |
} |
} |
} |
} |
} |
} |
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='5'><font face='arial'>".&mt($type)."</font></td></tr>"); |
} |
} |
$r->print($output); |
$r->print($output); |
} |
} |
Line 662 ENDHEADER
|
Line 692 ENDHEADER
|
} |
} |
unless ($nochoose) { |
unless ($nochoose) { |
if ($env{'request.role'} ne 'cm') { |
if ($env{'request.role'} ne 'cm') { |
$r->print('<td><input type=submit value="'. |
$r->print('<td><input type="submit" value="'. |
&mt('Select').'" name="cm"></td>'); |
&mt('Select').'" name="cm"></td>'); |
} else { |
} else { |
$r->print('<td> </td>'); |
$r->print('<td> </td>'); |
} |
} |
} |
} |
$r->print('<td colspan="4"><font color="'.$tfont.'">'.&mt('No role specified'). |
$r->print('<td colspan="3"><font color="'.$tfont.'">'.&mt('No role specified'). |
'</font></td><td><font color="'.$tfont.'">'.$tremark. |
'</font></td><td><font color="'.$tfont.'">'.$tremark. |
' </font></td></tr>'."\n"); |
' </font></td></tr>'."\n"); |
|
|
Line 678 ENDHEADER
|
Line 708 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 768 sub role_status {
|
Line 798 sub role_status {
|
sub build_roletext { |
sub build_roletext { |
my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_; |
my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_; |
my $roletext='<tr bgcolor="'.$tbg.'">'; |
my $roletext='<tr bgcolor="'.$tbg.'">'; |
|
my $is_dc=($trolecode =~ m/^dc\./); |
|
my $rowspan=($is_dc) ? '' |
|
: ' rowspan="2" '; |
|
|
unless ($nochoose) { |
unless ($nochoose) { |
|
my $buttonname=$trolecode; |
|
$buttonname=~s/\W//g; |
if (!$button) { |
if (!$button) { |
if ($switchserver) { |
if ($switchserver) { |
$roletext.='<td><a href="/adm/logout?handover='. |
$roletext.='<td'.$rowspan.'><a href="/adm/switchserver?'. |
$switchserver.'">'.&mt('Switch Server').'</a></td>'; |
$switchserver.'">'.&mt('Switch Server').'</a></td>'; |
} else { |
} else { |
$roletext.=('<td> </td>'); |
$roletext.=('<td> </td>'); |
} |
} |
} elsif ($tstatus eq 'is') { |
} elsif ($tstatus eq 'is') { |
$roletext.=('<td><input type=submit value="'. |
$roletext.='<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
&mt('Select').'" name="'. |
&mt('Select').'" onClick="javascript:enterrole(this.form,\''. |
$trolecode.'"></td>'); |
$trolecode."','".$buttonname.'\');"></td>'; |
} elsif ($tryagain) { |
} elsif ($tryagain) { |
$roletext.= |
$roletext.= |
'<td><input type=submit value="'. |
'<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
&mt('Try Selecting Again').'" name="'.$trolecode.'"></td>'; |
&mt('Try Selecting Again').'" onClick="javascript:enterrole(this.form,\''. |
|
$trolecode."','".$buttonname.'\');"></td>'; |
} elsif ($advanced) { |
} elsif ($advanced) { |
$roletext.= |
$roletext.= |
'<td><input type=submit value="'. |
'<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'. |
&mt('Re-Initialize').'" name="'.$trolecode.'"></td>'; |
&mt('Re-Initialize').'" onClick="javascript:enterrole(this.form,\''. |
|
$trolecode."','".$buttonname.'\');"></td>'; |
} else { |
} else { |
$roletext.='<td> </td>'; |
$roletext.='<td'.$rowspan.'> </td>'; |
} |
} |
} |
} |
$tremark.=&Apache::lonannounce::showday(time,1, |
$tremark.=&Apache::lonannounce::showday(time,1, |
&Apache::lonannounce::readcalendar($tdom.'_'.$trest)); |
&Apache::lonannounce::readcalendar($tdom.'_'.$trest)); |
|
|
|
|
$roletext.='<td><font color="'.$tfont.'">'.$trole. |
$roletext.='<td><font color="'.$tfont.'">'.$trole. |
'</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></tr>'; |
' </font></td></tr>'."\n"; |
if (!$is_dc) { |
|
$roletext.='<tr bgcolor="'.$tbg.'"><td colspan="4"><font color="'.$tfont.'">'.$tremark. |
|
' </font></td></tr><tr><td colspan="5" height="3"></td></tr>'."\n"; |
|
} |
return $roletext; |
return $roletext; |
} |
} |
|
|
Line 840 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 887 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+1].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 951 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">'. |
'<td><input type="button" value="'. |
'<td colspan="5">'. |
&mt('Select').'" name="ccpick_'.$dcdom.'"'. |
'<font color="#002200">'.$ccrole.'</font>'. |
'onClick="verifyCoursePick(this)">'. |
' <b>'.$selectlink.'</b>'. |
'<input type="hidden" name="pick_'.$dcdom.'" value="1"></td>'. |
' from '.&mt('Domain').' '.$dcdom. |
'<td><font color="#002200">'. |
'<tr><td colspan="5" height="3"></td></tr>'."\n"; |
$ccrole.'</font></td>'. |
|
'<td><font color="#002200">'.&mt('All courses').':<b> '. |
|
$selectlink.'</b>'. |
|
'<br />'.&mt('Domain').':'.$dcdom.'</font>'. |
|
'<td colspan="3"><font color="#002200">'. |
|
&mt('Course Coordinator access to all courses in domain'). |
|
': <b>'.$dcdom.'</b></font></td></tr>'."\n"; |
|
return $output; |
return $output; |
} |
} |
|
|
Line 1004 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__ |
|
|