--- loncom/auth/lonroles.pm 2010/09/03 19:20:51 1.240.2.16 +++ loncom/auth/lonroles.pm 2010/12/08 06:48:56 1.240.2.23 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.240.2.16 2010/09/03 19:20:51 raeburn Exp $ +# $Id: lonroles.pm,v 1.240.2.23 2010/12/08 06:48:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -138,7 +138,6 @@ use Apache::lonannounce; use Apache::lonlocal; use Apache::lonpageflip(); use Apache::lonnavdisplay(); -use Apache::lonmainmenu(); use Apache::loncoursequeueadmin; use GDBM_File; use LONCAPA qw(:DEFAULT :match); @@ -501,7 +500,7 @@ ENDENTERKEY $courseid = substr($courseid, 1); } $courseid =~ s/\//_/; - if (($cdom ne 'gcitest') && (($role eq 'cc') || ($role eq 'co')) + if (($cdom !~ /^\w+citest$/) && (($role eq 'cc') || ($role eq 'co')) && ($env{'course.' . $courseid .'.course.helper.not.run'})) { $furl = "/adm/helper/course.initialization.helper"; # Send the user to the course they selected @@ -525,7 +524,7 @@ ENDENTERKEY .$env{'request.course.sec'}) ) { my $startpage = &courseloadpage($courseid); - unless (($startpage eq 'firstres') || ($cdom eq 'gcitest')) { + unless (($startpage eq 'firstres') || ($cdom =~ /^\w+citest$/)) { $msg = &mt('Entering [_1] ...', $env{'course.'.$courseid.'.description'}); &redirect_user($r,&mt('New in course'), @@ -540,7 +539,7 @@ ENDENTERKEY # Guess not ... $furl=&Apache::lonpageflip::first_accessible_resource(); } - if (($cdom eq 'gcitest') && ($custommenu)) { + if (($cdom =~ /^\w+citest$/) && ($custommenu)) { $furl = '/adm/navmaps'; } $msg = &mt('Entering [_1] ...', @@ -593,13 +592,12 @@ ENDENTERKEY return OK if $r->header_only; my ($crumbtext,$pagetitle,$recent,$show_course); - my $noscript=''.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'
'.&mt('As this is not the case, most functionality in the system will be unavailable.').'

'; + $show_course=&Apache::loncommon::show_course(); + my $noscript='
'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'
'.&mt('As this is not the case, most functionality in the system will be unavailable.').'

'; if ($custommenu) { - my $start_page = &Apache::loncommon::start_page('Main Menu',undef, - {'bread_crumbs' => 1}); + my $start_page = &Apache::loncommon::start_page('Main Menu'); $r->print(<<"ENDCUSTOM"); $start_page -
@@ -608,20 +606,28 @@ ENDCUSTOM $crumbtext = 'User Roles'; $pagetitle = 'My Roles'; $recent = &mt('Recent Roles'); - $show_course=&Apache::loncommon::show_course(); + my $standby=&mt('Role selected. Please stand by.'); if ($show_course) { $crumbtext = 'Courses'; $pagetitle = 'My Courses'; $recent = &mt('Recent Courses'); + $standby = &mt('Course selected. Please stand by.'); + } + my $brcrum = [{ href => '/adm/roles', + text => $crumbtext,}, + ]; + my $args; + if ($numdc) { + $args = {bread_crumbs => $brcrum}; + } else { + $args = {bread_crumbs => $brcrum, + bread_crumbs_menulink => '_nomenu'}; } - my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}]; + my $start_page=&Apache::loncommon::start_page($pagetitle,undef,$args); my $swinfo=&Apache::lonmenu::rawconfig(); - my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum}); - my $standby=&mt('Role selected. Please stand by.'); $standby=~s/\n/\\n/g; $r->print(< @@ -737,8 +743,8 @@ ENDHEADER } } if ($custommenu) { - if ($env{'form.destinationurl'} eq '/adm/gci_info') { - $r->print(&gci_info_page()). + if ($env{'form.destinationurl'} eq '/adm/ci_info') { + $r->print(&ci_info_page()). &Apache::loncommon::end_page(); return OK; } @@ -748,26 +754,13 @@ ENDHEADER my $numcourses = keys(%courses); my $switcher; if ($numcourses > 0) { - $switcher = &Apache::lonmainmenu::gcitest_switcher('cc',%courses); - my $current; - if ($env{'request.course.id'}) { - $current = 'cc./'.$env{'course.'.$env{'request.course.id'}.'.domain'}. - '/'.$env{'course.'.$env{'request.course.id'}.'.num'}; - } - my $switcher_js = &Apache::lonmainmenu::gcitest_switcher_js($current,$numcourses); - $r->print(<<"ENDSCRIPT"); - -ENDSCRIPT + $switcher = &Apache::loncommon::gcitest_switcher('cc',%courses); } $r->print(&Apache::lonmenu::inlinemenu('gcicustom',$switcher). &Apache::loncommon::end_page()); return OK; } else { - if ($env{'form.destinationurl'} eq '/adm/gci_info') { + if ($env{'form.destinationurl'} eq '/adm/ci_info') { delete($env{'form.destinationurl'}); } } @@ -782,7 +775,7 @@ ENDSCRIPT $r->print(&Apache::loncoursequeueadmin::queued_selfenrollment()); my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); - unless ($env{'user.domain'} eq 'gcitest') { + unless ($env{'user.domain'} =~ /^\w+citest$/) { $r->print( '

' .&mt('[_1]Visit the [_2]Course/Community Catalog[_3]' @@ -805,15 +798,32 @@ ENDSCRIPT if ($inrole) { $r->print('

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

'); } else { - $r->print('

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

'); + if ($show_course) { + if ($env{'user.domain'} =~ /^\w+citest$/) { + $r->print('

'.&mt('Currently no active Concept Tests').'

'); + } elsif ($env{'user.domain'} =~ /^\w+ci$/) { + my $inventory = uc($env{'user.domain'}); + $r->print('

'.&mt('Currently not assigned as a [_1] contributor',$inventory).'

'); + } + } else { + $r->print('

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

'); + } } - unless ($env{'user.domain'} eq 'gcitest') { + unless ($env{'user.domain'} =~ /^\w+citest$/) { &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)); + if ($show_course) { + if ($env{'user.domain'} =~ /^\w+citest$/) { + $r->print(&mt('The following [quant,_1,Concept Test] will be available in the future:',$countfuture)); + } else { + $r->print(&mt('The following [quant,_1,course] will become active in the future:',$countfuture)); + } + } else { + $r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture)); + } my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole, $nochoose); &print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles, @@ -862,7 +872,7 @@ ENDSCRIPT } } # ----------------------------------------------------------------------- Table - unless ((!&Apache::loncommon::show_course()) || ($nochoose) || ($countactive==1)) { + unless ((!$show_course) || ($nochoose) || ($countactive==1)) { $r->print("

".&mt('Select a Course to Enter')."

\n"); } if ($env{'form.destinationurl'}) { @@ -963,22 +973,44 @@ ENDSCRIPT return OK; } -sub gci_info_page { - return <<"END"; -

Welcome to the Geoscience Concept Inventory WebCenter

+sub ci_info_page { + my %longname = ( + GCI => 'Geoscience Concept Inventory', + SLCI => 'Science Literacy Concept Inventory', + ); + my $inventory = uc($env{'user.domain'}); + my %features = ( + review => "Review and comment on existing $inventory questions", + submit => "Submit $inventory questions of your own", + managetest => 'Create an online test for your students', + tutorial => 'View tutorials on creating online tests', + ); + my $tabs = &Apache::loncommon::ci_tabs($env{'user.domain'}); + my %info = ( + GCI => '

For more information about writing and reviewing Concept Inventory questions please refer to the GCI Workbook.

', + ); + my $output = <<"END"; +
+
+

Welcome to the $longname{$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. - +$info{$inventory} +

END + } sub gather_roles { @@ -1283,10 +1315,15 @@ sub findcourse_advice { } else { $r->print(&mt('If you were expecting to see an active role listed for a particular course, that course may not have been created yet.').'
'); } - $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.').'

'. - &Apache::loncoursequeueadmin::queued_selfenrollment()); + my $queued = &Apache::loncoursequeueadmin::queued_selfenrollment(); + if ($queued) { + $r->print($queued); + } else { + $r->print(&mt('You have no request for contributor access pending approval by the GCI WebCenter team.').''); + } return; }