--- loncom/interface/lonpickcourse.pm 2014/03/11 21:42:18 1.110
+++ loncom/interface/lonpickcourse.pm 2016/04/02 04:30:21 1.117
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.110 2014/03/11 21:42:18 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.117 2016/04/02 04:30:21 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,7 +36,6 @@ use Apache::loncoursedata;
use Apache::lonnet;
use Apache::lonlocal;
use Apache::longroup;
-use Apache::courseclassifier;
use LONCAPA qw(:DEFAULT :match);
sub handler {
@@ -51,11 +50,12 @@ sub handler {
&Apache::loncommon::get_unprocessed_cgi
($ENV{'QUERY_STRING'},['domainfilter','form','cnumelement',
'cdomelement','cnameelement','roleelement',
- 'multiple','type','setroles','fixeddom','cloner']);
+ 'multiple','type','setroles','fixeddom','cloner',
+ 'crscode','crsdom']);
my ($type,$title,$jscript,$multelement,$multiple,$roleelement,$typeelement,
- $lastaction,$autosubmit,$submitopener,$cloneruname,$clonerudom);
+ $lastaction,$autosubmit,$submitopener,$cloneruname,$clonerudom,$crscode,$crsdom);
- # Get course type - Course or Community.
+ # Get course type - Course, Community or Placement.
$type = $env{'form.type'};
if (!defined($env{'form.type'})) {
$type = 'Course';
@@ -83,12 +83,16 @@ sub handler {
# if called when a DC is creating a course for another user.
if ($env{'form.form'} eq 'ccrs') {
($cloneruname,$clonerudom) = ($env{'form.cloner'} =~ /^($match_username):($match_domain)$/);
+ $crscode = $env{'form.crscode'};
+ $crsdom = $env{'request.role.domain'};
}
# if called when requesting a course
if ($env{'form.form'} eq 'requestcrs') {
$cloneruname = $env{'user.name'};
$clonerudom = $env{'user.domain'};
+ $crscode = $env{'form.crscode'};
+ $crsdom = $env{'form.crsdom'};
}
my $onlyown = 0;
@@ -106,9 +110,22 @@ sub handler {
if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) &&
($env{'form.pickedcourse'})) {
- $loaditem{'onload'} .= 'setDefaultCredits();setRoles();setSections();';
+ if ($type ne 'Community') {
+ my %coursedescription =
+ &Apache::lonnet::coursedescription($env{'form.pickedcourse'},
+ {'one_time' => '1'});
+ my $cdom = $coursedescription{'domain'};
+ my %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
+ if (($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'} || $domdefs{'textbookcredits'})) {
+ $loaditem{'onload'} .= 'setDefaultCredits();';
+ }
+ }
+ $loaditem{'onload'} .= 'setRoles();setSections();';
}
- my $js = &js_changer();
+ if ((($env{'form.gosearch'}) && ($env{'form.updater'} eq '')) && (!$onlyown)) {
+ $loaditem{'onload'} .= 'hideSearching(); ';
+ }
+ my $js = &Apache::loncommon::js_changer();
$r->print(&Apache::loncommon::start_page($title,$js,
{'add_entries' => \%loaditem,
'no_nav_bar' => 1, }));
@@ -141,8 +158,8 @@ sub handler {
my $filter = {};
my $action = '/adm/pickcourse';
my ($numtitles,$showroles,$nohost,@codetitles);
- if (!$onlyown) {
- my $filterlist = ['domainfilter'];
+ unless ($onlyown) {
+ my $filterlist = ['domainfilter','sincefilter'];
# created filter for DCs only
if ($env{'user.adv'} && $env{'form.domainfilter'} &&
exists($env{'user.role.dc./'.$env{'form.domainfilter'}.'/'})
@@ -154,7 +171,15 @@ sub handler {
}
push(@{$filterlist},('descriptfilter','instcodefilter'));
if ($env{'form.form'} eq 'rules') {
- push(@{$filterlist},'personfilter');
+ push(@{$filterlist},('personfilter','persondomfilter'));
+ if ($env{'form.persondomfilter'} eq '') {
+ unless ($env{'form.gosearch'}) {
+ $filter->{'persondomfilter'} = $env{'request.role.domain'};
+ }
+ } else {
+ $filter->{'persondomfilter'} =
+ &LONCAPA::clean_domain($env{'form.persondomfilter'});
+ }
if (($env{'form.personfilter'} ne '') && ($env{'form.persondomfilter'} ne '')) {
if (&Apache::lonnet::homeserver($env{'form.personfilter'},
$env{'form.persondomfilter'}) eq 'no_host') {
@@ -164,7 +189,7 @@ sub handler {
}
}
} else {
- push(@{$filterlist},'ownerfilter');
+ push(@{$filterlist},('ownerfilter','ownerdomfilter'));
}
# course ID filter for DCs only
if ($env{'user.adv'} && $env{'form.domainfilter'} &&
@@ -174,10 +199,46 @@ sub handler {
if ($cloneruname ne '' && $clonerudom ne '') {
push(@{$filterlist},'cloneableonly');
}
-
- $r->print(&build_filters($filterlist,$type,$roleelement,$multelement,
- $filter,$action,\$numtitles,undef,$cloneruname,
- $clonerudom,$typeelement,\@codetitles));
+ if ((ref($filterlist) eq 'ARRAY') && (ref($filter) eq 'HASH')) {
+ foreach my $item (@{$filterlist}) {
+ $filter->{$item} = $env{'form.'.$item};
+ }
+ }
+ if ($env{'form.form'} eq 'portform') {
+ $filter->{'domainfilter'} ||= $env{'user.domain'};
+ } elsif ($env{'form.form'} eq 'studentform') {
+ $filter->{'domainfilter'} ||= $env{'request.role.domain'};
+ }
+ my $codedom;
+ if ($env{'form.fixeddom'}) {
+ $codedom = $env{'request.role.domain'};
+ } else {
+ $codedom = $filter->{'domainfilter'};
+ }
+ my ($clonetext,$clonewarning);
+ if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) {
+ (my $coord_cloneable,$clonewarning) =
+ &get_coordinator_cloneable($cloneruname,$clonerudom,$type);
+ if ($env{'form.form'} eq 'ccrs') {
+ $clonetext = ''."\n";
+ }
+ if ($coord_cloneable) {
+ $clonetext .= '';
+ }
+ if ($crscode ne '') {
+ $clonetext .= '';
+ }
+ if ($crsdom ne '') {
+ $clonetext .= '';
+ }
+ }
+ $r->print(&Apache::loncommon::build_filters($filterlist,$type,$roleelement,$multelement,
+ $filter,$action,\$numtitles,undef,$cloneruname,
+ $clonerudom,$typeelement,\@codetitles,$codedom,
+ $env{'form.form'},$env{'form.fixeddom'},
+ $env{'form.prevphase'},$env{'form.cnameelement'},
+ $env{'form.cnumelement'},$env{'form.cdomelement'},
+ $env{'form.setroles'},$clonetext,$clonewarning));
}
# ---------------------------------------------------------------- Get the data
@@ -190,8 +251,22 @@ sub handler {
$domcloner = 1;
}
}
- my %courses = &search_courses($r,$type,$onlyown,$filter,$numtitles,
- $cloneruname,$clonerudom,$domcloner,\@codetitles);
+ my %courses;
+ if (!$onlyown) {
+ $r->print('
'.&mt('Searching ...').'
');
+ $r->rflush();
+ my $srchdom = $filter->{'domainfilter'};
+ %courses = &Apache::loncommon::search_courses($srchdom,$type,$filter,$numtitles,
+ $cloneruname,$clonerudom,$domcloner,
+ \@codetitles,$env{'form.cc_clone'},
+ $crsdom,$crscode);
+ } else {
+ $r->print('
');
+ my %coursehash = &Apache::loncommon::findallcourses();
+ foreach my $cid (sort(keys(%coursehash))) {
+ $courses{$cid}{'description'} = $env{'course.'.$cid.'.description'};
+ }
+ }
if ($nohost) {
$r->print (''.
&mt('User does not exist - username: [_1], domain: [_2].',
@@ -199,29 +274,13 @@ sub handler {
''.$filter->{'persondomfilter'}.'').'');
} else {
&display_matched_courses($r,$type,$multiple,$action,$showroles,$cloneruname,
- $clonerudom,%courses);
+ $clonerudom,$crsdom,$crscode,%courses);
}
}
$r->print(&Apache::loncommon::end_page());
return OK;
}
-sub js_changer {
- return <
-//
-
-
-ENDJS
-}
-
sub processpick {
my $openerform = 'rolechoice';
if ($env{'form.form'} eq 'studentform') {
@@ -324,7 +383,7 @@ function setDefaultCredits() {
}
sub display_matched_courses {
- my ($r,$type,$multiple,$action,$showroles,$cloneruname,$clonerudom,%courses) = @_;
+ my ($r,$type,$multiple,$action,$showroles,$cloneruname,$clonerudom,$crsdom,$crscode,%courses) = @_;
if ($env{'form.form'} eq 'portform') {
$action = '/adm/portfolio';
}
@@ -398,7 +457,7 @@ sub display_matched_courses {
$r->print(''.&mt('Select').' | '
.''.$titlehdr.' | '
.''.&mt('Domain').' | ');
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
$r->print(''.&mt('Course Code').' | ');
}
$r->print(''.&mt('Owner/Co-owner(s)').' | ');
@@ -417,6 +476,7 @@ sub display_matched_courses {
map {$cc_cloneable{$_} = 1;} split('&',$coord_cloneable);
}
}
+ my (%gotdomdefaults,%gotcodedefaults);
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());
@@ -442,7 +502,7 @@ sub display_matched_courses {
}
unless ($canclone) {
my $cloners = $courses{$course}{'cloners'};
- if ($cloners ne '') {
+ if ($cloners ne '') {
my @cloneable = split(',',$cloners);
if (grep(/^\*$/,@cloneable)) {
$canclone = 1;
@@ -453,6 +513,80 @@ sub display_matched_courses {
if (grep(/^\Q$cloneruname\E:\Q$clonerudom\E$/,@cloneable)) {
$canclone = 1;
}
+ unless ($canclone) {
+ if (($instcode) && ($crscode) && ($cdom eq $crsdom)) {
+ foreach my $cloner (@cloneable) {
+ if (($cloner ne '*') && ($cloner !~ /^\*\:$match_domain$/) &&
+ ($cloner !~ /^$match_username\:$match_domain$/) && ($cloner ne '')) {
+ if ($cloner =~ /\=/) {
+ my (%codedefaults,@code_order);
+ if (ref($gotcodedefaults{$cdom}) eq 'HASH') {
+ if (ref($gotcodedefaults{$cdom}{'defaults'}) eq 'HASH') {
+ %codedefaults = %{$gotcodedefaults{$cdom}{'defaults'}};
+ }
+ if (ref($gotcodedefaults{$cdom}{'order'}) eq 'ARRAY') {
+ @code_order = @{$gotcodedefaults{$cdom}{'order'}};
+ }
+ } else {
+ &Apache::lonnet::auto_instcode_defaults($cdom,
+ \%codedefaults,
+ \@code_order);
+ $gotcodedefaults{$cdom}{'defaults'} = \%codedefaults;
+ $gotcodedefaults{$cdom}{'order'} = \@code_order;
+ }
+ if (@code_order > 0) {
+ if (&Apache::lonnet::check_instcode_cloning(\%codedefaults,\@code_order,
+ $cloner,$instcode,$crscode)) {
+ $canclone = 1;
+ last;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ my %domdefs;
+ if (ref($gotdomdefaults{$cdom}) eq 'HASH') {
+ %domdefs = %{$gotdomdefaults{$cdom}};
+ } else {
+ %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
+ $gotdomdefaults{$cdom} = \%domdefs;
+ }
+ if ($domdefs{'canclone'}) {
+ unless ($domdefs{'canclone'} eq 'none') {
+ if ($domdefs{'canclone'} eq 'domain') {
+ if ($clonerudom eq $cdom) {
+ $canclone = 1;
+ }
+ } elsif (($instcode) && ($crscode) &&
+ ($cdom eq $crsdom)) {
+ my (%codedefaults,@code_order);
+ if (ref($gotcodedefaults{$cdom}) eq 'HASH') {
+ if (ref($gotcodedefaults{$cdom}{'defaults'}) eq 'HASH') {
+ %codedefaults = %{$gotcodedefaults{$cdom}{'defaults'}};
+ }
+ if (ref($gotcodedefaults{$cdom}{'order'}) eq 'ARRAY') {
+ @code_order = @{$gotcodedefaults{$cdom}{'order'}};
+ }
+ } else {
+ &Apache::lonnet::auto_instcode_defaults($cdom,
+ \%codedefaults,
+ \@code_order);
+ $gotcodedefaults{$cdom}{'defaults'} = \%codedefaults;
+ $gotcodedefaults{$cdom}{'order'} = \@code_order;
+ }
+ if (@code_order > 0) {
+ if (&Apache::lonnet::default_instcode_cloning($cdom,$domdefs{'canclone'},
+ $instcode,$crscode,\%codedefaults,
+ \@code_order)) {
+ $canclone = 1;
+ }
+ }
+ }
+ }
+ }
}
}
}
@@ -474,7 +608,7 @@ sub display_matched_courses {
$r->print(&Apache::lonnet::domain($cdom,'description')?
$cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom);
$r->print('');
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
$r->print('');
if ($instcode ne '') {
$r->print(&unescape($instcode));
@@ -558,294 +692,6 @@ sub multiples_tag {
return ($jscript,$multelement);
}
-sub build_filters {
- my ($filterlist,$type,$roleelement,$multelement,$filter,$action,
- $numtitlesref,$caller,$cloneruname,$clonerudom,$typeelement,$codetitlesref) = @_;
- my ($list,$formname,$fixeddom,$codedom,$jscript);
- $codedom = $env{'request.role.domain'};
- if (defined($env{'form.form'})) {
- $formname = $env{'form.form'};
- } else {
- $formname = $caller;
- }
- my $onchange = 'javascript:updateFilters(this)';
- my ($domainselectform,$sincefilterform,$createdfilterform,
- $ownerdomselectform,$persondomselectform,$instcodeform,
- $typeselectform,$instcodetitle);
- foreach my $item (@{$filterlist}) {
- $filter->{$item} = $env{'form.'.$item};
- if ($item ne 'descriptfilter' && $item ne 'instcodefilter') {
- if ($item eq 'domainfilter') {
- $filter->{$item} = &LONCAPA::clean_domain($filter->{$item});
- } elsif ($item eq 'coursefilter') {
- $filter->{$item} = &LONCAPA::clean_courseid($filter->{$item});
- } elsif ($item eq 'ownerfilter') {
- $filter->{$item} = &LONCAPA::clean_username($filter->{$item});
- $filter->{'ownerdomfilter'} =
- &LONCAPA::clean_domain($env{'form.ownerdomfilter'});
- $ownerdomselectform =
- &Apache::loncommon::select_dom_form($filter->{'ownerdomfilter'},
- 'ownerdomfilter',1);
- } elsif ($item eq 'personfilter') {
- $filter->{$item} = &LONCAPA::clean_username($filter->{$item});
- if ($env{'form.persondomfilter'} eq '') {
- unless ($env{'form.gosearch'}) {
- $filter->{'persondomfilter'} = $env{'request.role.domain'};
- }
- } else {
- $filter->{'persondomfilter'} =
- &LONCAPA::clean_domain($env{'form.persondomfilter'});
- }
- $persondomselectform =
- &Apache::loncommon::select_dom_form($filter->{'persondomfilter'},
- 'persondomfilter',1);
- } else {
- $filter->{$item} =~ s/\W//g;
- }
- if (!$filter->{$item}) {
- $filter->{$item} = '';
- }
- }
- if ($item eq 'domainfilter') {
- my $allow_blank = 1;
- if ($formname eq 'portform') {
- $filter->{$item} ||= $env{'user.domain'};
- $allow_blank=0;
- } elsif ($formname eq 'studentform') {
- $filter->{$item} ||= $env{'request.role.domain'};
- $allow_blank=0;
- }
- if ($env{'form.fixeddom'}) {
- $domainselectform = ''.
- &Apache::lonnet::domain($env{'request.role.domain'},
- 'description');
- $codedom = $env{'request.role.domain'};
- } else {
- $domainselectform =
- &Apache::loncommon::select_dom_form($filter->{$item},
- 'domainfilter',
- $allow_blank,'',$onchange);
- $codedom = $filter->{'domainfilter'};
- }
- } else {
- $list->{$item} = &HTML::Entities::encode($filter->{$item},'<>&"');
- }
- }
-
- # last course activity filter and selection
- $sincefilterform = &timebased_select_form('sincefilter',$filter);
-
- # course created filter and selection
- if (exists($filter->{'createdfilter'})) {
- $createdfilterform = &timebased_select_form('createdfilter',$filter);
- }
-
- my %lt = &Apache::lonlocal::texthash(
- 'cac' => "$type Activity",
- 'ccr' => "$type Created",
- 'cde' => "$type Title",
- 'cdo' => "$type Domain",
- 'ins' => 'Institutional Code',
- 'inc' => 'Institutional Categorization',
- 'cow' => "$type Owner/Co-owner",
- 'cop' => "$type Personnel Includes",
- 'cog' => 'Type',
- );
-
- if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) {
- my $typeval = 'Course';
- if ($type eq 'Community') {
- $typeval = 'Community';
- }
- $typeselectform = '';
- } else {
- $typeselectform = '";
- }
-
- my ($cloneableonlyform,$cloneabletitle);
- if (exists($filter->{'cloneableonly'})) {
- my $cloneableon = '';
- my $cloneableoff = ' checked="checked"';
- if ($filter->{'cloneableonly'}) {
- $cloneableon = $cloneableoff;
- $cloneableoff = '';
- }
- $cloneableonlyform = ''.(' 'x3).'';
- if ($env{'form.form'} eq 'ccrs') {
- $cloneabletitle = &mt('Cloneable for').' '.$cloneruname.':'.$clonerudom;
- } else {
- $cloneabletitle = &mt('Cloneable by you');
- }
- }
- my $officialjs;
- if ($type eq 'Course') {
- if (exists($filter->{'instcodefilter'})) {
- if (($env{'form.fixeddom'}) || ($formname eq 'requestcrs')
- || ($formname eq 'modifycourse')) {
- $officialjs = 1;
- ($instcodeform,$jscript,$$numtitlesref) =
- &Apache::courseclassifier::instcode_selectors($codedom,'filterpicker',
- $officialjs,$codetitlesref);
- if ($jscript) {
- $jscript = ''."\n";
- }
- }
- if ($instcodeform eq '') {
- $instcodeform =
- '';
- $instcodetitle = $lt{'ins'};
- } else {
- $instcodetitle = $lt{'inc'};
- }
- if ($env{'form.fixeddom'}) {
- $instcodetitle .= ' ('.$codedom.')';
- }
- }
- }
-
- my $output = qq|
-'."\n".' '."\n";
- return $jscript.$warning.$output;
-}
-
-sub timebased_select_form {
- my ($item,$filter) = @_;
- if (ref($filter) eq 'HASH') {
- $filter->{$item} = $env{'form.'.$item};
- $filter->{$item} =~ s/[^\d-]//g;
- if (!$filter->{$item}) { $filter->{$item}=-1; }
- return &Apache::loncommon::select_form(
- $filter->{$item},
- $item,
- { '-1' => '',
- '86400' => &mt('today'),
- '604800' => &mt('last week'),
- '2592000' => &mt('last month'),
- '7776000' => &mt('last three months'),
- '15552000' => &mt('last six months'),
- '31104000' => &mt('last year'),
- 'select_form_order' =>
- ['-1','86400','604800','2592000','7776000',
- '15552000','31104000']});
- }
-}
-
sub get_coordinator_cloneable {
my ($cloneruname,$clonerudom,$type) = @_;
if (($cloneruname!~/\w/) || ($clonerudom!~/\w/)) {
@@ -860,7 +706,7 @@ sub get_coordinator_cloneable {
my ($cc_clone,$ccrole);
if ($type eq 'Community') {
$ccrole = 'co';
- } elsif ($type eq 'Course') {
+ } else {
$ccrole = 'cc';
}
my %ccroles = &Apache::lonnet::get_my_roles($cloneruname,$clonerudom,
@@ -874,102 +720,6 @@ sub get_coordinator_cloneable {
}
}
-sub search_courses {
- my ($r,$type,$onlyown,$filter,$numtitles,$cloneruname,$clonerudom,$domcloner,$codetitles) = @_;
- my (%courses,%showcourses,$cloner,$ccrole);
- if ($type eq 'Community') {
- $ccrole = 'co';
- } else {
- $ccrole = 'cc';
- }
- if (!$onlyown) {
- $r->print(''.&mt('Searching ...').' ');
- $r->rflush();
- if (($filter->{'ownerfilter'} ne '') ||
- ($filter->{'ownerdomfilter'} ne '')) {
- $filter->{'combownerfilter'} = $filter->{'ownerfilter'}.':'.
- $filter->{'ownerdomfilter'};
- }
- foreach my $item ('descriptfilter','coursefilter','combownerfilter') {
- if (!$filter->{$item}) {
- $filter->{$item}='.';
- }
- }
- my $now = time;
- my $timefilter =
- ($filter->{'sincefilter'}==-1?1:$now-$filter->{'sincefilter'});
- my ($createdbefore,$createdafter);
- if (($filter->{'createdfilter'} ne '') && ($filter->{'createdfilter'} !=-1)) {
- $createdbefore = $now;
- $createdafter = $now-$filter->{'createdfilter'};
- }
- my ($instcodefilter,$regexpok);
- if ($numtitles) {
- if ($env{'form.official'} eq 'on') {
- $instcodefilter =
- &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles,$codetitles);
- $regexpok = 1;
- } elsif ($env{'form.official'} eq 'off') {
- $instcodefilter = &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles,$codetitles);
- unless ($instcodefilter eq '') {
- $regexpok = -1;
- }
- }
- } else {
- $instcodefilter = $filter->{'instcodefilter'};
- }
- if ($instcodefilter eq '') { $instcodefilter = '.'; }
- if ($type eq '') { $type = '.'; }
-
- if (($clonerudom ne '') && ($cloneruname ne '')) {
- $cloner = $cloneruname.':'.$clonerudom;
- }
- %courses =
- &Apache::lonnet::courseiddump($filter->{'domainfilter'},
- $filter->{'descriptfilter'},
- $timefilter,
- $instcodefilter,
- $filter->{'combownerfilter'},
- $filter->{'coursefilter'},
- undef,undef,$type,$regexpok,undef,undef,
- undef,undef,$cloner,$env{'form.cc_clone'},
- $filter->{'cloneableonly'},
- $createdbefore,$createdafter,undef,
- $domcloner);
- if (($filter->{'personfilter'} ne '') && ($filter->{'persondomfilter'} ne '')) {
- my %rolehash = &Apache::lonnet::get_my_roles($filter->{'personfilter'},
- $filter->{'persondomfilter'},
- 'userroles',undef,
- [$ccrole,'in','ad','ep','ta','cr'],
- $filter->{'domainfilter'});
- foreach my $role (keys(%rolehash)) {
- my ($cnum,$cdom,$courserole) = split(':',$role);
- my $cid = $cdom.'_'.$cnum;
- if (exists($courses{$cid})) {
- if (ref($courses{$cid}) eq 'HASH') {
- if (ref($courses{$cid}{roles}) eq 'ARRAY') {
- if (!grep(/^\Q$courserole\E$/,@{$courses{$cid}{roles}})) {
- push (@{$courses{$cid}{roles}},$courserole);
- }
- } else {
- $courses{$cid}{roles} = [$courserole];
- }
- $showcourses{$cid} = $courses{$cid};
- }
- }
- }
- %courses = %showcourses;
- }
- } else {
- $r->print(' ');
- my %coursehash = &Apache::loncommon::findallcourses();
- foreach my $cid (sort(keys(%coursehash))) {
- $courses{$cid}{'description'} = $env{'course.'.$cid.'.description'};
- }
- }
- return %courses;
-}
-
sub course_chooser {
my ($multiple,$cdom,$cnum,$cleandesc,$canclone) = @_;
my $output;
@@ -977,7 +727,7 @@ sub course_chooser {
$output = ' |