version 1.31, 2008/06/20 13:45:12
|
version 1.32, 2008/06/27 04:59:45
|
Line 100 ENDSCRIPT
|
Line 100 ENDSCRIPT
|
} |
} |
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print('<br />'.&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
Line 216 function setElements() {
|
Line 216 function setElements() {
|
$jscript .= qq| |
$jscript .= qq| |
function changeSort(caller) { |
function changeSort(caller) { |
document.$formname.sortby.value = caller; |
document.$formname.sortby.value = caller; |
|
copy_filters(); |
document.$formname.submit(); |
document.$formname.submit(); |
} |
} |
function setCourseId(caller) { |
function setCourseId(caller) { |
document.$formname.coursenum.value = caller; |
document.$formname.coursenum.value = caller; |
document.$formname.submit(); |
copy_filters(); |
|
document.$formname.submit(); |
}\n|; |
}\n|; |
} |
} |
} |
} |
|
$jscript .= qq| |
|
function copy_filters() { |
|
if (document.coursecats.showselfenroll.checked) { |
|
document.$formname.showselfenroll.value = '1'; |
|
} else { |
|
document.$formname.showselfenroll.value = ''; |
|
} |
|
|; |
|
if (&user_is_dc($codedom)) { |
|
$jscript .= qq| |
|
if (document.coursecats.showhidden.checked) { |
|
document.$formname.showhidden.value = '1'; |
|
} else { |
|
document.$formname.showhidden.value = ''; |
|
} |
|
if (document.coursecats.showdetails.checked) { |
|
document.$formname.showdetails.value = '1'; |
|
} else { |
|
document.$formname.showdetails.value = ''; |
|
} |
|
|; |
|
} |
|
$jscript .= qq| |
|
} |
|
|
|
function display_courses() { |
|
copy_filters(); |
|
document.$formname.submit(); |
|
} |
|
|
|
|; |
$js = '<script type"text/javascript">'."\n$jscript\n$catjs\n". |
$js = '<script type"text/javascript">'."\n$jscript\n$catjs\n". |
'</script>'; |
'</script>'; |
if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) { |
if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) { |
Line 232 function setCourseId(caller) {
|
Line 265 function setCourseId(caller) {
|
&cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles); |
&cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles); |
my $cat_maxdepth = $env{'form.catalog_maxdepth'}; |
my $cat_maxdepth = $env{'form.catalog_maxdepth'}; |
$r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'. |
$r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'. |
'<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'. |
'<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'."\n". |
'<input type="hidden" name="showdom" value="'.$env{'form.showdom'}.'" />'. |
'<input type="hidden" name="showdom" value="'.$env{'form.showdom'}.'" />'."\n". |
'<input type="hidden" name="currcat_0" value="instcode::0" />'); |
'<input type="hidden" name="currcat_0" value="instcode::0" />'. |
|
'<input type="hidden" name="showselfenroll" value="" />'."\n"); |
|
if (&user_is_dc($codedom)) { |
|
$r->print('<input type="hidden" name="showhidden" value="" />'."\n". |
|
'<input type="hidden" name="showdetails" value="" />'."\n"); |
|
} |
if ($numtitles > 0) { |
if ($numtitles > 0) { |
$r->print('<br /><b>'.&mt('Choose which course(s) to list.').'</b><br />'); |
$r->print('<b>'.&mt('Choose which course(s) to list.').'</b><br />'); |
$r->print('<table><tr>'); |
$r->print('<table><tr>'); |
for (my $k=0; $k<$lasttitle-1; $k++) { |
for (my $k=0; $k<$lasttitle-1; $k++) { |
my (@items,@unsorted); |
my (@items,@unsorted); |
Line 267 function setCourseId(caller) {
|
Line 305 function setCourseId(caller) {
|
'<select name="'.$codetitles[$lasttitle-1].'">'."\n". |
'<select name="'.$codetitles[$lasttitle-1].'">'."\n". |
'<option value="0">All'."\n". |
'<option value="0">All'."\n". |
'</option>'."\n".'</select>'."\n". |
'</option>'."\n".'</select>'."\n". |
'</td>' |
'</td></tr></table>'."\n"); |
); |
|
my $show_selfenroll_status; |
|
if ($env{'form.showselfenroll'}) { |
|
$show_selfenroll_status = 'checked="checked" '; |
|
} |
|
if (&user_is_dc($codedom)) { |
|
my $showdetails_status; |
|
if ($env{'form.showdetails'}) { |
|
$showdetails_status = 'checked="checked" '; |
|
} |
|
$r->print('<td></td><td><label><input type="checkbox" name="showdetails" value="1" '.$showdetails_status.'/>'.&mt('Show full details for each course (DC only)').'</label><br /><label><input type="checkbox" name="showselfenroll" value="1" '.$show_selfenroll_status.'/>'.&mt('Only show courses which allow self-enrollment').'</label></td>'); |
|
} else { |
|
$r->print('<td></td><td><br /><label><input type="checkbox" name="showselfenroll" value="1" '.$show_selfenroll_status.'/>'.&mt('Only show courses which allow self-enrollment').'</label></td>'); |
|
} |
|
$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". |
'<input type="text" name="'.$codetitles[$numtitles-1].'" /><br />'."\n"); |
'<input type="text" name="'.$codetitles[$numtitles-1].'" /><br />'."\n"); |
Line 291 function setCourseId(caller) {
|
Line 314 function setCourseId(caller) {
|
} |
} |
$r->print('<input type="hidden" name="coursenum" value="" /><input type="hidden" name="sortby" value="" /><input type="hidden" name="state" value="listing" /><input type="hidden" name="form.currcat_0" value="instcode::0" />'); |
$r->print('<input type="hidden" name="coursenum" value="" /><input type="hidden" name="sortby" value="" /><input type="hidden" name="state" value="listing" /><input type="hidden" name="form.currcat_0" value="instcode::0" />'); |
if ($numtitles > 0) { |
if ($numtitles > 0) { |
$r->print('<input type="submit" name="catalogfilter" value="'.&mt('Display courses').'" />'); |
$r->print('<input type="button" name="catalogfilter" value="'.&mt('Display courses').'" onclick="javascript:display_courses()" />'); |
} |
} |
$r->print('<input type="hidden" name="numtitles" value="'. |
$r->print('<input type="hidden" name="numtitles" value="'. |
$numtitles.'" /></form>'); |
$numtitles.'" /></form>'); |
Line 339 sub cat_header {
|
Line 362 sub cat_header {
|
'<form name="coursecatdom" method="post" action="/adm/coursecatalog">'. |
'<form name="coursecatdom" method="post" action="/adm/coursecatalog">'. |
'<td><b>'.&mt('Domain:').'</b></td><td>'. |
'<td><b>'.&mt('Domain:').'</b></td><td>'. |
&Apache::loncommon::select_dom_form($codedom,'showdom','',1). |
&Apache::loncommon::select_dom_form($codedom,'showdom','',1). |
' <input type="submit" name="godom" value="Go"></td></form></tr><tr>'. |
' <input type="submit" name="godom" value="'.&mt('Go').'"></td></form></tr>'. |
'<form name="coursecats" method="post" action="/adm/coursecatalog">'. |
'<form name="coursecats" method="post" action="/adm/coursecatalog"><tr>'. |
$catlinks.'</form></tr></table>'); |
$catlinks.'</tr>'); |
|
my $show_selfenroll_status; |
|
if ($env{'form.showselfenroll'}) { |
|
$show_selfenroll_status = 'checked="checked" '; |
|
} |
|
if (&user_is_dc($codedom)) { |
|
my $showdetails_status; |
|
if ($env{'form.showdetails'}) { |
|
$showdetails_status = 'checked="checked" '; |
|
} |
|
my $showhidden_status; |
|
if ($env{'form.showhidden'}) { |
|
$showhidden_status = 'checked="checked" '; |
|
} |
|
$r->print('<tr><td colspan="2"><label><input type="checkbox" name="showdetails" value="1" '.$showdetails_status.'/>'.&mt('Show full details for each course (DC only)').'</label></td></tr><tr><td colspan="2"><label><input type="checkbox" name="showhidden" value="1" '.$showhidden_status.'/>'.&mt('Include courses set to be hidden from catalog (DC only)').'</label></td></tr>'); |
|
} |
|
$r->print('<tr><td colspan="2">'. |
|
'<label><input type="checkbox" name="showselfenroll" value="1" '. |
|
$show_selfenroll_status.'/>'. |
|
&mt('Only show courses which allow self-enrollment'). |
|
'</label></td></tr></form></table><br />'); |
return; |
return; |
} |
} |
|
|
Line 349 sub category_breadcrumbs {
|
Line 392 sub category_breadcrumbs {
|
my ($dom) = @_; |
my ($dom) = @_; |
my %domconfig = |
my %domconfig = |
&Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); |
&Apache::lonnet::get_dom('configuration',['coursecategories'],$dom); |
my (@cats,@trails,%allitems,%idx,@jsarray); |
my (@cats,@trails,%allitems,%idx,@jsarray,$cathash); |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'},\@cats,\@trails, |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
\%allitems,\%idx,\@jsarray); |
$cathash = $domconfig{'coursecategories'}{'cats'}; |
|
} else { |
|
$cathash = {}; |
|
} |
|
&Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems,\%idx, |
|
\@jsarray); |
my $currdepth = 0; |
my $currdepth = 0; |
my $deeper = 0; |
my $deeper = 0; |
my $currcat_str; |
my $currcat_str; |
Line 409 sub category_breadcrumbs {
|
Line 457 sub category_breadcrumbs {
|
$catlinks .= '</option>'."\n"; |
$catlinks .= '</option>'."\n"; |
} |
} |
$catlinks .= '</select>'."\n". |
$catlinks .= '</select>'."\n". |
' <input type="submit" name="gocats" value="Go" />'; |
' <input type="submit" name="gocats" value="'.&mt('Display courses').'" />'; |
} |
} |
} else { |
} else { |
$catlinks .= &mt('Official courses (with institutional codes)'). |
$catlinks .= &mt('Official courses (with institutional codes)'). |
Line 439 sub category_breadcrumbs {
|
Line 487 sub category_breadcrumbs {
|
$catlinks .= '<option value="'.$item.'">'.$name.'</option>'."\n"; |
$catlinks .= '<option value="'.$item.'">'.$name.'</option>'."\n"; |
} |
} |
$catlinks .= '</select>'."\n". |
$catlinks .= '</select>'."\n". |
' <input type="submit" name="gocats" value="Go" />'; |
' <input type="submit" name="gocats" value="'.&mt('Display courses').'" />'; |
} |
} |
} |
} |
$catlinks .= $currcat_str.'</td></tr></table></td>'; |
$catlinks .= $currcat_str.'</td></tr></table></td>'; |
Line 566 sub search_official_courselist {
|
Line 614 sub search_official_courselist {
|
$instcode = '.'; |
$instcode = '.'; |
} |
} |
} |
} |
my %courses = &Apache::lonnet::courseiddump($domain,'.',1,$instcode,'.','.', |
my $showhidden; |
undef,undef,'Course',1, |
if (&user_is_dc($domain)) { |
$env{'form.showselfenroll'}); |
$showhidden = $env{'form.showhidden'}; |
|
} |
|
my %courses = |
|
&Apache::lonnet::courseiddump($domain,'.',1,$instcode,'.','.',undef,undef, |
|
'Course',1,$env{'form.showselfenroll'},undef, |
|
$showhidden,'coursecatalog'); |
return %courses; |
return %courses; |
} |
} |
|
|
Line 582 sub search_courselist {
|
Line 635 sub search_courselist {
|
} |
} |
my %courses; |
my %courses; |
if ($filter ne '') { |
if ($filter ne '') { |
%courses = &Apache::lonnet::courseiddump($domain,'.',1,'.','.','.', |
my $showhidden; |
undef,undef,'Course',1, |
if (&user_is_dc($domain)) { |
$env{'form.showselfenroll'},$filter); |
$showhidden = $env{'form.showhidden'}; |
|
} |
|
%courses = |
|
&Apache::lonnet::courseiddump($domain,'.',1,'.','.','.',undef,undef, |
|
'.',1,$env{'form.showselfenroll'}, |
|
$filter,$showhidden,'coursecatalog'); |
} |
} |
return %courses; |
return %courses; |
} |
} |
Line 618 sub print_course_listing {
|
Line 676 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 && !$env{'form.showdetails'}) { |
if (($knownuser) && (!$env{'form.showdetails'}) && (!&user_is_dc($domain))) { |
$output = '<b>'.&mt('Note for students:').'</b> ' |
$output = '<b>'.&mt('Note for students:').'</b> ' |
.&mt('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.') |
.&mt('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 />'; |
.'<br /><br />'; |