--- loncom/interface/lonmenu.pm 2009/10/28 09:01:59 1.296
+++ loncom/interface/lonmenu.pm 2010/12/02 16:44:09 1.309.2.21
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.296 2009/10/28 09:01:59 droeschl Exp $
+# $Id: lonmenu.pm,v 1.309.2.21 2010/12/02 16:44:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -131,6 +131,7 @@ use Apache::lonhtmlcommon();
use Apache::loncommon();
use Apache::lonenc();
use Apache::lonlocal;
+use Apache::loncoursequeueadmin;
use LONCAPA qw(:DEFAULT :match);
use HTML::Entities();
@@ -150,7 +151,10 @@ sub prep_menuitem {
} else { # textual Link
$link = &mt($$menuitem[3]);
}
- return '
-$inlineremote[21] $inlineremote[23]
-ENDARROWSINLINE
- if (&hidden_button_check() ne 'yes') {
- $inlinebuttons .= (<
-ENDINLINEICONS
- }
- } else {
- if ($inlineremote[21] ne '' || $inlineremote[23] ne '') {
- $inlinebuttons=(<$inlineremote[21] | | $inlineremote[23] |
-ENDFIRSTLINE
- }
- if (&hidden_button_check() ne 'yes') {
- foreach my $row (6..9) {
- if ($inlineremote[${row}.'1'] ne ''
- || $inlineremote[$row.'2'] ne ''
- || $inlineremote[$row.'3'] ne '') {
- $inlinebuttons .= <<"ENDLINE";
-$inlineremote["${row}1"] | $inlineremote["${row}2"] | $inlineremote["${row}3"] |
-ENDLINE
- }
- }
- }
- }
- }
+
+ if ($addremote) {
+
+ Apache::lonhtmlcommon::clear_breadcrumb_tools();
+
+ Apache::lonhtmlcommon::add_breadcrumb_tool(
+ 'navigation', @inlineremote[21,23]);
+ if(hidden_button_check() ne 'yes') {
+ Apache::lonhtmlcommon::add_breadcrumb_tool(
+ 'tools', @inlineremote[93,91,81,82,83]);
+
+ #publish button in construction space
+ if ($env{'request.state'} eq 'construct'){
+ Apache::lonhtmlcommon::add_breadcrumb_tool(
+ 'advtools', @inlineremote[63]);
+ }else{
+ Apache::lonhtmlcommon::add_breadcrumb_tool(
+ 'tools', @inlineremote[63]);
+ }
+
+ unless ($env{'request.noversionuri'}=~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
+ Apache::lonhtmlcommon::add_breadcrumb_tool(
+ 'advtools', @inlineremote[61,71,72,73,92]);
+ }
+ }
+
+# # Registered, textual output
+# if ( $env{'environment.icons'} eq 'iconsonly' ) {
+# $inlinebuttons = (<
+#$inlineremote[21] $inlineremote[23]
+#ENDARROWSINLINE
+# if ( &hidden_button_check() ne 'yes' ) {
+# $inlinebuttons .= (<
+#ENDINLINEICONS
+# }
+# } else { # not iconsonly
+# if ( $inlineremote[21] ne '' || $inlineremote[23] ne '' ) {
+# $inlinebuttons = (<$inlineremote[21] | | $inlineremote[23] |
+#ENDFIRSTLINE
+# }
+# if ( &hidden_button_check() ne 'yes' ) {
+# foreach my $row ( 6 .. 9 ) {
+# if ( $inlineremote[ ${row} . '1' ] ne ''
+# || $inlineremote[ $row . '2' ] ne ''
+# || $inlineremote[ $row . '3' ] ne '' )
+# {
+# $inlinebuttons .= <<"ENDLINE";
+#$inlineremote["${row}1"] | $inlineremote["${row}2"] | $inlineremote["${row}3"] |
+#ENDLINE
+# }
+# }
+# }
+# }
+ }
+ #SD see below
+ $breadcrumb = &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
$result =(<
// BEGIN LON-CAPA Internal
$timesync
$breadcrumb
-$tablestart
-$inlinebuttons
-$tableend
+
+
+
$newmail
-$separator
+
@@ -1213,7 +1363,7 @@ sub switch {
my $pic=
'';
+ '" align="'.($nobreak==3?'right':'left').'" class="LC_icon" />';
if ($env{'browser.interface'} eq 'faketextual') {
# Main Menu
if ($nobreak==3) {
@@ -1239,7 +1389,7 @@ sub switch {
$inlineremote[$idx]=''.$pic.'';
} else {
$inlineremote[$idx]=
- '';
}
}
@@ -1269,36 +1419,172 @@ sub openmenu {
}
sub inlinemenu {
+ my ($context) = @_;
undef(@inlineremote);
undef(%category_members);
-# calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control
- &rawconfig(1);
- my $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.='';
- $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 (%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
}
- }
- $output.="";
+ $switcher = $switcher_js.$switcher;
+ }
+ if ($env{'user.domain'} eq 'gci') {
+ $canreq =
+ &Apache::lonnet::check_can_request('gcitest',\%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'} eq 'gcitest') {
+ $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.
+ '';
+ }
+ } 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.=" ";
return $output;
}
@@ -1398,15 +1684,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
@@ -1551,12 +1853,80 @@ 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('cc');
+ 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';
+ }
+ if (caller == 'tutorial') {
+ document.location.href = '/adm/roles?selectrole=1&st./gci/5422913620b814c90gcil1=1';
+ }
+ 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'}) {
@@ -1568,6 +1938,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,
@@ -1595,6 +1972,9 @@ return (< 1) {
$role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
$role_selector .= ' |
| |