version 1.253.2.6, 2010/11/29 04:40:12
|
version 1.273, 2010/05/30 18:30:52
|
Line 66 use LONCAPA;
|
Line 66 use LONCAPA;
|
sub coursepreflink { |
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'})) { |
return '<a href="/adm/courseprefs?phase=display&actions='.$category.'">'.$text.'</a>'; |
return '<a href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'">'.$text.'</a>'; |
} else { |
} else { |
return ''; |
return ''; |
} |
} |
Line 74 sub coursepreflink {
|
Line 74 sub coursepreflink {
|
|
|
sub raw_href_to_link { |
sub raw_href_to_link { |
my ($message)=@_; |
my ($message)=@_; |
$message=~s/(https?\:\/\/[^\s\'\"]+)(\s|$)/<a href="$1"><tt>$1<\/tt><\/a>$2/gi; |
$message=~s/(https?\:\/\/[^\s\'\"\<]+)([\s\<]|$)/<a href="$1"><tt>$1<\/tt><\/a>$2/gi; |
return $message; |
return $message; |
} |
} |
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
=pod |
|
|
|
=item confirm_success |
=item confirm_success |
|
|
Successful completion of an operation message |
Successful completion of an operation message |
Line 92 Successful completion of an operation me
|
Line 90 Successful completion of an operation me
|
sub confirm_success { |
sub confirm_success { |
my ($message,$failure)=@_; |
my ($message,$failure)=@_; |
if ($failure) { |
if ($failure) { |
return '<span class="LC_error">'."\n" |
return '<span class="LC_error" style="font-size: inherit;">'."\n" |
.'<img src="/adm/lonIcons/navmap.wrong.gif" alt="'.&mt('Error').'" /> '."\n" |
.'<img src="/adm/lonIcons/navmap.wrong.gif" alt="'.&mt('Error').'" /> '."\n" |
.$message."\n" |
.$message."\n" |
.'</span>'."\n"; |
.'</span>'."\n"; |
Line 139 ENDDRAGMATH
|
Line 137 ENDDRAGMATH
|
|
|
Javascript used to open pop-up window containing dragmath applet which |
Javascript used to open pop-up window containing dragmath applet which |
can be used to paste LaTeX into a textarea. |
can be used to paste LaTeX into a textarea. |
|
|
=cut |
=cut |
|
|
sub dragmath_js { |
sub dragmath_js { |
Line 383 dname_hour, dname_min, and dname_sec.
|
Line 380 dname_hour, dname_min, and dname_sec.
|
|
|
The current setting for this time parameter. A unix format time |
The current setting for this time parameter. A unix format time |
(time in seconds since the beginning of Jan 1st, 1970, GMT. |
(time in seconds since the beginning of Jan 1st, 1970, GMT. |
An undefined value is taken to indicate the value is the current time. |
An undefined value is taken to indicate the value is the current time |
|
unless it is requested to leave it empty. See $includeempty. |
Also, to be explicit, a value of 'now' also indicates the current time. |
Also, to be explicit, a value of 'now' also indicates the current time. |
|
|
=item $special |
=item $special |
Line 393 the date_setter. See lonparmset for exa
|
Line 391 the date_setter. See lonparmset for exa
|
|
|
=item $includeempty |
=item $includeempty |
|
|
|
If it is set (true) and no date/time value is provided, |
|
the date/time fields are left empty. |
|
|
=item $state |
=item $state |
|
|
Specifies the initial state of the form elements. Either 'disabled' or empty. |
Specifies the initial state of the form elements. Either 'disabled' or empty. |
Line 410 The method used to restrict user input w
|
Line 411 The method used to restrict user input w
|
############################################## |
############################################## |
sub date_setter { |
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,$hide_timezone) = @_; |
$no_hh_mm_ss,$defhour,$defmin,$defsec,$nolink) = @_; |
my $now = time; |
my $now = time; |
my $wasdefined=1; |
|
|
my $tzname; |
|
my ($sec,$min,$hour,$mday,$month,$year) = ('', '', undef,''.''.''); |
|
#other potentially useful values: wkday,yrday,is_daylight_savings |
|
|
if (! defined($state) || $state ne 'disabled') { |
if (! defined($state) || $state ne 'disabled') { |
$state = ''; |
$state = ''; |
} |
} |
Line 420 sub date_setter {
|
Line 425 sub date_setter {
|
$no_hh_mm_ss = 0; |
$no_hh_mm_ss = 0; |
} |
} |
if ($currentvalue eq 'now') { |
if ($currentvalue eq 'now') { |
$currentvalue = $now; |
$currentvalue = $now; |
} |
} |
if ((!defined($currentvalue)) || ($currentvalue eq '')) { |
|
$wasdefined=0; |
# Default value: Set empty date field to current time |
if ($includeempty) { |
# unless empty inclusion is requested |
$currentvalue = 0; |
if ((!$includeempty) && (!$currentvalue)) { |
} else { |
$currentvalue = $now; |
$currentvalue = $now; |
|
} |
|
} |
} |
# other potentially useful values: wkday,yrday,is_daylight_savings |
# Do we have a date? Split it! |
my $tzname; |
|
my ($sec,$min,$hour,$mday,$month,$year)=('','',undef,'','',''); |
|
if ($currentvalue) { |
if ($currentvalue) { |
($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($currentvalue); |
($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($currentvalue); |
} |
|
unless ($wasdefined) { |
#No values provided for hour, min, sec? Use default 0 |
($tzname,$sec,$min,$hour,$mday,$month,$year) = &get_timedates($now); |
if (($defhour) || ($defmin) || ($defsec)) { |
if (($defhour) || ($defmin) || ($defsec)) { |
$sec = ($defsec ? $defsec : 0); |
$sec=($defsec?$defsec:0); |
$min = ($defmin ? $defmin : 0); |
$min=($defmin?$defmin:0); |
$hour = ($defhour ? $defhour : 0); |
$hour=($defhour?$defhour:0); |
} |
} elsif (!$includeempty) { |
|
$sec=0; |
|
$min=0; |
|
$hour=0; |
|
} |
|
} |
} |
my $result = "\n<!-- $dname date setting form -->\n"; |
my $result = "\n<!-- $dname date setting form -->\n"; |
$result .= <<ENDJS; |
$result .= <<ENDJS; |
Line 563 ENDJS
|
Line 559 ENDJS
|
$cal_link = qq{<a href="javascript:$dname\_opencalendar()">}; |
$cal_link = qq{<a href="javascript:$dname\_opencalendar()">}; |
} |
} |
# |
# |
my $tzone; |
my $tzone = ' '.$tzname.' '; |
unless ($hide_timezone) { |
|
$tzone = ' '.$tzname.' '; |
|
} |
|
if ($no_hh_mm_ss) { |
if ($no_hh_mm_ss) { |
$result .= &mt('[_1] [_2] [_3] ', |
$result .= &mt('[_1] [_2] [_3] ', |
$monthselector,$dayselector,$yearselector). |
$monthselector,$dayselector,$yearselector). |
Line 646 Returns: Unix time represented in the fo
|
Line 639 Returns: Unix time represented in the fo
|
############################################## |
############################################## |
############################################## |
############################################## |
sub get_date_from_form { |
sub get_date_from_form { |
my ($dname,$timezone) = @_; |
my ($dname) = @_; |
my ($sec,$min,$hour,$day,$month,$year); |
my ($sec,$min,$hour,$day,$month,$year); |
# |
# |
if (defined($env{'form.'.$dname.'_second'})) { |
if (defined($env{'form.'.$dname.'_second'})) { |
Line 696 sub get_date_from_form {
|
Line 689 sub get_date_from_form {
|
if (($year<1970) || ($year>2037)) { return undef; } |
if (($year<1970) || ($year>2037)) { return undef; } |
if (defined($sec) && defined($min) && defined($hour) && |
if (defined($sec) && defined($min) && defined($hour) && |
defined($day) && defined($month) && defined($year)) { |
defined($day) && defined($month) && defined($year)) { |
if (defined($timezone)) { |
my $timezone = &Apache::lonlocal::gettimezone(); |
if (&Apache::lonlocal::gettimezone($timezone) eq 'local') { |
|
$timezone = &Apache::lonlocal::gettimezone(); |
|
} |
|
} |
|
my $dt = DateTime->new( year => $year, |
my $dt = DateTime->new( year => $year, |
month => $month, |
month => $month, |
day => $day, |
day => $day, |
Line 1072 sub Increment_PrgWin {
|
Line 1061 sub Increment_PrgWin {
|
# |
# |
my $str; |
my $str; |
if ($min == 0 && $sec > 1) { |
if ($min == 0 && $sec > 1) { |
$str = '[_2] seconds'; |
$str = '[_1] seconds'; |
} elsif ($min == 1 && $sec > 1) { |
} elsif ($min == 1 && $sec > 1) { |
$str = '1 minute [_2] seconds'; |
$str = '1 minute [_2] seconds'; |
} elsif ($min == 1 && $sec < 2) { |
} elsif ($min == 1 && $sec < 2) { |
Line 1248 ENDLINK
|
Line 1237 ENDLINK
|
} |
} |
|
|
sub htmlareaheaders { |
sub htmlareaheaders { |
return if (&htmlareablocked()); |
my $s=""; |
return if (!&htmlareabrowser()); |
if (&htmlareabrowser()) { |
return (<<ENDHEADERS); |
$s.=(<<ENDEDITOR); |
<script type="text/javascript" src="/fckeditor/fckeditor.js"></script> |
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script> |
ENDHEADERS |
ENDEDITOR |
|
} |
|
$s.=(<<ENDJQUERY); |
|
<script type="text/javascript" src="/adm/jQuery/js/jquery-1.3.2.min.js"></script> |
|
<script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.7.2.custom.min.js"></script> |
|
<link rel="stylesheet" type="text/css" href="/adm/jQuery/css/smoothness/jquery-ui-1.7.2.custom.css" /> |
|
ENDJQUERY |
|
return $s; |
} |
} |
|
|
# ----------------------------------------------------------------- Preferences |
# ----------------------------------------------------------------- Preferences |
Line 1287 sub htmlarea_lang {
|
Line 1283 sub htmlarea_lang {
|
sub htmlareaselectactive { |
sub htmlareaselectactive { |
my @fields=@_; |
my @fields=@_; |
unless (&htmlareabrowser()) { return ''; } |
unless (&htmlareabrowser()) { return ''; } |
if (&htmlareablocked()) { return '<br />'.&enablelink(@fields); } |
my $output='<script type="text/javascript" defer="defer">'."\n" |
my $output='<script type="text/javascript" defer="1">'."\n" |
|
.'// <![CDATA['."\n"; |
.'// <![CDATA['."\n"; |
my $lang = &htmlarea_lang(); |
my $lang = &htmlarea_lang(); |
foreach my $field (@fields) { |
$output.=' |
$output.=" |
|
{ |
function containsBlockHtml(id) { |
var oFCKeditor = new FCKeditor('$field'); |
var re = $("#"+id).html().search(/(?:\<\;|\<)(br|h1|h2|h3|h4|h5|h6|p|ol|ul|table|pre|address|blockquote|center|div)[\s]*((?:\/[\s]*(?:\>\;|\>)|(?:\>\;|\>)[\s\S]*(?:\<\;|\<)\/[\s]*\1[\s]*\(?:\>\;|\>))/im); |
oFCKeditor.Config['CustomConfigurationsPath'] = |
return (re >= 0); |
'/fckeditor/loncapaconfig.js'; |
} |
oFCKeditor.ReplaceTextarea(); |
|
oFCKeditor.Config['AutoDetectLanguage'] = false; |
function startRichEditor(id) { |
oFCKeditor.Config['DefaultLanguage'] = '$lang'; |
CKEDITOR.replace(id, |
}"; |
{ |
|
customConfig: "/ckeditor/loncapaconfig.js" |
|
} |
|
); |
|
} |
|
|
|
function destroyRichEditor(id) { |
|
CKEDITOR.instances[id].destroy(); |
} |
} |
|
|
|
function editorHandler(event) { |
|
var rawid = $(this).attr("id"); |
|
var id = new RegExp("LC_rt_(.*)").exec(rawid)[1] |
|
event.preventDefault(); |
|
if ($(this).hasClass("LC_enable_rt")) { |
|
startRichEditor(id); |
|
$("#LC_rt_"+id).html("<b>« Plain text</b>"); |
|
$("#LC_rt_"+id).attr("title", "Disable rich text formatting and edit in plain text"); |
|
$("#LC_rt_"+id).addClass("LC_disable_rt"); |
|
$("#LC_rt_"+id).removeClass("LC_enable_rt"); |
|
} else { |
|
destroyRichEditor(id); |
|
$("#LC_rt_"+id).html("<b>Rich formatting »</b>"); |
|
$("#LC_rt_"+id).attr("title", "Enable rich text formatting (bold, italic, etc.)"); |
|
$("#LC_rt_"+id).addClass("LC_enable_rt"); |
|
$("#LC_rt_"+id).removeClass("LC_disable_rt"); |
|
} |
|
} |
|
|
|
$(document).ready(function(){ |
|
$(".LC_richAlwaysOn").each(function() { |
|
startRichEditor($(this).attr("id")); |
|
}); |
|
$(".LC_richDetectHtml").each(function() { |
|
var id = $(this).attr("id"); |
|
if(containsBlockHtml(id)) { |
|
$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Disable rich text formatting and edit in plain text\" class=\"LC_disable_rt\"><b>« Plain text</b></a></div>"); |
|
startRichEditor(id); |
|
$("#LC_rt_"+id).click(editorHandler); |
|
} |
|
else { |
|
$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Enable rich text formatting (bold, italic, etc.)\" class=\"LC_enable_rt\"><b>Rich formatting »</b></a></div>"); |
|
$("#LC_rt_"+id).click(editorHandler); |
|
} |
|
}); |
|
$(".LC_richDefaultOn").each(function() { |
|
var id = $(this).attr("id"); |
|
$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Disable rich text formatting and edit in plain text\" class=\"LC_disable_rt\"><b>« Plain text</b></a></div>"); |
|
startRichEditor(id); |
|
$("#LC_rt_"+id).click(editorHandler); |
|
}); |
|
$(".LC_richDefaultOff").each(function() { |
|
var id = $(this).attr("id"); |
|
$(this).before("<div><a href=\"#\" id=\"LC_rt_"+id+"\" title=\"Enable rich text formatting (bold, italic, etc.)\" class=\"LC_enable_rt\"><b>Rich formatting »</b></a></div>"); |
|
$("#LC_rt_"+id).click(editorHandler); |
|
}); |
|
|
|
}); |
|
'; |
$output.="\nwindow.status='Activated Editfields';\n" |
$output.="\nwindow.status='Activated Editfields';\n" |
.'// ]]>'."\n" |
.'// ]]>'."\n" |
.'</script><br />'. |
.'</script><br />'; |
&disablelink(@fields); |
|
return $output; |
return $output; |
} |
} |
|
|
Line 1385 returns: nothing
|
Line 1436 returns: nothing
|
# The first one should be the course or a menu link |
# The first one should be the course or a menu link |
if (!defined($menulink)) { $menulink=1; } |
if (!defined($menulink)) { $menulink=1; } |
if ($menulink) { |
if ($menulink) { |
if ($menulink eq '_nomenu') { |
my $description = 'Menu'; |
return unless($last); |
my $no_mt_descr = 0; |
|
if ((exists($env{'request.course.id'})) && |
|
($env{'request.course.id'} ne '') && |
|
($env{'course.'.$env{'request.course.id'}.'.description'} ne '')) { |
|
$description = |
|
$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
$no_mt_descr = 1; |
|
} |
|
$menulink = { href =>'/adm/menu', |
|
title =>'Go to main menu', |
|
target =>'_top', |
|
text =>$description, |
|
no_mt =>$no_mt_descr, }; |
|
if($last) { |
|
#$last set, so we have some crumbs |
|
unshift(@Crumbs,$menulink); |
} else { |
} else { |
my $description = 'Menu'; |
#only menulink crumb present |
my $href = '/adm/menu'; |
$last = $menulink; |
my $tooltip = 'Go to main menu'; |
|
my $no_mt_descr = 0; |
|
if ((exists($env{'request.course.id'})) && |
|
($env{'request.course.id'} ne '') && |
|
!($env{'form.context'} eq 'requestcrs')) { |
|
if ((&Apache::loncommon::needs_gci_custom()) || ($env{'user.domain'} eq 'gcitest')) { |
|
if ($env{'environment.remotenavmap'} eq 'on') { |
|
# open link using javascript when remote navmap is activated |
|
$href = "javascript:gonav('/adm/navmaps');"; |
|
} else { |
|
$href = '/adm/navmaps'; |
|
} |
|
$tooltip = 'Contents'; |
|
} |
|
if ($env{'course.'.$env{'request.course.id'}.'.description'} ne '') { |
|
$description = |
|
$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
$no_mt_descr = 1; |
|
} |
|
} |
|
$menulink = { href => $href, |
|
title => $tooltip, |
|
target => '_top', |
|
text => $description, |
|
no_mt => $no_mt_descr, }; |
|
if ($last) { |
|
#$last set, so we have some crumbs |
|
unshift(@Crumbs,$menulink); |
|
} else { |
|
#only menulink crumb present |
|
$last = $menulink; |
|
} |
|
} |
} |
} |
} |
my $links = join "", |
my $links = join "", |
map { |
map { |
$faq = $_->{'faq'} if (exists($_->{'faq'})); |
$faq = $_->{'faq'} if (exists($_->{'faq'})); |
$bug = $_->{'bug'} if (exists($_->{'bug'})); |
$bug = $_->{'bug'} if (exists($_->{'bug'})); |
$help = $_->{'help'} if (exists($_->{'help'})); |
$help = $_->{'help'} if (exists($_->{'help'})); |
|
|
my $result = $_->{no_mt} ? $_->{text} : mt($_->{text}); |
my $result = $_->{no_mt} ? $_->{text} : mt($_->{text}); |
|
|
if ($_->{href}){ |
if ($_->{href}){ |
$result = htmltag( 'a', $result, |
$result = htmltag( 'a', $result, |
{ |
{ href => $_->{href}, |
href => $_->{href}, |
title => $_->{no_mt} ? $_->{title} : mt($_->{title}), |
title => $_->{no_mt} ? |
target => $_->{target}, }); |
$_->{title} : mt($_->{title}), |
} |
target => $_->{target}, |
|
}); |
|
} |
|
|
|
$result = htmltag( 'li', "$result $crumbsymbol"); |
$result = htmltag( 'li', "$result $crumbsymbol"); |
} @Crumbs; |
} @Crumbs; |
|
|
#should the last Element be translated? |
#should the last Element be translated? |
|
|
my $lasttext = $last->{'no_mt'} ? $last->{'text'} |
my $lasttext = $last->{'no_mt'} ? $last->{'text'} |
: mt( $last->{'text'} ); |
: mt( $last->{'text'} ); |
|
|
# last breadcrumb is the first order heading of a page |
$links .= htmltag( 'li', htmltag('h1', $lasttext), {title => $lasttext}); |
# for course breadcrumbs it's just bold |
|
$links .= htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1', |
|
$lasttext), {title => $lasttext}); |
|
|
|
my $icons = ''; |
my $icons = ''; |
$faq = $last->{'faq'} if (exists($last->{'faq'})); |
$faq = $last->{'faq'} if (exists($last->{'faq'})); |
Line 1513 returns: nothing
|
Line 1541 returns: nothing
|
|
|
Adds $html to $category of the breadcrumb toolbar container. |
Adds $html to $category of the breadcrumb toolbar container. |
|
|
$html is usually a link to a page that invokes a function on the currently |
$html is usually a link to a page that invokes a function on the currently |
displayed data (e.g. print when viewing a problem) |
displayed data (e.g. print when viewing a problem) |
|
|
Currently there are 3 possible values for $category: |
Currently there are 3 possible values for $category: |
|
|
=over |
=over |
|
|
=item navigation |
=item navigation |
left of breadcrumbs line |
left of breadcrumbs line |
|
|
=item tools |
=item tools |
right of breadcrumbs line |
right of breadcrumbs line |
|
|
=item advtools |
=item advtools |
advanced tools shown in a separate box below breadcrumbs line |
advanced tools shown in a separate box below breadcrumbs line |
|
|
=back |
=back |
|
|
returns: nothing |
returns: nothing |
|
|
=cut |
=cut |
Line 1538 returns: nothing
|
Line 1566 returns: nothing
|
sub add_breadcrumb_tool { |
sub add_breadcrumb_tool { |
my ($category, @html) = @_; |
my ($category, @html) = @_; |
return unless @html; |
return unless @html; |
if (!defined(%tools)) { |
if (!defined(%tools)) { |
%tools = ( navigation => [], tools => [], advtools => []); |
%tools = ( navigation => [], tools => [], advtools => []); |
} |
} |
|
|
#this cleans data received from lonmenu::innerregister |
#this cleans data received from lonmenu::innerregister |
@html = grep {defined $_ && $_ ne ''} @html; |
@html = grep {defined $_ && $_ ne ''} @html; |
for (@html) { |
for (@html) { |
s/align="(right|left)"//; |
s/align="(right|left)"//; |
s/<span.*?\/span>// if $category ne 'advtools'; |
s/<span.*?\/span>// if $category ne 'advtools'; |
} |
} |
|
|
push @{$tools{$category}}, @html; |
push @{$tools{$category}}, @html; |
} |
} |
Line 1566 returns: nothing
|
Line 1594 returns: nothing
|
|
|
=item render_tools(\$breadcrumbs) |
=item render_tools(\$breadcrumbs) |
|
|
Creates html for breadcrumb tools (categories navigation and tools) and inserts |
Creates html for breadcrumb tools (categories navigation and tools) and inserts |
\$breadcrumbs at the correct position. |
\$breadcrumbs at the correct position. |
|
|
input: \$breadcrumbs - a reference to the string containing prepared |
input: \$breadcrumbs - a reference to the string containing prepared |
breadcrumbs. |
breadcrumbs. |
|
|
returns: nothing |
returns: nothing |
Line 1580 returns: nothing
|
Line 1608 returns: nothing
|
my ($breadcrumbs) = @_; |
my ($breadcrumbs) = @_; |
return unless defined %tools; |
return unless defined %tools; |
|
|
my $navigation = list_from_array($tools{navigation}, |
my $navigation = list_from_array($tools{navigation}, |
{ listattr => { class=>"LC_breadcrumb_tools_navigation" } }); |
{ listattr => { class=>"LC_breadcrumb_tools_navigation" } }); |
my $tools = list_from_array($tools{tools}, |
my $tools = list_from_array($tools{tools}, |
{ listattr => { class=>"LC_breadcrumb_tools_tools" } }); |
{ listattr => { class=>"LC_breadcrumb_tools_tools" } }); |
$$breadcrumbs = list_from_array([$navigation, $tools, $$breadcrumbs], |
$$breadcrumbs = list_from_array([$navigation, $tools, $$breadcrumbs], |
{ listattr => { class=>'LC_breadcrumb_tools_outerlist' } }); |
{ listattr => { class=>'LC_breadcrumb_tools_outerlist' } }); |
} |
} |
|
|
=item render_advtools(\$breadcrumbs,$legend) |
=item render_advtools(\$breadcrumbs) |
|
|
Creates html for advanced tools (category advtools) and inserts \$breadcrumbs |
Creates html for advanced tools (category advtools) and inserts \$breadcrumbs |
at the correct position. |
at the correct position. |
|
|
input: \$breadcrumbs - a reference to the string containing prepared |
input: \$breadcrumbs - a reference to the string containing prepared |
breadcrumbs (after render_tools call). |
breadcrumbs (after render_tools call). |
|
|
returns: nothing |
returns: nothing |
=cut |
=cut |
|
|
sub render_advtools { |
sub render_advtools { |
my ($breadcrumbs,$legend) = @_; |
my ($breadcrumbs) = @_; |
return unless (defined $tools{'advtools'}) |
return unless (defined $tools{'advtools'}) |
and (scalar(@{$tools{'advtools'}}) > 0); |
and (scalar(@{$tools{'advtools'}}) > 0); |
my $args; |
|
if ($legend) { |
|
$args = {legend => $legend}; |
|
} |
|
$$breadcrumbs .= Apache::loncommon::head_subbox( |
$$breadcrumbs .= Apache::loncommon::head_subbox( |
funclist_from_array($tools{'advtools'},$args)); |
funclist_from_array($tools{'advtools'}) ); |
} |
} |
|
|
} # End of scope for @Crumbs |
} # End of scope for @Crumbs |
Line 1964 sub course_custom_roles {
|
Line 1989 sub course_custom_roles {
|
} |
} |
|
|
|
|
|
sub resource_info_box { |
|
my ($symb,$onlyfolderflag)=@_; |
|
my $return=''; |
|
if ($symb) { |
|
$return=&Apache::loncommon::start_data_table(); |
|
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symb); |
|
my $folder=&Apache::lonnet::gettitle($map); |
|
$return.=&Apache::loncommon::start_data_table_row(). |
|
'<th>'.&mt('Folder:').'</th><td>'.$folder.'</td>'. |
|
&Apache::loncommon::end_data_table_row(); |
|
unless ($onlyfolderflag) { |
|
$return.=&Apache::loncommon::start_data_table_row(). |
|
'<th>'.&mt('Resource:').'</th><td>'.&Apache::lonnet::gettitle($symb).'</td>'. |
|
&Apache::loncommon::end_data_table_row(); |
|
} |
|
$return.=&Apache::loncommon::end_data_table(); |
|
} else { |
|
$return='<p><span class="LC_error">'.&mt('No context provided.').'</span></p>'; |
|
} |
|
return $return; |
|
|
|
} |
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
Line 2322 sub scripttag {
|
Line 2370 sub scripttag {
|
|
|
Constructs a XHTML list from \@array. |
Constructs a XHTML list from \@array. |
|
|
input: |
input: |
|
|
=over |
=over |
|
|
=item \@array |
=item \@array |
|
|
A reference to the array containing text that will be wrapped in <li></li> tags. |
A reference to the array containing text that will be wrapped in <li></li> tags. |
|
|
=item { listattr => {}, itemattr =>{} } |
=item { listattr => {}, itemattr =>{} } |
|
|
Attributes for <ul> and <li> passed in as hash references. |
Attributes for <ul> and <li> passed in as hash references. |
See htmltag() for more details. |
See htmltag() for more details. |
|
|
=back |
=back |
|
|
|
returns: XHTML list as String. |
|
|
returns: XHTML list as String. |
=cut |
|
|
=cut |
|
|
|
# \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}} |
# \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}} |
sub list_from_array { |
sub list_from_array { |
Line 2395 sub generate_menu {
|
Line 2443 sub generate_menu {
|
# create the markup for the current $link and push it into @links. |
# create the markup for the current $link and push it into @links. |
# each entry consists of an image and a text optionally followed |
# each entry consists of an image and a text optionally followed |
# by a help link. |
# by a help link. |
my $src; |
|
if ($$link{icon} ne '') { |
|
$src = '/res/adm/pages/'.$$link{icon}; |
|
} |
|
push(@links,$li->( |
push(@links,$li->( |
$a->( |
$a->( |
$img->("", { |
$img->("", { |
class => "LC_noBorder LC_middle", |
class => "LC_noBorder LC_middle", |
src => $src, |
src => "/res/adm/pages/$$link{icon}", |
alt => mt(defined($$link{alttext}) ? |
alt => mt(defined($$link{alttext}) ? |
$$link{alttext} : $$link{linktext}) |
$$link{alttext} : $$link{linktext}) |
}), { |
}), { |
Line 2533 sub end_funclist {
|
Line 2577 sub end_funclist {
|
|
|
Constructs a XHTML list from \@array with the first item being visually |
Constructs a XHTML list from \@array with the first item being visually |
highlighted and set to the value of legend or 'Functions' if legend is |
highlighted and set to the value of legend or 'Functions' if legend is |
empty. |
empty. |
|
|
=over |
=over |
|
|
Line 2547 A string that's used as visually highlig
|
Line 2591 A string that's used as visually highlig
|
it's value evaluates to false. |
it's value evaluates to false. |
|
|
=back |
=back |
|
|
returns: XHTML list as string. |
returns: XHTML list as string. |
|
|
=back |
=back |
|
|
=cut |
=cut |
|
|
sub funclist_from_array { |
sub funclist_from_array { |
my ($items, $args) = @_; |
my ($items, $args) = @_; |
$args->{legend} ||= mt('Functions'); |
$args->{legend} ||= mt('Functions'); |
return list_from_array( [$args->{legend}, @$items], |
return list_from_array( [$args->{legend}, @$items], |
{ listattr => {class => 'LC_funclist'} }); |
{ listattr => {class => 'LC_funclist'} }); |
} |
} |
|
|
1; |
1; |
|
|