version 1.257, 2009/12/22 17:27:28
|
version 1.280, 2010/07/09 14:40:20
|
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 930 Returns: none
|
Line 927 Returns: none
|
|
|
=item Increment_PrgWin |
=item Increment_PrgWin |
|
|
Increment the count of items completed for the progress window by 1. |
Increment the count of items completed for the progress window by $step or 1 if no step is provided. |
|
|
Inputs: |
Inputs: |
|
|
Line 943 Inputs:
|
Line 940 Inputs:
|
=item $extraInfo A description of the items being iterated over. Typically |
=item $extraInfo A description of the items being iterated over. Typically |
'student'. |
'student'. |
|
|
|
=item $step (optional) counter step. Will be set to default 1 if ommited. step must be greater than 0 or empty. |
|
|
=back |
=back |
|
|
Returns: none |
Returns: none |
Line 1052 sub Update_PrgWin {
|
Line 1051 sub Update_PrgWin {
|
|
|
# increment progress state |
# increment progress state |
sub Increment_PrgWin { |
sub Increment_PrgWin { |
my ($r,$prog_state,$extraInfo)=@_; |
my ($r,$prog_state,$extraInfo,$step)=@_; |
$$prog_state{'done'}++; |
$step = $step > 0 ? $step : 1; |
|
$$prog_state{'done'} += $step; |
|
|
|
# Catch (max modulo step) <> 0 |
|
my $current = $$prog_state{'done'}; |
|
my $last = ($$prog_state{'max'} - $current); |
|
if ($last <= 0) { |
|
$last = 1; |
|
$current = $$prog_state{'max'}; |
|
} |
|
|
my $time_est= (&Time::HiRes::time() - $$prog_state{'firststart'})/ |
my $time_est= (&Time::HiRes::time() - $$prog_state{'firststart'})/ |
$$prog_state{'done'} * |
$current * $last; |
($$prog_state{'max'}-$$prog_state{'done'}); |
|
$time_est = int($time_est); |
$time_est = int($time_est); |
# |
# |
my $min = int($time_est/60); |
my $min = int($time_est/60); |
my $sec = $time_est % 60; |
my $sec = $time_est % 60; |
# |
|
my $str; |
|
if ($min == 0 && $sec > 1) { |
|
$str = '[_2] seconds'; |
|
} elsif ($min == 1 && $sec > 1) { |
|
$str = '1 minute [_2] seconds'; |
|
} elsif ($min == 1 && $sec < 2) { |
|
$str = '1 minute'; |
|
} elsif ($min < 10 && $sec > 1) { |
|
$str = '[_1] minutes, [_2] seconds'; |
|
} elsif ($min >= 10 || $sec < 2) { |
|
$str = '[_1] minutes'; |
|
} |
|
$time_est = &mt($str,$min,$sec); |
|
# |
|
my $lasttime = &Time::HiRes::time()-$$prog_state{'laststart'}; |
my $lasttime = &Time::HiRes::time()-$$prog_state{'laststart'}; |
if ($lasttime > 9) { |
if ($lasttime > 9) { |
$lasttime = int($lasttime); |
$lasttime = int($lasttime); |
Line 1084 sub Increment_PrgWin {
|
Line 1078 sub Increment_PrgWin {
|
} else { |
} else { |
$lasttime = sprintf("%3.2f",$lasttime); |
$lasttime = sprintf("%3.2f",$lasttime); |
} |
} |
if ($lasttime == 1) { |
|
$lasttime = '('.$lasttime.' '.&mt('second for').' '.$extraInfo.')'; |
$sec = 0 if ($min >= 10); # Don't show seconds if remaining time >= 10 min. |
} else { |
$sec = 1 if ( ($min == 0) && ($sec == 0) ); # Little cheating: pretend to have 1 second remaining instead of 0 to have something to display |
$lasttime = '('.$lasttime.' '.&mt('seconds for').' '.$extraInfo.')'; |
|
} |
my $timeinfo = |
# |
&mt('[_1]/[_2]:' |
my $user_browser = $env{'browser.type'} if (exists($env{'browser.type'})); |
.' [quant,_3,minute,minutes,] [quant,_4,second ,seconds ,]remaining' |
my $user_os = $env{'browser.os'} if (exists($env{'browser.os'})); |
.' ([quant,_5,second] for '.$extraInfo.')', |
if (! defined($user_browser) || ! defined($user_os)) { |
$current, |
(undef,$user_browser,undef,undef,undef,$user_os) = |
$$prog_state{'max'}, |
&Apache::loncommon::decode_user_agent(); |
$min, |
} |
$sec, |
if ($user_browser eq 'explorer' && $user_os =~ 'mac') { |
$lasttime); |
$lasttime = ''; |
|
} |
|
&r_print($r,&Apache::lonhtmlcommon::scripttag( |
&r_print($r,&Apache::lonhtmlcommon::scripttag( |
$$prog_state{'window'}.'.document.'. |
$$prog_state{'window'}.'.document.'. |
$$prog_state{'formname'}.'.'. |
$$prog_state{'formname'}.'.'. |
$$prog_state{'inputname'}.'.value="'. |
$$prog_state{'inputname'}.'.value="'.$timeinfo.'";' |
$$prog_state{'done'}.'/'.$$prog_state{'max'}. |
|
': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";' |
|
)); |
)); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
$$prog_state{'laststart'}=&Time::HiRes::time(); |
} |
} |
Line 1241 ENDLINK
|
Line 1232 ENDLINK
|
|
|
sub htmlareaheaders { |
sub htmlareaheaders { |
my $s=""; |
my $s=""; |
if (!&htmlareablocked() && &htmlareabrowser()) { |
if (&htmlareabrowser()) { |
$s.=(<<ENDEDITOR); |
$s.=(<<ENDEDITOR); |
<script type="text/javascript" src="/fckeditor/fckeditor.js"></script> |
|
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script> |
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script> |
ENDEDITOR |
ENDEDITOR |
} |
} |
$s.=(<<ENDJQUERY); |
$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-1.3.2.min.js"></script> |
<script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.7.2.custom.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 |
ENDJQUERY |
return $s; |
return $s; |
} |
} |
Line 1286 sub htmlarea_lang {
|
Line 1277 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(); |
$output.=' |
$output.=' |
Line 1300 sub htmlareaselectactive {
|
Line 1290 sub htmlareaselectactive {
|
function startRichEditor(id) { |
function startRichEditor(id) { |
CKEDITOR.replace(id, |
CKEDITOR.replace(id, |
{ |
{ |
customConfig: "/ckeditor/loncapaconfig.js", |
customConfig: "/ckeditor/loncapaconfig.js" |
} |
} |
); |
); |
} |
} |
Line 1357 sub htmlareaselectactive {
|
Line 1347 sub htmlareaselectactive {
|
}); |
}); |
|
|
}); |
}); |
'; |
'; |
|
|
foreach my $field (@fields) { |
|
$output.=' |
|
|
|
{ |
|
$(document).ready(function() { |
|
if (!($("#'.$field.'").hasClass("LC_richAlwaysOn"))) { |
|
if (!($("#'.$field.'").hasClass("LC_richAlwaysOff"))) { |
|
if (!($("#'.$field.'").hasClass("LC_richDetectHtml"))) { |
|
if (!($("#'.$field.'").hasClass("LC_richDefaultOn"))) { |
|
if (!($("#'.$field.'").hasClass("LC_richDefaultOff"))) { |
|
var oFCKeditor = new FCKeditor("'.$field.'"); |
|
oFCKeditor.Config["CustomConfigurationsPath"] = |
|
"/fckeditor/loncapaconfig.js"; |
|
oFCKeditor.ReplaceTextarea(); |
|
oFCKeditor.Config["AutoDetectLanguage"] = false; |
|
oFCKeditor.Config["DefaultLanguage"] = "'.$lang.'"; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
}); |
|
}'; |
|
} |
|
$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 1468 returns: nothing
|
Line 1432 returns: nothing
|
if ($menulink) { |
if ($menulink) { |
my $description = 'Menu'; |
my $description = 'Menu'; |
my $no_mt_descr = 0; |
my $no_mt_descr = 0; |
if (exists($env{'request.course.id'}) && |
if ((exists($env{'request.course.id'})) && |
$env{'request.course.id'} ne '') { |
($env{'request.course.id'} ne '') && |
|
($env{'course.'.$env{'request.course.id'}.'.description'} ne '')) { |
$description = |
$description = |
$env{'course.'.$env{'request.course.id'}.'.description'}; |
$env{'course.'.$env{'request.course.id'}.'.description'}; |
$no_mt_descr = 1; |
$no_mt_descr = 1; |
Line 1488 returns: nothing
|
Line 1453 returns: nothing
|
} |
} |
} |
} |
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 = htmltag( 'a', |
my $result = $_->{no_mt} ? $_->{text} : mt($_->{text}); |
$_->{no_mt} ? |
|
$_->{text} : mt($_->{text}), |
if ($_->{href}){ |
{ |
$result = htmltag( 'a', $result, |
href => $_->{href}, |
{ href => $_->{href}, |
title => $_->{no_mt} ? |
title => $_->{no_mt} ? $_->{title} : mt($_->{title}), |
$_->{title} : mt($_->{title}), |
target => $_->{target}, }); |
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? |
$links .= htmltag( 'li', |
|
htmltag( 'b', |
my $lasttext = $last->{'no_mt'} ? $last->{'text'} |
$last->{'no_mt'} ? |
: mt( $last->{'text'} ); |
$last->{'text'} : mt($last->{'text'}) )); |
|
|
# last breadcrumb is the first order heading of a page |
|
# 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 1544 returns: nothing
|
Line 1513 returns: nothing
|
.$links; |
.$links; |
} |
} |
|
|
#SD START (work in progress!) |
render_tools(\$links); |
add_tools(\$links); |
|
#SD END |
|
$links = htmltag('div', $links, |
$links = htmltag('div', $links, |
{ id => "LC_breadcrumbs" }) unless ($CourseBreadcrumbs) ; |
{ id => "LC_breadcrumbs" }) unless ($CourseBreadcrumbs) ; |
add_advtools(\$links); |
render_advtools(\$links); |
|
|
# Return the @Crumbs stack to what we started with |
# Return the @Crumbs stack to what we started with |
push(@Crumbs,$last); |
push(@Crumbs,$last); |
Line 1567 returns: nothing
|
Line 1534 returns: nothing
|
push(@Crumbs,@_); |
push(@Crumbs,@_); |
} |
} |
|
|
|
=item add_breadcrumb_tool($category, $html) |
|
|
|
Adds $html to $category of the breadcrumb toolbar container. |
|
|
|
$html is usually a link to a page that invokes a function on the currently |
|
displayed data (e.g. print when viewing a problem) |
|
|
|
Currently there are 3 possible values for $category: |
|
|
|
=over |
|
|
|
=item navigation |
|
left of breadcrumbs line |
|
|
|
=item tools |
|
right of breadcrumbs line |
|
|
|
=item advtools |
|
advanced tools shown in a separate box below breadcrumbs line |
|
|
|
=back |
|
|
|
returns: nothing |
|
|
|
=cut |
|
|
#SD START (work in progress!) |
|
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)) { |
my %tools = ( A => [], B => [], C => []); |
%tools = ( navigation => [], tools => [], advtools => []); |
} |
} |
push @{$tools{$category}}, $html; |
|
|
#this cleans data received from lonmenu::innerregister |
|
@html = grep {defined $_ && $_ ne ''} @html; |
|
for (@html) { |
|
s/align="(right|left)"//; |
|
s/<span.*?\/span>// if $category ne 'advtools'; |
|
} |
|
|
|
push @{$tools{$category}}, @html; |
} |
} |
|
|
|
=item clear_breadcrumb_tools() |
|
|
|
Clears the breadcrumb toolbar container. |
|
|
|
returns: nothing |
|
|
|
=cut |
|
|
sub clear_breadcrumb_tools { |
sub clear_breadcrumb_tools { |
undef(%tools); |
undef(%tools); |
} |
} |
|
|
sub add_tools { |
=item render_tools(\$breadcrumbs) |
my ($links) = @_; |
|
|
Creates html for breadcrumb tools (categories navigation and tools) and inserts |
|
\$breadcrumbs at the correct position. |
|
|
|
input: \$breadcrumbs - a reference to the string containing prepared |
|
breadcrumbs. |
|
|
|
returns: nothing |
|
=cut |
|
|
|
#TODO might split this in separate functions for each category |
|
sub render_tools { |
|
my ($breadcrumbs) = @_; |
return unless defined %tools; |
return unless defined %tools; |
my $html = '<ul class="LC_bct">'; |
|
for my $category ('A','B') { |
my $navigation = list_from_array($tools{navigation}, |
$html .= '<li class="LC_breadcrumb_tools">' |
{ listattr => { class=>"LC_breadcrumb_tools_navigation" } }); |
. '<ul class="LC_breadcrumb_tools' |
my $tools = list_from_array($tools{tools}, |
. " LC_breadcrumb_tools_$category\">"; |
{ listattr => { class=>"LC_breadcrumb_tools_tools" } }); |
for my $item (@{$tools{$category}}){ |
$$breadcrumbs = list_from_array([$navigation, $tools, $$breadcrumbs], |
#SD ugly! I'll fix that later on |
{ listattr => { class=>'LC_breadcrumb_tools_outerlist' } }); |
$item =~ s/align="(right|left)"//; |
} |
$item =~ s/<span(.*?)\/span>//; |
|
$html .= "<li>$item</li>"; |
=item render_advtools(\$breadcrumbs) |
} |
|
$html .= '</ul></li>'; |
Creates html for advanced tools (category advtools) and inserts \$breadcrumbs |
if ($category eq 'A') { $html .= "<li>$$links</li>"; } |
at the correct position. |
} |
|
$$links = $html.'</ul>'; |
input: \$breadcrumbs - a reference to the string containing prepared |
} |
breadcrumbs (after render_tools call). |
|
|
sub add_advtools { |
returns: nothing |
my ($links) = @_; |
=cut |
return unless (defined $tools{'C'}) and (scalar (@{$tools{'C'}}) > 0); |
|
my $html = start_funclist(); |
sub render_advtools { |
for my $item (@{$tools{'C'}}){ |
my ($breadcrumbs) = @_; |
next unless $item; |
return unless (defined $tools{'advtools'}) |
$item =~ s/align="(right|left)"//; |
and (scalar(@{$tools{'advtools'}}) > 0); |
$html .= add_item_funclist($item); |
|
} |
$$breadcrumbs .= Apache::loncommon::head_subbox( |
$html .= end_funclist(); |
funclist_from_array($tools{'advtools'}) ); |
$html = Apache::loncommon::head_subbox($html); |
|
$$links .= $html; |
|
} |
} |
#SD END |
|
|
|
} # End of scope for @Crumbs |
} # End of scope for @Crumbs |
|
|
Line 1748 ENDTWO
|
Line 1764 ENDTWO
|
|
|
} # End: row_count block for pick_box |
} # End: row_count block for pick_box |
|
|
|
|
sub role_select_row { |
sub role_select_row { |
my ($roles,$title,$css_class,$show_separate_custom,$cdom,$cnum) = @_; |
my ($roles,$title,$css_class,$show_separate_custom,$cdom,$cnum) = @_; |
my $crstype = 'Course'; |
my $crstype = 'Course'; |
Line 1794 sub role_select_row {
|
Line 1809 sub role_select_row {
|
|
|
sub course_select_row { |
sub course_select_row { |
my ($title,$formname,$totcodes,$codetitles,$idlist,$idlist_titles, |
my ($title,$formname,$totcodes,$codetitles,$idlist,$idlist_titles, |
$css_class,$crstype) = @_; |
$css_class,$crstype,$standardnames) = @_; |
my $output = &row_title($title,$css_class); |
my $output = &row_title($title,$css_class); |
$output .= &course_selection($formname,$totcodes,$codetitles,$idlist,$idlist_titles,$crstype); |
$output .= &course_selection($formname,$totcodes,$codetitles,$idlist,$idlist_titles,$crstype,$standardnames); |
$output .= &row_closure(); |
$output .= &row_closure(); |
return $output; |
return $output; |
} |
} |
|
|
sub course_selection { |
sub course_selection { |
my ($formname,$totcodes,$codetitles,$idlist,$idlist_titles,$crstype) = @_; |
my ($formname,$totcodes,$codetitles,$idlist,$idlist_titles,$crstype,$standardnames) = @_; |
my $output = qq| |
my $output = qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 1849 sub course_selection {
|
Line 1864 sub course_selection {
|
if ($numtitles > 0) { |
if ($numtitles > 0) { |
$output .= '<input type="radio" name="coursepick" value="category" onclick="coursePick(this.form);alert('."'".&mt('Choose categories, from left to right')."'".')" />'.&mt('Pick courses by category:').' <br />'; |
$output .= '<input type="radio" name="coursepick" value="category" onclick="coursePick(this.form);alert('."'".&mt('Choose categories, from left to right')."'".')" />'.&mt('Pick courses by category:').' <br />'; |
$output .= '<table><tr><td>'.$$codetitles[0].'<br />'."\n". |
$output .= '<table><tr><td>'.$$codetitles[0].'<br />'."\n". |
'<select name="'.$$codetitles[0]. |
'<select name="'.$standardnames->[0]. |
'" onChange="setPick(this.form);courseSet('."'$$codetitles[0]'".')">'."\n". |
'" onChange="setPick(this.form);courseSet('."'$$codetitles[0]'".')">'."\n". |
' <option value="-1" />Select'."\n"; |
' <option value="-1" />Select'."\n"; |
my @items = (); |
my @items = (); |
Line 1879 sub course_selection {
|
Line 1894 sub course_selection {
|
$output .= '</select></td>'; |
$output .= '</select></td>'; |
for (my $i=1; $i<$numtitles; $i++) { |
for (my $i=1; $i<$numtitles; $i++) { |
$output .= '<td>'.$$codetitles[$i].'<br />'."\n". |
$output .= '<td>'.$$codetitles[$i].'<br />'."\n". |
'<select name="'.$$codetitles[$i]. |
'<select name="'.$standardnames->[$i]. |
'" onChange="courseSet('."'$$codetitles[$i]'".')">'."\n". |
'" onChange="courseSet('."'$$codetitles[$i]'".')">'."\n". |
'<option value="-1"><-Pick '.$$codetitles[$i-1].'</option>'."\n". |
'<option value="-1"><-Pick '.$$codetitles[$i-1].'</option>'."\n". |
'</select>'."\n". |
'</select>'."\n". |
Line 1971 sub course_custom_roles {
|
Line 1986 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 1995 sub topic_bar {
|
Line 2033 sub topic_bar {
|
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
# echo_form_input |
# echo_form_input |
# |
# |
# Generates html markup to add form elements from the referrer page |
# Generates html markup to add form elements from the referrer page |
Line 2060 sub echo_form_input {
|
Line 2097 sub echo_form_input {
|
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
# set_form_elements |
# set_form_elements |
# |
# |
# Generates javascript to set form elements to values based on |
# Generates javascript to set form elements to values based on |
Line 2278 sub htmltag{
|
Line 2314 sub htmltag{
|
# USAGE: inittags(@tags); |
# USAGE: inittags(@tags); |
# |
# |
# EXAMPLES: |
# EXAMPLES: |
# - my ($h1, $h2, $h3) = initTags( qw( h1 h2 h3 ) ) |
# - my ($h1, $h2, $h3) = inittags( qw( h1 h2 h3 ) ) |
# $h1->("This is a headline") #Returns: <h1>This is a headline</h1> |
# $h1->("This is a headline") #Returns: <h1>This is a headline</h1> |
# |
# |
# NOTES: See sub htmltag for further information. |
# NOTES: See sub htmltag for further information. |
Line 2327 sub scripttag {
|
Line 2363 sub scripttag {
|
}; |
}; |
|
|
|
|
|
=item list_from_array( \@array, { listattr =>{}, itemattr =>{} } ) |
|
|
|
Constructs a XHTML list from \@array. |
|
|
|
input: |
|
|
|
=over |
|
|
|
=item \@array |
|
|
|
A reference to the array containing text that will be wrapped in <li></li> tags. |
|
|
|
=item { listattr => {}, itemattr =>{} } |
|
|
|
Attributes for <ul> and <li> passed in as hash references. |
|
See htmltag() for more details. |
|
|
|
=back |
|
|
|
returns: XHTML list as String. |
|
|
|
=cut |
|
|
|
# \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}} |
|
sub list_from_array { |
|
my ($items, $args) = @_; |
|
return unless scalar @$items; |
|
my ($ul, $li) = inittags( qw(ul li) ); |
|
my $listitems = join '', map { $li->($_, $args->{itemattr}) } @$items; |
|
return $ul->( $listitems, $args->{listattr} ); |
|
} |
|
|
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
Line 2356 sub scripttag {
|
Line 2425 sub scripttag {
|
# |
# |
# Outputs: A scalar containing the html markup for the menu. |
# Outputs: A scalar containing the html markup for the menu. |
|
|
# ---- Remove when done ---- |
|
# This routine is part of the redesign of LON-CAPA and it's |
|
# subject to change during this project. |
|
# Don't rely on its current functionality as it might be |
|
# changed or removed. |
|
# -------------------------- |
|
sub generate_menu { |
sub generate_menu { |
my @menu = @_; |
my @menu = @_; |
# subs for specific html elements |
# subs for specific html elements |
Line 2484 sub add_item_funclist {
|
Line 2547 sub add_item_funclist {
|
return '<li>'.$content.'</li>'."\n"; |
return '<li>'.$content.'</li>'."\n"; |
} |
} |
|
|
############################################## |
|
############################################## |
|
|
|
=pod |
=pod |
|
|
=item &end_funclist |
=item &end_funclist |
Line 2502 add_item_funclist
|
Line 2562 add_item_funclist
|
Inputs: ./. |
Inputs: ./. |
|
|
Returns: HTML code with function list end |
Returns: HTML code with function list end |
|
|
=cut |
=cut |
|
|
############################################## |
|
############################################## |
|
|
|
sub end_funclist { |
sub end_funclist { |
return "</ul>\n"; |
return "</ul>\n"; |
} |
} |
|
|
|
=pod |
|
|
|
=item funclist_from_array( \@array, {legend => 'text for legend'} ) |
|
|
|
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 |
|
empty. |
|
|
|
=over |
|
|
|
=item \@array |
|
|
|
A reference to the array containing text that will be wrapped in <li></li> tags. |
|
|
|
=item { legend => 'text' } |
|
|
|
A string that's used as visually highlighted first item. 'Functions' is used if |
|
it's value evaluates to false. |
|
|
|
=back |
|
|
|
returns: XHTML list as string. |
|
|
|
=back |
|
|
|
=cut |
|
|
|
sub funclist_from_array { |
|
my ($items, $args) = @_; |
|
$args->{legend} ||= mt('Functions'); |
|
return list_from_array( [$args->{legend}, @$items], |
|
{ listattr => {class => 'LC_funclist'} }); |
|
} |
|
|
1; |
1; |
|
|
__END__ |
__END__ |