--- loncom/interface/lonmenu.pm 2009/10/26 21:19:22 1.295
+++ loncom/interface/lonmenu.pm 2009/11/20 04:12:43 1.306
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.295 2009/10/26 21:19:22 raeburn Exp $
+# $Id: lonmenu.pm,v 1.306 2009/11/20 04:12:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -164,6 +164,7 @@ sub primary_menu {
# (link url, icon path, alt text, link text, condition)
foreach my $menuitem (@primary_menu) {
# evaluate conditions
+ next if ref($menuitem) ne 'ARRAY'; #
next if $$menuitem[4] eq 'nonewmsg' # show links depending on
&& &Apache::lonmsg::mynewmail(); # whether a new msg
next if $$menuitem[4] eq 'newmsg' # arrived or not
@@ -183,11 +184,9 @@ sub primary_menu {
if ($$menuitem[3] eq 'Help') { # special treatment for helplink
$menu .= '
'.&Apache::loncommon::top_nav_help('Help').'';
} else {
- if (ref($menuitem) eq 'ARRAY') {
- my @items = @{$menuitem};
- $items[0] = 'javascript:'.$menuitem->[0].';';
- $menu .= &prep_menuitem(\@items);
- }
+ my @items = @{$menuitem};
+ $items[0] = 'javascript:'.$menuitem->[0].';';
+ $menu .= &prep_menuitem(\@items);
}
}
@@ -210,6 +209,7 @@ sub secondary_menu {
$env{'course.' . $env{'request.course.id'} . '.num'});
foreach my $menuitem (@secondary_menu) {
# evaluate conditions
+ next if ref($menuitem) ne 'ARRAY';
next if $$menuitem[4] ne 'always'
&& !$env{'request.course.id'};
next if $$menuitem[4] eq 'showreturn'
@@ -230,29 +230,28 @@ sub secondary_menu {
next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/
&& $crstype ne 'Community';
next if $$menuitem[4] =~ /showgroups$/
- && $canviewgrps
+ && !$canviewgrps
&& !%groups;
if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
# special treatment for role selector
- my $roles_selector = roles_selector(
+ my $roles_selector = &roles_selector(
$env{'course.' . $env{'request.course.id'} . '.domain'},
$env{'course.' . $env{'request.course.id'} . '.num'} );
$menu .= $roles_selector ? "$roles_selector"
: '';
- } else {
- if ($env{'environment.remotenavmap'} eq 'on') {
- my @items = @{$menuitem};
- if ($menuitem->[4] eq 'remotenav') {
- $items[0] = "javascript:gonav('$menuitem->[0]');";
- } else {
- $items[0] = "javascript:go('$menuitem->[0]');";
- }
- $menu .= &prep_menuitem(\@items);
+ } elsif ($env{'environment.remotenavmap'} eq 'on') {
+ # open link using javascript when remote navmap is activated
+ my @items = @{$menuitem};
+ if ($menuitem->[4] eq 'remotenav') {
+ $items[0] = "javascript:gonav('$menuitem->[0]');";
} else {
- $menu .= &prep_menuitem(\@$menuitem);
+ $items[0] = "javascript:go('$menuitem->[0]');";
}
+ $menu .= &prep_menuitem(\@items);
+ } else {
+ $menu .= &prep_menuitem(\@$menuitem);
}
}
if ($menu =~ /\[url\].*\[symb\]/) {
@@ -546,7 +545,13 @@ sub innerregister {
my $maptitle = &Apache::lonnet::gettitle($mapurl);
my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
- my @crumbs = ({text => "Course Contents",
+ my $contentstext;
+ if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Community') {
+ $contentstext = &mt('Community Contents');
+ } else {
+ $contentstext = &mt('Course Contents');
+ }
+ my @crumbs = ({text => $contentstext,
href => "Javascript:gonav('/adm/navmaps')"});
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
@@ -562,7 +567,7 @@ sub innerregister {
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
- $breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
+ #$breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
unless (($env{'request.state'} eq 'edit') || ($newmail) ||
($env{'request.state'} eq 'construct') ||
($env{'form.register'})) {
@@ -578,7 +583,7 @@ sub innerregister {
my $tableend = ( $noremote ? '' : '');
# =============================================================================
# ============================ This is for URLs that actually can be registered
- if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {
+ if (($env{'request.noversionuri'}!~m{^/(res/)*adm/}) || ($forcereg)) {
# -- This applies to homework problems for users with grading privileges
my $crs='/'.$env{'request.course.id'};
if ($env{'request.course.sec'}) {
@@ -684,10 +689,22 @@ sub innerregister {
}
# Finally, turn the button on or off
if ($cfile && !$const_space) {
- $editbutton=&switch
- ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
+ my $nocrsedit;
+ # Suppress display where CC has switched to student role.
+ if ($env{'request.course.id'}) {
+ unless(&Apache::lonnet::allowed('mdc',
+ $env{'request.course.id'})) {
+ $nocrsedit = 1;
+ }
+ }
+ if ($nocrsedit) {
+ $editbutton=&clear(6,1);
+ } else {
+ $editbutton=&switch
+ ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
"go('".$cfile."');","Edit this resource");
- $noeditbutton = 0;
+ $noeditbutton = 0;
+ }
} elsif ($editbutton eq '') {
$editbutton=&clear(6,1);
}
@@ -812,51 +829,88 @@ ENDMENUITEMS
my $addremote=0;
foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
my $inlinebuttons='';
- if ($addremote) {
- # Registered, textual output
- if ($env{'environment.icons'} eq 'iconsonly') {
- $inlinebuttons=(<
-$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) {
+
+ #SD START (work in progress!)
+ Apache::lonhtmlcommon::clear_breadcrumb_tools();
+ # Arrows for navigation
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[21] );
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[23] );
+ if(hidden_button_check() ne 'yes'){
+ # notes
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[93]);
+ # bookmark
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[91]);
+ # evaluate
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[81]);
+ # feedback
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[82]);
+ # print
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[83]);
+ # metadata
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[63]);
+
+ # ?
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[61]);
+ # ?
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[71]);
+ # ?
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[72]);
+ # ?
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[73]);
+ # ?
+ Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[92]);
+
+ }
+
+ #SD END
+# # 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
+
@@ -1214,7 +1268,7 @@ sub switch {
my $pic=
'';
+ '" align="'.($nobreak==3?'right':'left').'" class="LC_icon" />';
if ($env{'browser.interface'} eq 'faketextual') {
# Main Menu
if ($nobreak==3) {
@@ -1240,7 +1294,7 @@ sub switch {
$inlineremote[$idx]=''.$pic.'';
} else {
$inlineremote[$idx]=
- '';
}
}
@@ -1552,6 +1606,31 @@ 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;
unless ($env{'environment.remote'} eq 'off' ||
@@ -1569,6 +1648,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,
@@ -1596,6 +1682,7 @@ return (< 1) {
$role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
$role_selector .= ' | |