--- loncom/interface/lonmenu.pm 2021/12/13 23:26:32 1.369.2.83 +++ loncom/interface/lonmenu.pm 2022/01/03 16:37:24 1.369.2.83.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.369.2.83 2021/12/13 23:26:32 raeburn Exp $ +# $Id: lonmenu.pm,v 1.369.2.83.2.1 2022/01/03 16:37:24 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -263,8 +263,8 @@ sub prep_menuitem { # @primary_menu is filled within the BEGIN block of this module with # entries from mydesk.tab sub primary_menu { - my ($links_disabled) = @_; - my %menu; + my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled) = @_; + my (%menu,%menuopts); # each element of @primary contains following array: # (link url, icon path, alt text, link text, condition, position) my $public; @@ -272,6 +272,9 @@ sub primary_menu { || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) { $public = 1; } + if (($menucoll) && (ref($menuref) eq 'HASH')) { + %menuopts = %{$menuref}; + } foreach my $menuitem (@primary_menu) { # evaluate conditions next if ref($menuitem) ne 'ARRAY'; # @@ -295,6 +298,23 @@ sub primary_menu { if ($position eq '') { $position = 'right'; } + if ($env{'request.course.id'} && $menucoll) { + if (($menuitem->[6]) && (!$menuopts{$menuitem->[6]})) { + if ($menuitem->[6] eq 'pers') { + if ($menuopts{'name'} && + $env{'user.name'} && $env{'user.domain'}) { + $menu{$position} .= '
'; + if ($type eq 'map') { + $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,question part,question parts] in this folder.',$missing); + } else { + $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,part] in this question.',$missing); + } + if ($missing > 1) { + $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit answers for them.').''; + } else { + $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').'
'; + } + } + $donebuttontext = &HTML::Entities::encode($donebuttontext,'<>&"'); + if ($proctor) { + if ($height !~ /^\d+$/) { + $height = 400; + if ($missing) { + $height += 60; + } + } + if ($width !~ /^\d+$/) { + $width = 400; + if ($missing) { + $width += 60; + } + } + return <$lt{'preamble'} $lt{$type}
+ $lt{'miss'} +$lt{'proctor'}
+ +$lt{'cancel'}
+';
+ }
+ return < $lt{'preamble'} $lt{$type} $lt{'miss'} $lt{'okdone'} $lt{'cancel'}