--- loncom/interface/lonpickcourse.pm 2007/10/22 22:16:38 1.66 +++ loncom/interface/lonpickcourse.pm 2008/07/01 05:26:04 1.73.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network # Pick a course # -# $Id: lonpickcourse.pm,v 1.66 2007/10/22 22:16:38 raeburn Exp $ +# $Id: lonpickcourse.pm,v 1.73.2.2 2008/07/01 05:26:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -93,7 +93,8 @@ sub handler { if ($env{'form.form'} eq 'portform') { $lastaction = 'document.courselist.submit()'; - } elsif ($env{'form.form'} eq 'cu' || $env{'form.form'} eq 'studentform') { + } elsif ($env{'form.form'} eq 'cu' || ($env{'form.form'} eq 'studentform' && + !$multiple)) { $lastaction = 'document.courselist.pickedcourse.value = cdom+"_"+cname;'."\n". 'document.courselist.submit();'; @@ -103,7 +104,7 @@ sub handler { # if called to assign a role in a course to a user via CUSR if ($env{'form.form'} eq 'cu' || $env{'form.form'} eq 'studentform') { - $r->print(&create_user_javascript($type)); + $r->print(&create_user_javascript($type)); } # print javascript functions for choosing a course @@ -214,9 +215,39 @@ sub display_matched_courses { if ($env{'form.form'} eq 'portform') { $action = '/adm/portfolio'; } + my $numcourses = keys(%courses); $r->print('
'); + if ($env{'form.form'} eq 'modifycourse') { + if ($numcourses > 0) { + my $cctitle = &Apache::lonnet::plaintext('cc',$type); + my $dctitle = &Apache::lonnet::plaintext('dc'); + my $ccrolechk = ' checked="checked" '; + my $menuchk = ' '; + if ($env{'form.prevphase'} ne '') { + $ccrolechk = ' '; + $menuchk = ' checked="checked" '; + } + $r->print( + ''. + ''. + ''. + ''. + ''. + '
'.&mt('Action').''. + ''.(' 'x3).''. + '
'. + ''. + '
'. + '
'); + } + } my %by_descrip; - my $numcourses = keys(%courses); foreach my $course (keys(%courses)) { my $descr; if (ref($courses{$course}) eq 'HASH') { @@ -229,6 +260,7 @@ sub display_matched_courses { my $description = $descr; push (@{$by_descrip{$description}}, $course); } + if ($numcourses > 1 && $multiple) { $r->print(' @@ -236,8 +268,22 @@ sub display_matched_courses { onclick="javascript:uncheckAll(document.courselist.course_id)" />

'); } + + if (%courses) { + $r->print(&Apache::loncommon::start_data_table()); + $r->print(&Apache::loncommon::start_data_table_header_row()); + $r->print(''.&mt('Select').'' + .''.&mt('Course Description').'' + .''.&mt('Domain').'' + .''.&mt('Course Code').'' + .''.&mt('Owner/Co-owner(s)').'' +# .''.&mt('Type').'' + ); + $r->print(&Apache::loncommon::end_data_table_header_row()); + } foreach my $description (sort { lc($a) cmp lc($b) } (keys(%by_descrip))) { foreach my $course (@{$by_descrip{$description}}) { + $r->print(&Apache::loncommon::start_data_table_row()); my $cleandesc=&HTML::Entities::encode($description,'<>&"'); $cleandesc=~s/'/\\'/g; my ($cdom,$cnum)=split(/\_/,$course); @@ -257,26 +303,37 @@ sub display_matched_courses { ($descr,$instcode,$singleowner,$ttype)=split(/:/,$courses{$course}); push(@owners,&unescape($singleowner)); } - my $owner = join(', ',@owners); - $r->print(&course_chooser($multiple,$cdom,$cnum,$cleandesc)); - $r->print($description.'('. - (&Apache::lonnet::domain($cdom,'description')? - &Apache::lonnet::domain($cdom,'description'):$cdom).")"); + my $ownerstr = join(', ',@owners); + $r->print(''.&course_chooser($multiple,$cdom,$cnum,$cleandesc).''); + $r->print(''.$description.''); + $r->print(''); + $r->print(&Apache::lonnet::domain($cdom,'description')? + $cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom); + $r->print(''); + $r->print(''); if ($instcode ne '') { - $r->print(" - ".&unescape($instcode)); - } - if (@owners > 1) { - $r->print(', '.&mt('owners').' - ',join(', ',@owners)); - } elsif (@owners == 1) { - $r->print(', '.&mt('owner').' - '.$owner); - } - if ($ttype ne '') { - $r->print('('.&unescape($ttype).')'); + $r->print(&unescape($instcode)); + } else { + $r->print(' '); } + $r->print(''); + $r->print(''.$ownerstr.''); +# $r->print(''); +# if ($ttype ne '') { +# $r->print(&mt(&unescape($ttype))); +# } else { +# $r->print(' '); +# } +# $r->print(''); if ($multiple) { $r->print("\n"); } - $r->print("
\n"); + $r->print(&Apache::loncommon::end_data_table_row()); + # $r->print("
\n"); } } + if (%courses) { + $r->print(&Apache::loncommon::end_data_table()); + } + if (!%courses) { $r->print(&mt('None found')); } elsif ($multiple) { @@ -295,7 +352,6 @@ sub display_matched_courses { $r->print(''); $r->print(''); } elsif ($env{'form.form'} eq 'modifycourse') { - $r->print(''."\n"); $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','pickedcourse','type','form'])); } else { $r->print(''; } foreach my $posstype ('Course','Non-standard Course') { - $typeselectform.='\n"; + $typeselectform.='\n"; } $typeselectform.=""; my $output = qq| @@ -402,8 +461,10 @@ sub build_filters { |; if ($formname eq 'modifycourse') { - $output .= ''; - } else { + $output .= ''."\n". + ''."\n"; + } else { my $name_input; if ($env{'form.cnameelement'} ne '') { $name_input = ''."\n"; - } +# if ($typeselectform) { +# $output .= $lt{'cog'}.': '.$typeselectform.'
'."\n"; +# } if ($instcodeform) { $output .= $lt{'cin'}.': '.$instcodeform.'
'."\n"; } @@ -448,11 +509,8 @@ $multelement ''."\n"; } - $output .= qq| -

-
-
-|; + $output .= '

'."\n".''."\n".'
'."\n"; return $output; } @@ -460,7 +518,7 @@ sub search_courses { my ($r,$type,$onlyown,$filter) = @_; my %courses; if (!$onlyown) { - $r->print(&mt('Searching').' ...
 
'); + $r->print(&mt('Searching ...').'
 
'); $r->rflush(); if (($filter->{'ownerfilter'} ne '') || ($filter->{'ownerdomfilter'} ne '')) { @@ -500,7 +558,7 @@ sub course_chooser { if ($multiple) { $output = '