version 1.218, 2009/05/22 17:57:19
|
version 1.220, 2009/06/04 16:33:08
|
Line 1398 returns: nothing
|
Line 1398 returns: nothing
|
$last = $menulink; |
$last = $menulink; |
} |
} |
} |
} |
my $links .= '<li>'. |
my $links = join "", |
join('</li><li>'.$crumbsymbol, |
|
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 = '<a href="'.$_->{'href'}.'" '; |
|
if (defined($_->{'target'}) && $_->{'target'} ne '') { |
my $result = htmltag( 'a', |
$result .= 'target="'.$_->{'target'}.'" '; |
$_->{no_mt} ? $_->{text} : mt($_->{text}), |
} |
{ |
# set the possible translation for title |
href => $_->{href}, |
if ($_->{'no_mt'}) { |
title => $_->{no_mt} ? $_->{title} : mt($_->{title}), |
$result .='title="'.$_->{'title'}.'">'. |
target => $_->{target}, |
$_->{'text'}.'</a>'; |
}); |
} else { |
$result = htmltag( 'li', $crumbsymbol.$result); |
$result .='title="'.&mt($_->{'title'}).'">'. |
} @Crumbs; |
&mt($_->{'text'}).'</a>'; |
|
} |
|
$result; |
|
} @Crumbs |
|
).'</li>'; |
|
#Workaround for edit course. |
#Workaround for edit course. |
if(@Crumbs == 0 ){ |
if(@Crumbs == 0 ){ |
$links .= '<li>' if ($links ne ''); |
$links .= '<li>' if ($links ne ''); |
Line 1836 sub course_custom_roles {
|
Line 1830 sub course_custom_roles {
|
# |
# |
sub topic_bar { |
sub topic_bar { |
my ($imgnum,$title) = @_; |
my ($imgnum,$title) = @_; |
return ' |
return '<div class="LC_topic_bar">' |
<div class="LC_topic_bar"> |
.'<img src="/res/adm/pages/bl_step'.$imgnum.'.gif"' |
<img alt="'.&mt('Step [_1]',$imgnum). |
.' alt="'.&mt('Step [_1]',$imgnum).'" />' |
' "src="/res/adm/pages/bl_step'.$imgnum.'.gif" /> |
.$title |
<span>'.$title.'</span> |
.'</div>'; |
</div> |
|
'; |
|
} |
} |
|
|
############################################## |
############################################## |
Line 2094 END
|
Line 2086 END
|
return $scripttag; |
return $scripttag; |
} |
} |
|
|
|
|
|
# USAGE: htmltag(element, content, {attribute => value,...}); |
|
# |
|
# EXAMPLES: |
|
# - htmltag('a', 'this is an anchor', {href => 'www.example.com', |
|
# title => 'this is a title'}) |
|
# |
|
# - You might want to set up needed tags like: |
|
# |
|
# my $h3 = sub { return htmltag( "h3", @_ ) }; |
|
# |
|
# ... and use them: $h3->("This is a headline") |
|
# |
|
# - To set up a couple of tags, see sub inittags |
|
# |
|
# NOTES: |
|
# - Empty elements, such as <br/> are correctly terminated, |
|
# i.e. htmltag('br') returns <br/> |
|
# - Empty attributes (title="") are filtered out. |
|
# - The function will not check for deprecated attributes. |
|
# |
|
# OUTPUT: content enclosed in xhtml conform tags |
|
sub htmltag{ |
|
return |
|
qq|<$_[0]| |
|
. join( '', map { qq| $_="${$_[2]}{$_}"| if ${$_[2]}{$_} } keys %{ $_[2] } ) |
|
. ($_[1] ? qq|>$_[1]</$_[0]>| : qq|/>|). "\n"; |
|
}; |
|
|
|
|
|
# USAGE: inittags(@tags); |
|
# |
|
# EXAMPLES: |
|
# - my ($h1, $h2, $h3) = initTags( qw( h1 h2 h3 ) ) |
|
# $h1->("This is a headline") #Returns: <h1>This is a headline</h1> |
|
# |
|
# NOTES: See sub htmltag for further information. |
|
# |
|
# OUTPUT: List of subroutines. |
|
sub inittags { |
|
my @tags = @_; |
|
return map { my $tag = $_; |
|
sub { return htmltag( $tag, @_ ) } |
|
} @tags; |
|
} |
|
|
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
Line 2131 END
|
Line 2170 END
|
# -------------------------- |
# -------------------------- |
sub generate_menu { |
sub generate_menu { |
my @menu = @_; |
my @menu = @_; |
|
|
# usage: $wrap->(element, content, {attribute => value,...}); |
|
# output: content enclosed in html conform tags |
|
my $wrap = sub { |
|
return |
|
qq|<$_[0]| |
|
. join( '', map { qq| $_="${$_[2]}{$_}"| } keys %{ $_[2] } ) |
|
. ($_[1] ? qq|>$_[1]</$_[0]>| : qq|/>|). "\n"; |
|
}; |
|
|
|
# subs for specific html elements |
# subs for specific html elements |
my $h3 = sub { return $wrap->( "h3", @_ ) }; |
my ($h3, $div, $ul, $li, $a, $img) = inittags( qw(h3 div ul li a img) ); |
my $div = sub { return $wrap->( "div", @_ ) }; |
|
my $ul = sub { return $wrap->( "ul", @_ ) }; |
|
my $li = sub { return $wrap->( "li", @_ ) }; |
|
my $a = sub { return $wrap->( "a", @_ ) }; |
|
my $img = sub { return $wrap->( "img", @_ ) }; |
|
|
|
my @categories; # each element represents the entire markup for a category |
my @categories; # each element represents the entire markup for a category |
|
|