--- loncom/auth/lonroles.pm 2010/01/18 16:48:21 1.240.2.12
+++ loncom/auth/lonroles.pm 2010/12/05 16:31:53 1.240.2.20
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.240.2.12 2010/01/18 16:48:21 raeburn Exp $
+# $Id: lonroles.pm,v 1.240.2.20 2010/12/05 16:31:53 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);
@@ -455,6 +454,12 @@ ENDENTERKEY
&Apache::lonnet::appenv({'request.role.adv'=>$tadv});
my ($furl,$ferr)=
&Apache::lonuserstate::readmap($cdom.'/'.$cnum);
+ if ($custommenu) {
+ unless (($ferr) || ($env{'form.switchrole'})) {
+ &Apache::lonnet::put('nohist_crslastlogin',{$env{'user.name'}.':'.$env{'user.domain'}.':'.$csec.':'.$role => $now},
+ $cdom,$cnum);
+ }
+ }
if (($env{'form.orgurl'}) &&
($env{'form.orgurl'}!~/^\/adm\/flip/)) {
my $dest=$env{'form.orgurl'};
@@ -587,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
-
@@ -602,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(<
@@ -742,20 +754,7 @@ 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());
@@ -799,7 +798,15 @@ 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'} eq 'gcitest') {
+ $r->print('
'.&mt('Currently not assigned as a GCI contributor').'
');
+ }
+ } else {
+ $r->print('
'.&mt('Currently no active roles, courses or communities').'
');
+ }
}
unless ($env{'user.domain'} eq 'gcitest') {
&findcourse_advice($r);
@@ -807,7 +814,15 @@ ENDSCRIPT
}
$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'} eq 'gcitest') {
+ $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,
@@ -856,7 +871,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'}) {
@@ -959,18 +974,21 @@ ENDSCRIPT
sub gci_info_page {
return <<"END";
+
+
Welcome to the Geoscience Concept Inventory WebCenter
Use the tabs to navigate the WebCenter and...
Review and comment on existing GCI questions
-
Submit a GCI question of your own
+
Submit GCI questions of your own
Create an online test for your students
+
View tutorials on creating online tests
For more information about writing and reviewing Concept Inventory questions
please refer to the GCI Workbook.
-
+
END
}
@@ -1079,7 +1097,7 @@ sub gather_roles {
} elsif ($trest) {
my $tcourseid=$tdom.'_'.$trest;
$ttype = &Apache::loncommon::course_type($tcourseid);
- $trole = &Apache::lonnet::plaintext($role,$ttype,$tcourseid));
+ $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;
@@ -1276,10 +1294,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.').'
'.
+ '
'.&mt('This may mean that action was taken on your request in the time since your most recent log-in.[_1]View [_2]Message[_3] to see if this is the case.',' ','','').'
'.
+ '
'.&mt('If you logout and log-in again you may find you now have access to the Geoscience Concept Inventory, as a contributor.').'
'.
+ '
');
+ }
return;
}
@@ -1335,49 +1358,6 @@ sub requestcourse_advice {
}
return;
}
-
-sub queued_selfenrollment {
- my ($r) = @_;
- my %selfenrollrequests = &Apache::lonnet::dump('selfenrollrequests');
- my %reqs_by_date;
- foreach my $item (keys(%selfenrollrequests)) {
- if (ref($selfenrollrequests{$item}) eq 'HASH') {
- if ($selfenrollrequests{$item}{'status'} eq 'request') {
- if ($selfenrollrequests{$item}{'timestamp'}) {
- push(@{$reqs_by_date{$selfenrollrequests{$item}{'timestamp'}}},$item);
- }
- }
- }
- }
- if (keys(%reqs_by_date)) {
- my $rolename = &Apache::lonnet::plaintext('st');
- $r->print(''.&mt('Enrollment requests pending Course Coordinator approval').' '.
- &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row().
- '
'.&mt('Date requested').'
'.&mt('Course title').'
'.
- '
'.&mt('User role').'
'.&mt('Section').'
'.
- &Apache::loncommon::end_data_table_header_row());
- my @sorted = sort { $a <=> $b } (keys(%reqs_by_date));
- foreach my $item (@sorted) {
- if (ref($reqs_by_date{$item}) eq 'ARRAY') {
- foreach my $crs (@{$reqs_by_date{$item}}) {
- my %courseinfo = &Apache::lonnet::coursedescription($crs);
- my $usec = $selfenrollrequests{$crs}{'section'};
- if ($usec eq '') {
- $usec = &mt('No section');
- }
- $r->print(&Apache::loncommon::start_data_table_row().
- '