--- loncom/interface/lonmenu.pm 2009/08/13 13:52:01 1.244.2.3 +++ loncom/interface/lonmenu.pm 2009/08/12 18:38:04 1.279 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.244.2.3 2009/08/13 13:52:01 raeburn Exp $ +# $Id: lonmenu.pm,v 1.279 2009/08/12 18:38:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,15 +26,10 @@ # http://www.lon-capa.org/ # # -# There are two parameters controlling the action of this module: -# -# browser.interface - if this is 'textual', it overrides the second parameter -# and goes to screen reader PDA mode +# There is one parameter controlling the action of this module: # # environment.remote - if this is 'on', the routines controll the remote -# control, otherwise they render the main window controls; ignored it -# browser.interface is 'textual' -# +# control, otherwise they render the main window controls; =head1 NAME @@ -51,8 +46,6 @@ described at http://www.lon-capa.org. =over -=item show_course() - Little texts =item initlittle() @@ -150,21 +143,9 @@ use vars qw(@desklines %category_names % my @inlineremote; - - -sub show_course { - my $course = !$env{'user.adv'}; - if (!$env{'user.adv'}) { - foreach my $env (keys(%env)) { - next if ($env !~ m/^user\.priv\./); - if ($env !~ m/^user\.priv\.(?:st|cm)/) { - $course = 0; - last; - } - } - } - return $course; -} +# +# This routine returns a translated hash for the menu items in the top inline menu row +# Probably should be in mydesk.tab sub initlittle { return &Apache::lonlocal::texthash('ret' => 'Return to Last Location', @@ -184,8 +165,10 @@ sub initlittle { sub menubuttons { my $forcereg=shift; - my $registration=shift; my $titletable=shift; +# +# Early-out for pages that should not have a menu, triggered by query string "inhibitmenu=yes" +# &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); if (($env{'form.inhibitmenu'} eq 'yes') || @@ -202,14 +185,20 @@ sub menubuttons { my $role_selector; my $showgroups=0; my ($cnum,$cdom); +# +# if the URL is hidden, symbs and the non-versioned version of the URL would be encrypted +# my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'})); my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'})); my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif"); - $logo = 'LON-CAPA Logo'; + $logo = 'LON-CAPA Logo'; if ($env{'request.state'} eq 'construct') { +# +# We are in construction space +# if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) { my $returnurl = $env{'request.filename'}; $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:; @@ -217,6 +206,9 @@ sub menubuttons { } } if ($env{'request.course.id'}) { +# +# We are in a course +# $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my %coursegroups; @@ -234,75 +226,28 @@ sub menubuttons { } } - if ($env{'browser.interface'} eq 'textual') { -# Textual display only - if ($env{'request.course.id'}) { - $navmaps=(<$lt{'nav'} -ENDNAV - if (&show_return_link()) { - my $escreload=&escape('return:'); - $reloadlink=(<$lt{'ret'} -ENDRELOAD - } - if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { - $docs=(<$lt{'docs'} -ENDDOCS - } - if ($showgroups) { - $groups =(<$lt{'groups'} -ENDGROUPS - } - } - my $form=&serverform(); - my $utility=&utilityfunctions(); - my $output=(< -// BEGIN LON-CAPA Internal -$utility - -
-$lt{'main'} -$reloadlink $navmaps $docs $groups $roles -$lt{'exit'} -
-
- -$form -ENDMAINMENU - if ($registration) { $output.=&innerregister($forcereg); } - return $output."
"; - } elsif ($env{'environment.remote'} eq 'off') { + if ($env{'environment.remote'} eq 'off') { # Remote Control is switched off # figure out colors - my %lt=&initlittle(); + my %lt=&initlittle(); my $domain=&Apache::loncommon::determinedomain(); - my $function =&Apache::loncommon::get_users_function(); + my $function =&Apache::loncommon::get_users_function(); my $link=&Apache::loncommon::designparm($function.'.link',$domain); my $alink=&Apache::loncommon::designparm($function.'.alink',$domain); my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain); my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain); - if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') { - return (< - - $logo - - - $lt{'login'} - - - - + + if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') { + return (< +
  • $logo
  • +
  • $lt{'login'}
  • + +
    ENDINLINEMENU } - $roles = ''.$lt{'roles'}.''; + $roles = ''.$lt{'roles'}.''; # Do we have a NAV link? if ($env{'request.course.id'}) { my $link='/adm/navmaps?postdata='.$escurl.'&postsymb='. @@ -311,44 +256,47 @@ ENDINLINEMENU $link="javascript:gonav('".$link."')"; } $navmaps=(<$lt{'nav'} +
  • $lt{'nav'}
  • ENDNAV my $is_group = (&Apache::loncommon::course_type() eq 'Group'); if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'}; $docs=(<$text +
  • $text
  • ENDDOCS } if ($showgroups) { $groups =(<$lt{'groups'} +
  • $lt{'groups'}
  • ENDGROUPS } if (&show_return_link()) { my $escreload=&escape('return:'); $reloadlink=(<$lt{'ret'} +
  • $lt{'ret'}
  • ENDRELOAD } if ($role_selector) { - $roles = ''.$role_selector.''.$lt{'other'}.''; + #$roles = ''.$role_selector.''.$lt{'other'}.''; + $role_selector = '
  • '.$role_selector.'
  • '; } } if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) { my $escreload=&escape('return:'); $reloadlink=(<$lt{'ret'} +
  • $lt{'ret'}
  • ENDCRELOAD } - my $reg=''; - if ($registration) { - $reg=&innerregister($forcereg,$titletable); - } - my $form=&serverform(); - my $utility=&utilityfunctions(); + my $reg = $forcereg ? &innerregister($forcereg,$titletable) : ''; + my $form = &serverform(); + my $utility = &utilityfunctions(); + + #Prepare the message link that indicates the arrival of new mail + my $messagelink = Apache::lonmsg::mynewmail() ? "Message (new)" : "Message"; + $messagelink = '' + . mt($messagelink) .''; - my $helplink=&Apache::loncommon::top_nav_help('Help'); + my $helplink = &Apache::loncommon::top_nav_help('Help'); return (< // - - -$logo - +
      +
    1. $logo
    2. +
    3. $messagelink
    4. +
    5. $roles
    6. +
    7. $helplink
    8. +
    9. $lt{'exit'}
    10. +
    +
      +
    • $lt{'main'}
    • $reloadlink $navmaps $docs $groups -$roles -
    - - -
    $lt{'main'}$helplink$lt{'exit'}
    +$role_selector + $form '.$force_title; + return + $result + .'' + .$force_title; } # Graphical display after login only if ($env{'request.registered'} && !$forcereg) { return ''; } @@ -430,57 +383,51 @@ sub innerregister { $env{'request.registered'} = 1; - my $textinter=($env{'browser.interface'} eq 'textual'); - my $noremote=($env{'environment.remote'} eq 'off'); + my $noremote = ($env{'environment.remote'} eq 'off'); - my $textual=($textinter || $noremote); - undef(@inlineremote); my $reopen=&Apache::lonmenu::reopenmenu(); my $newmail=''; - if ($noremote) { - $newmail=''; - } - if (&Apache::lonmsg::newmail()) { - if ($textual) { - $newmail.= ''; - } else { - $newmail= 'swmenu.setstatus("you have","messages");'; - } + + if (&Apache::lonmsg::newmail() && !$noremote) { + # We have new mail and remote is up + $newmail= 'swmenu.setstatus("you have","messages");'; } - if (($textual) + + my $breadcrumb; + if ($noremote && ($env{'request.symb'}) && ($env{'request.course.id'})) { - $newmail.= ''; + + my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); + my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'}; + + my $maptitle = &Apache::lonnet::gettitle($mapurl); + my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread()); + my @crumbs = ({text => "Course Content", + href => "Javascript:gonav('/adm/navmaps')"}, + {text => '...', + no_mt => 1}); + + push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle + && $maptitle ne 'default.sequence' + && $maptitle ne $coursetitle); + + push @crumbs, {text => $restitle, no_mt => 1} if $restitle; + + Apache::lonhtmlcommon::clear_breadcrumbs(); + Apache::lonhtmlcommon::add_breadcrumb(@crumbs); + $breadcrumb .= Apache::lonhtmlcommon::breadcrumbs(undef,undef,0); + # } if ($env{'request.state'} eq 'construct') { $newmail = $titletable; - } else { - if ($noremote) { - $newmail.='
    - '. - &mt('You have new messages').''; - my ($mapurl,$rid,$resurl)= - &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); - my $coursetitle=$env{'course.'.$env{'request.course.id'}.'.description'}; - $newmail.=$coursetitle; - my $maptitle=&Apache::lonnet::gettitle($mapurl); - my $restitle=&Apache::lonnet::gettitle(&Apache::lonnet::symbread()); - if ($maptitle && ($maptitle ne 'default.sequence') && ($maptitle ne $coursetitle)) { - $newmail.=', '.$maptitle; - } - if ($restitle) { - $newmail.=': '.$restitle; - } - $newmail.='   
    '; - } - } - my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');'); - my $tablestart=($noremote?'':''). - ($textinter?'
    '.&mt('Skip to Content').'
    ':''); - my $tableend=($noremote?'
    ':'').($textinter?'':''); + } + my $timesync = ( $noremote ? '' : 'swmenu.syncclock(1000*'.time.');' ); + my $tablestart = ( $noremote ? '' : ''); + my $tableend = ( $noremote ? '
    ' : ''); # ============================================================================= # ============================ This is for URLs that actually can be registered if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) { @@ -524,6 +471,9 @@ sub innerregister { } if ($env{'user.author'}) { if ($env{'request.role'}=~/^(aa|ca|au)/) { +# +# We have the role of an author +# # Set defaults for authors my ($top,$bottom) = ('con-','struct'); my $action = "go('/priv/".$env{'user.name'}."');"; @@ -552,6 +502,11 @@ sub innerregister { $noeditbutton = 0; } } +# +# We are an author for some stuff, but currently do not have the role of author. +# Figure out if we have authoring privileges for the resource we are looking at. +# This should maybe become a privilege check in lonnet +# ## ## Determine if user can edit url. ## @@ -561,19 +516,24 @@ sub innerregister { my $uploaded; if ($env{'request.filename'}) { my $file=&Apache::lonnet::declutter($env{'request.filename'}); - $file=~s/^($match_domain)\/($match_username)/\/priv\/$2/; - # Check that the user has permission to edit this resource - ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1); - if (defined($cfudom)) { - my $home=&Apache::lonnet::homeserver($cfuname,$cfudom); - my $allowed=0; - my @ids=&Apache::lonnet::current_machine_ids(); - foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } - if ($allowed) { - $cfile=$file; + if (defined($cnum) && defined($cdom)) { + $uploaded = &is_course_upload($file,$cnum,$cdom); + } + if (!$uploaded) { + $file=~s/^($match_domain)\/($match_username)/\/priv\/$2/; + # Check that the user has permission to edit this resource + ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1); + if (defined($cfudom)) { + my $home=&Apache::lonnet::homeserver($cfuname,$cfudom); + my $allowed=0; + my @ids=&Apache::lonnet::current_machine_ids(); + foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } + if ($allowed) { + $cfile=$file; + } } } - } + } # Finally, turn the button on or off if ($cfile && !$const_space) { $editbutton=&switch @@ -584,7 +544,7 @@ sub innerregister { $editbutton=&clear(6,1); } } - if (($noeditbutton) && ($env{'request.filename'})) { + if (($noeditbutton) && ($env{'request.filename'})) { if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { my $file=&Apache::lonnet::declutter($env{'request.filename'}); if (defined($cnum) && defined($cdom)) { @@ -605,15 +565,21 @@ sub innerregister { # Prepare the rest of the buttons my $menuitems; if ($const_space) { +# +# We are in construction space +# my ($uname,$thisdisfn) = ($env{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|); my $currdir = '/priv/'.$uname.'/'.$thisdisfn; if ($currdir =~ m-/$-) { $is_const_dir = 1; } else { - $currdir =~ s#[^/]+$##; + $currdir =~ s|[^/]+$||; my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn); my $esc_currdir = &Apache::loncommon::escape_single($currdir); +# +# Probably should be in mydesk.tab +# $menuitems=(< 0){ $menuitems.="&anno-[_1]&tations[_1]&annotate()&"; $menuitems.="Make notes and annotations about this resource&&1\n"; + unless ($noremote) { + my $showreqcrs = &check_for_rcrs(); + if ($showreqcrs) { + $menuitems.="s&8&1&rcrs.gif&request[_1]&course[_16]". + "&go('/adm/requestcourse')&Course requests\n"; + } + } unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { if (!$env{'request.enc'}) { $menuitems.=(< @@ -724,13 +697,13 @@ ENDLINE } } } - } } $result =(< // BEGIN LON-CAPA Internal $timesync +$breadcrumb $tablestart $inlinebuttons $tableend @@ -795,9 +768,9 @@ ENDREGTHIS # ============================================================================= } else { # ========================================== This can or will not be registered - if ($textual) { -# Not registered, textual - $result= (<'); } # @@ -951,6 +923,7 @@ function main() { timestart=date.getTime(); wait(); } + // ]]> ENDREMOTESTARTUP @@ -968,8 +941,7 @@ ENDSETFLAGS } sub maincall() { - if (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { return ''; } + if ($env{'environment.remote'} eq 'off') { return ''; } return(< // ', - '
    '); + my $link=&mt('[_1]Continue[_2] on in Inline Menu mode' + ,'' + ,''); return(<
    @@ -1007,8 +978,7 @@ sub get_menu_name { sub reopenmenu { - if (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { return ''; } + if ($env{'environment.remote'} eq 'off') { return ''; } my $menuname = &get_menu_name(); my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); return('window.open('.$nothing.',"'.$menuname.'","",false);'); @@ -1017,14 +987,13 @@ sub reopenmenu { sub open { my $returnval=''; - if (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { - return - ''; + if ($env{'environment.remote'} eq 'off') { + return + ''; } my $menuname = &get_menu_name(); @@ -1040,7 +1009,7 @@ sub open { $returnval=(< @@ -1053,8 +1022,8 @@ ENDOPEN sub clear { my ($row,$col)=@_; - unless (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { + unless ($env{'environment.remote'} eq 'off') { + if (($row<1) || ($row>13)) { return ''; } return "\n".qq(window.status+='.';swmenu.clearbut($row,$col);); } else { $inlineremote[10*$row+$col]=''; @@ -1079,23 +1048,11 @@ sub switch { my $idx=10*$row+$col; $category_members{$cat}.=':'.$idx; - unless (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { + unless ($env{'environment.remote'} eq 'off') { + if (($row<1) || ($row>13)) { return ''; } # Remote return "\n". qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc");); - } elsif ($env{'browser.interface'} eq 'textual') { -# Accessibility - if ($nobreak==2) { return ''; } - my $text=$top.' '.$bot; - $text=~s/\s*\-\s*//gs; - if ($nobreak) { - $inlineremote[$idx]= - ''.$text.''; - } else { - $inlineremote[$idx]="\n
    ". - $desc.' '.$text.''; - } } else { # Inline Remote if ($env{'environment.icons'} ne 'classic') { @@ -1108,22 +1065,22 @@ sub switch { my $pic= ''.$text.''; + '" align="'.($nobreak==3?'right':'left').'" class="LC_noBorder" />'; if ($env{'browser.interface'} eq 'faketextual') { -# Accessibility +# Main Menu if ($nobreak==3) { $inlineremote[$idx]="\n". ''.$text. - ''. + ''. ''.$pic.''; } elsif ($nobreak) { $inlineremote[$idx]="\n". - ''. + ''. ''.$pic.' '.$text.''; } else { $inlineremote[$idx]="\n". - ''. + ''. ''.$pic. ''. ''.$desc.''; @@ -1158,8 +1115,7 @@ sub secondlevel { sub openmenu { my $menuname = &get_menu_name(); - if (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { return ''; } + if ($env{'environment.remote'} eq 'off') { return ''; } my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); return "window.open(".$nothing.",'".$menuname."');"; } @@ -1167,6 +1123,7 @@ sub openmenu { sub inlinemenu { 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++) { @@ -1174,10 +1131,10 @@ sub inlinemenu { 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.='
    '.&mt($category_names{$cat}).'
    '; + #$output.='
    '; + $output.='
    '; + $output.='

    '.&mt($category_names{$cat}).'

    '; + $output.='
    '.&mt($category_names{$cat}).'
    '; my %active=(); foreach my $menu_item (split(/\:/,$category_members{$cat})) { if ($inlineremote[$menu_item]) { @@ -1186,10 +1143,9 @@ sub inlinemenu { } foreach my $item (sort(keys(%active))) { $output.=$inlineremote[$item]; - &Apache::lonnet::logthis("item=$item output=$inlineremote[$item]"); } $output.='
    '; - $output.=''; + $output.=''; } } $output.=""; @@ -1199,10 +1155,14 @@ sub inlinemenu { } sub rawconfig { +# +# This evaluates mydesk.tab +# Need to add more positions and more privileges to deal with all +# menu items. +# my $textualoverride=shift; my $output=''; - unless (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { + unless ($env{'environment.remote'} eq 'off') { $output.= "window.status='Opening Remote Control';var swmenu=".&openmenu(). "\nwindow.status='Configuring Remote Control ';"; @@ -1234,9 +1194,12 @@ sub rawconfig { $prt=~s/\$requested_domain/$requested_domain/g; if ($category_names{$cat}!~/\w/) { $cat='oth'; } my $type = &Apache::loncommon::course_type(); - if ($type eq 'Group') { - $desc = &convert_menu_function($desc,$type); - } +# +# I don't think we support this +# +# if ($type eq 'Group') { +# $desc = &convert_menu_function($desc,$type); +# } if ($pro eq 'clear') { $output.=&clear($row,$col); } elsif ($pro eq 'any') { @@ -1315,16 +1278,14 @@ sub rawconfig { $output.=&clear($row,$col); next; } - } elsif ($prt eq 'reqcrs') { - my $showreqcrs = 0; - foreach my $type ('official','unofficial') { - if (&Apache::lonnet::usertools_access($env{'user.name'}, - $env{'user.domain'}, - $type,undef,'requestcourses')) { - $showreqcrs = 1; - last; - } + } elsif (($prt eq 'reqcrsnsc') || ($prt eq 'reqcrsshc')) { + if (($prt eq 'reqcrsnsc') && ($show_course)) { + next; } + if (($prt eq 'reqcrsshc') && (!$show_course)) { + next; + } + my $showreqcrs = &check_for_rcrs(); if (!$showreqcrs) { $output.=&clear($row,$col); next; @@ -1333,11 +1294,9 @@ sub rawconfig { $prt='any'; $output.=&secondlevel( $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat); - } } - unless (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { + unless ($env{'environment.remote'} eq 'off') { $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';"; if (&Apache::lonmsg::newmail()) { $output.='swmenu.setstatus("you have","messages");'; @@ -1347,11 +1306,23 @@ sub rawconfig { return $output; } +sub check_for_rcrs { + my $showreqcrs = 0; + foreach my $type ('official','unofficial','community') { + if (&Apache::lonnet::usertools_access($env{'user.name'}, + $env{'user.domain'}, + $type,undef,'requestcourses')) { + $showreqcrs = 1; + last; + } + } + return $showreqcrs; +} + # ======================================================================= Close sub close { - if (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off')) { return ''; } + if ($env{'environment.remote'} eq 'off') { return ''; } my $menuname = &get_menu_name(); return(< @@ -1395,8 +1366,10 @@ NAVCONTROL sub utilityfunctions { my $caller = shift; - unless (($env{'browser.interface'} eq 'textual') || - ($env{'environment.remote'} eq 'off') || ($caller eq '/adm/menu')) { return ''; } + unless ($env{'environment.remote'} eq 'off' || + $caller eq '/adm/menu') { + return ''; } + my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0])); $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl)); @@ -1555,7 +1528,7 @@ function set_bookmark() { +'
    Link Name:
    Link Name:
    ' +'
    Address:

    {'roles'}) eq 'HASH') && + if ((ref($result->{'roles'}) eq 'HASH') && (ref($result->{'seccount'}) eq 'HASH')) { %{$courseroles} = %{$result->{'roles'}}; %{$seccount} = %{$result->{'seccount'}}; @@ -1740,7 +1716,7 @@ sub get_all_courseroles { } if (ref($courseroles->{$urole}) eq 'ARRAY') { if ($usec ne '') { - if (!grep(/^\Q$usec\E$/,@{$courseroles->{$urole}})) { + if (!grep(/^Q$usec\E$/,@{$courseroles->{$urole}})) { push(@{$courseroles->{$urole}},$usec); $seccount->{$urole} ++; } @@ -1757,7 +1733,7 @@ sub get_all_courseroles { @{$courseroles->{'st'}} = (); if (keys(%sections_count) > 0) { push(@{$courseroles->{'st'}},keys(%sections_count)); - $seccount->{'st'} = scalar(keys(%sections_count)); + $seccount->{'st'} = scalar(keys(%sections_count)); } my $rolehash = { 'roles' => $courseroles,