--- loncom/interface/lonhtmlcommon.pm 2009/05/26 20:06:46 1.219 +++ loncom/interface/lonhtmlcommon.pm 2009/08/10 12:32:34 1.229 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.219 2009/05/26 20:06:46 droeschl Exp $ +# $Id: lonhtmlcommon.pm,v 1.229 2009/08/10 12:32:34 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -505,23 +505,23 @@ ENDJS unshift(@Months,'If you can read this an error occurred'); if ($includeempty) { $monthselector.=""; } for(my $m = 1;$m <=$#Months;$m++) { - $monthselector .= qq{ '; + $monthselector .= qq{ '."\n"; } $monthselector.= ' '; # Day my $dayselector = qq{}; # Year - my $yearselector = qq{}; + my $yearselector = qq{}; # my $hourselector = qq{}; if ($includeempty) { $hourselector.=qq{}; } for (my $h = 0;$h<24;$h++) { - $hourselector .= qq{'; - - if($CourseBreadcrumbs){ - $Str1 = ''; - } - my $Str = ''; - # # Make the faq and bug data cascade - my $faq = ''; - my $bug = ''; - my $help=''; + my $faq = ''; + my $bug = ''; + my $help = ''; # Crumb Symbol - my $crumbsymbol = '» '; + my $crumbsymbol = '»'; # The last breadcrumb does not have a link, so handle it separately. my $last = pop(@Crumbs); # @@ -1405,30 +1396,26 @@ returns: nothing $help = $_->{'help'} if (exists($_->{'help'})); my $result = htmltag( 'a', - $_->{no_mt} ? $_->{text} : mt($_->{text}), + $_->{no_mt} ? + $_->{text} : mt($_->{text}), { href => $_->{href}, - title => $_->{no_mt} ? $_->{title} : mt($_->{title}), + title => $_->{no_mt} ? + $_->{title} : mt($_->{title}), target => $_->{target}, }); - $result = htmltag( 'li', $crumbsymbol.$result); + $result = htmltag( 'li', "$result $crumbsymbol"); } @Crumbs; -#Workaround for edit course. - if(@Crumbs == 0 ){ - $links .= '' if ($links ne ''); - } else { - $links .= ''.$crumbsymbol if ($links ne ''); - } -#should the last Element be translated? - if ($last->{'no_mt'}) { - $links .= ''.$last->{'text'}.''; - } else { - $links .= ''.&mt($last->{'text'}).''; - } - $links .= ''; + + #should the last Element be translated? + $links .= htmltag( 'li', + htmltag( 'b', + $last->{'no_mt'} ? + $last->{'text'} : mt($last->{'text'}) )); + my $icons = ''; - $faq = $last->{'faq'} if (exists($last->{'faq'})); - $bug = $last->{'bug'} if (exists($last->{'bug'})); + $faq = $last->{'faq'} if (exists($last->{'faq'})); + $bug = $last->{'bug'} if (exists($last->{'bug'})); $help = $last->{'help'} if (exists($last->{'help'})); $component_help=($component_help?$component_help:$help); # if ($faq ne '') { @@ -1437,39 +1424,36 @@ returns: nothing # if ($bug ne '') { # $icons .= &Apache::loncommon::help_open_bug($bug); # } - if ($faq ne '' || $component_help ne '' || $bug ne '') { - $icons .= &Apache::loncommon::help_open_menu($component, - $component_help, - $faq,$bug); - } + if ($faq ne '' || $component_help ne '' || $bug ne '') { + $icons .= &Apache::loncommon::help_open_menu($component, + $component_help, + $faq,$bug); + } # - if($CourseBreadcrumbs){ - $Str1 .= $links.''; - } else { - $Str1 .= $links.''; - } - # - if (defined($component)) { - $Str .= "\n".'' - .''; - if ($no_mt) { - $Str .= $component; - } else { - $Str .= &mt($component); - } - if ($icons ne '') { - $Str .= ' '.$icons; - } - $Str .= ''."\n"; + unless ($CourseBreadcrumbs) { + $links = htmltag('ol', $links, { id => "LC_MenuBreadcrumbs" }); + } else { + $links = htmltag('ul', $links, { class => "LC_CourseBreadcrumbs" }); } - # + + if ($component) { + $links = htmltag('span', + ( $no_mt ? $component : mt($component) ). + ( $icons ? $icons : '' ), + { class => 'LC_breadcrumbs_component' } ) + .$links; + } + + $links = htmltag('div', $links, + { id => "LC_breadcrumbs" }) unless ($CourseBreadcrumbs) ; + # Return the @Crumbs stack to what we started with push(@Crumbs,$last); shift(@Crumbs); - # Return a table and after that the breadcrumb's line - return "$Str\n$Str1"; + # Return the breadcrumb's line + return "$links"; } sub clear_breadcrumbs { @@ -1830,13 +1814,11 @@ sub course_custom_roles { # sub topic_bar { my ($imgnum,$title) = @_; - return ' - - - '.$title.' - -'; + return '' + .'' + .' '.$title + .''; } ############################################## @@ -2135,6 +2117,25 @@ sub inittags { } +# USAGE: scripttag(scriptcode, true/false); +# +# EXAMPLES: +# - scripttag("alert('Hello World!')") +# +# NOTES: +# - works currently only for javascripts +# +# OUTPUT: Scriptcode properly enclosed in