version 1.15, 2007/01/08 15:54:56
|
version 1.16, 2007/01/10 03:57:51
|
Line 66 sub handler {
|
Line 66 sub handler {
|
&course_selector($r,$codedom,$formname,$domdesc); |
&course_selector($r,$codedom,$formname,$domdesc); |
if ($env{'form.state'} eq 'listing') { |
if ($env{'form.state'} eq 'listing') { |
$r->print('<br /><br />'.&print_course_listing($codedom).'<br />'); |
$r->print('<br /><br />'.&print_course_listing($codedom).'<br />'); |
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return OK; |
return OK; |
Line 236 function setCourseId(caller) {
|
Line 236 function setCourseId(caller) {
|
'</option>'."\n".'</select>'."\n". |
'</option>'."\n".'</select>'."\n". |
'</td>' |
'</td>' |
); |
); |
|
if (&user_is_dc($codedom)) { |
|
my $showdetails_status; |
|
if ($env{'form.showdetails'}) { |
|
$showdetails_status = 'checked="checked" '; |
|
} |
|
$r->print('<td></td><td><input type="checkbox" name="showdetails" value="1" '.$showdetails_status.'/>'.&mt('Show full details for each course (DC only)').'</td>'); |
|
} |
$r->print('</tr></table>'); |
$r->print('</tr></table>'); |
if ($numtitles > 4) { |
if ($numtitles > 4) { |
$r->print('<br /><br />'.$codetitles[$numtitles-1].'<br />'."\n". |
$r->print('<br /><br />'.$codetitles[$numtitles-1].'<br />'."\n". |
Line 252 function setCourseId(caller) {
|
Line 259 function setCourseId(caller) {
|
return; |
return; |
} |
} |
|
|
|
sub user_is_dc { |
|
my ($codedom) = @_; |
|
if (exists($env{'user.role.dc./'.$codedom.'/'})) { |
|
my $livedc = 1; |
|
my $now = time; |
|
my ($start,$end)=split(/\./,$env{'user.role.dc./'.$codedom.'/'}); |
|
if ($start && $start>$now) { $livedc = 0; } |
|
if ($end && $end <$now) { $livedc = 0; } |
|
return $livedc; |
|
} |
|
return; |
|
} |
|
|
sub recurse_options { |
sub recurse_options { |
my ($currkey,$currlist,$level,$cat,$cat_options,$data,$by_year,$by_sem,$by_dept) = @_; |
my ($currkey,$currlist,$level,$cat,$cat_options,$data,$by_year,$by_sem,$by_dept) = @_; |
Line 366 sub print_course_listing {
|
Line 385 sub print_course_listing {
|
my $output; |
my $output; |
my %courses; |
my %courses; |
my $knownuser = &user_is_known(); |
my $knownuser = &user_is_known(); |
|
my $details = $env{'form.coursenum'}; |
|
if (&user_is_dc($domain)) { |
|
if ($env{'form.showdetails'}) { |
|
$details = 1; |
|
} |
|
} |
if ($env{'form.coursenum'} ne '') { |
if ($env{'form.coursenum'} ne '') { |
%courses = &Apache::lonnet::courseiddump($domain,'.',1,'.','.', |
%courses = &Apache::lonnet::courseiddump($domain,'.',1,'.','.', |
$env{'form.coursenum'}, |
$env{'form.coursenum'}, |
Line 380 sub print_course_listing {
|
Line 405 sub print_course_listing {
|
$output = &mt('No courses match the criteria you selected.'); |
$output = &mt('No courses match the criteria you selected.'); |
return $output; |
return $output; |
} |
} |
if ($knownuser) { |
if ($knownuser && !$env{'form.showdetails'}) { |
$output = &mt('<b>Note for students:</b> If you are officially enrolled in a course but the course is not listed in your LON-CAPA courses, click the "Show more details" link for the specific course and check the default access dates and/or automated enrollment settings.<br /><br />'); |
$output = &mt('<b>Note for students:</b> If you are officially enrolled in a course but the course is not listed in your LON-CAPA courses, click the "Show more details" link for the specific course and check the default access dates and/or automated enrollment settings.<br /><br />'); |
} |
} |
} |
} |
$output .= &construct_data_table($knownuser,\%courses,$env{'form.coursenum'}); |
$output .= &construct_data_table($knownuser,\%courses,$details); |
$output .= &Apache::lonhtmlcommon::echo_form_input(['coursenum','state','catalogfilter','sortby']); |
$output .= &Apache::lonhtmlcommon::echo_form_input(['coursenum','state','catalogfilter','sortby','showdetails']); |
return $output; |
return $output; |
} |
} |
|
|
sub construct_data_table { |
sub construct_data_table { |
my ($knownuser,$courses,$details,$usersections) = @_; |
my ($knownuser,$courses,$details,$usersections) = @_; |
my %sortname; |
my %sortname; |
if ($details eq '') { |
if (($details eq '') || ($env{'form.showdetails'})) { |
$sortname{'Code'} = 'code'; |
$sortname{'Code'} = 'code'; |
$sortname{'Title'} = 'title'; |
$sortname{'Title'} = 'title'; |
$sortname{'Owner'} = 'owner'; |
$sortname{'Owner'} = 'owner'; |