--- loncom/interface/lonpickcourse.pm 2004/05/07 21:51:30 1.16 +++ loncom/interface/lonpickcourse.pm 2004/11/12 23:29:56 1.18 @@ -1,7 +1,7 @@ # The LearningOnline Network # Pick a course # -# $Id: lonpickcourse.pm,v 1.16 2004/05/07 21:51:30 albertel Exp $ +# $Id: lonpickcourse.pm,v 1.18 2004/11/12 23:29:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,7 +52,7 @@ ENDDOCUMENT &Apache::loncommon::get_unprocessed_cgi ($ENV{'QUERY_STRING'},['domainfilter','descriptfilter', 'sincefilter','form','cnumelement', - 'cdomelement','cnameelement']); + 'cdomelement','cnameelement','roleelement']); # domain filter and selection my $domainfilter=$ENV{'form.domainfilter'}; $domainfilter=~s/\W//g; @@ -90,6 +90,15 @@ ENDDOCUMENT $name_input =''; } + my $submitopener = ''; + my $autosubmit = ''; + my $roleelement = ''; + my $roledom = $ENV{'form.roleelement'}; + if ($roledom) { + $roleelement = ''; + $submitopener = &Apache::lonroles::processpick($roledom); + $autosubmit = 'process_pick("'.$roledom.'")'; + } $r->print(< function gochoose(cname,cdom,cdesc) { @@ -100,15 +109,17 @@ function gochoose(cname,cdom,cdesc) { for (i=0;i +$submitopener
$name_input - +$roleelement $lt{'cac'}: $sincefilterform
$lt{'cdo'}: $domainselectform @@ -131,15 +142,21 @@ ENDSCRIPT $r->print(''); my %by_descrip; foreach my $course (keys %courses) { - $by_descrip{lc($courses{$course})}=$course; + my $descr; + if ($courses{$course} =~ m/^([^:]*):/) { + $descr = &Apache::lonnet::unescape($1); + } else { + $descr = &Apache::lonnet::unescape($courses{$course}); + } + $by_descrip{lc($descr)}=$course; } foreach my $description (sort(keys(%by_descrip))) { my $course=$by_descrip{$description}; - my $cleandesc=&HTML::Entities::encode($courses{$course},'<>&"'); + my $cleandesc=&HTML::Entities::encode($description,'<>&"'); $cleandesc=~s/'/\\'/g; my ($cdom,$cnum)=split(/\_/,$course); $r->print(' '.$courses{$course}.' ('. + "'".$cnum."','".$cdom."','".$cleandesc."')".'" /> '.$description.' ('. ($Apache::lonnet::domaindescription{$cdom}? $Apache::lonnet::domaindescription{$cdom}:$cdom). ")
\n"); @@ -149,7 +166,7 @@ ENDSCRIPT } $r->print(''); return OK; -} +} 1; __END__