--- loncom/interface/lonhtmlcommon.pm 2009/08/14 12:18:46 1.182.4.7
+++ loncom/interface/lonhtmlcommon.pm 2010/01/22 13:54:06 1.182.4.9
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.182.4.7 2009/08/14 12:18:46 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.182.4.9 2010/01/22 13:54:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1136,7 +1136,7 @@ sub crumbs {
my $output='';
unless ($noformat) { $output.='
'; }
$output.=''.$prefix.'/';
- if ($env{'user.adv'}) {
+ if (($env{'user.adv'}) | ($env{'user.author'})) {
my $path=$prefix.'/';
foreach my $dir (split('/',$uri)) {
if (! $dir) { next; }
@@ -1594,6 +1594,10 @@ ENDTWO
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);
@@ -1618,7 +1622,7 @@ sub role_select_row {
$plrole = &mt('Custom Role');
}
} else {
- $plrole=&Apache::lonnet::plaintext($role);
+ $plrole=&Apache::lonnet::plaintext($role,$crstype);
}
if (($role ne 'cr') || (!$show_separate_custom)) {
$output .= ' ';
@@ -1633,15 +1637,15 @@ sub role_select_row {
sub course_select_row {
my ($title,$formname,$totcodes,$codetitles,$idlist,$idlist_titles,
- $css_class) = @_;
+ $css_class,$crstype) = @_;
my $output = &row_title($title,$css_class);
- $output .= &course_selection($formname,$totcodes,$codetitles,$idlist,$idlist_titles);
+ $output .= &course_selection($formname,$totcodes,$codetitles,$idlist,$idlist_titles,$crstype);
$output .= &row_closure();
return $output;
}
sub course_selection {
- my ($formname,$totcodes,$codetitles,$idlist,$idlist_titles) = @_;
+ my ($formname,$totcodes,$codetitles,$idlist,$idlist_titles,$crstype) = @_;
my $output = qq|
|;
+
+ my ($allcrs,$pickspec);
+ if ($crstype eq 'Community') {
+ $allcrs = &mt('All communities');
+ $pickspec = &mt('Pick specific communities:');
+ } else {
+ $allcrs = &mt('All courses');
+ $pickspec = &mt('Pick specific course(s):');
+ }
+
my $courseform=''.&Apache::loncommon::selectcourse_link
- ($formname,'pickcourse','pickdomain','coursedesc','',1).'';
- $output .= ''.&mt('All courses').'
';
+ ($formname,'pickcourse','pickdomain','coursedesc','',1,$crstype).'';
+ $output .= ''.$allcrs.'
';
if ($totcodes > 0) {
my $numtitles = @$codetitles;
if ($numtitles > 0) {
@@ -1717,7 +1731,7 @@ sub course_selection {
$output .= '
';
}
}
- $output .= ''.&mt('Pick specific course(s):').' '.$courseform.' selected.
'."\n";
+ $output .= ''.$pickspec.' '.$courseform.' selected.
'."\n";
return $output;
}
@@ -1950,7 +1964,7 @@ sub set_form_elements {
$values{$name}[$i] =~ s/([\r\n\f]+)/\\n/g;
$values{$name}[$i] =~ s/"/\\"/g;
}
- if ($$elements{$name} eq 'text') {
+ if (($$elements{$name} eq 'text') || ($$elements{$name} eq 'hidden')) {
my $numvalues = @{$values{$name}};
if ($numvalues > 1) {
my $valuestring = join('","',@{$values{$name}});
@@ -1985,6 +1999,8 @@ sub set_form_elements {
$output .= qq|
if (courseForm.elements['$name'].value == "$value") {
courseForm.elements['$name'].checked = true;
+ } else {
+ courseForm.elements['$name'].checked = false;
}|;
}
}
@@ -2026,6 +2042,7 @@ sub set_form_elements {
}
}
$output .= "
+ return;
}\n";
return $output;
}