--- loncom/interface/lonpickcourse.pm 2011/01/25 02:49:42 1.101 +++ loncom/interface/lonpickcourse.pm 2013/03/01 04:55:35 1.106 @@ -1,7 +1,7 @@ # The LearningOnline Network # Pick a course # -# $Id: lonpickcourse.pm,v 1.101 2011/01/25 02:49:42 raeburn Exp $ +# $Id: lonpickcourse.pm,v 1.106 2013/03/01 04:55:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,6 +31,7 @@ package Apache::lonpickcourse; use strict; use Apache::Constants qw(:common); use Apache::loncommon; +use Apache::lonhtmlcommon; use Apache::loncoursedata; use Apache::lonnet; use Apache::lonlocal; @@ -105,10 +106,11 @@ sub handler { if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && ($env{'form.pickedcourse'})) { - $loaditem{'onload'} .= 'setRoles();setSections();'; + $loaditem{'onload'} .= 'setDefaultCredits();setRoles();setSections();'; } my $js = &js_changer(); - $r->print(&Apache::loncommon::start_page($title,$js, + $r->print(&Apache::loncommon::start_page($title, + &Apache::lonhtmlcommon::scripttag($js), {'add_entries' => \%loaditem, 'no_nav_bar' => 1, })); @@ -133,8 +135,7 @@ sub handler { $onlyown) { $r->print(&gochoose_javascript($type,$multiple,$autosubmit,$lastaction)); } - $r->print(''); + $r->print(&Apache::lonhtmlcommon::scripttag($jscript)); $r->print($submitopener); # ------------------------------------------ Display of filters to limit search @@ -207,20 +208,19 @@ sub handler { } sub js_changer { - return <<"ENDJS"; + return < - +// ENDJS - } sub processpick { @@ -282,6 +282,13 @@ sub create_user_javascript { my $cdom = $coursedescription{'domain'}; my $cnum = $coursedescription{'num'}; my $crstype = $coursedescription{'type'}; + my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); + my ($showcredits,$credits); + if (($crstype ne 'Community') && + ($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'})) { + $showcredits = 1; + $credits = $coursedescription{'internal.defaultcredits'}; + } my $sec_element = 'currsec'; my $grplist_element = 'groups'; my ($sections,$groups) = @@ -292,6 +299,7 @@ sub create_user_javascript { my $groupslist = join(',',@{$groups}); $output = qq| |; -; } return $output; } @@ -325,9 +342,10 @@ sub display_matched_courses { my $ccrolechk = ' '; my $menuchk = ' checked="checked" '; $r->print( - '
' - .''.&mt('Action').'' - .'
' - .'
' + $r->print('' + .'' + .'
' ); } } @@ -364,9 +382,9 @@ sub display_matched_courses { } if ($numcourses > 1 && $multiple) { - $r->print('print(' -   

'); } @@ -494,9 +512,9 @@ sub display_matched_courses { } if (!%courses) { - $r->print(&mt('None found')); + $r->print('

'.&mt('None found').'

'); } elsif ($multiple) { - $r->print(''); + $r->print(''); } $r->print(''. "\n".''."\n". @@ -645,7 +663,7 @@ sub build_filters { } else { $typeselectform = ''."\n". + $output .= ''."\n". '

'."\n".''."\n".'
'."\n"; return $jscript.$warning.$output; @@ -892,7 +910,7 @@ sub search_courses { $ccrole = 'cc'; } if (!$onlyown) { - $r->print(&mt('Searching ...').'
 
'); + $r->print('
'.&mt('Searching ...').'
'); $r->rflush(); if (($filter->{'ownerfilter'} ne '') || ($filter->{'ownerdomfilter'} ne '')) { @@ -1012,7 +1030,6 @@ sub gochoose_javascript { }, ); my $output .= qq| - |; - return $output; + return &Apache::lonhtmlcommon::scripttag($output); } 1; @@ -1289,7 +1310,7 @@ javascript functions used when user sele =item -(g) Scantron Operator uploading a scantron file to a course - course number is written to visible form element in opener window. Child window closes. +(g) Bubblesheet Scanning Operator uploading a bubblesheet file to a course - course number is written to visible form element in opener window. Child window closes. =item