--- loncom/interface/lonpickcourse.pm 2011/01/25 02:49:42 1.101 +++ loncom/interface/lonpickcourse.pm 2014/03/11 21:42:18 1.110 @@ -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.110 2014/03/11 21:42:18 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,7 +106,7 @@ 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, @@ -133,8 +134,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 +207,19 @@ sub handler { } sub js_changer { - return <<"ENDJS"; + return < - +// ENDJS - } sub processpick { @@ -282,6 +281,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'} || $domdefs{'textbookcredits'}))) { + $showcredits = 1; + $credits = $coursedescription{'internal.defaultcredits'}; + } my $sec_element = 'currsec'; my $grplist_element = 'groups'; my ($sections,$groups) = @@ -292,6 +298,7 @@ sub create_user_javascript { my $groupslist = join(',',@{$groups}); $output = qq| |; -; } return $output; } @@ -325,9 +341,10 @@ sub display_matched_courses { my $ccrolechk = ' '; my $menuchk = ' checked="checked" '; $r->print( - '
' - .''.&mt('Action').'' - .'
' - .'
' + $r->print('' + .'' + .'
' ); } } @@ -364,9 +381,9 @@ sub display_matched_courses { } if ($numcourses > 1 && $multiple) { - $r->print('print(' -   

'); } @@ -494,9 +511,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 +662,7 @@ sub build_filters { } else { $typeselectform = ''; } } - $output .= ''."\n". + $output .= ''."\n". '

'."\n".''."\n".'
'."\n"; return $jscript.$warning.$output; @@ -856,33 +874,6 @@ sub get_coordinator_cloneable { } } -sub instcode_selectors { - my ($codedom,$formname,$officialjs,$codetitles) = @_; - my ($output,%cat_titles,%cat_order,%cat_items); - my ($jscript,$totcodes,$numtitles,$lasttitle) = - &Apache::courseclassifier::instcode_selectors_data($codedom,$formname, - \%cat_items,$codetitles,\%cat_titles,\%cat_order,$officialjs); - if ($numtitles > 0) { - my $official = ' checked="checked" '; - my $unofficial = ''; - if ($env{'form.official'} eq 'off') { - $unofficial = $official; - $official = ''; - } - $output .= ''.&mt('Official course:').' '.(' 'x3).'
'. - &Apache::courseclassifier::build_instcode_selectors($numtitles, - $lasttitle,\%cat_items,$codetitles,\%cat_titles,\%cat_order)."\n". - ''."\n". - ''."\n"; - - } - return ($output,$jscript,$numtitles); -} - sub search_courses { my ($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom,$domcloner,$codetitles) = @_; my (%courses,%showcourses,$cloner,$ccrole); @@ -892,7 +883,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 '')) { @@ -991,7 +982,7 @@ sub course_chooser { $output = &mt('No rights to clone')."\n"; } } else { - $output = ''."\n"; } return $output; @@ -1011,8 +1002,7 @@ sub gochoose_javascript { list => 'courselist', }, ); - my $output .= qq| - |; - return $output; + return &Apache::lonhtmlcommon::scripttag($output); } 1; @@ -1289,7 +1283,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