--- loncom/interface/lonpickcourse.pm 2009/10/31 14:27:48 1.88 +++ loncom/interface/lonpickcourse.pm 2009/11/03 14:32:44 1.89 @@ -1,7 +1,7 @@ # The LearningOnline Network # Pick a course # -# $Id: lonpickcourse.pm,v 1.88 2009/10/31 14:27:48 raeburn Exp $ +# $Id: lonpickcourse.pm,v 1.89 2009/11/03 14:32:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -102,10 +102,7 @@ sub handler { if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && ($env{'form.pickedcourse'})) { - if ($env{'form.form'} eq 'cu') { - $loaditem{'onload'} .= 'setRoles();'; - } - $loaditem{'onload'} .= 'setSections();'; + $loaditem{'onload'} .= 'setRoles();setSections();'; } my $js = &js_changer(); $r->print(&Apache::loncommon::start_page($title,$js, @@ -300,7 +297,11 @@ sub display_matched_courses { $r->print('
'); if ($env{'form.form'} eq 'modifycourse') { if ($numcourses > 0) { - my $cctitle = &Apache::lonnet::plaintext('cc',$type); + my $ccrole = 'cc'; + if ($type eq 'Community') { + $ccrole = 'co'; + } + my $cctitle = &Apache::lonnet::plaintext($ccrole,$type); my $dctitle = &Apache::lonnet::plaintext('dc'); my $ccrolechk = ' checked="checked" '; my $menuchk = ' '; @@ -313,12 +314,21 @@ sub display_matched_courses { .''.&mt('Action').'' .'
' + .' '); + if ($type eq 'Community') { + $r->print(&mt('Enter the community with the role of [_1].',$cctitle)); + } else { + $r->print(&mt('Enter the course with the role of [_1].',$cctitle)); + } + $r->print('' .'
' + .' '); + if ($type eq 'Community') { + $r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle)); + } else { + $r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle)); + } + $r->print('' .'' .'
' ); @@ -349,13 +359,17 @@ sub display_matched_courses { if (%courses) { $r->print(&Apache::loncommon::start_data_table()); $r->print(&Apache::loncommon::start_data_table_header_row()); + my $titlehdr = &mt('Course Title'); + if ($type eq 'Community') { + $titlehdr = &mt('Community Title'); + } $r->print(''.&mt('Select').'' - .''.&mt('Course Title').'' - .''.&mt('Domain').'' - .''.&mt('Course Code').'' - .''.&mt('Owner/Co-owner(s)').'' - .''.&mt('Type').'' - ); + .''.$titlehdr.'' + .''.&mt('Domain').''); + unless ($type eq 'Community') { + $r->print(''.&mt('Course Code').''); + } + $r->print(''.&mt('Owner/Co-owner(s)').''); if ($showroles) { $r->print(''.&mt("Role(s) for [_1]", &Apache::loncommon::plainname($env{'form.personfilter'}, @@ -407,21 +421,16 @@ sub display_matched_courses { $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)); - } else { - $r->print(' '); + unless ($type eq 'Community') { + $r->print(''); + if ($instcode ne '') { + $r->print(&unescape($instcode)); + } else { + $r->print(' '); + } + $r->print(''); } - $r->print(''); $r->print(''.$ownerstr.''); - $r->print(''); - if ($ttype ne '') { - $r->print(&mt(&unescape($ttype))); - } else { - $r->print(' '); - } - $r->print(''); if ($showroles) { $r->print(''); my $rolestr; @@ -432,7 +441,7 @@ sub display_matched_courses { my (undef,$crdom,$crname,$crtitle) = split('/',$role); $rolestr .= $crtitle.', '; } else { - $rolestr .= &Apache::lonnet::plaintext($role,$ttype).', '; + $rolestr .= &Apache::lonnet::plaintext($role,$type).', '; } } $rolestr =~ s/\, $//; @@ -595,11 +604,24 @@ sub build_filters { 'cog' => &mt('Type') ); - $typeselectform = '".&mt($posstype)."\n"; + } + $typeselectform.=""; } - $typeselectform .= '>'."\n"; my ($cloneableonlyform,$cloneabletitle); if (exists($filter->{'cloneableonly'})) { @@ -643,11 +665,6 @@ sub build_filters { } } - foreach my $posstype ('Course','Community') { - $typeselectform.='\n"; - } - $typeselectform.=""; my $output = qq| @@ -688,9 +705,13 @@ $multelement .&Apache::lonhtmlcommon::row_closure(); } if ($typeselectform) { - $output .= &Apache::lonhtmlcommon::row_title($lt{'cog'}) - .$typeselectform - .&Apache::lonhtmlcommon::row_closure(); + if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) { + $output .= $typeselectform; + } else { + $output .= &Apache::lonhtmlcommon::row_title($lt{'cog'}) + .$typeselectform + .&Apache::lonhtmlcommon::row_closure(); + } } if ($instcodeform) { $output .= &Apache::lonhtmlcommon::row_title($instcodetitle) @@ -738,11 +759,17 @@ $multelement $warning = '
'.&mt('Intended course owner does not exist'). '
'; } else { + my $ccrole; + if ($type eq 'Community') { + $ccrole = 'co'; + } elsif ($type eq 'Course') { + $ccrole = 'cc'; + } if ($env{'form.form'} eq 'ccrs') { $output .= ''."\n"; } my %ccroles = &Apache::lonnet::get_my_roles($cloneruname,$clonerudom, - 'userroles',['active'], ['cc']); + 'userroles',['active'], [$ccrole]); foreach my $key (sort(keys(%ccroles))) { my ($cnum,$cdom,$role) = split(':',$key); $cc_clone .= $cdom.':'.$cnum.'&'; @@ -788,7 +815,12 @@ sub instcode_selectors { sub search_courses { my ($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom) = @_; - my (%courses,%showcourses,$cloner); + my (%courses,%showcourses,$cloner,$ccrole); + if ($type eq 'Community') { + $ccrole = 'co'; + } else { + $ccrole = 'cc'; + } if (!$onlyown) { $r->print(&mt('Searching ...').'
 
'); $r->rflush(); @@ -839,7 +871,7 @@ sub search_courses { my %rolehash = &Apache::lonnet::get_my_roles($filter->{'personfilter'}, $filter->{'persondomfilter'}, 'userroles',undef, - ['cc','in','ad','ep','ta','cr'], + [$ccrole,'in','ad','ep','ta','cr'], $filter->{'domainfilter'}); foreach my $role (keys(%rolehash)) { my ($cnum,$cdom,$courserole) = split(':',$role);