version 1.1362, 2021/07/19 15:48:26
|
version 1.1371, 2021/11/24 04:25:01
|
Line 1416 sub help_open_menu {
|
Line 1416 sub help_open_menu {
|
} |
} |
|
|
sub top_nav_help { |
sub top_nav_help { |
my ($text) = @_; |
my ($text,$linkattr) = @_; |
$text = &mt($text); |
$text = &mt($text); |
my $stay_on_page = 1; |
my $stay_on_page = 1; |
|
|
Line 1430 sub top_nav_help {
|
Line 1430 sub top_nav_help {
|
if ($link) { |
if ($link) { |
return <<"END"; |
return <<"END"; |
$banner_link |
$banner_link |
<a href="$link" title="$title">$text</a> |
<a href="$link" title="$title" $linkattr>$text</a> |
END |
END |
} else { |
} else { |
return ' '.$text.' '; |
return ' '.$text.' '; |
Line 5745 sub get_domainconf {
|
Line 5745 sub get_domainconf {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($key eq 'saml') { |
|
if (ref($domconfig{'login'}{$key}) eq 'HASH') { |
|
foreach my $host (keys(%{$domconfig{'login'}{$key}})) { |
|
if (ref($domconfig{'login'}{$key}{$host}) eq 'HASH') { |
|
$designhash{$udom.'.login.'.$key.'_'.$host} = 1; |
|
foreach my $item ('text','img','alt','url','title','notsso') { |
|
$designhash{$udom.'.login.'.$key.'_'.$item.'_'.$host} = $domconfig{'login'}{$key}{$host}{$item}; |
|
} |
|
} |
|
} |
|
} |
} else { |
} else { |
foreach my $img (keys(%{$domconfig{'login'}{$key}})) { |
foreach my $img (keys(%{$domconfig{'login'}{$key}})) { |
$designhash{$udom.'.login.'.$key.'_'.$img} = |
$designhash{$udom.'.login.'.$key.'_'.$img} = |
Line 6255 sub bodytag {
|
Line 6266 sub bodytag {
|
Apache::lonmenu::utilityfunctions($httphost), 'start'); |
Apache::lonmenu::utilityfunctions($httphost), 'start'); |
|
|
unless ($args->{'no_primary_menu'}) { |
unless ($args->{'no_primary_menu'}) { |
my ($left,$right) = Apache::lonmenu::primary_menu($crstype,$ltimenu,$menucoll,$menuref); |
my ($left,$right) = Apache::lonmenu::primary_menu($crstype,$ltimenu,$menucoll,$menuref, |
|
$args->{'links_disabled'}); |
|
|
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { |
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { |
if ($dc_info) { |
if ($dc_info) { |
Line 6287 sub bodytag {
|
Line 6299 sub bodytag {
|
unless ($args->{'no_inline_menu'}) { |
unless ($args->{'no_inline_menu'}) { |
$bodytag .= Apache::lonmenu::secondary_menu($httphost,$ltiscope,$ltimenu, |
$bodytag .= Apache::lonmenu::secondary_menu($httphost,$ltiscope,$ltimenu, |
$args->{'no_primary_menu'}, |
$args->{'no_primary_menu'}, |
$menucoll,$menuref); |
$menucoll,$menuref, |
|
$args->{'links_disabled'}); |
} |
} |
$bodytag .= Apache::lonmenu::serverform(); |
$bodytag .= Apache::lonmenu::serverform(); |
$bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); |
$bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); |
Line 8364 ul.LC_funclist li {
|
Line 8377 ul.LC_funclist li {
|
cursor:pointer; |
cursor:pointer; |
} |
} |
|
|
|
.LCisDisabled { |
|
cursor: not-allowed; |
|
opacity: 0.5; |
|
} |
|
|
|
a[aria-disabled="true"] { |
|
color: currentColor; |
|
display: inline-block; /* For IE11/ MS Edge bug */ |
|
pointer-events: none; |
|
text-decoration: none; |
|
} |
|
|
pre.LC_wordwrap { |
pre.LC_wordwrap { |
white-space: pre-wrap; |
white-space: pre-wrap; |
white-space: -moz-pre-wrap; |
white-space: -moz-pre-wrap; |
Line 8952 $args - additional optional args support
|
Line 8977 $args - additional optional args support
|
will contain https://<hostname> if server uses |
will contain https://<hostname> if server uses |
https (as per hosts.tab), but request is for http |
https (as per hosts.tab), but request is for http |
hostname -> hostname, originally from $r->hostname(), (optional). |
hostname -> hostname, originally from $r->hostname(), (optional). |
|
links_disabled -> Links in primary and secondary menus are disabled |
|
(Can enable them once page has loaded - see lonroles.pm |
|
for an example). |
|
|
=back |
=back |
|
|
Line 9143 sub menucoll_in_effect {
|
Line 9171 sub menucoll_in_effect {
|
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
$menucoll = $env{'course.'.$env{'request.course.id'}.'.menudefault'}; |
$menucoll = $env{'course.'.$env{'request.course.id'}.'.menudefault'}; |
if ($env{'request.deeplink.login'}) { |
if ($env{'request.deeplink.login'}) { |
my ($deeplink_symb,$deeplink); |
my ($deeplink_symb,$deeplink,$check_login_symb); |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
if ($env{'request.noversionuri'} =~ m{^/(res|uploaded)/}) { |
if ($env{'request.noversionuri'} =~ m{^/(res|uploaded)/}) { |
Line 9153 sub menucoll_in_effect {
|
Line 9181 sub menucoll_in_effect {
|
$deeplink = $navmap->get_mapparam(undef, |
$deeplink = $navmap->get_mapparam(undef, |
&Apache::lonnet::declutter($env{'request.noversionuri'}), |
&Apache::lonnet::declutter($env{'request.noversionuri'}), |
'0.deeplink'); |
'0.deeplink'); |
|
} else { |
|
$check_login_symb = 1; |
} |
} |
} else { |
} else { |
$deeplink = &Apache::lonnet::EXT('resource.0.deeplink'); |
my $symb = &Apache::lonnet::symbread(); |
|
if ($symb) { |
|
$deeplink = &Apache::lonnet::EXT('resource.0.deeplink',$symb); |
|
} else { |
|
$check_login_symb = 1; |
|
} |
} |
} |
} else { |
} else { |
|
$check_login_symb = 1; |
|
} |
|
if ($check_login_symb) { |
$deeplink_symb = &deeplink_login_symb($cnum,$cdom); |
$deeplink_symb = &deeplink_login_symb($cnum,$cdom); |
if ($deeplink_symb =~ /\.(page|sequence)$/) { |
if ($deeplink_symb =~ /\.(page|sequence)$/) { |
my $mapname = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($deeplink_symb))[2]); |
my $mapname = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($deeplink_symb))[2]); |
Line 9170 sub menucoll_in_effect {
|
Line 9208 sub menucoll_in_effect {
|
} |
} |
} |
} |
if ($deeplink ne '') { |
if ($deeplink ne '') { |
my ($listed,$scope,$access,$display) = split(/,/,$deeplink); |
my ($state,$others,$listed,$scope,$protect,$display) = split(/,/,$deeplink); |
if ($display =~ /^\d+$/) { |
if ($display =~ /^\d+$/) { |
$deeplinkmenu = 1; |
$deeplinkmenu = 1; |
$menucoll = $display; |
$menucoll = $display; |
Line 9188 sub deeplink_login_symb {
|
Line 9226 sub deeplink_login_symb {
|
my ($cnum,$cdom) = @_; |
my ($cnum,$cdom) = @_; |
my $login_symb; |
my $login_symb; |
if ($env{'request.deeplink.login'}) { |
if ($env{'request.deeplink.login'}) { |
if ($env{'request.deeplink.login'} =~ m{^\Q/tiny/$cdom/\E(\w+)$}) { |
$login_symb = &symb_from_tinyurl($env{'request.deeplink.login'},$cnum,$cdom); |
my $key = $1; |
} |
my ($tinyurl,$login); |
return $login_symb; |
my ($result,$cached)=&Apache::lonnet::is_cached_new('tiny',$cdom."\0".$key); |
} |
if (defined($cached)) { |
|
$tinyurl = $result; |
sub symb_from_tinyurl { |
} else { |
my ($url,$cnum,$cdom) = @_; |
my $configuname = &Apache::lonnet::get_domainconfiguser($cdom); |
if ($url =~ m{^\Q/tiny/$cdom/\E(\w+)$}) { |
my %currtiny = &Apache::lonnet::get('tiny',[$key],$cdom,$configuname); |
my $key = $1; |
if ($currtiny{$key} ne '') { |
my ($tinyurl,$login); |
$tinyurl = $currtiny{$key}; |
my ($result,$cached)=&Apache::lonnet::is_cached_new('tiny',$cdom."\0".$key); |
&Apache::lonnet::do_cache_new('tiny',$cdom."\0".$key,$currtiny{$key},600); |
if (defined($cached)) { |
} |
$tinyurl = $result; |
|
} else { |
|
my $configuname = &Apache::lonnet::get_domainconfiguser($cdom); |
|
my %currtiny = &Apache::lonnet::get('tiny',[$key],$cdom,$configuname); |
|
if ($currtiny{$key} ne '') { |
|
$tinyurl = $currtiny{$key}; |
|
&Apache::lonnet::do_cache_new('tiny',$cdom."\0".$key,$currtiny{$key},600); |
} |
} |
if ($tinyurl ne '') { |
} |
my ($cnumreq,$posslogin) = split(/\&/,$tinyurl); |
if ($tinyurl ne '') { |
if ($cnumreq eq $cnum) { |
my ($cnumreq,$symb) = split(/\&/,$tinyurl); |
$login_symb = $posslogin; |
if (wantarray) { |
} |
return ($cnumreq,$symb); |
|
} elsif ($cnumreq eq $cnum) { |
|
return $symb; |
} |
} |
} |
} |
} |
} |
return $login_symb; |
if (wantarray) { |
|
return (); |
|
} else { |
|
return; |
|
} |
} |
} |
|
|
sub wishlist_window { |
sub wishlist_window { |
Line 9302 ENDLINK
|
Line 9352 ENDLINK
|
} |
} |
|
|
sub modal_adhoc_script { |
sub modal_adhoc_script { |
my ($funcname,$width,$height,$content)=@_; |
my ($funcname,$width,$height,$content,$possmathjax)=@_; |
|
my $mathjax; |
|
if ($possmathjax) { |
|
$mathjax = <<'ENDJAX'; |
|
if (typeof MathJax == 'object') { |
|
MathJax.Hub.Queue(["Typeset",MathJax.Hub]); |
|
} |
|
ENDJAX |
|
} |
return (<<ENDADHOC); |
return (<<ENDADHOC); |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 9313 sub modal_adhoc_script {
|
Line 9371 sub modal_adhoc_script {
|
modalWindow.height = $height; |
modalWindow.height = $height; |
modalWindow.content = '$content'; |
modalWindow.content = '$content'; |
modalWindow.open(); |
modalWindow.open(); |
|
$mathjax |
}; |
}; |
// ]]> |
// ]]> |
</script> |
</script> |
Line 9320 ENDADHOC
|
Line 9379 ENDADHOC
|
} |
} |
|
|
sub modal_adhoc_inner { |
sub modal_adhoc_inner { |
my ($funcname,$width,$height,$content)=@_; |
my ($funcname,$width,$height,$content,$possmathjax)=@_; |
my $innerwidth=$width-20; |
my $innerwidth=$width-20; |
$content=&js_ready( |
$content=&js_ready( |
&start_page('Dialog',undef,{'only_body'=>1,'bgcolor'=>'#FFFFFF'}). |
&start_page('Dialog',undef,{'only_body'=>1,'bgcolor'=>'#FFFFFF'}). |
Line 9329 sub modal_adhoc_inner {
|
Line 9388 sub modal_adhoc_inner {
|
&end_scrollbox(). |
&end_scrollbox(). |
&end_page() |
&end_page() |
); |
); |
return &modal_adhoc_script($funcname,$width,$height,$content); |
return &modal_adhoc_script($funcname,$width,$height,$content,$possmathjax); |
} |
} |
|
|
sub modal_adhoc_window { |
sub modal_adhoc_window { |
my ($funcname,$width,$height,$content,$linktext)=@_; |
my ($funcname,$width,$height,$content,$linktext,$possmathjax)=@_; |
return &modal_adhoc_inner($funcname,$width,$height,$content). |
return &modal_adhoc_inner($funcname,$width,$height,$content,$possmathjax). |
"<a href=\"javascript:$funcname();void(0);\">".$linktext."</a>"; |
"<a href=\"javascript:$funcname();void(0);\">".$linktext."</a>"; |
} |
} |
|
|
Line 16393 sub construct_course {
|
Line 16452 sub construct_course {
|
if ($args->{'crstype'}) { |
if ($args->{'crstype'}) { |
$cenv{'type'}=$args->{'crstype'}; |
$cenv{'type'}=$args->{'crstype'}; |
} |
} |
|
if ($args->{'lti'}) { |
|
$cenv{'internal.lti'}=$args->{'lti'}; |
|
} |
if ($args->{'crsid'}) { |
if ($args->{'crsid'}) { |
$cenv{'courseid'}=$args->{'crsid'}; |
$cenv{'courseid'}=$args->{'crsid'}; |
} |
} |
Line 18264 sub create_captcha {
|
Line 18326 sub create_captcha {
|
|
|
if (-e $Apache::lonnet::perlvar{'lonCaptchaDir'}.'/'.$md5sum.'.png') { |
if (-e $Apache::lonnet::perlvar{'lonCaptchaDir'}.'/'.$md5sum.'.png') { |
$output = '<input type="hidden" name="crypt" value="'.$md5sum.'" />'."\n". |
$output = '<input type="hidden" name="crypt" value="'.$md5sum.'" />'."\n". |
|
'<span class="LC_nobreak">'. |
&mt('Type in the letters/numbers shown below').' '. |
&mt('Type in the letters/numbers shown below').' '. |
'<input type="text" size="5" name="code" value="" autocomplete="off" />'. |
'<input type="text" size="5" name="code" value="" autocomplete="off" />'. |
'<br />'. |
'</span><br />'. |
'<img src="'.$captcha_params{'www_output_dir'}.'/'.$md5sum.'.png" alt="captcha" />'; |
'<img src="'.$captcha_params{'www_output_dir'}.'/'.$md5sum.'.png" alt="captcha" />'; |
last; |
last; |
} |
} |
Line 18312 sub check_captcha {
|
Line 18375 sub check_captcha {
|
sub create_recaptcha { |
sub create_recaptcha { |
my ($pubkey,$version) = @_; |
my ($pubkey,$version) = @_; |
if ($version >= 2) { |
if ($version >= 2) { |
return '<div class="g-recaptcha" data-sitekey="'.$pubkey.'"></div>'; |
return '<div class="g-recaptcha" data-sitekey="'.$pubkey.'"></div>'. |
|
'<div style="padding:0;clear:both;margin:0;border:0"></div>'; |
} else { |
} else { |
my $use_ssl; |
my $use_ssl; |
if ($ENV{'SERVER_PORT'} == 443) { |
if ($ENV{'SERVER_PORT'} == 443) { |
Line 18805 sub page_menu {
|
Line 18869 sub page_menu {
|
my @entries = split(/\&/,$value); |
my @entries = split(/\&/,$value); |
foreach my $entry (@entries) { |
foreach my $entry (@entries) { |
my ($name,$fields) = split(/=/,$entry); |
my ($name,$fields) = split(/=/,$entry); |
if (($name eq 'top') || ($name eq 'inline') || ($name eq 'main')) { |
if (($name eq 'top') || ($name eq 'inline') || ($name eq 'foot') || ($name eq 'main')) { |
$menu{$name} = $fields; |
$menu{$name} = $fields; |
} else { |
} else { |
my @shown; |
my @shown; |