version 1.401, 2022/05/24 16:23:03
|
version 1.419, 2025/03/03 22:03:02
|
Line 79 sub coursepreflink {
|
Line 79 sub coursepreflink {
|
my ($text,$category)=@_; |
my ($text,$category)=@_; |
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) { |
my $target =' target="_top"'; |
my $target =' target="_top"'; |
if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || |
|
(($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { |
$target =''; |
$target =''; |
} |
} |
if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) { |
|
$target = ' target="'.$env{'request.deeplink.target'}.'"'; |
|
} |
|
return '<a'.$target.' href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>'; |
return '<a'.$target.' href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>'; |
} else { |
} else { |
return ''; |
return ''; |
Line 109 sub direct_parm_link {
|
Line 107 sub direct_parm_link {
|
$part=&entity_encode($part); |
$part=&entity_encode($part); |
if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) { |
if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) { |
my $target=' target="_top"'; |
my $target=' target="_top"'; |
if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || |
|
(($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { |
$target=''; |
$target=''; |
} |
} |
if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) { |
|
$target = ' target="'.$env{'request.deeplink.target'}.'"'; |
|
} |
|
return "<a".$target." href=\"/adm/parmset?symb=$symb&filter=$filter&part=$part\"><span class=\"LC_setting\">$linktext</span></a>"; |
return "<a".$target." href=\"/adm/parmset?symb=$symb&filter=$filter&part=$part\"><span class=\"LC_setting\">$linktext</span></a>"; |
} else { |
} else { |
return $linktext; |
return $linktext; |
Line 235 sub dependencycheck_js {
|
Line 231 sub dependencycheck_js {
|
$link = '/adm/dependencies?symb='.&HTML::Entities::encode($symb,'<>&"'); |
$link = '/adm/dependencies?symb='.&HTML::Entities::encode($symb,'<>&"'); |
} elsif ($folderpath) { |
} elsif ($folderpath) { |
$link = '/adm/dependencies?folderpath='.&HTML::Entities::encode($folderpath,'<>&"'); |
$link = '/adm/dependencies?folderpath='.&HTML::Entities::encode($folderpath,'<>&"'); |
$url = $uri; |
$url = $uri; |
} elsif ($uri =~ m{^/public/$match_domain/$match_courseid/syllabus$}) { |
} elsif ($uri =~ m{^/public/$match_domain/$match_courseid/syllabus$}) { |
$link = '/adm/dependencies'; |
$link = '/adm/dependencies'; |
} |
} |
$link .= (($link=~/\?/)?'&':'?').'title='. |
$link .= (($link=~/\?/)?'&':'?').'title='. |
&HTML::Entities::encode($title,'<>&"'); |
&HTML::Entities::encode($title,'<>&"'); |
if ($url) { |
if ($url) { |
$link .= '&url='.&HTML::Entities::encode($url,'<>&"'); |
$link .= '&url='.&HTML::Entities::encode($url,'<>&"'); |
} |
} |
|
&js_escape(\$link); |
return <<ENDJS; |
return <<ENDJS; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 545 sub date_setter {
|
Line 542 sub date_setter {
|
my ($formname,$dname,$currentvalue,$special,$includeempty,$state, |
my ($formname,$dname,$currentvalue,$special,$includeempty,$state, |
$no_hh_mm_ss,$defhour,$defmin,$defsec,$nolink,$no_mm_ss,$no_ss) = @_; |
$no_hh_mm_ss,$defhour,$defmin,$defsec,$nolink,$no_mm_ss,$no_ss) = @_; |
my $now = time; |
my $now = time; |
|
my %labels = &Apache::lonlocal::texthash( |
|
day => 'day', |
|
month => 'month', |
|
year => 'year', |
|
sec => 'seconds', |
|
min => 'minutes', |
|
hour => 'hours', |
|
); |
my $tzname; |
my $tzname; |
my ($sec,$min,$hour,$mday,$month,$year) = ('', '', undef,''.''.''); |
my ($sec,$min,$hour,$mday,$month,$year) = ('', '', undef,''.''.''); |
#other potentially useful values: wkday,yrday,is_daylight_savings |
#other potentially useful values: wkday,yrday,is_daylight_savings |
Line 646 document.$formname.$dname\_year.value,
|
Line 650 document.$formname.$dname\_year.value,
|
</script> |
</script> |
ENDJS |
ENDJS |
$result .= ' <span class="LC_nobreak">'; |
$result .= ' <span class="LC_nobreak">'; |
my $monthselector = qq{<select name="$dname\_month" $special $state onchange="javascript:$dname\_checkday()" >}; |
my $monthselector = qq{<select name="$dname\_month" $special $state onchange="javascript:$dname\_checkday()" aria-label="$labels{'month'}">}; |
# Month |
# Month |
my @Months = qw/January February March April May June |
my @Months = qw/January February March April May June |
July August September October November December/; |
July August September October November December/; |
Line 660 ENDJS
|
Line 664 ENDJS
|
} |
} |
$monthselector.= ' </select>'; |
$monthselector.= ' </select>'; |
# Day |
# Day |
my $dayselector = qq{<input type="text" name="$dname\_day" $state value="$mday" size="3" $special onchange="javascript:$dname\_checkday()" />}; |
my $dayselector = qq{<input type="text" name="$dname\_day" $state value="$mday" size="3" $special onchange="javascript:$dname\_checkday()" aria-label="$labels{'day'}" />}; |
# Year |
# Year |
my $yearselector = qq{<input type="text" name="$dname\_year" $state value="$year" size="5" $special onchange="javascript:$dname\_checkday()" />}; |
my $yearselector = qq{<input type="text" name="$dname\_year" $state value="$year" size="5" $special onchange="javascript:$dname\_checkday()" aria-label="$labels{'year'}" />}; |
# |
# |
my $hourselector = qq{<select name="$dname\_hour" $special $state >}; |
my $hourselector = qq{<select name="$dname\_hour" $special $state aria-label="$labels{'hour'}">}; |
if ($includeempty) { |
if ($includeempty) { |
$hourselector.=qq{<option value=''></option>}; |
$hourselector.=qq{<option value=''></option>}; |
} |
} |
Line 686 ENDJS
|
Line 690 ENDJS
|
$hourselector .= $timest." </option>\n"; |
$hourselector .= $timest." </option>\n"; |
} |
} |
$hourselector .= " </select>\n"; |
$hourselector .= " </select>\n"; |
my $minuteselector = qq{<input type="text" name="$dname\_minute" $special $state value="$min" size="3" />}; |
my $minuteselector = qq{<input type="text" name="$dname\_minute" $special $state value="$min" size="3" aria-label="$labels{'min'}" />}; |
my $secondselector= qq{<input type="text" name="$dname\_second" $special $state value="$sec" size="3" />}; |
my $secondselector= qq{<input type="text" name="$dname\_second" $special $state value="$sec" size="3" aria-label="$labels{'sec'}" />}; |
my $cal_link; |
my $cal_link; |
unless (($nolink) || ($state eq 'disabled')) { |
unless (($nolink) || ($state eq 'disabled')) { |
$cal_link = qq{<a href="javascript:$dname\_opencalendar()">}; |
$cal_link = qq{<a href="javascript:$dname\_opencalendar()">}; |
Line 1320 sub htmlareaheaders {
|
Line 1324 sub htmlareaheaders {
|
ENDEDITOR |
ENDEDITOR |
} |
} |
$s.=(<<ENDJQUERY); |
$s.=(<<ENDJQUERY); |
<script type="text/javascript" src="/adm/jQuery/js/jquery-3.2.1.min.js"></script> |
<script type="text/javascript" src="/adm/jQuery/js/jquery-3.7.1.min.js"></script> |
<script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.12.1.custom.min.js"></script> |
<script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.13.3.custom.min.js"></script> |
<link rel="stylesheet" type="text/css" href="/adm/jQuery/css/smoothness/jquery-ui-1.12.1.custom.min.css" /> |
<link rel="stylesheet" type="text/css" href="/adm/jQuery/css/smoothness/jquery-ui-1.13.3.custom.min.css" /> |
<script type="text/javascript" src="/adm/jpicker/js/jpicker-1.1.6.min.js" > |
<script type="text/javascript" src="/adm/jpicker/js/jpicker-1.1.6.min.js" > |
</script> |
</script> |
<link rel="stylesheet" type="text/css" href="/adm/jpicker/css/jPicker-1.1.6.min.css" /> |
<link rel="stylesheet" type="text/css" href="/adm/jpicker/css/jPicker-1.1.6.min.css" /> |
Line 1741 sub show_return_link {
|
Line 1745 sub show_return_link {
|
unless ($env{'request.course.id'}) { return 0; } |
unless ($env{'request.course.id'}) { return 0; } |
if ($env{'request.noversionuri'}=~m{^/priv/} || |
if ($env{'request.noversionuri'}=~m{^/priv/} || |
$env{'request.uri'}=~m{^/priv/}) { return 1; } |
$env{'request.uri'}=~m{^/priv/}) { return 1; } |
return if ($env{'request.noversionuri'} eq '/adm/supplemental'); |
return if (($env{'request.noversionuri'} eq '/adm/supplemental') && |
|
($env{'form.folder'} ne 'supplemental')); |
|
return if (($env{'form.folderpath'} ne '') && |
|
(($env{'request.noversionuri'} =~ m{^/adm/$match_domain/$match_username/aboutme$}) || |
|
($env{'request.noversionuri'} =~ m{^/public/$match_domain/$match_courseid/syllabus$}))); |
return if (($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') && |
return if (($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') && |
(!$env{'request.role.adv'})); |
(!$env{'request.role.adv'})); |
if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)}) |
if (($env{'request.noversionuri'} =~ m{^/adm/viewclasslist($|\?)}) |
|| ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) { |
|| ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) { |
|
|
return if ($env{'form.register'}); |
return if ($env{'form.register'}); |
} |
} |
|
if ((($env{'request.symb'} ne '') || ($env{'form.folderpath'} ne '')) && |
|
($env{'request.noversionuri'} =~m{^/adm/coursedocs/showdoc/uploaded/($match_domain)/($match_courseid)/(docs|supplemental)/})) { |
|
my ($cdom,$cnum,$area) = ($1,$2,$3); |
|
if (($env{'course.'.$env{'request.course.id'}.'.domain'} eq $cdom) && |
|
($env{'course.'.$env{'request.course.id'}.'.num'} eq $cnum)) { |
|
if (($env{'request.symb'}) && ($area eq 'docs')) { |
|
my ($map,$resid,$url) = &Apache::lonnet::decode_symb($env{'request.symb'}); |
|
return if ($env{'request.noversionuri'} eq '/adm/coursedocs/showdoc/'.$url); |
|
} elsif (($env{'form.folderpath'}) && ($area eq 'supplemental')) { |
|
return; |
|
} |
|
} |
|
} |
return (($env{'request.noversionuri'}=~m{^/(res|public)/} && |
return (($env{'request.noversionuri'}=~m{^/(res|public)/} && |
$env{'request.symb'} eq '') |
$env{'request.symb'} eq '') |
|| |
|| |
Line 1817 clientTime = (new Date()).getTime();
|
Line 1838 clientTime = (new Date()).getTime();
|
END |
END |
} |
} |
|
|
|
## |
|
# Client-side javascript to convert any dashes in text pasted |
|
# into textbox(es) for numericalresponse item(s) to a standard |
|
# minus, i.e., - . Calls to dash_to_minus_js() in end_problem() |
|
# and in loncommon::endbodytag() for a .page (arg: dashjs => 1) |
|
# |
|
# Will apply to any input tag with class: LC_numresponse_text. |
|
# Currently set in start_textline for numericalresponse items. |
|
# |
|
|
|
sub dash_to_minus_js { |
|
return <<'ENDJS'; |
|
|
|
<script type="text/javascript"> |
|
//<![CDATA[ |
|
//<!-- BEGIN LON-CAPA Internal |
|
document.addEventListener("DOMContentLoaded", (event) => { |
|
const numresp = document.querySelectorAll("input.LC_numresponse_text"); |
|
if (numresp.length > 0) { |
|
Array.from(numresp).forEach((el) => { |
|
el.addEventListener("paste", (e) => { |
|
e.preventDefault(); |
|
e.stopPropagation(); |
|
let p = (e.clipboardData || window.clipboardData).getData("text"); |
|
p.toString(); |
|
var regex; |
|
try |
|
{ |
|
regex = new RegExp ("\\p{Dash}", "gu"); |
|
} |
|
catch (e) { regex = new RegExp ("[\\u058A\\u05BE\\u1400\\u1806\\u2010-\\u2015\\u2212\\u2E3A\\u2E3B\\u2E5D\\u301C\\uFE58\\uFE63\\uFF0D]","g"); } |
|
p = p.replace(regex,'-'); |
|
putInText(p); |
|
}); |
|
}); |
|
} |
|
const putInText = (newText, el = document.activeElement) => { |
|
const [start, end] = [el.selectionStart, el.selectionEnd]; |
|
el.setRangeText(newText, start, end, 'end'); |
|
} |
|
}); |
|
// END LON-CAPA Internal --> |
|
//]]> |
|
</script> |
|
|
|
ENDJS |
|
} |
|
|
############################################################ |
############################################################ |
############################################################ |
############################################################ |
|
|
Line 1853 boolean, controls whether to include a l
|
Line 1922 boolean, controls whether to include a l
|
|
|
if 'nohelp' don't include the orange help link |
if 'nohelp' don't include the orange help link |
|
|
=item $css_class |
=item $crumbs_style |
|
|
optional name for the class to apply to the table for CSS |
optional style attribute for div containing breadcrumbs |
|
unless called from docs_breadcrumbs |
|
|
=item $no_mt |
=item $no_mt |
|
|
Line 1876 loncommon::help_open_topic() to generate
|
Line 1946 loncommon::help_open_topic() to generate
|
text to include in the link in the optional help item ($topic_help) on the right |
text to include in the link in the optional help item ($topic_help) on the right |
side of the breadcrumbs row. |
side of the breadcrumbs row. |
|
|
|
=item $links_target |
|
|
|
optionally includes the target (_top, _parent or _self) for (i) initial |
|
$menulink item in the breadcrumbs (if present), (ii) return to last location |
|
(if present), and (iii) help item at the right side of breadcrumbs menu, |
|
created by loncommon::help_open_topic() or loncommon::help_open_menu(). |
|
|
=back |
=back |
|
|
=back |
=back |
Line 1906 returns: nothing
|
Line 1983 returns: nothing
|
my %tools = (); |
my %tools = (); |
|
|
sub breadcrumbs { |
sub breadcrumbs { |
my ($component,$component_help,$menulink,$helplink,$css_class,$no_mt, |
my ($component,$component_help,$menulink,$helplink,$crumbs_style,$no_mt, |
$CourseBreadcrumbs,$topic_help,$topic_help_text,$crstype) = @_; |
$CourseBreadcrumbs,$topic_help,$topic_help_text,$links_target) = @_; |
# |
# |
$css_class ||= 'LC_breadcrumbs'; |
|
|
|
# Make the faq and bug data cascade |
# Make the faq and bug data cascade |
my $faq = ''; |
my $faq = ''; |
my $bug = ''; |
my $bug = ''; |
Line 1951 returns: nothing
|
Line 2026 returns: nothing
|
} |
} |
} |
} |
my $target = '_top'; |
my $target = '_top'; |
if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
if ($links_target) { |
|
$target = $links_target; |
|
} elsif ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) || |
|
(($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) { |
$target=''; |
$target=''; |
} |
} |
if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) { |
|
$target = $env{'request.deeplink.target'}; |
|
} |
|
$menulink = { href =>'/adm/menu', |
$menulink = { href =>'/adm/menu', |
title =>'Go to main menu', |
title =>'Go to main menu', |
target =>$target, |
target =>$target, |
Line 1977 returns: nothing
|
Line 2052 returns: nothing
|
title => &mt('Back to most recent content resource'), |
title => &mt('Back to most recent content resource'), |
class => 'LC_menubuttons_link', |
class => 'LC_menubuttons_link', |
}; |
}; |
if ($env{'request.noversionuri'} eq '/adm/searchcat') { |
if ($links_target) { |
$hashref->{'target'} = '_top'; |
$hashref->{'target'} = $links_target; |
if (($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) { |
|
$hashref->{'target'} = ''; |
|
} |
|
if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'})) { |
|
$hashref->{'target'} = $env{'request.deeplink.target'}; |
|
} |
|
} |
} |
$links=&htmltag( 'a','<img src="/res/adm/pages/tolastloc.png" alt="'.$alttext.'" class="LC_icon" />', |
$links=&htmltag( 'a','<img src="/res/adm/pages/tolastloc.png" alt="'.$alttext.'" class="LC_icon" />', |
$hashref); |
$hashref); |
Line 2018 returns: nothing
|
Line 2087 returns: nothing
|
|
|
if ($lasttext ne '') { |
if ($lasttext ne '') { |
$links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1', |
$links .= &htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1', |
$lasttext), {title => $lasttext}); |
$lasttext)); |
} |
} |
|
|
my $icons = ''; |
my $icons = ''; |
Line 2035 returns: nothing
|
Line 2104 returns: nothing
|
if ($faq ne '' || $component_help ne '' || $bug ne '') { |
if ($faq ne '' || $component_help ne '' || $bug ne '') { |
$icons .= &Apache::loncommon::help_open_menu($component, |
$icons .= &Apache::loncommon::help_open_menu($component, |
$component_help, |
$component_help, |
$faq,$bug); |
$faq,$bug,'','','','', |
|
$links_target); |
} |
} |
if ($topic_help && $topic_help_text) { |
if ($topic_help && $topic_help_text) { |
$icons .= ' '.&Apache::loncommon::help_open_topic($topic_help,&mt($topic_help_text),'', |
$icons .= ' '.&Apache::loncommon::help_open_topic($topic_help,&mt($topic_help_text),'', |
undef,600); |
undef,600,'',$links_target); |
} |
} |
# |
# |
|
|
Line 2069 returns: nothing
|
Line 2139 returns: nothing
|
} |
} |
if (($links ne '') || ($nav_and_tools)) { |
if (($links ne '') || ($nav_and_tools)) { |
&render_tools(\$links); |
&render_tools(\$links); |
$links = &htmltag('div', $links, |
unless ($CourseBreadcrumbs) { |
{ id => "LC_breadcrumbs" }) unless ($CourseBreadcrumbs) ; |
my $args = { id => 'LC_breadcrumbs' }; |
|
if ($crumbs_style ne '') { |
|
$args->{'style'} = $crumbs_style; |
|
} |
|
$links = &htmltag('div', $links, $args); |
|
} |
} |
} |
my $adv_tools = 0; |
my $adv_tools = 0; |
if (ref($tools{'advtools'}) eq 'ARRAY') { |
if (ref($tools{'advtools'}) eq 'ARRAY') { |
Line 2087 returns: nothing
|
Line 2162 returns: nothing
|
|
|
# Return the breadcrumb's line |
# Return the breadcrumb's line |
|
|
|
my $labeltext = &HTML::Entities::encode(&mt('Links for navigation and information')); |
|
return '<div class="LC_landmark" role="navigation" aria-label="'.$labeltext.'">'.$links.'</div>'; |
return "$links"; |
|
} |
} |
|
|
sub clear_breadcrumbs { |
sub clear_breadcrumbs { |
Line 2239 returns: nothing
|
Line 2313 returns: nothing
|
} # End of scope for @Crumbs |
} # End of scope for @Crumbs |
|
|
sub docs_breadcrumbs { |
sub docs_breadcrumbs { |
my ($allowed,$crstype,$contenteditor,$title,$precleared)=@_; |
my ($allowed,$crstype,$contenteditor,$title,$precleared,$checklinkprot)=@_; |
my ($folderpath,@folders,$supplementalflag); |
my ($folderpath,@folders,$supplementalflag); |
@folders = split('&',$env{'form.folderpath'}); |
@folders = split('&',$env{'form.folderpath'}); |
if ($env{'form.folderpath'} =~ /^supplemental/) { |
if ($env{'form.folderpath'} =~ /^supplemental/) { |
Line 2265 sub docs_breadcrumbs {
|
Line 2339 sub docs_breadcrumbs {
|
# each of randompick number, hidden, encrypted, random order, is_page |
# each of randompick number, hidden, encrypted, random order, is_page |
# are appended with ":"s to the foldername |
# are appended with ":"s to the foldername |
$name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//; |
$name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//; |
unless ($supplementalflag) { |
if ($contenteditor) { |
if ($contenteditor) { |
if ($supplementalflag) { |
|
if ($2) { $ishidden=1; } |
|
} else { |
if ($1 ne '') { |
if ($1 ne '') { |
$randompick=$1; |
$randompick=$1; |
} else { |
} else { |
Line 2307 sub docs_breadcrumbs {
|
Line 2383 sub docs_breadcrumbs {
|
$plain=~s/\>\;\s*$//; |
$plain=~s/\>\;\s*$//; |
} |
} |
my $menulink = 0; |
my $menulink = 0; |
if (!$allowed && !$contenteditor) { |
if (!$allowed && !$contenteditor && !$supplementalflag) { |
$menulink = 1; |
$menulink = 1; |
} |
} |
|
if ($checklinkprot) { |
|
if ($env{'request.deeplink.login'}) { |
|
my $linkprotout = &Apache::lonmenu::linkprot_exit(); |
|
if ($linkprotout) { |
|
&Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout); |
|
} |
|
} |
|
} |
return (&breadcrumbs(undef,undef,$menulink,'nohelp',undef,undef, |
return (&breadcrumbs(undef,undef,$menulink,'nohelp',undef,undef, |
$contenteditor), |
$contenteditor), |
$randompick,$ishidden,$isencrypted,$plain, |
$randompick,$ishidden,$isencrypted,$plain, |
Line 2412 END
|
Line 2496 END
|
} |
} |
|
|
sub row_title { |
sub row_title { |
my ($title,$css_title_class,$css_value_class, $css_value_furtherAttributes) = @_; |
my ($title,$css_title_class,$css_value_class,$css_value_furtherAttributes,$nocolon) = @_; |
$row_count[0]++; |
$row_count[0]++; |
my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row'; |
my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row'; |
$css_title_class ||= 'LC_pick_box_title'; |
$css_title_class ||= 'LC_pick_box_title'; |
Line 2420 sub row_title {
|
Line 2504 sub row_title {
|
|
|
$css_value_class ||= 'LC_pick_box_value'; |
$css_value_class ||= 'LC_pick_box_value'; |
|
|
if ($title ne '') { |
if (($title ne '') && (!$nocolon)) { |
$title .= ':'; |
$title .= ':'; |
} |
} |
my $output = <<"ENDONE"; |
my $output = <<"ENDONE"; |
<tr class="LC_pick_box_row" $css_value_furtherAttributes> |
<tr class="LC_pick_box_row" $css_value_furtherAttributes> |
<td $css_title_class> |
<th $css_title_class> |
$title |
$title |
</td> |
</th> |
<td class="$css_value_class $css_class"> |
<td class="$css_value_class $css_class"> |
ENDONE |
ENDONE |
return $output; |
return $output; |
Line 3529 THIRD
|
Line 3613 THIRD
|
sub javascript_jumpto_resource { |
sub javascript_jumpto_resource { |
my $confirm_switch = &mt("Editing requires switching to the resource's home server.")."\n". |
my $confirm_switch = &mt("Editing requires switching to the resource's home server.")."\n". |
&mt('Switch server?'); |
&mt('Switch server?'); |
|
my $confirm_new_tab = &mt("Editing requires using the resource's home server.")."\n". |
|
&mt('Open a new browser tab?'); |
&js_escape(\$confirm_switch); |
&js_escape(\$confirm_switch); |
|
&js_escape(\$confirm_new_tab); |
return (<<ENDUTILITY) |
return (<<ENDUTILITY) |
|
|
function go(url) { |
function go(url) { |
Line 3550 function go(url) {
|
Line 3637 function go(url) {
|
} |
} |
} |
} |
|
|
function need_switchserver(url) { |
function need_switchserver(url,target) { |
if (url!='' && url!= null) { |
if (url!='' && url!= null) { |
if (confirm("$confirm_switch")) { |
if (target == '_blank') { |
|
if (confirm("$confirm_new_tab")) { |
|
window.open(url,target); |
|
} |
|
} else if (confirm("$confirm_switch")) { |
go(url); |
go(url); |
} |
} |
} |
} |
Line 3564 ENDUTILITY
|
Line 3655 ENDUTILITY
|
} |
} |
|
|
sub jump_to_editres { |
sub jump_to_editres { |
my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$folderpath, |
my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$shownsymb, |
$title,$hostname,$idx,$suppurl,$todocs,$suppanchor) = @_; |
$folderpath,$title,$hostname,$idx,$suppurl,$todocs,$suppanchor) = @_; |
my ($jscall,$anchor,$usehttp,$usehttps,$is_ext); |
my ($jscall,$anchor,$usehttp,$usehttps,$is_ext,$target); |
if ($switchserver) { |
if ($switchserver) { |
if ($home) { |
if ($home) { |
|
my $resedit; |
|
if ($cfile =~ m{^/priv/($match_domain)/($match_username)/}) { |
|
my ($audom,$auname) = ($1,$2); |
|
unless (&Apache::lonnet::is_course($audom,$auname)) { |
|
unless ((&Apache::lonnet::will_trust('othcoau',$env{'user.domain'},$audom)) && |
|
(&Apache::lonnet::will_trust('coaurem',$audom,$env{'user.domain'}))) { |
|
return; |
|
} |
|
if (($symb ne '') && ($env{'request.course.id'}) && |
|
(&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { |
|
unless (&Apache::lonnet::can_switchserver($env{'user.domain'},$home)) { |
|
$target = '_blank'; |
|
$resedit = 1; |
|
} |
|
} |
|
} |
|
} |
$cfile = '/adm/switchserver?otherserver='.$home.'&role='. |
$cfile = '/adm/switchserver?otherserver='.$home.'&role='. |
&HTML::Entities::encode($env{'request.role'},'"<>&'); |
&HTML::Entities::encode($env{'request.role'},'"<>&'); |
if ($symb) { |
if ($shownsymb) { |
$cfile .= '&symb='.&HTML::Entities::encode($symb,'"<>&'); |
$cfile .= '&symb='.&HTML::Entities::encode($shownsymb,'"<>&'); |
|
if ($resedit) { |
|
$cfile .= '&edit=1'; |
|
} |
} elsif ($folderpath) { |
} elsif ($folderpath) { |
$cfile .= '&folderpath='.&HTML::Entities::encode($folderpath,'"<>&'); |
$cfile .= '&folderpath='.&HTML::Entities::encode($folderpath,'"<>&'); |
} |
} |
Line 3582 sub jump_to_editres {
|
Line 3693 sub jump_to_editres {
|
if ($forcereg) { |
if ($forcereg) { |
$cfile .= '&register=1'; |
$cfile .= '&register=1'; |
} |
} |
$jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."');"; |
$jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."','$target')"; |
} |
} |
} else { |
} else { |
unless ($cfile =~ m{^/priv/}) { |
unless ($cfile =~ m{^/priv/}) { |
Line 3865 sub list_from_array {
|
Line 3976 sub list_from_array {
|
sub generate_menu { |
sub generate_menu { |
my @menu = @_; |
my @menu = @_; |
# subs for specific html elements |
# subs for specific html elements |
my ($h3, $div, $ul, $li, $a, $img) = inittags( qw(h3 div ul li a img) ); |
my ($h2, $div, $ul, $li, $a, $img) = inittags( qw(h2 div ul li a img) ); |
|
|
my @categories; # each element represents the entire markup for a category |
my @categories; # each element represents the entire markup for a category |
|
|
Line 3903 sub generate_menu {
|
Line 4014 sub generate_menu {
|
{class => "LC_menubuttons_inline_text"})); |
{class => "LC_menubuttons_inline_text"})); |
} |
} |
|
|
# wrap categorytitle in <h3>, concatenate with |
# wrap categorytitle in <h2>, concatenate with |
# joined and in <ul> tags wrapped @links |
# joined and in <ul> tags wrapped @links |
# and wrap everything in an enclosing <div> and push it into |
# and wrap everything in an enclosing <div> and push it into |
# @categories |
# @categories |
# such that each element looks like: |
# such that each element looks like: |
# <div><h3>title</h3><ul><li>...</li>...</ul></div> |
# <div><h2>title</h2><ul><li>...</li>...</ul></div> |
# the category won't be added if there aren't any links |
# the category won't be added if there aren't any links |
push(@categories, |
push(@categories, |
$div->($h3->(mt($$category{categorytitle}), {class=>"LC_hcell"}). |
$div->($h2->(mt($$category{categorytitle}), {class=>'LC_hcell LC_heading_2'}). |
$ul->(join('' ,@links), {class =>"LC_ListStyleNormal" }), |
$ul->(join('' ,@links), {class =>"LC_ListStyleNormal" }), |
{class=>"LC_Box LC_400Box"})) if scalar(@links); |
{class=>"LC_Box LC_400Box"})) if scalar(@links); |
} |
} |