';
- for (my $col=1; $col<=2; $col++) {
- $output.='';
- for (my $row=1; $row<=8; $row++) {
- foreach my $cat (keys(%category_members)) {
- if ($category_positions{$cat} ne "$col,$row") { next; }
- #$output.=' ';
- $output.='';
- $output.=' '.&mt($category_names{$cat}).'';
- $output.=' ';
- my %active=();
- foreach my $menu_item (split(/\:/,$category_members{$cat})) {
- if ($inlineremote[$menu_item]) {
- $active{$menu_item}=1;
- }
- }
- foreach my $item (sort(keys(%active))) {
- $output.=$inlineremote[$item];
- }
- $output.=' ';
- $output.=' ';
+ my $output;
+ if ($context eq 'gcicustom') {
+ my $createtext = &mt('Create Concept Test');
+ if ($switcher) {
+ $createtext = &mt('Create New Test');
+ }
+ $output=''.
+ ''.
+ ''.
+ ' '.&mt('Utilities').''.
+ ' | ';
+ if ($switcher) {
+ $output .= ' | ';
+ }
+ $output .= ' |
| ';
+ if (($env{'request.course.id'}) &&
+ (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
+ $output.= ''.
+ ' | ';
+ }
+ $output.=' ';
+ } else {
+ # calling rawconfig with "1" will evaluate mydesk.tab,
+ # even if there is no active remote control
+ &rawconfig(1);
+ $output='';
+ for (my $col=1; $col<=2; $col++) {
+ $output.='';
+ for (my $row=1; $row<=8; $row++) {
+ foreach my $cat (keys(%category_members)) {
+ if ($category_positions{$cat} ne "$col,$row") { next; }
+ $output.='';
+ $output.=' '.&mt($category_names{$cat}).'';
+ $output.=' ';
+ my %active=();
+ foreach my $menu_item (split(/\:/,$category_members{$cat})) {
+ if ($inlineremote[$menu_item]) {
+ $active{$menu_item}=1;
+ }
+ }
+ foreach my $item (sort(keys(%active))) {
+ $output.=$inlineremote[$item];
+ }
+ $output.=' ';
+ $output.=' ';
+ }
}
- }
- $output.=" | ";
+ $output.="";
+ }
+ $output.=" ";
}
- $output.=" ";
return $output;
}
@@ -1440,15 +1531,31 @@ sub rawconfig {
}
} elsif ($pro =~ /^courseenv_(.*)$/) {
my $key = $1;
- if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) &&
- ($crstype ne 'Community')) {
- $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+ if ($crstype ne 'Community') {
+ my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
+ if ($key eq 'canuse_pdfforms') {
+ if ($env{'request.course.id'} && $coursepref eq '') {
+ my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
+ $coursepref = $domdefs{'canuse_pdfforms'};
+ }
+ }
+ if ($coursepref) {
+ $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+ }
}
} elsif ($pro =~ /^communityenv_(.*)$/) {
my $key = $1;
- if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) &&
- ($crstype eq 'Community')) {
- $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+ if ($crstype eq 'Community') {
+ my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
+ if ($key eq 'canuse_pdfforms') {
+ if ($env{'request.course.id'} && $coursepref eq '') {
+ my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
+ $coursepref = $domdefs{'canuse_pdfforms'};
+ }
+ }
+ if ($coursepref) {
+ $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+ }
}
} elsif ($pro =~ /^course_(.*)$/) {
# Check for permissions inside of a course
@@ -1593,12 +1700,77 @@ function gonav(url) {
NAVCONTROL
}
+sub dc_popup_js {
+ my %lt = &Apache::lonlocal::texthash(
+ more => '(More ...)',
+ less => '(Less ...)',
+ );
+ return <<"END";
+
+function showCourseID() {
+ document.getElementById('dccid').style.display='block';
+ document.getElementById('dccid').style.textAlign='left';
+ document.getElementById('dccid').style.textFace='normal';
+ document.getElementById('dccidtext').innerHTML ='$lt{'less'}';
+ return;
+}
+
+function hideCourseID() {
+ document.getElementById('dccid').style.display='none';
+ document.getElementById('dccidtext').innerHTML ='$lt{'more'}';
+ return;
+}
+
+END
+
+}
+
sub utilityfunctions {
- my $caller = shift;
+ my ($caller,$custommenu) = @_;
unless ($env{'environment.remote'} eq 'off' ||
$caller eq '/adm/menu') {
return ''; }
-
+
+ my $gcimenujs;
+ if ($custommenu) {
+ my %concepttests = &Apache::loncommon::existing_gcitest_courses();
+ my $managetesturl = '/adm/menu';
+ my $createtesturl = '/adm/requestcourse';
+ if (($env{'request.course.id'}) &&
+ ($env{'course.'.$env{'request.course.id'}.'.domain'} eq 'gci')) {
+ my @items = keys(%concepttests);
+ if (@items== 1) {
+ my $newrole = $items[0];
+ $newrole =~ s{_}{/};
+ $managetesturl = '/adm/roles?selectrole=1&cc./'.$newrole.'=1';
+ } else {
+ $managetesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu';
+ }
+ }
+ if ($env{'request.course.id'}) {
+ $createtesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2frequestcourse';
+ }
+ $gcimenujs = <<"ENDCUSTOM";
+
+function switchpage(caller) {
+ if (caller == 'review') {
+ document.location.href = '/adm/roles?selectrole=1&st./gci/9615072b469884921gcil1=1';
+ }
+ if (caller == 'submit') {
+ document.location.href = '/adm/roles?selectrole=1&st./gci/1H96711d710194bfegcil1=1';
+ }
+ if (caller == 'createtest') {
+ document.location.href = '$createtesturl';
+ }
+ if (caller == 'managetest') {
+ document.location.href = '$managetesturl';
+ }
+ return;
+}
+
+ENDCUSTOM
+ }
+
my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
if ($currenturl =~ m{^/adm/wrapper/ext/}) {
if ($env{'request.external.querystring'}) {
@@ -1610,6 +1782,13 @@ sub utilityfunctions {
my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
my $nav_control=&nav_control_js();
+ my $dc_popup_cid;
+ if ($env{'user.adv'} && exists($env{'user.role.dc./'.
+ $env{'course.'.$env{'request.course.id'}.
+ '.domain'}.'/'})) {
+ $dc_popup_cid = &dc_popup_js();
+ }
+
my $start_page_annotate =
&Apache::loncommon::start_page('Annotator',undef,
{'only_body' => 1,
@@ -1637,6 +1816,9 @@ return (< |