'.
- ''.
- ''.
- ' '.&mt('Utilities').''.
- '  | ';
- if ($switcher) {
- $output .= ' | ';
+ my (%can_request,%request_domains,$canreq,$createtext);
+ my $role = 'st';
+ my $custommenu = &Apache::loncommon::needs_gci_custom();
+ if ($custommenu) {
+ $role = 'cc';
+ }
+ my %courses = &Apache::loncommon::existing_gcitest_courses($role);
+ my $numcourses = keys(%courses);
+ my ($switcher_js,$switcher);
+ my $formname = 'testpicker';
+ if ($numcourses > 0) {
+ $switcher = &Apache::loncommon::gcitest_switcher($role,$formname,%courses);
+ my $current;
+ my $cid = $env{'request.course.id'};
+ if ($cid) {
+ $current = $role.'./'.$env{'course.'.$cid.'.domain'}.
+ '/'.$env{'course.'.$cid.'.num'};
+ }
+ $switcher_js = &Apache::loncommon::gcitest_switcher_js($current,$numcourses,$formname);
+ if ($switcher_js) {
+ $switcher_js= <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+ }
+ $switcher = $switcher_js.$switcher;
}
- $output .= ' |
| ';
- if (($env{'request.course.id'}) &&
- (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
- $output.= ''.
- ' | ';
+ if ($env{'user.domain'} !~ /^\w+citest$/) {
+ $canreq =
+ &Apache::lonnet::check_can_request($env{'user.domain'}.'test',\%can_request,\%request_domains);
+ $createtext = &mt('Create Concept Test');
+ if ($numcourses) {
+ $createtext = &mt('Create New Test');
+ }
+ }
+ if ($env{'request.course.id'}) {
+ if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+ my $navlink;
+ if ($env{'environment.remotenavmap'} eq 'on') {
+ $navlink = "javascript:gonav('/adm/navmaps')";
+ } else {
+ $navlink = '/adm/navmaps';
+ }
+ $output .=
+ '
';
+ } else {
+ my $navtext = &mt('Table of Contents');
+ my $navdesc = &mt('Display Table of Contents for Geoscience Concept Inventory');
+ if ($env{'request.role.domain'} =~ /^\w+citest$/) {
+ $navtext = &mt('Display Test Contents');
+ $navdesc = &mt('Display the table of contents for this Concept Test');
+ }
+ my $navlink;
+ if ($env{'environment.remotenavmap'} eq 'on') {
+ $navlink = "javascript:gonav('/adm/navmaps');"
+ } else {
+ $navlink = '/adm/navmaps';
+ }
+ $output .=
+ '
';
+ }
+ } elsif ($switcher || $canreq) {
+ $output .= '
'.
+ '
';
+ }
+ } elsif ($context eq 'gcinorole') {
+ my $queued = &Apache::loncoursequeueadmin::queued_selfenrollment('notitle');
+ if ($queued) {
+ $output .=
+ ''.
+ '
'.&mt('Pending Enrollment Requests').'
'.
+ $queued.
+ '';
}
- $output.='
';
} else {
# calling rawconfig with "1" will evaluate mydesk.tab,
# even if there is no active remote control
@@ -1736,11 +1898,11 @@ sub utilityfunctions {
my $gcimenujs;
if ($custommenu) {
- my %concepttests = &Apache::loncommon::existing_gcitest_courses();
+ my %concepttests = &Apache::loncommon::existing_gcitest_courses('cc');
my $managetesturl = '/adm/menu';
my $createtesturl = '/adm/requestcourse';
if (($env{'request.course.id'}) &&
- ($env{'course.'.$env{'request.course.id'}.'.domain'} eq 'gci')) {
+ ($env{'course.'.$env{'request.course.id'}.'.domain'} !~ /^\w+citest$/)) {
my @items = keys(%concepttests);
if (@items== 1) {
my $newrole = $items[0];
@@ -1753,14 +1915,22 @@ sub utilityfunctions {
if ($env{'request.course.id'}) {
$createtesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2frequestcourse';
}
+ my %allnums = &Apache::loncommon::get_faculty_cnums();
+ my $udom = $env{'user.domain'};
+ my %crs_by_caller;
+ if (ref($allnums{$udom}) eq 'HASH') {
+ foreach my $key (keys(%{$allnums{$udom}})) {
+ $crs_by_caller{$allnums{$udom}->{$key}} = 'st./'.$udom.'/'.$key.'=1';
+ }
+ }
$gcimenujs = <<"ENDCUSTOM";
function switchpage(caller) {
if (caller == 'review') {
- document.location.href = '/adm/roles?selectrole=1&st./gci/9615072b469884921gcil1=1';
+ document.location.href = '/adm/roles?selectrole=1&'.$crs_by_caller{'review'};
}
if (caller == 'submit') {
- document.location.href = '/adm/roles?selectrole=1&st./gci/1H96711d710194bfegcil1=1';
+ document.location.href = '/adm/roles?selectrole=1&'.$crs_by_caller{'submit'};
}
if (caller == 'createtest') {
document.location.href = '$createtesturl';
@@ -1768,6 +1938,9 @@ function switchpage(caller) {
if (caller == 'managetest') {
document.location.href = '$managetesturl';
}
+ if (caller == 'tutorial') {
+ document.location.href = '/adm/roles?selectrole=1&'.$crs_by_caller{'tutorial'};
+ }
return;
}
@@ -1831,12 +2004,6 @@ function go(url) {
}
}
-function gotop(url) {
- if (url!='' && url!= null) {
- top.location.href = url;
- }
-}
-
function gopost(url,postdata) {
if (url!='') {
this.document.server.action=url;