'.&mt('Continue').''.
- &Apache::loncommon::end_page());
+ ' '.&mt('Continue').''
+ );
+ $r->print(&Apache::loncommon::end_page());
}
sub handler {
@@ -212,6 +226,7 @@ sub handler {
my %dcroles = ();
my $numdc = &check_fordc(\%dcroles,$then);
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
+ my $custommenu = &Apache::loncommon::needs_gci_custom();
# ================================================================== Roles Init
if ($env{'form.selectrole'}) {
@@ -306,7 +321,9 @@ sub handler {
}
}
}
-
+ if (($env{'form.cm'}) && ($env{'form.orgurl'})) {
+ $r->internal_redirect($env{'form.orgurl'});
+ }
foreach $envkey (keys %env) {
next if ($envkey!~/^user\.role\./);
my ($where,$trolecode,$role,$tstatus,$tend,$tstart);
@@ -433,8 +450,16 @@ 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 ($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'};
@@ -446,8 +471,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 {
@@ -466,8 +489,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);
@@ -479,8 +500,8 @@ ENDENTERKEY
$courseid = substr($courseid, 1);
}
$courseid =~ s/\//_/;
- if ((($role eq 'cc') || ($role eq 'co'))
- && ($env{'course.' . $courseid .'.course.helper.not.run'})) {
+ 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
} elsif ($env{'request.course.id'}) {
@@ -503,7 +524,7 @@ ENDENTERKEY
.$env{'request.course.sec'})
) {
my $startpage = &courseloadpage($courseid);
- unless ($startpage eq 'firstres') {
+ unless (($startpage eq 'firstres') || ($cdom =~ /^\w+citest$/)) {
$msg = &mt('Entering [_1] ...',
$env{'course.'.$courseid.'.description'});
&redirect_user($r,&mt('New in course'),
@@ -518,6 +539,9 @@ ENDENTERKEY
# Guess not ...
$furl=&Apache::lonpageflip::first_accessible_resource();
}
+ if (($cdom =~ /^\w+citest$/) && ($custommenu)) {
+ $furl = '/adm/navmaps';
+ }
$msg = &mt('Entering [_1] ...',
$env{'course.'.$courseid.'.description'});
&redirect_user($r,&mt('Entering [_1]',
@@ -560,7 +584,6 @@ ENDENTERKEY
}
}
-
# =============================================================== No Roles Init
&Apache::loncommon::content_type($r,'text/html');
@@ -568,25 +591,43 @@ ENDENTERKEY
$r->send_http_header;
return OK if $r->header_only;
- my $crumbtext = 'User Roles';
- my $pagetitle = 'My Roles';
- my $recent = &mt('Recent Roles');
- my $show_course=&Apache::loncommon::show_course();
- if ($show_course) {
- $crumbtext = 'Courses';
- $pagetitle = 'My Courses';
- $recent = &mt('Recent Courses');
- }
- my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}];
- 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;
- 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.').' ';
-
- $r->print(<'.&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');
+ $r->print(<<"ENDCUSTOM");
+$start_page
+
+ENDCUSTOM
+ } else {
+ $crumbtext = 'User Roles';
+ $pagetitle = 'My Roles';
+ $recent = &mt('Recent Roles');
+ 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 $start_page=&Apache::loncommon::start_page($pagetitle,undef,$args);
+ my $swinfo=&Apache::lonmenu::rawconfig();
+ $standby=~s/\n/\\n/g;
+ $r->print(<
@@ -611,6 +652,7 @@ function enterrole (thisform,rolecode,bu
// ]]>
ENDHEADER
+ }
# ------------------------------------------ Get Error Message from Environment
@@ -659,7 +701,7 @@ ENDHEADER
if ($reinit) {
$r->print(
'
'.
- &mt('As your session file for the course or community has expired, you will need to re-select the course.').'
');
+ &mt('As your session file for the course or community has expired, you will need to re-select it.').'');
} else {
$r->print(
'
'.
@@ -678,10 +720,12 @@ ENDHEADER
if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
$fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
}
- $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,
@@ -755,9 +848,30 @@ ENDHEADER
}
$r->print(&Apache::loncommon::end_page());
return OK;
+ } elsif ($countactive==1) { # Is there only one choice?
+ my $needs_switchserver;
+ if ($env{'user.author'}) {
+ $needs_switchserver = &check_needs_switchserver($possiblerole);
+ }
+ if ((!$needs_switchserver) && ($env{'request.role'} eq 'cm')) {
+ $r->print('
\n".
+ &mt('Construction Space access is only available from '.
+ 'the home server of the corresponding Author.').' '.
+ &mt("Click the 'Switch Server' link to go there.").' ');
+ }
}
# ----------------------------------------------------------------------- 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'}) {
@@ -858,6 +972,46 @@ ENDHEADER
return OK;
}
+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...
+
+END
+ if (ref($tabs) eq 'ARRAY') {
+ foreach my $tab (@{$tabs}) {
+ if ($features{$tab}) {
+ $output .= '
'.$features{$tab}.'
'."\n";
+ }
+ }
+ }
+ $output .= <<"END";
+
+
+$info{$inventory}
+
+END
+
+}
+
sub gather_roles {
my ($then,$refresh,$now,$reinit,$nochoose,$roletext,$sortrole,$roleclass,$futureroles,$timezones) = @_;
my ($countactive,$countfuture,$inrole,$possiblerole) = (0,0,0,'');
@@ -963,7 +1117,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;
@@ -982,7 +1136,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;
@@ -1160,10 +1314,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.').'
');
- &queued_selfenrollment($r);
+ 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;
}
@@ -1175,12 +1334,12 @@ sub requestcourse_advice {
&Apache::lonnet::check_can_request($env{'user.domain'},\%can_request,\%request_doms);
if (keys(%request_doms) > 0) {
my ($types,$typename) = &Apache::loncommon::course_types();
- if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) {
+ if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) {
$r->print('
'.&mt('Request creation of a course or community').'
'.
'
'.&mt('You have rights to request the creation of courses and/or communities in the following domain(s):').'
');
my (@reqdoms,@reqtypes);
foreach my $type (sort(keys(%request_doms))) {
- push(@reqtypes,$type);
+ push(@reqtypes,$type);
if (ref($request_doms{$type}) eq 'ARRAY') {
my $domstr = join(', ',map { &Apache::lonnet::domain($_) } sort(@{$request_doms{$type}}));
$r->print(
@@ -1213,53 +1372,10 @@ sub requestcourse_advice {
}
if (@reqdoms == 1 || @showtypes > 0) {
$requrl .= '&state=crstype&action=new';
- }
- $r->print('
'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','','').'');
- }
- }
- 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);
- }
}
+ $r->print(''.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','','').'');
}
}
- 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().
- '
'.&Apache::lonlocal::locallocaltime($item).'
'.
- '
'.$courseinfo{'description'}.'
'.
- '
'.$rolename.'
'.$usec.'
'.
- &Apache::loncommon::end_data_table_row());
- }
- }
- }
- $r->print(&Apache::loncommon::end_data_table());
- }
return;
}
@@ -1585,7 +1701,7 @@ sub display_cc_role {
my $advanced = $env{'user.adv'};
my $tryagain = $env{'form.tryagain'};
unless ($rolekey =~/^error\:/) {
- if ($rolekey =~ m-^user\.role.(cc|co)\./($match_domain)/($match_courseid)$-) {
+ if ($rolekey =~ m{^user\.role\.(cc|co)\./($match_domain)/($match_courseid)$}) {
my $ccrole = $1;
my $tcourseid = $2.'_'.$3;
my $trolecode = $1.'./'.$2.'/'.$3;
@@ -1603,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,'');
}