version 1.32, 2008/06/27 04:59:45
|
version 1.34, 2008/07/04 15:40:04
|
Line 84 function setCatDepth(depth) {
|
Line 84 function setCatDepth(depth) {
|
} |
} |
|
|
ENDSCRIPT |
ENDSCRIPT |
|
if ($env{'form.state'} eq 'listing') { |
|
$catjs .= qq| |
|
function changeSort(caller) { |
|
document.$formname.sortby.value = caller; |
|
document.$formname.submit(); |
|
} |
|
function setCourseId(caller) { |
|
document.$formname.coursenum.value = caller; |
|
document.$formname.submit(); |
|
}\n|; |
|
} |
my $numtitles; |
my $numtitles; |
if ($env{'form.currcat_0'} eq 'instcode::0') { |
if ($env{'form.currcat_0'} eq 'instcode::0') { |
$numtitles = &instcode_course_selector($r,$codedom,$formname,$domdesc, |
$numtitles = &instcode_course_selector($r,$codedom,$formname,$domdesc, |
Line 96 ENDSCRIPT
|
Line 107 ENDSCRIPT
|
$catjs = '<script type="text/javascript">'."\n".$catjs."\n".'</script>'; |
$catjs = '<script type="text/javascript">'."\n".$catjs."\n".'</script>'; |
&cat_header($r,$codedom,$catjs,\%add_entries,$catlinks); |
&cat_header($r,$codedom,$catjs,\%add_entries,$catlinks); |
if ($env{'form.currcat_0'} ne '') { |
if ($env{'form.currcat_0'} ne '') { |
|
$r->print('<form name="'.$formname. |
|
'" method="post" action="/adm/coursecatalog">'. |
|
&additional_filters($codedom)."\n"); |
|
my ($currdepth,$deeper) = &get_depth_values(); |
|
$r->print('<input type="hidden" name="catalog_maxdepth" value="'. |
|
$deeper.'" />'."\n"); |
|
for (my $i=0; $i<$deeper; $i++) { |
|
$r->print('<input type="hidden" name="currcat_'.$i.'" value="'.$env{'form.currcat_'.$i}.'" />'."\n"); |
|
} |
|
$r->print('<input type="hidden" name="coursenum" value="" />'."\n". |
|
'<input type="hidden" name="sortby" value="" />'."\n". |
|
'<input type="hidden" name="state" value="listing" />'."\n". |
|
'<input type="hidden" name="showdom" value="'. |
|
$env{'form.showdom'}.'" />'. |
|
'<input type="submit" name="catalogfilter" value="'. |
|
&mt('Display courses').'" /></form><br /><br />'); |
|
} |
|
if ($env{'form.state'} eq 'listing') { |
$r->print(&print_course_listing($codedom)); |
$r->print(&print_course_listing($codedom)); |
} |
} |
} |
} |
Line 212 function setElements() {
|
Line 241 function setElements() {
|
$jscript .= '}'; |
$jscript .= '}'; |
} |
} |
} |
} |
if ($env{'form.state'} eq 'listing') { |
|
$jscript .= qq| |
|
function changeSort(caller) { |
|
document.$formname.sortby.value = caller; |
|
copy_filters(); |
|
document.$formname.submit(); |
|
} |
|
function setCourseId(caller) { |
|
document.$formname.coursenum.value = caller; |
|
copy_filters(); |
|
document.$formname.submit(); |
|
}\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 268 function display_courses() {
|
Line 253 function display_courses() {
|
'<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'."\n". |
'<input type="hidden" name="catalog_maxdepth" value="'.$cat_maxdepth.'" />'."\n". |
'<input type="hidden" name="showdom" value="'.$env{'form.showdom'}.'" />'."\n". |
'<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"); |
&additional_filters($codedom)); |
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('<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>'); |
Line 312 function display_courses() {
|
Line 293 function display_courses() {
|
} |
} |
$r->print('<br />'); |
$r->print('<br />'); |
} |
} |
$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="" />'."\n". |
if ($numtitles > 0) { |
'<input type="hidden" name="sortby" value="" />'."\n". |
$r->print('<input type="button" name="catalogfilter" value="'.&mt('Display courses').'" onclick="javascript:display_courses()" />'); |
'<input type="hidden" name="state" value="listing" />'."\n". |
} |
'<input type="hidden" name="form.currcat_0" value="instcode::0" />'."\n". |
$r->print('<input type="hidden" name="numtitles" value="'. |
'<input type="submit" name="catalogfilter" value="'. |
$numtitles.'" /></form>'); |
&mt('Display courses').'" />'. |
|
'<input type="hidden" name="numtitles" value="'.$numtitles. |
|
'" /></form>'); |
if (($numtitles > 0) && ($env{'form.state'} eq 'listing')) { |
if (($numtitles > 0) && ($env{'form.state'} eq 'listing')) { |
$r->print('<br />'); |
$r->print('<br />'); |
} |
} |
Line 358 sub cat_header {
|
Line 341 sub cat_header {
|
text=>"Select courses"}); |
text=>"Select courses"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Select courses')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Select courses')); |
} |
} |
$r->print('<table border="0"><tr>'. |
$r->print('<form name="coursecatdom" method="post" action="/adm/coursecatalog">'. |
'<form name="coursecatdom" method="post" action="/adm/coursecatalog">'. |
'<table border="0"><tr><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="'.&mt('Go').'"></td></form></tr>'. |
' <input type="submit" name="godom" value="'.&mt('Change').'" /></td></tr></table></form>'. |
'<form name="coursecats" method="post" action="/adm/coursecatalog"><tr>'. |
'<form name="coursecats" method="post" action="/adm/coursecatalog">'. |
$catlinks.'</tr>'); |
'<table border="0"><tr>'.$catlinks.'</tr></table></form>'); |
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 400 sub category_breadcrumbs {
|
Line 362 sub category_breadcrumbs {
|
} |
} |
&Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems,\%idx, |
&Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems,\%idx, |
\@jsarray); |
\@jsarray); |
my $currdepth = 0; |
my ($currdepth,$deeper) = &get_depth_values(); |
my $deeper = 0; |
my $currcat_str = '<input type="hidden" name="catalog_maxdepth" value="'.$deeper.'" /><input type="hidden" name="showdom" value="'.$dom.'" />'; |
my $currcat_str; |
|
if ($env{'form.catalog_maxdepth'} ne '') { |
|
$currdepth = $env{'form.catalog_maxdepth'}; |
|
if ($env{'form.currcat_'.$currdepth} eq '') { |
|
$deeper = $currdepth; |
|
} else { |
|
$deeper = $currdepth + 1; |
|
} |
|
} |
|
$currcat_str = '<input type="hidden" name="catalog_maxdepth" value="'.$deeper.'" /><input type="hidden" name="showdom" value="'.$dom.'" />'; |
|
my $catlinks = '<td valign="top"><b>'.&mt('Catalog:').'</b></td><td><table><tr>'; |
my $catlinks = '<td valign="top"><b>'.&mt('Catalog:').'</b></td><td><table><tr>'; |
for (my $i=0; $i<$deeper; $i++) { |
for (my $i=0; $i<$deeper; $i++) { |
$currcat_str .= '<input type="hidden" name="currcat_'.$i.'" value="'.$env{'form.currcat_'.$i}.'" />'; |
$currcat_str .= '<input type="hidden" name="currcat_'.$i.'" value="'.$env{'form.currcat_'.$i}.'" />'; |
Line 430 sub category_breadcrumbs {
|
Line 382 sub category_breadcrumbs {
|
if (ref($cats[0]) eq 'ARRAY') { |
if (ref($cats[0]) eq 'ARRAY') { |
if ((@{$cats[0]} == 1) && ($cats[0][0] eq 'instcode')) { |
if ((@{$cats[0]} == 1) && ($cats[0][0] eq 'instcode')) { |
$catlinks .= &mt('Official courses (with institutional codes)'). |
$catlinks .= &mt('Official courses (with institutional codes)'). |
'<input type="hidden" name="currcat_0" value="instcode::0">'; |
'<input type="hidden" name="currcat_0" value="instcode::0" />'; |
$env{'form.currcat_0'} = 'instcode::0'; |
$env{'form.currcat_0'} = 'instcode::0'; |
} else { |
} else { |
$catlinks .= '<select name="currcat_0">'."\n"; |
$catlinks .= '<select name="currcat_0">'."\n"; |
Line 457 sub category_breadcrumbs {
|
Line 409 sub category_breadcrumbs {
|
$catlinks .= '</option>'."\n"; |
$catlinks .= '</option>'."\n"; |
} |
} |
$catlinks .= '</select>'."\n". |
$catlinks .= '</select>'."\n". |
' <input type="submit" name="gocats" value="'.&mt('Display courses').'" />'; |
' <input type="submit" name="gocats" value="'.&mt('Change').'" />'; |
} |
} |
} else { |
} else { |
$catlinks .= &mt('Official courses (with institutional codes)'). |
$catlinks .= &mt('Official courses (with institutional codes)'). |
'<input type="hidden" name="currcat_0" value="instcode::0">'; |
'<input type="hidden" name="currcat_0" value="instcode::0" />'; |
$env{'form.currcat_0'} = 'instcode::0'; |
$env{'form.currcat_0'} = 'instcode::0'; |
} |
} |
} else { |
} else { |
Line 487 sub category_breadcrumbs {
|
Line 439 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="'.&mt('Display courses').'" />'; |
' <input type="submit" name="gocats" value="'.&mt('Change').'" />'; |
} |
} |
} |
} |
$catlinks .= $currcat_str.'</td></tr></table></td>'; |
$catlinks .= $currcat_str.'</td></tr></table></td>'; |
return $catlinks; |
return $catlinks; |
} |
} |
|
|
|
sub get_depth_values { |
|
my $currdepth = 0; |
|
my $deeper = 0; |
|
if ($env{'form.catalog_maxdepth'} ne '') { |
|
$currdepth = $env{'form.catalog_maxdepth'}; |
|
if ($env{'form.currcat_'.$currdepth} eq '') { |
|
$deeper = $currdepth; |
|
} else { |
|
$deeper = $currdepth + 1; |
|
} |
|
} |
|
return ($currdepth,$deeper); |
|
} |
|
|
|
sub additional_filters { |
|
my ($codedom) = @_; |
|
my $output = '<table>'; |
|
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" '; |
|
} |
|
my $dc_title = &Apache::lonnet::plaintext('dc'); |
|
$output .= '<tr><td>'."\n". |
|
'<label><input type="checkbox" name="showdetails" value="1" '. |
|
$showdetails_status.'/>'."\n". |
|
&mt('Show full details for each course ([_1] only)',$dc_title). |
|
'</label>'."\n".'</td></tr><tr><td>'. |
|
'<label><input type="checkbox" name="showhidden" value="1" '. |
|
$showhidden_status.'/>'. |
|
&mt('Include courses set to be hidden from catalog ([_1] only)',$dc_title). |
|
'</label>'."\n".'</td></tr>'; |
|
} |
|
$output .= '<tr><td>'. |
|
'<label><input type="checkbox" name="showselfenroll" value="1" '. |
|
$show_selfenroll_status.'/>'. |
|
&mt('Only show courses which allow self-enrollment'). |
|
'</label></td></tr></table><br />'; |
|
return $output; |
|
} |
|
|
sub user_is_dc { |
sub user_is_dc { |
my ($codedom) = @_; |
my ($codedom) = @_; |
if (exists($env{'user.role.dc./'.$codedom.'/'})) { |
if (exists($env{'user.role.dc./'.$codedom.'/'})) { |
Line 661 sub print_course_listing {
|
Line 662 sub print_course_listing {
|
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'}, |
undef,undef,'Course',1); |
undef,undef,'.',1); |
if (keys(%courses) == 0) { |
if (keys(%courses) == 0) { |
$output .= &mt('The courseID provided does not match a course in this domain.'); |
$output .= &mt('The courseID provided does not match a course in this domain.'); |
return $output; |
return $output; |
Line 858 sub build_courseinfo_hash {
|
Line 859 sub build_courseinfo_hash {
|
if ( defined($coursehash{'default_enrollment_end_date'}) ) { |
if ( defined($coursehash{'default_enrollment_end_date'}) ) { |
$endaccess = &Apache::lonlocal::locallocaltime($coursehash{'default_enrollment_end_date'}); |
$endaccess = &Apache::lonlocal::locallocaltime($coursehash{'default_enrollment_end_date'}); |
if ($coursehash{'default_enrollment_end_date'} == 0) { |
if ($coursehash{'default_enrollment_end_date'} == 0) { |
$endaccess = "No ending date"; |
$endaccess = &mt('No ending date'); |
} |
} |
} |
} |
if ($startaccess) { |
if ($startaccess) { |
Line 867 sub build_courseinfo_hash {
|
Line 868 sub build_courseinfo_hash {
|
if ($endaccess) { |
if ($endaccess) { |
$accessdates .= &mt('<i>To:</i> ').$endaccess.'<br />'; |
$accessdates .= &mt('<i>To:</i> ').$endaccess.'<br />'; |
} |
} |
|
if (($selfenroll_types ne '') && |
|
($selfenroll_end > 0 && $selfenroll_end > $now)) { |
|
my ($selfenroll_start_access,$selfenroll_end_access); |
|
if (($coursehash{'default_enrollment_start_date'} ne |
|
$coursehash{'internal.selfenroll_start_access'}) || |
|
($coursehash{'default_enrollment_end_date'} ne |
|
$coursehash{'internal.selfenroll_end_access'})) { |
|
if ( defined($coursehash{'internal.selfenroll_start_access'}) ) { |
|
$selfenroll_start_access = &Apache::lonlocal::locallocaltime($coursehash{'internal.selfenroll_start_access'}); |
|
} |
|
if ( defined($coursehash{'default_enrollment_end_date'}) ) { |
|
$selfenroll_end_access = &Apache::lonlocal::locallocaltime($coursehash{'internal.selfenroll_end_access'}); |
|
if ($coursehash{'internal.selfenroll_end_access'} == 0) { |
|
$selfenroll_end_access = &mt('No ending date'); |
|
} |
|
} |
|
if ($selfenroll_start_access || $selfenroll_end_access) { |
|
$accessdates .= '<br/><br /><i>'.&mt('Self-enrollers:').'</i><br />'; |
|
if ($selfenroll_start_access) { |
|
$accessdates .= &mt('<i>From:</i> ').$selfenroll_start_access.'<br />'; |
|
} |
|
if ($selfenroll_end_access) { |
|
$accessdates .= &mt('<i>To:</i> ').$selfenroll_end_access.'<br />'; |
|
} |
|
} |
|
} |
|
} |
$courseinfo{$course}{'access'} = $accessdates; |
$courseinfo{$course}{'access'} = $accessdates; |
} |
} |
if ($xlist_items eq '') { |
if ($xlist_items eq '') { |