version 1.114, 2006/05/09 14:38:10
|
version 1.115, 2006/05/09 15:09:27
|
Line 974 ENDDROW
|
Line 974 ENDDROW
|
# |
# |
# Course level |
# Course level |
# |
# |
my $num_sections; |
|
|
|
if ($env{'request.role'} =~ m-^dc\./(\w+)/$-) { |
if ($env{'request.role'} =~ m-^dc\./(\w+)/$-) { |
$r->print(&course_level_dc($1)); |
$r->print(&course_level_dc($1)); |
Line 1761 sub course_level_table {
|
Line 1760 sub course_level_table {
|
$bgcol=~s/[^7-9a-e]//g; |
$bgcol=~s/[^7-9a-e]//g; |
$bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6); |
$bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6); |
my ($domain,$cnum)=split(/\//,$thiscourse); |
my ($domain,$cnum)=split(/\//,$thiscourse); |
my %sections_count = (); |
my %sections_count; |
my $num_sections = 0; |
|
if (defined($env{'request.course.id'})) { |
if (defined($env{'request.course.id'})) { |
if ($env{'request.course.id'} eq $domain.'_'.$cnum) { |
if ($env{'request.course.id'} eq $domain.'_'.$cnum) { |
$num_sections = &Apache::loncommon::get_sections($domain,$cnum,\%sections_count); |
%sections_count = |
|
&Apache::loncommon::get_sections($domain,$cnum); |
} |
} |
} |
} |
foreach ('st','ta','ep','ad','in','cc') { |
foreach ('st','ta','ep','ad','in','cc') { |
Line 1778 sub course_level_table {
|
Line 1777 sub course_level_table {
|
<td>$area<br />Domain: $domain</td> |
<td>$area<br />Domain: $domain</td> |
ENDEXTENT |
ENDEXTENT |
if ($_ ne 'cc') { |
if ($_ ne 'cc') { |
if ($num_sections > 0) { |
if (%sections_count) { |
my $currsec = &course_sections($num_sections,\%sections_count,$protectedcourse.'_'.$_); |
my $currsec = &course_sections(\%sections_count,$protectedcourse.'_'.$_); |
$table .= |
$table .= |
'<td><table border="0" cellspacing="0" cellpadding="0">'. |
'<td><table border="0" cellspacing="0" cellpadding="0">'. |
'<tr><td valign="top">'.$lt{'exs'}.'<br />'. |
'<tr><td valign="top">'.$lt{'exs'}.'<br />'. |
Line 1819 ENDTIMEENTRY
|
Line 1818 ENDTIMEENTRY
|
<td>$plrole</td> |
<td>$plrole</td> |
<td>$area</td> |
<td>$area</td> |
END |
END |
if ($num_sections > 0) { |
if (%sections_count) { |
my $currsec = &course_sections($num_sections,\%sections_count,$customrole); |
my $currsec = &course_sections(\%sections_count,$customrole); |
$table.= |
$table.= |
'<td><table border="0" cellspacing="0" cellpadding="0">'. |
'<td><table border="0" cellspacing="0" cellpadding="0">'. |
'<tr><td valign="top">'.$lt{'exs'}.'<br />'. |
'<tr><td valign="top">'.$lt{'exs'}.'<br />'. |
Line 1859 ENDTABLE
|
Line 1858 ENDTABLE
|
} |
} |
|
|
sub course_sections { |
sub course_sections { |
my ($num_sections,$sections_count,$role) = @_; |
my ($sections_count,$role) = @_; |
my $output = ''; |
my $output = ''; |
my @sections = (sort {$a <=> $b} keys %{$sections_count}); |
my @sections = (sort {$a <=> $b} keys %{$sections_count}); |
if ($num_sections == 1) { |
if (scalar(@sections) == 1) { |
$output = '<select name="currsec_'.$role.'" >'."\n". |
$output = '<select name="currsec_'.$role.'" >'."\n". |
' <option value="">Select</option>'."\n". |
' <option value="">Select</option>'."\n". |
' <option value="">No section</option>'."\n". |
' <option value="">No section</option>'."\n". |
Line 1870 sub course_sections {
|
Line 1869 sub course_sections {
|
} else { |
} else { |
$output = '<select name="currsec_'.$role.'" '; |
$output = '<select name="currsec_'.$role.'" '; |
my $multiple = 4; |
my $multiple = 4; |
if ($num_sections <4) { $multiple = $num_sections; } |
if (scalar(@sections) < 4) { $multiple = scalar(@sections); } |
$output .= '"multiple" size="'.$multiple.'">'."\n"; |
$output .= '"multiple" size="'.$multiple.'">'."\n"; |
foreach (@sections) { |
foreach (@sections) { |
$output .= '<option value="'.$_.'">'.$_."</option>\n"; |
$output .= '<option value="'.$_.'">'.$_."</option>\n"; |