");
+ $("#LC_rt_"+id).click(editorHandler);
+ });
+ });
+';
+
+ $output.="\nwindow.status='Activated Editfields';\n"
+ .'// ]]>'."\n"
+ .' '.
&disablelink(@fields);
return $output;
}
@@ -1265,19 +1387,19 @@ sub htmlareabrowser {
=item breadcrumbs
Compiles the previously registered breadcrumbs into an series of links.
-FAQ and BUG links will be placed on the left side of the table if they
-are defined for the last registered breadcrumb.
Additionally supports a 'component', which will be displayed on the
-right side of the table (without a link).
+right side of the breadcrumbs enclosing div (without a link).
A link to help for the component will be included if one is specified.
All inputs can be undef without problems.
-Inputs: $component (the large text on the right side of the table),
+Inputs: $component (the text on the right side of the breadcrumbs trail),
$component_help
$menulink (boolean, controls whether to include a link to /adm/menu)
$helplink (if 'nohelp' don't include the orange help link)
$css_class (optional name for the class to apply to the table for CSS)
+ $no_mt (optional flag, 1 if &mt() is _not_ to be applied to $component
+ when including the text on the right.
Returns a string containing breadcrumbs for the current page.
=item clear_breadcrumbs
@@ -1301,24 +1423,24 @@ returns: nothing
############################################################
{
my @Crumbs;
+ my %tools = ();
sub breadcrumbs {
- my ($component,$component_help,$menulink,$helplink,$css_class) = @_;
- #
- $css_class ||= 'LC_breadcrumbs';
- my $Str = "\n".'
';
+ my ($component,$component_help,$menulink,$helplink,$css_class,$no_mt, $CourseBreadcrumbs) = @_;
#
+ $css_class ||= 'LC_breadcrumbs';
+
# Make the faq and bug data cascade
- my $faq = '';
- my $bug = '';
- my $help='';
- # Crumb Symbol
- my $crumbsymbol = ' ▶ ';
+ my $faq = '';
+ my $bug = '';
+ my $help = '';
+ # Crumb Symbol
+ my $crumbsymbol = '»';
# The last breadcrumb does not have a link, so handle it separately.
my $last = pop(@Crumbs);
#
# The first one should be the course or a menu link
- if (!defined($menulink)) { $menulink=1; }
+ if (!defined($menulink)) { $menulink=1; }
if ($menulink) {
my $description = 'Menu';
my $no_mt_descr = 0;
@@ -1328,44 +1450,46 @@ returns: nothing
$env{'course.'.$env{'request.course.id'}.'.description'};
$no_mt_descr = 1;
}
- unshift(@Crumbs,{
- href =>'/adm/menu',
- title =>'Go to main menu',
- target =>'_top',
- text =>$description,
- no_mt =>$no_mt_descr,
- });
+ $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 {
+ #only menulink crumb present
+ $last = $menulink;
+ }
}
- my $links .=
- join($crumbsymbol,
+ my $links = join "",
map {
- $faq = $_->{'faq'} if (exists($_->{'faq'}));
- $bug = $_->{'bug'} if (exists($_->{'bug'}));
+ $faq = $_->{'faq'} if (exists($_->{'faq'}));
+ $bug = $_->{'bug'} if (exists($_->{'bug'}));
$help = $_->{'help'} if (exists($_->{'help'}));
- my $result = '{'target'}) && $_->{'target'} ne '') {
- $result .= 'target="'.$_->{'target'}.'" ';
- }
- if ($_->{'no_mt'}) {
- $result .='title="'.$_->{'title'}.'">'.
- $_->{'text'}.'';
- } else {
- $result .='title="'.&mt($_->{'title'}).'">'.
- &mt($_->{'text'}).'';
- }
- $result;
- } @Crumbs
- );
- $links .= $crumbsymbol if ($links ne '');
- if ($last->{'no_mt'}) {
- $links .= ''.$last->{'text'}.'';
- } else {
- $links .= ''.&mt($last->{'text'}).'';
- }
- #
+
+ my $result = htmltag( 'a',
+ $_->{no_mt} ?
+ $_->{text} : mt($_->{text}),
+ {
+ href => $_->{href},
+ title => $_->{no_mt} ?
+ $_->{title} : mt($_->{title}),
+ target => $_->{target},
+ });
+ $result = htmltag( 'li', "$result $crumbsymbol");
+ } @Crumbs;
+
+ #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 '') {
@@ -1374,39 +1498,101 @@ 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);
- }
- #
- $Str .= $links.'
';
- #
- if (defined($component)) {
- $Str .= '
'.
- &mt($component);
- if ($icons ne '') {
- $Str .= ' '.$icons;
- }
- $Str .= '
';
+ if ($faq ne '' || $component_help ne '' || $bug ne '') {
+ $icons .= &Apache::loncommon::help_open_menu($component,
+ $component_help,
+ $faq,$bug);
}
- $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;
+ }
+
+ #SD START (work in progress!)
+ add_tools(\$links);
+ #SD END
+ $links = htmltag('div', $links,
+ { id => "LC_breadcrumbs" }) unless ($CourseBreadcrumbs) ;
+ add_advtools(\$links);
+
# Return the @Crumbs stack to what we started with
push(@Crumbs,$last);
shift(@Crumbs);
- #
- return $Str;
+ # Return the breadcrumb's line
+ return "$links";
}
sub clear_breadcrumbs {
undef(@Crumbs);
+ undef(%tools);
}
sub add_breadcrumb {
- push (@Crumbs,@_);
+ push(@Crumbs,@_);
+ }
+
+
+ #SD START (work in progress!)
+ sub add_breadcrumb_tool {
+ my ($category, $html) = @_;
+ return unless $html;
+ if (!defined(%tools)) {
+ my %tools = ( A => [], B => [], C => []);
+ }
+ push @{$tools{$category}}, $html;
+ }
+
+ sub clear_breadcrumb_tools {
+ undef(%tools);
+ }
+
+ sub add_tools {
+ my ($links) = @_;
+ return unless defined %tools;
+ my $html = '
';
+ for my $category ('A','B') {
+ $html .= '
'
+ . '
";
+ for my $item (@{$tools{$category}}){
+ #SD ugly! I'll fix that later on
+ $item =~ s/align="(right|left)"//;
+ $item =~ s///;
+ $html .= "
$item
";
+ }
+ $html .= '
';
+ if ($category eq 'A') { $html .= "
$$links
"; }
+ }
+ $$links = $html.'
';
}
+ sub add_advtools {
+ my ($links) = @_;
+ return unless (defined $tools{'C'}) and (scalar (@{$tools{'C'}}) > 0);
+ my $html = start_funclist();
+ for my $item (@{$tools{'C'}}){
+ next unless $item;
+ $item =~ s/align="(right|left)"//;
+ $html .= add_item_funclist($item);
+ }
+ $html .= end_funclist();
+ $html = Apache::loncommon::head_subbox($html);
+ $$links .= $html;
+ }
+ #SD END
+
} # End of scope for @Crumbs
############################################################
@@ -1465,6 +1651,9 @@ returns: nothing
# routines, but can also be called directly to start and end rows which have
# needs that are not accommodated by the *_select_row() routines.
+{ # Start: row_count block for pick_box
+my @row_count;
+
sub start_pick_box {
my ($css_class) = @_;
if (defined($css_class)) {
@@ -1472,6 +1661,7 @@ sub start_pick_box {
} else {
$css_class= 'class="LC_pick_box"';
}
+ unshift(@row_count,0);
my $output = <<"END";
END
@@ -1479,6 +1669,7 @@ END
}
sub end_pick_box {
+ shift(@row_count);
my $output = <<"END";
END
@@ -1493,22 +1684,23 @@ END
}
sub row_title {
- my ($title,$css_title_class,$css_value_class) = @_;
+ my ($title,$css_title_class,$css_value_class, $css_value_furtherAttributes) = @_;
+ $row_count[0]++;
+ my $css_class = ($row_count[0] % 2)?'LC_odd_row':'LC_even_row';
$css_title_class ||= 'LC_pick_box_title';
$css_title_class = 'class="'.$css_title_class.'"';
$css_value_class ||= 'LC_pick_box_value';
- $css_value_class = 'class="'.$css_value_class.'"';
if ($title ne '') {
$title .= ':';
}
my $output = <<"ENDONE";
-
+
$title
-
+
ENDONE
return $output;
}
@@ -1530,14 +1722,21 @@ ENDTWO
return $output;
}
+} # End: row_count block for pick_box
+
+
sub role_select_row {
my ($roles,$title,$css_class,$show_separate_custom,$cdom,$cnum) = @_;
+ my $crstype = 'Course';
+ if ($cdom ne '' && $cnum ne '') {
+ $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);
+ }
my $output;
if (defined($title)) {
$output = &row_title($title,$css_class);
}
$output .= qq|
-
';
}
}
- $output .= ''.&mt('Pick specific course(s):').' '.$courseform.' selected. '."\n";
+ $output .= ''.$pickspec.' '.$courseform.' selected. '."\n";
return $output;
}
@@ -1664,7 +1875,7 @@ sub status_select_row {
$output = &row_title($title,$css_class,'LC_pick_box_select');
}
$output .= qq|
- \n|;
+ \n|;
foreach my $status_type (sort(keys(%{$types}))) {
$output .= ' ';
}
@@ -1708,7 +1919,6 @@ sub email_default_row {
sub submit_row {
my ($title,$cmd,$submit_text,$css_class) = @_;
- $submit_text = &mt($submit_text);
my $output = &row_title($title,$css_class,'LC_pick_box_submit');
$output .= qq|
@@ -1742,18 +1952,21 @@ sub course_custom_roles {
# topic_bar
#
-# Generates a div containing a numbered (static image) followed by a title
-# with a background color defined in the corresponding CSS: LC_topic_bar
-#
+# Generates a div containing an (optional) number with a white background followed by a
+# title with a background color defined in the corresponding CSS: LC_topic_bar
+# Inputs:
+# 1. number to display.
+# If input for number is empty only the title will be displayed.
+# 2. title text to display.
+# Outputs - a scalar containing html mark-up for the div.
+
sub topic_bar {
- my ($imgnum,$title) = @_;
- return '
-