print(''.&mt('Select').' | '
+ .''.$titlehdr.' | '
+ .''.&mt('Domain').' | ');
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
+ $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'},
+ $env{'form.persondomfilter'},'firstname')).' | ');
+ }
+ $r->print(&Apache::loncommon::end_data_table_header_row());
+ }
+ my %cc_cloneable;
+ if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) {
+ my ($coord_cloneable,$warning) =
+ &get_coordinator_cloneable($cloneruname,$clonerudom,$type);
+ if ($coord_cloneable) {
+ 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());
+ my $cleandesc=&HTML::Entities::encode($description,'<>&"');
+ $cleandesc=~s/'/\\'/g;
+ my ($cdom,$cnum)=split(/\_/,$course);
+ my ($descr,$instcode,$ttype,$canclone,@owners);
+ if (ref($courses{$course}) eq 'HASH') {
+ $descr = $courses{$course}{'description'};
+ $instcode = $courses{$course}{'inst_code'};
+ $ttype = $courses{$course}{'type'};
+ if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) {
+ if ($env{'form.form'} eq 'ccrs') {
+ if (($env{'request.role.domain'} eq $cdom) &&
+ (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) {
+ $canclone = 1;
+ }
+ }
+ unless ($canclone) {
+ if ($cc_cloneable{$cnum.':'.$cdom}) {
+ $canclone = 1;
+ }
+ }
+ unless ($canclone) {
+ my $cloners = $courses{$course}{'cloners'};
+ if ($cloners ne '') {
+ my @cloneable = split(',',$cloners);
+ if (grep(/^\*$/,@cloneable)) {
+ $canclone = 1;
+ }
+ if (grep(/^\*:\Q$clonerudom\E$/,@cloneable)) {
+ $canclone = 1;
+ }
+ 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;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ push(@owners,$courses{$course}{'owner'});
+ if ($courses{$course}{'co-owners'} ne '') {
+ foreach my $item (split(/,/,$courses{$course}{'co-owners'})) {
+ push(@owners,$item);
+ }
+ }
+ } else {
+ my $singleowner;
+ ($descr,$instcode,$singleowner,$ttype)=split(/:/,$courses{$course});
+ push(@owners,&unescape($singleowner));
+ }
+ my $ownerstr = join(', ',map { &Apache::loncommon::plainname(split(':',$_)); } @owners);
+ $r->print(''.&course_chooser($multiple,$cdom,$cnum,$cleandesc,$canclone).' | ');
+ $r->print(''.$description.' | ');
+ $r->print('');
+ $r->print(&Apache::lonnet::domain($cdom,'description')?
+ $cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom);
+ $r->print(' | ');
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
+ $r->print('');
+ if ($instcode ne '') {
+ $r->print(&unescape($instcode));
+ } else {
+ $r->print(' ');
+ }
+ $r->print(' | ');
+ }
+ $r->print(''.$ownerstr.' | ');
+ if ($showroles) {
+ $r->print('');
+ my $rolestr;
+ if (ref($courses{$course}{'roles'}) eq 'ARRAY') {
+ my @roles = sort(@{$courses{$course}{'roles'}});
+ foreach my $role (@roles) {
+ if ($role =~ /^cr/) {
+ my (undef,$crdom,$crname,$crtitle) = split('/',$role);
+ $rolestr .= $crtitle.', ';
+ } else {
+ $rolestr .= &Apache::lonnet::plaintext($role,$type).', ';
+ }
+ }
+ $rolestr =~ s/\, $//;
+ }
+ $r->print($rolestr.' | ');
}
+ if ($multiple) { $r->print("\n"); }
+ $r->print(&Apache::loncommon::end_data_table_row());
+ # $r->print("
\n");
}
}
- $autosubmit
- $lastaction
-}
+ if (%courses) {
+ $r->print(&Apache::loncommon::end_data_table());
+ }
-function setSections() {
- var numSections = $num_sections
- var sectionsArray = new Array("$seclist")
- opener.document.$env{"form.form"}.$sec_element.length = 0
- if (numSections == 0) {
- opener.document.$env{"form.form"}.$sec_element.multiple=false
- opener.document.$env{"form.form"}.$sec_element.size=1;
- opener.document.$env{"form.form"}.$sec_element.options[0] = new Option('No existing sections','',false,false)
+ if (!%courses) {
+ $r->print(''.&mt('None found').'
');
+ } elsif ($multiple) {
+ $r->print('');
+ }
+ $r->print(''.
+ "\n".''."\n".
+ ''."\n");
+ if ((exists($env{'form.roleelement'})) && ($env{'form.form'} eq 'rolechoice')) {
+ $r->print(''."\n");
+ }
+ if ($env{'form.form'} eq 'portform') {
+ $r->print('');
+ $r->print('');
+ $r->print('');
+ $r->print('');
+ } elsif ($env{'form.form'} eq 'modifycourse') {
+ $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','pickedcourse','type','form','numtitles','state']));
} else {
- if (numSections == 1) {
- opener.document.$env{"form.form"}.$sec_element.multiple=false;
- opener.document.$env{"form.form"}.$sec_element.size=1;
- opener.document.$env{"form.form"}.$sec_element.options[0] = new Option('Select','',true,true);
- opener.document.$env{"form.form"}.$sec_element.options[1] = new Option('No section','',false,false)
- opener.document.$env{"form.form"}.$sec_element.options[2] = new Option(sectionsArray[0],sectionsArray[0],false,false);
- } else {
- for (var i=0; iprint(''."\n".
+ ''."\n");
+ if ($env{'form.typeelement'} ne '') {
+ $r->print(''."\n");
+
}
}
- opener.document.$env{"form.form"}.$grplist_element.value='$groupslist';
- self.close()
+ if ((exists($env{'form.fixeddom'})) && ($env{'form.form'} eq 'rules')) {
+ $r->print('');
+ }
+ if ($env{'form.numtitles'}) {
+ $r->print('');
+ }
+ $r->print("