--- loncom/auth/lonroles.pm 2009/12/15 05:04:17 1.240.2.3 +++ loncom/auth/lonroles.pm 2010/01/18 16:48:21 1.240.2.12 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.240.2.3 2009/12/15 05:04:17 raeburn Exp $ +# $Id: lonroles.pm,v 1.240.2.12 2010/01/18 16:48:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -139,6 +139,7 @@ use Apache::lonlocal; use Apache::lonpageflip(); use Apache::lonnavdisplay(); use Apache::lonmainmenu(); +use Apache::loncoursequeueadmin; use GDBM_File; use LONCAPA qw(:DEFAULT :match); use HTML::Entities; @@ -165,6 +166,7 @@ sub redirect_user { my $start_page = &Apache::loncommon::start_page('Switching Role',undef, {'redirect' => [1,$url], 'bread_crumbs' => $brcrum,}); + &Apache::lonhtmlcommon::clear_breadcrumbs(); my $end_page = &Apache::loncommon::end_page(); # Note to style police: @@ -449,6 +451,8 @@ ENDENTERKEY if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { my $msg; + if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } + &Apache::lonnet::appenv({'request.role.adv'=>$tadv}); my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); if (($env{'form.orgurl'}) && @@ -462,8 +466,6 @@ ENDENTERKEY } $dest .= 'symb='.$env{'form.symb'}; } - if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } - &Apache::lonnet::appenv({'request.role.adv'=>$tadv}); if (($ferr) && ($tadv)) { &error_page($r,$ferr,$dest); } else { @@ -482,8 +484,6 @@ ENDENTERKEY .'

'.&mt('Please try again.').'

' .'

'.$ferr.'

'; } - if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; } - &Apache::lonnet::appenv({'request.role.adv'=>$tadv}); if (($ferr) && ($tadv)) { &error_page($r,$ferr,$furl); @@ -723,14 +723,26 @@ ENDHEADER $refresh = $now; &Apache::lonnet::appenv({'user.refresh.time' => $refresh}); + if (!$countactive && !$countfuture) { + if (&Apache::loncommon::new_roles_update()) { + ($countactive,$countfuture,$inrole,$possiblerole) = + &gather_roles($then,$refresh,$now,$reinit,$nochoose,\%roletext,\%sortrole, + \%roleclass,\%futureroles,\%timezones); + } + } if ($custommenu) { - my %courses = &Apache::loncommon::existing_gcitest_courses(); + if ($env{'form.destinationurl'} eq '/adm/gci_info') { + $r->print(&gci_info_page()). + &Apache::loncommon::end_page(); + return OK; + } + my %courses = &Apache::loncommon::existing_gcitest_courses('cc'); $env{'browser.interface'}='faketextual'; $env{'environment.remote'}='off'; my $numcourses = keys(%courses); my $switcher; if ($numcourses > 0) { - $switcher = &Apache::lonmainmenu::gcitest_switcher(%courses); + $switcher = &Apache::lonmainmenu::gcitest_switcher('cc',%courses); my $current; if ($env{'request.course.id'}) { $current = 'cc./'.$env{'course.'.$env{'request.course.id'}.'.domain'}. @@ -748,6 +760,10 @@ ENDSCRIPT $r->print(&Apache::lonmenu::inlinemenu('gcicustom',$switcher). &Apache::loncommon::end_page()); return OK; + } else { + if ($env{'form.destinationurl'} eq '/adm/gci_info') { + delete($env{'form.destinationurl'}); + } } if ($env{'user.adv'}) { $r->print('

' - .&mt('[_1]Visit the [_2]Course/Community Catalog[_3]' - .' to view all [_4] LON-CAPA courses and communities.' - ,'' - ,'' - ,'',$domdesc) - .'
' - .&mt('If a course or community is [_1]not[_2] in your list of current courses and communities below,' + unless ($env{'user.domain'} eq 'gcitest') { + $r->print( + '

' + .&mt('[_1]Visit the [_2]Course/Community Catalog[_3]' + .' to view all [_4] LON-CAPA courses and communities.' + ,'' + ,'' + ,'',$domdesc) + .'
' + .&mt('If a course or community is [_1]not[_2] in your list of current courses and communities below,' .' you may be able to enroll if self-enrollment is permitted.' ,'','') - .'

' - ); + .'

' + ); + } } } @@ -783,8 +801,10 @@ ENDSCRIPT } else { $r->print('

'.&mt('Currently no active roles, courses or communities').'

'); } - &findcourse_advice($r); - &requestcourse_advice($r); + unless ($env{'user.domain'} eq 'gcitest') { + &findcourse_advice($r); + &requestcourse_advice($r); + } $r->print(''); if ($countfuture) { $r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture)); @@ -937,6 +957,23 @@ ENDSCRIPT return OK; } +sub gci_info_page { + return <<"END"; +

Welcome to the Geoscience Concept Inventory WebCenter

+

+Use the tabs to navigate the WebCenter and... +

+

+

For more information about writing and reviewing Concept Inventory questions +please refer to the GCI Workbook. + +END +} + sub gather_roles { my ($then,$refresh,$now,$reinit,$nochoose,$roletext,$sortrole,$roleclass,$futureroles,$timezones) = @_; my ($countactive,$countfuture,$inrole,$possiblerole) = (0,0,0,''); @@ -1042,7 +1079,7 @@ sub gather_roles { } elsif ($trest) { my $tcourseid=$tdom.'_'.$trest; $ttype = &Apache::loncommon::course_type($tcourseid); - $trole = &Apache::lonnet::plaintext($role,$ttype); + $trole = &Apache::lonnet::plaintext($role,$ttype,$tcourseid)); if ($env{'course.'.$tcourseid.'.description'}) { $twhere=$env{'course.'.$tcourseid.'.description'}; $sortkey=$role."\0".$tdom."\0".$twhere."\0".$envkey; @@ -1061,7 +1098,7 @@ sub gather_roles { &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom). ''; $ttype = $newhash{'type'}; - $trole = &Apache::lonnet::plaintext($role,$ttype); + $trole = &Apache::lonnet::plaintext($role,$ttype,$tcourseid); } else { $twhere=&mt('Currently not available'); $env{'course.'.$tcourseid.'.description'}=$twhere; @@ -1241,8 +1278,8 @@ sub findcourse_advice { } $r->print('

'.&mt('Self-Enrollment').'

'. '

'.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','','',$domdesc).'
'); - $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'

'); - &queued_selfenrollment($r); + $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'

'. + &Apache::loncoursequeueadmin::queued_selfenrollment()); return; } @@ -1682,7 +1719,7 @@ sub display_cc_role { $twhere=&mt('Currently not available'); $env{'course.'.$tcourseid.'.description'}=$twhere; } - my $trole = &Apache::lonnet::plaintext($ccrole,$ttype); + my $trole = &Apache::lonnet::plaintext($ccrole,$ttype,$tcourseid); $twhere.="
".&mt('Domain').":".$1; ($roletext,$roletext_end) = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,''); }