--- loncom/auth/lonroles.pm 2005/04/07 06:56:21 1.118 +++ loncom/auth/lonroles.pm 2005/07/08 10:39:49 1.126 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.118 2005/04/07 06:56:21 albertel Exp $ +# $Id: lonroles.pm,v 1.126 2005/07/08 10:39:49 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,6 +39,7 @@ use Apache::loncommon; use Apache::lonhtmlcommon; use Apache::lonannounce; use Apache::lonlocal; +use GDBM_File; sub redirect_user { my ($r,$title,$url,$msg,$launch_nav) = @_; @@ -226,15 +227,12 @@ ENDENTERKEY my $tadv=0; my $msg=&mt('Entering course ...'); - if (($cnum) && ($role ne 'ca')) { + if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); if (($env{'form.orgurl'}) && ($env{'form.orgurl'}!~/^\/adm\/flip/)) { my $dest=$env{'form.orgurl'}; - if ( &Apache::lonnet::mod_perl_version() == 2 ) { - &Apache::lonnet::cleanenv(); - } if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } &Apache::lonnet::appenv('request.role.adv'=>$tadv); $r->internal_redirect($dest); @@ -262,17 +260,24 @@ ENDENTERKEY if ($role eq 'cc' && $env{'course.' . $courseid . '.course.helper.not.run'}) { $furl = "/adm/helper/course.initialization.helper"; + # Send the user to the course they selected + } elsif (($env{'request.course.fn'}) + && ($role eq 'cc' && ($env{'environment.course_init_display'} ne 'firstres'))) { + $msg = &mt('Entering course ....'); + &redirect_user($r,&mt('New in course'), + '/adm/whatsnew',$msg, + $env{'environment.remotenavmap'}); + return OK; } - # Send the user to the course they selected - &redirect_user($r,&mt('Entering Course'), + &redirect_user($r,&mt('Entering Course'), $furl,$msg, $env{'environment.remotenavmap'}); - return OK; + return OK; } } # # Send the user to the construction space they selected - if ($role =~ /^(au|ca)$/) { + if ($role =~ /^(au|ca|aa)$/) { my $redirect_url = '/priv/'; if ($role eq 'au') { $redirect_url.=$env{'user.name'}; @@ -338,10 +343,21 @@ ENDHEADER # --------------------------------------------------------------- Error Header? if ($error) { $r->print("

LON-CAPA Access Control

"); - $r->print("
Access  : ".
+        $r->print("
Access  : ".
                   Apache::lonnet::plaintext($priv)."\n");
         $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");
-        $r->print("Action  : $msg\n

"); + $r->print("Action : $msg\n

"); + my $url=$fn; + my $last; + if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db', + &GDBM_READER(),0640)) { + $last=$hash{'last_known'}; + untie(%hash); + } + if ($last) { $fn.='?symb='.&Apache::lonnet::escape($last); } + + &Apache::londocs::changewarning($r,undef,'You have modified your course recently, [_1] may fix this access problem.', + &Apache::lonenc::check_encrypt($fn)); } else { if ($env{'user.error.msg'}) { $r->print( @@ -371,7 +387,7 @@ ENDHEADER ($env{'user.name'},$env{'user.domain'})}. "
\n"); $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)) { $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; @@ -414,28 +430,34 @@ ENDHEADER $tstatus='selected'; } my $tbg; + my $tbghigh; if (($tstatus eq 'is') || ($tstatus eq 'selected') || ($env{'form.showall'})) { if ($tstatus eq 'is') { $tbg='#77FF77'; + $tbghigh='#99CC77'; $tfont='#003300'; $possiblerole=$trolecode; $countactive++; } elsif ($tstatus eq 'future') { $tbg='#FFFF77'; + $tbghigh='#DDDD55'; $button=0; } elsif ($tstatus eq 'will') { $tbg='#FFAA77'; $tremark.=&mt('Active at next login. '); } elsif ($tstatus eq 'expired') { $tbg='#FF7777'; + $tbghigh='#EE9955'; $tfont='#330000'; $button=0; } elsif ($tstatus eq 'will_not') { $tbg='#AAFF77'; + $tbghigh='#BBDD55'; $tremark.=&mt('Expired after logout. '); } elsif ($tstatus eq 'selected') { $tbg='#11CC55'; + $tbghigh='339944'; $tfont='#002200'; $inrole=1; $countactive++; @@ -444,7 +466,7 @@ ENDHEADER my $trole; if ($role =~ /^cr\//) { my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role); - $tremark.='
'.&mt('Defined by ').$rauthor. + $tremark.='
'.&mt('Defined by ').$rauthor. &mt(' at ').$rdomain.'.'; $trole=$rrole; } else { @@ -455,7 +477,7 @@ ENDHEADER my ($tdom,$trest,$tsection)= split(/\//,Apache::lonnet::declutter($where)); # First, Co-Authorship roles - if ($role eq 'ca') { + if (($role eq 'ca') || ($role eq 'aa')) { my $home = &Apache::lonnet::homeserver($trest,$tdom); my $allowed=0; my @ids=&Apache::lonnet::current_machine_ids(); @@ -502,9 +524,6 @@ ENDHEADER $sortkey=$role; } elsif ($trest) { $ttype='Course'; - if ($tsection) { - $ttype.='
'.&mt('Section/Group').': '.$tsection; - } my $tcourseid=$tdom.'_'.$trest; if ($env{'course.'.$tcourseid.'.description'}) { $twhere=$env{'course.'.$tcourseid.'.description'}; @@ -529,6 +548,10 @@ ENDHEADER $sortkey=$role."\0".$tdom."\0".$twhere."\0".$envkey; } } + if ($tsection) { + $twhere.='
'.&mt('Section/Group').': '.$tsection; + } + if ($role ne 'st') { $twhere.="
".&mt('Domain').":".$tdom; } } elsif ($tdom) { $ttype='Domain'; @@ -540,7 +563,7 @@ ENDHEADER $sortkey=$role.$twhere; } - $roletext.=&build_roletext($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver); + $roletext.=&build_roletext($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tbghigh,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver); $roletext{$envkey}=$roletext; if (!$sortkey) {$sortkey=$twhere."\0".$envkey;} $sortrole{$sortkey}=$envkey; @@ -574,7 +597,7 @@ ENDHEADER } $r->print('
'); unless ($nochoose) { $r->print(''); } - $r->print(''."\n"); my $doheaders=-1; @@ -602,8 +625,8 @@ ENDHEADER } } if ($output) { - $r->print(""); + $r->print(""); $r->print($output); $r->print(""); $doheaders ++; @@ -628,8 +651,8 @@ ENDHEADER } if ($output) { if ($doheaders > 0) { - $r->print("". - ""); + $r->print("". + ""); } $r->print($output); } @@ -651,7 +674,7 @@ ENDHEADER $r->print(''); } } - $r->print(''."\n"); @@ -749,8 +772,8 @@ sub role_status { } sub build_roletext { - my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_; - my $roletext=''; + my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tbghigh,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_; + my $roletext=''; unless ($nochoose) { if (!$button) { if ($switchserver) { @@ -780,8 +803,7 @@ sub build_roletext { $roletext.=''. + my $output = ''. ''. ''. + $ccrole.''. ''."\n"; return $output;
 '.&mt('User Role').''.&mt('Extent'). + $r->print(''.&mt('User Role').''.&mt('Extent'). ''.&mt('Start').''.&mt('End').''. &mt('Remarks and Calendar Announcements').'
". - &mt('Recent Roles')."
". + &mt('Recent Roles')."
".&mt($type)."
".&mt($type)."
 '.&mt('No role specified'). + $r->print(''.&mt('No role specified'). ''.$tremark. ' 
'.$trole. - ''.$ttype. - ''.$twhere. + ''.$twhere. ''.$tpstart. ''.$tpend. ''.$tremark. @@ -916,6 +938,7 @@ sub display_cc_role { my $trole = Apache::lonnet::plaintext('cc'); my $twhere; my $tbg='#77FF77'; + my $tbghigh='#99CC77'; my $tfont='#003300'; my %newhash=&Apache::lonnet::coursedescription($tcourseid); if (%newhash) { @@ -928,7 +951,7 @@ sub display_cc_role { $env{'course.'.$tcourseid.'.description'}=$twhere; } $twhere.="
".&mt('Domain').":".$1; - $roletext = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$tfont,$trole,&mt('Course'),$twhere,'','','',1,''); + $roletext = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$tbghigh,$tfont,$trole,&mt('Course'),$twhere,'','','',1,''); } } return $roletext; @@ -938,17 +961,17 @@ sub allcourses_row { my $dcdom = shift; my $ccrole = Apache::lonnet::plaintext('cc'); my $selectlink = &courselink($dcdom); - my $output = '
'. ''. - $ccrole.''.&mt('Course').''.&mt('All courses').': '. $selectlink.''. '
'.&mt('Domain').':'.$dcdom.'
'. - '
'. + ''. &mt('Course Coordinator access to all courses in domain'). ': '.$dcdom.'