version 1.520, 2022/05/28 16:25:45
|
version 1.523, 2022/06/11 04:30:48
|
Line 99 It gets filled in the BEGIN block of thi
|
Line 99 It gets filled in the BEGIN block of thi
|
|
|
=over |
=over |
|
|
=item prep_menuitems(\@menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr) |
=item prep_menuitems(\@menuitem,$target,$listclass,$linkattr) |
|
|
This routine wraps a menuitem in proper HTML. It is used by primary_menu() and |
This routine wraps a menuitem in proper HTML. It is used by primary_menu() and |
secondary_menu(). |
secondary_menu(). |
Line 220 use vars qw(@desklines %category_names %
|
Line 220 use vars qw(@desklines %category_names %
|
my @inlineremote; |
my @inlineremote; |
|
|
sub prep_menuitem { |
sub prep_menuitem { |
my ($menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr) = @_; |
my ($menuitem,$target,$listclass,$linkattr) = @_; |
return '' unless(ref($menuitem) eq 'ARRAY'); |
return '' unless(ref($menuitem) eq 'ARRAY'); |
my $link; |
my ($link,$targetattr); |
if ($$menuitem[1]) { # graphical Link |
if ($$menuitem[1]) { # graphical Link |
$link = "<img class=\"LC_noBorder\"" |
$link = "<img class=\"LC_noBorder\"" |
. " src=\"" . &Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\"" |
. " src=\"" . &Apache::loncommon::lonhttpdurl($$menuitem[1]) . "\"" |
Line 230 sub prep_menuitem {
|
Line 230 sub prep_menuitem {
|
} else { # textual Link |
} else { # textual Link |
$link = &mt($$menuitem[3]); |
$link = &mt($$menuitem[3]); |
} |
} |
my $target = ' target="_top"'; |
if ($target ne '') { |
if ($ltitarget eq 'iframe') { |
$targetattr = ' target="'.$target.'"'; |
$target =''; |
|
} elsif ($deeplinktarget eq '_self') { |
|
$target = ' target="'.$deeplinktarget.'"'; |
|
} |
} |
return ($listclass?'<li class="'.$listclass.'">':'<li>').'<a' |
return ($listclass?'<li class="'.$listclass.'">':'<li>').'<a' |
# highlighting for new messages |
# highlighting for new messages |
. ( $$menuitem[4] eq 'newmsg' ? ' class="LC_new_message"' : '') |
. ( $$menuitem[4] eq 'newmsg' ? ' class="LC_new_message"' : '') |
. qq| href="$$menuitem[0]"$target $linkattr>$link</a></li>|; |
. qq| href="$$menuitem[0]"$targetattr $linkattr>$link</a></li>|; |
} |
} |
|
|
# primary_menu() evaluates @primary_menu and returns a two item array, |
# primary_menu() evaluates @primary_menu and returns a two item array, |
Line 249 sub prep_menuitem {
|
Line 246 sub prep_menuitem {
|
# @primary_menu is filled within the BEGIN block of this module with |
# @primary_menu is filled within the BEGIN block of this module with |
# entries from mydesk.tab |
# entries from mydesk.tab |
sub primary_menu { |
sub primary_menu { |
my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled) = @_; |
my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled,$links_target) = @_; |
my (%menu,%ltiexc,%menuopts); |
my (%menu,%ltiexc,%menuopts); |
# each element of @primary contains following array: |
# each element of @primary contains following array: |
# (link url, icon path, alt text, link text, condition, position) |
# (link url, icon path, alt text, link text, condition, position) |
Line 267 sub primary_menu {
|
Line 264 sub primary_menu {
|
my %roles_in_env; |
my %roles_in_env; |
$rolecount = &Apache::lonroles::roles_from_env(\%roles_in_env,$update); |
$rolecount = &Apache::lonroles::roles_from_env(\%roles_in_env,$update); |
} |
} |
my ($lti,$ltitarget,$deeplinktarget); |
my $lti; |
if ($env{'request.lti.login'}) { |
if ($env{'request.lti.login'}) { |
$lti = 1; |
$lti = 1; |
$ltitarget = $env{'request.lti.target'}; |
|
if (ref($ltimenu) eq 'HASH') { |
if (ref($ltimenu) eq 'HASH') { |
foreach my $item ('fullname','logout') { |
foreach my $item ('fullname','logout') { |
unless ($ltimenu->{$item}) { |
unless ($ltimenu->{$item}) { |
Line 279 sub primary_menu {
|
Line 275 sub primary_menu {
|
} |
} |
} |
} |
} |
} |
if ($env{'request.deeplink.login'}) { |
my ($listclass,$linkattr,$target); |
$deeplinktarget = $env{'request.deeplink.target'}; |
if ($links_disabled) { |
|
$listclass = 'LCisDisabled'; |
|
$linkattr = 'aria-disabled="true"'; |
|
} |
|
if ($links_target ne '') { |
|
$target = $links_target; |
|
} else { |
|
my ($ltitarget,$deeplinktarget); |
|
if ($env{'request.lti.login'}) { |
|
$ltitarget = $env{'request.lti.target'}; |
|
} |
|
if ($env{'request.deeplink.login'}) { |
|
$deeplinktarget = $env{'request.deeplink.target'}; |
|
} |
|
if (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) { |
|
$target = '_self'; |
|
} else { |
|
$target = '_top'; |
|
} |
} |
} |
if (($menucoll) && (ref($menuref) eq 'HASH')) { |
if (($menucoll) && (ref($menuref) eq 'HASH')) { |
%menuopts = %{$menuref}; |
%menuopts = %{$menuref}; |
Line 337 sub primary_menu {
|
Line 351 sub primary_menu {
|
} |
} |
} |
} |
} |
} |
my ($listclass,$linkattr); |
|
if ($links_disabled) { |
|
$listclass = 'LCisDisabled'; |
|
$linkattr = 'aria-disabled="true"'; |
|
} |
|
if (defined($primary_submenu{$title})) { |
if (defined($primary_submenu{$title})) { |
my ($link,$target); |
my $link; |
if ($menuitem->[0] ne '') { |
if ($menuitem->[0] ne '') { |
$link = $menuitem->[0]; |
$link = $menuitem->[0]; |
unless (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) { |
|
$target = '_top'; |
|
} |
|
} else { |
} else { |
$link = '#'; |
$link = '#'; |
} |
} |
Line 396 sub primary_menu {
|
Line 402 sub primary_menu {
|
'helpdeskmail', |
'helpdeskmail', |
$defdom,$origmail); |
$defdom,$origmail); |
if ($to ne '') { |
if ($to ne '') { |
$menu{$position} .= &prep_menuitem($menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr); |
$menu{$position} .= &prep_menuitem($menuitem,$target,$listclass,$linkattr); |
} |
} |
} else { |
} else { |
$menu{$position} .= ($listclass?'<li class="'.$listclass.'">':'<li>'). |
$menu{$position} .= ($listclass?'<li class="'.$listclass.'">':'<li>'). |
Line 409 sub primary_menu {
|
Line 415 sub primary_menu {
|
$$menuitem[0] = '/adm/login'; |
$$menuitem[0] = '/adm/login'; |
} |
} |
} |
} |
$menu{$position} .= prep_menuitem($menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr); |
$menu{$position} .= prep_menuitem($menuitem,$target,$listclass,$linkattr); |
} else { |
} else { |
$menu{$position} .= prep_menuitem($menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr); |
$menu{$position} .= prep_menuitem($menuitem,$target,$listclass,$linkattr); |
} |
} |
} |
} |
my @output = ('',''); |
my @output = ('',''); |
Line 450 sub getauthor{
|
Line 456 sub getauthor{
|
} |
} |
|
|
sub secondary_menu { |
sub secondary_menu { |
my ($httphost,$ltiscope,$ltimenu,$noprimary,$menucoll,$menuref,$links_disabled) = @_; |
my ($httphost,$ltiscope,$ltimenu,$noprimary,$menucoll,$menuref, |
|
$links_disabled,$links_target) = @_; |
my $menu; |
my $menu; |
|
|
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
Line 527 sub secondary_menu {
|
Line 534 sub secondary_menu {
|
%menuopts = %{$menuref}; |
%menuopts = %{$menuref}; |
} |
} |
|
|
my ($listclass,$linkattr); |
my ($listclass,$linkattr,$target); |
if ($links_disabled) { |
if ($links_disabled) { |
$listclass = 'LCisDisabled'; |
$listclass = 'LCisDisabled'; |
$linkattr = 'aria-disabled="true"'; |
$linkattr = 'aria-disabled="true"'; |
Line 542 sub secondary_menu {
|
Line 549 sub secondary_menu {
|
} |
} |
} |
} |
|
|
my ($roleswitcher_js,$roleswitcher_form,$ltitarget,$deeplinktarget); |
my ($roleswitcher_js,$roleswitcher_form); |
if ($env{'request.lti.login'}) { |
if ($links_target ne '') { |
$ltitarget = $env{'request.lti.target'}; |
$target = $links_target; |
} |
} else { |
if ($env{'request.deeplink.login'}) { |
my ($ltitarget,$deeplinktarget); |
$deeplinktarget = $env{'request.deeplink.target'}; |
if ($env{'request.lti.login'}) { |
|
$ltitarget = $env{'request.lti.target'}; |
|
} |
|
if ($env{'request.deeplink.login'}) { |
|
$deeplinktarget = $env{'request.deeplink.target'}; |
|
} |
|
if (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) { |
|
$target = '_self'; |
|
} else { |
|
$target = '_top'; |
|
} |
} |
} |
|
|
foreach my $menuitem (@secondary_menu) { |
foreach my $menuitem (@secondary_menu) { |
Line 603 sub secondary_menu {
|
Line 620 sub secondary_menu {
|
} |
} |
} |
} |
if (defined($secondary_submenu{$title})) { |
if (defined($secondary_submenu{$title})) { |
my ($link,$target); |
my $link; |
if ($menuitem->[0] ne '') { |
if ($menuitem->[0] ne '') { |
$link = $menuitem->[0]; |
$link = $menuitem->[0]; |
unless (($ltitarget eq 'iframe') || ($deeplinktarget eq '_self')) { |
|
$target = '_top'; |
|
} |
|
} else { |
} else { |
$link = '#'; |
$link = '#'; |
} |
} |
Line 657 sub secondary_menu {
|
Line 671 sub secondary_menu {
|
&roles_selector( |
&roles_selector( |
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
$env{'course.' . $env{'request.course.id'} . '.num'}, |
$env{'course.' . $env{'request.course.id'} . '.num'}, |
$httphost,$menucoll,$menuref |
$httphost,$target,$menucoll,$menuref |
); |
); |
if (($$menuitem[5]) && (!$menuopts{$$menuitem[5]})) { |
if (($$menuitem[5]) && (!$menuopts{$$menuitem[5]})) { |
next unless ($has_opa_priv); |
next unless ($has_opa_priv); |
Line 691 sub secondary_menu {
|
Line 705 sub secondary_menu {
|
} |
} |
$$menuitem[0] = &HTML::Entities::encode($$menuitem[0],'&<>"'); |
$$menuitem[0] = &HTML::Entities::encode($$menuitem[0],'&<>"'); |
} |
} |
$menu .= &prep_menuitem(\@$menuitem,$ltitarget,$deeplinktarget,$listclass,$linkattr); |
$menu .= &prep_menuitem(\@$menuitem,$target,$listclass,$linkattr); |
} |
} |
} |
} |
if ($menu =~ /\[url\].*\[symb\]/) { |
if ($menu =~ /\[url\].*\[symb\]/) { |
Line 731 sub secondary_menu {
|
Line 745 sub secondary_menu {
|
sub create_submenu { |
sub create_submenu { |
my ($link,$target,$title,$submenu,$translate,$addclass,$listclass,$linkattr) = @_; |
my ($link,$target,$title,$submenu,$translate,$addclass,$listclass,$linkattr) = @_; |
return unless (ref($submenu) eq 'ARRAY'); |
return unless (ref($submenu) eq 'ARRAY'); |
my $disptarget; |
my $targetattr; |
if ($target ne '') { |
if (($target ne '') && ($link ne '#')) { |
$disptarget = ' target="'.$target.'"'; |
$targetattr = ' target="'.$target.'"'; |
} |
} |
my $menu = '<li class="LC_hoverable '.$addclass.'">'. |
my $menu = '<li class="LC_hoverable '.$addclass.'">'. |
'<a href="'.$link.'"'.$disptarget.'>'. |
'<a href="'.$link.'"'.$targetattr.'>'. |
'<span class="LC_nobreak">'.$title. |
'<span class="LC_nobreak">'.$title. |
'<span class="LC_fontsize_small" style="font-weight:normal;">'. |
'<span class="LC_fontsize_small" style="font-weight:normal;">'. |
' ▼</span></span></a>'. |
' ▼</span></span></a>'. |
Line 813 sub build_submenu {
|
Line 827 sub build_submenu {
|
} |
} |
$href =~ s/\[returnurl\]/$returnurl/; |
$href =~ s/\[returnurl\]/$returnurl/; |
} |
} |
|
my $targetattr; |
unless (($href eq '') || ($href =~ /^\#/)) { |
unless (($href eq '') || ($href =~ /^\#/)) { |
if ($target eq '_top') { |
if ($target ne '') { |
$target = ' target="_top"'; |
$targetattr = ' target="'.$target.'"'; |
} |
} |
} |
} |
|
|
$menu .= '<li '; |
$menu .= '<li '; |
$menu .= ($listclass?'class="'.$listclass.'" ':''); |
$menu .= ($listclass?'class="'.$listclass.'" ':''); |
$menu .= 'style="margin:0;padding:0;'. $bordertop . $borderbot .'">'; |
$menu .= 'style="margin:0;padding:0;'. $bordertop . $borderbot .'">'; |
$menu .= '<a href="'.$href.'"'.$target.' '.$linkattr.'>' . $title . '</a>'; |
$menu .= '<a href="'.$href.'"'.$targetattr.' '.$linkattr.'>' . $title . '</a>'; |
$menu .= '</li>'; |
$menu .= '</li>'; |
} |
} |
} |
} |
Line 872 sub innerregister {
|
Line 887 sub innerregister {
|
} |
} |
} |
} |
} |
} |
unless (($forcereg) && |
unless ((($crstype eq 'Placement') && (!$env{'request.role.adv'})) || |
($env{'request.noversionuri'} eq '/adm/navmaps') && |
|
($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'}) || |
|
(($crstype eq 'Placement') && (!$env{'request.role.adv'})) || |
|
($ltiscope eq 'map') || ($ltiscope eq 'resource')) { |
($ltiscope eq 'map') || ($ltiscope eq 'resource')) { |
@crumbs = ({text => $crstype.' Contents', |
@crumbs = ({text => $crstype.' Contents', |
href => "Javascript:gopost('/adm/navmaps','')"}); |
href => "Javascript:gopost('/adm/navmaps','')"}); |
Line 1934 sub check_for_rcrs {
|
Line 1946 sub check_for_rcrs {
|
if (!$showreqcrs) { |
if (!$showreqcrs) { |
foreach my $type (@reqtypes) { |
foreach my $type (@reqtypes) { |
if ($env{'environment.reqcrsotherdom.'.$type} ne '') { |
if ($env{'environment.reqcrsotherdom.'.$type} ne '') { |
$showreqcrs = 1; |
my @domains = split(',',$env{'environment.reqcrsotherdom.'.$type}); |
last; |
foreach my $entry (@domains) { |
|
my ($extdom,$extopt) = split(':',$entry); |
|
if (&Apache::lonnet::will_trust('reqcrs',$env{'user.domain'},$extdom)) { |
|
$showreqcrs = 1; |
|
last; |
|
} |
|
} |
|
if ($showreqcrs) { |
|
last; |
|
} |
} |
} |
} |
} |
} |
} |
Line 2490 sub constspaceform {
|
Line 2511 sub constspaceform {
|
unless ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || |
unless ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || |
(($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { |
(($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { |
$target = ' target="_top"'; |
$target = ' target="_top"'; |
$printtarget = ' target="_parent"'; |
$printtarget = ' target="_top"'; |
} |
} |
} |
} |
return(<<ENDCONSTSPACEFORM); |
return(<<ENDCONSTSPACEFORM); |
Line 2526 sub hidden_button_check {
|
Line 2547 sub hidden_button_check {
|
} |
} |
|
|
sub roles_selector { |
sub roles_selector { |
my ($cdom,$cnum,$httphost,$menucoll,$menuref) = @_; |
my ($cdom,$cnum,$httphost,$target,$menucoll,$menuref) = @_; |
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
my $now = time; |
my $now = time; |
my (%courseroles,%seccount,%courseprivs,%roledesc); |
my (%courseroles,%seccount,%courseprivs,%roledesc); |
Line 2632 sub roles_selector {
|
Line 2653 sub roles_selector {
|
} |
} |
} |
} |
if ((keys(%seccount) > 1) || ($numdiffsec > 1)) { |
if ((keys(%seccount) > 1) || ($numdiffsec > 1)) { |
|
my $targetattr; |
|
if ($target ne '') { |
|
$targetattr = ' target="'.$target.'"'; |
|
} |
my @submenu; |
my @submenu; |
$js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs, |
$js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs, |
\%roledesc,$privref,$menucoll,$menuref); |
\%roledesc,$privref,$menucoll,$menuref); |
$form = |
$form = |
'<form name="rolechooser" method="post" action="'.$httphost.'/adm/roles">'."\n". |
'<form name="rolechooser" method="post" action="'.$httphost.'/adm/roles"'.$targetattr.'>'."\n". |
' <input type="hidden" name="destinationurl" value="'. |
' <input type="hidden" name="destinationurl" value="'. |
&HTML::Entities::encode($destinationurl).'" />'."\n". |
&HTML::Entities::encode($destinationurl).'" />'."\n". |
' <input type="hidden" name="gotorole" value="1" />'."\n". |
' <input type="hidden" name="gotorole" value="1" />'."\n". |
Line 2699 sub roles_selector {
|
Line 2724 sub roles_selector {
|
} |
} |
} |
} |
if (@submenu > 0) { |
if (@submenu > 0) { |
$switcher = &create_submenu('#','',&mt('Switch role'),\@submenu); |
$switcher = &create_submenu('#',$target,&mt('Switch role'),\@submenu); |
} |
} |
} |
} |
return ($js,$form,$switcher,$has_opa_priv); |
return ($js,$form,$switcher,$has_opa_priv); |