Annotation of loncom/interface/lonpickcourse.pm, revision 1.113

1.1       www         1: # The LearningOnline Network
                      2: # Pick a course
                      3: #
1.113   ! raeburn     4: # $Id: lonpickcourse.pm,v 1.112 2014/03/17 02:45:25 raeburn Exp $
1.1       www         5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
                     28: 
                     29: package Apache::lonpickcourse;
                     30: 
                     31: use strict;
                     32: use Apache::Constants qw(:common);
                     33: use Apache::loncommon;
1.106     raeburn    34: use Apache::lonhtmlcommon;
1.1       www        35: use Apache::loncoursedata;
                     36: use Apache::lonnet;
1.8       www        37: use Apache::lonlocal;
1.46      raeburn    38: use Apache::longroup;
1.85      raeburn    39: use LONCAPA qw(:DEFAULT :match);
1.1       www        40: 
                     41: sub handler {
                     42:     my $r = shift;
1.8       www        43:     &Apache::loncommon::content_type($r,'text/html');
1.1       www        44:     $r->send_http_header;
                     45:     return OK if $r->header_only;
                     46: 
                     47: # ------------------------------------------------------------ Print the screen
1.40      albertel   48: 
1.55      raeburn    49:     # Get parameters from query string
1.1       www        50:     &Apache::loncommon::get_unprocessed_cgi
1.55      raeburn    51:         ($ENV{'QUERY_STRING'},['domainfilter','form','cnumelement',
1.19      raeburn    52: 			       'cdomelement','cnameelement','roleelement',
1.85      raeburn    53:                                'multiple','type','setroles','fixeddom','cloner']);
1.90      raeburn    54:     my ($type,$title,$jscript,$multelement,$multiple,$roleelement,$typeelement,
1.85      raeburn    55:         $lastaction,$autosubmit,$submitopener,$cloneruname,$clonerudom);
1.55      raeburn    56: 
1.83      raeburn    57:     # Get course type - Course or Community.
1.54      raeburn    58:     $type = $env{'form.type'};
                     59:     if (!defined($env{'form.type'})) {
                     60:         $type = 'Course';
                     61:     }
1.82      bisitz     62:     $title = 'Selecting a '.$type;
1.54      raeburn    63: 
                     64:     # Setup for multiple course selections, if flag for multiples set.
1.55      raeburn    65:     $multiple = $env{'form.multiple'};
                     66:     if ($multiple) {
                     67:         ($jscript,$multelement) = &multiples_tag();
1.82      bisitz     68:         $title = 'Selecting '.$type.'(s)';
1.54      raeburn    69:     }
                     70: 
1.55      raeburn    71:     # if called when a DC is selecting a course 
1.54      raeburn    72:     my $roledom = $env{'form.roleelement'};
                     73:     if ($roledom) {
                     74:         $roleelement = '<input type="hidden" name="roleelement" value="'.$roledom.'" />';
1.66      raeburn    75:         $submitopener = &processpick();
1.54      raeburn    76:         $autosubmit = 'process_pick("'.$roledom.'")';
                     77:     }
1.90      raeburn    78:     if ($env{'form.typeelement'} ne '') {
                     79:         $typeelement = '<input type="hidden" name="typeelement" value="'.$env{'form.typeelement'}.'" />';
                     80:     }
1.54      raeburn    81: 
1.92      raeburn    82:     # if called when a DC is creating a course for another user.
1.85      raeburn    83:     if ($env{'form.form'} eq 'ccrs') {
                     84:         ($cloneruname,$clonerudom) = ($env{'form.cloner'} =~ /^($match_username):($match_domain)$/);
                     85:     }
                     86: 
                     87:     # if called when requesting a course
                     88:     if ($env{'form.form'} eq 'requestcrs') {
                     89:         $cloneruname = $env{'user.name'};
                     90:         $clonerudom =  $env{'user.domain'};
                     91:     }
                     92: 
1.54      raeburn    93:     my $onlyown = 0;
1.55      raeburn    94:     # if called to assign course-based portfolio access control
1.59      raeburn    95:     if ((($env{'form.form'} eq 'portform') && (!$env{'user.adv'}))) {
1.54      raeburn    96:         $onlyown = 1;
1.49      raeburn    97:     }
1.55      raeburn    98: 
                     99:     my %loaditem;
1.84      raeburn   100:     if (($env{'form.type'} eq 'Course') && ($env{'form.numtitles'})) {
                    101:         if (($env{'form.official'} eq 'on') && ($env{'form.state'} eq 'listing')) {
                    102:             $loaditem{'onload'} = 'setElements(document.filterpicker); ';
                    103:         }
1.78      raeburn   104:     }
                    105: 
1.66      raeburn   106:     if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && 
                    107:         ($env{'form.pickedcourse'})) {
1.106     raeburn   108:         $loaditem{'onload'} .= 'setDefaultCredits();setRoles();setSections();';
1.30      raeburn   109:     }
1.113   ! raeburn   110:     if ((($env{'form.gosearch'}) && ($env{'form.updater'} eq '')) && (!$onlyown)) {
        !           111:         $loaditem{'onload'} .=  'hideSearching(); ';
        !           112:     }
1.112     raeburn   113:     my $js = &Apache::loncommon::js_changer();
1.107     raeburn   114:     $r->print(&Apache::loncommon::start_page($title,$js,
1.42      albertel  115: 					     {'add_entries' => \%loaditem,
1.41      albertel  116: 					      'no_nav_bar'  => 1, }));
1.55      raeburn   117: 
                    118:     if ($env{'form.form'} eq 'portform') {
                    119:         $lastaction = 'document.courselist.submit()';
1.67      raeburn   120:     } elsif ($env{'form.form'} eq 'cu' || ($env{'form.form'} eq 'studentform' &&
                    121:         !$multiple)) {
1.55      raeburn   122:         $lastaction = 
                    123:              'document.courselist.pickedcourse.value = cdom+"_"+cname;'."\n".
                    124:              'document.courselist.submit();';
1.34      albertel  125:     } else {
1.55      raeburn   126:         $lastaction = 'self.close()';
1.1       www       127:     }
1.19      raeburn   128: 
1.55      raeburn   129:     # if called to assign a role in a course to a user via CUSR
1.66      raeburn   130:     if ($env{'form.form'} eq 'cu' || $env{'form.form'} eq 'studentform') {
1.68      raeburn   131:         $r->print(&create_user_javascript($type));
1.55      raeburn   132:     }
1.54      raeburn   133: 
1.55      raeburn   134:     # print javascript functions for choosing a course 
1.85      raeburn   135:     if ((($env{'form.gosearch'}) && ($env{'form.updater'} eq '')) || 
                    136:         $onlyown) {
1.58      raeburn   137:         $r->print(&gochoose_javascript($type,$multiple,$autosubmit,$lastaction));
1.55      raeburn   138:     }
1.105     bisitz    139:     $r->print(&Apache::lonhtmlcommon::scripttag($jscript));
1.55      raeburn   140:     $r->print($submitopener);
1.54      raeburn   141: 
1.55      raeburn   142: # ------------------------------------------ Display of filters to limit search
1.57      raeburn   143:     my $filter = {};
                    144:     my $action = '/adm/pickcourse';
1.99      raeburn   145:     my ($numtitles,$showroles,$nohost,@codetitles);
1.112     raeburn   146:     unless ($onlyown) {
1.111     raeburn   147:         my $filterlist = ['domainfilter','sincefilter'];
1.94      raeburn   148:         # created filter for DCs only
                    149:         if ($env{'user.adv'} && $env{'form.domainfilter'} &&
1.95      raeburn   150:             exists($env{'user.role.dc./'.$env{'form.domainfilter'}.'/'})
                    151:             && $env{'form.form'} ne 'portform') {
1.94      raeburn   152:             my $loncaparev = &Apache::lonnet::get_server_loncaparev($env{'form.domainfilter'});
                    153:             if ($loncaparev ne 'unknown_cmd') {
                    154:                 push(@{$filterlist},'createdfilter');
                    155:             }
                    156:         }
                    157:         push(@{$filterlist},('descriptfilter','instcodefilter'));
1.79      raeburn   158:         if ($env{'form.form'} eq 'rules') {
1.111     raeburn   159:             push(@{$filterlist},('personfilter','persondomfilter'));
                    160:             if ($env{'form.persondomfilter'} eq '') {
                    161:                 unless ($env{'form.gosearch'}) {
                    162:                     $filter->{'persondomfilter'} = $env{'request.role.domain'};
                    163:                 }
                    164:             } else {
                    165:                 $filter->{'persondomfilter'} =
                    166:                     &LONCAPA::clean_domain($env{'form.persondomfilter'});
                    167:             }
1.79      raeburn   168:             if (($env{'form.personfilter'} ne '') && ($env{'form.persondomfilter'} ne '')) {
                    169:                 if (&Apache::lonnet::homeserver($env{'form.personfilter'},
                    170:                                                  $env{'form.persondomfilter'}) eq 'no_host') {
                    171:                     $nohost = 1;
                    172:                 } else {
                    173:                     $showroles = 1;
                    174:                 } 
                    175:             }
                    176:         } else {
1.111     raeburn   177:             push(@{$filterlist},('ownerfilter','ownerdomfilter'));
1.79      raeburn   178:         }
1.55      raeburn   179:         # course ID filter for DCs only
                    180:         if ($env{'user.adv'} && $env{'form.domainfilter'} &&
                    181:             exists($env{'user.role.dc./'.$env{'form.domainfilter'}.'/'})) {
                    182:             push(@{$filterlist},'coursefilter');
                    183:         }
1.85      raeburn   184:         if ($cloneruname ne '' && $clonerudom ne '') {
                    185:             push(@{$filterlist},'cloneableonly');
                    186:         }
1.111     raeburn   187:         if ((ref($filterlist) eq 'ARRAY') && (ref($filter) eq 'HASH')) {
                    188:             foreach my $item (@{$filterlist}) {
                    189:                 $filter->{$item} = $env{'form.'.$item};
                    190:             }
                    191:         }
                    192:         if ($env{'form.form'} eq 'portform') {
                    193:             $filter->{'domainfilter'} ||= $env{'user.domain'};
                    194:         } elsif ($env{'form.form'} eq 'studentform') {
                    195:             $filter->{'domainfilter'} ||= $env{'request.role.domain'};
                    196:         }
                    197:         my $codedom;
                    198:         if ($env{'form.fixeddom'}) {
                    199:             $codedom = $env{'request.role.domain'};
                    200:         } else {
                    201:             $codedom = $filter->{'domainfilter'};
                    202:         }
                    203:         my ($clonetext,$clonewarning);
                    204:         if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) {
                    205:             (my $coord_cloneable,$clonewarning) =
                    206:                 &get_coordinator_cloneable($cloneruname,$clonerudom,$type);
                    207:             if ($env{'form.form'} eq 'ccrs') {
                    208:                 $clonetext = '<input type="hidden" name="cloner" value="'.$env{'form.cloner'}.'" />'."\n";
                    209:             }
                    210:             if ($coord_cloneable) {
                    211:                 $clonetext .= '<input type="hidden" name="cc_clone" value="'.$coord_cloneable.'" />';
                    212:             }
                    213:         }
                    214:         $r->print(&Apache::loncommon::build_filters($filterlist,$type,$roleelement,$multelement,
                    215:                                                     $filter,$action,\$numtitles,undef,$cloneruname,
                    216:                                                     $clonerudom,$typeelement,\@codetitles,$codedom,
                    217:                                                     $env{'form.form'},$env{'form.fixeddom'},
                    218:                                                     $env{'form.prevphase'},$env{'form.cnameelement'},
                    219:                                                     $env{'form.cnumelement'},$env{'form.cdomelement'},
                    220:                                                     $env{'form.setroles'},$clonetext,$clonewarning));
1.55      raeburn   221:     }
1.54      raeburn   222: 
                    223: # ---------------------------------------------------------------- Get the data
1.85      raeburn   224:     if ((($env{'form.gosearch'}) && ($env{'form.updater'} eq '')) || 
                    225:          $onlyown) {
1.98      raeburn   226:         my $domcloner;
                    227:         if ($env{'form.form'} eq 'ccrs') {
                    228:             if (($env{'request.role.domain'} eq $env{'form.domainfilter'}) &&
                    229:                 (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) {
                    230:                 $domcloner = 1;
                    231:             }
                    232:         }
1.112     raeburn   233:         my %courses;
                    234:         if (!$onlyown) {
                    235:             $r->print('<div id="searching">'.&mt('Searching ...').'</div>');
                    236:             $r->rflush();
                    237:             my $srchdom = $filter->{'domainfilter'};
                    238:             %courses = &Apache::loncommon::search_courses($srchdom,$type,$filter,$numtitles,
                    239:                                                           $cloneruname,$clonerudom,$domcloner,
                    240:                                                           \@codetitles,$env{'form.cc_clone'});
                    241:         } else {
                    242:             $r->print('<br />');
                    243:             my %coursehash = &Apache::loncommon::findallcourses();
                    244:             foreach my $cid (sort(keys(%coursehash))) {
                    245:                 $courses{$cid}{'description'} = $env{'course.'.$cid.'.description'};
                    246:             }
                    247:         }
1.79      raeburn   248:         if ($nohost) {
                    249:             $r->print ('<span class="LC_warning">'.
                    250:                        &mt('User does not exist - username: [_1], domain: [_2].',
                    251:                            '<b>'.$filter->{'personfilter'}.'</b>',
                    252:                            '<b>'.$filter->{'persondomfilter'}.'</b>').'</span>');
                    253:         } else {
1.85      raeburn   254:             &display_matched_courses($r,$type,$multiple,$action,$showroles,$cloneruname,
                    255:                                      $clonerudom,%courses);
1.79      raeburn   256:         }
1.54      raeburn   257:     }
                    258:     $r->print(&Apache::loncommon::end_page());
                    259:     return OK;
                    260: }
                    261: 
1.66      raeburn   262: sub processpick {
                    263:     my $openerform = 'rolechoice';
                    264:     if ($env{'form.form'} eq 'studentform') {
                    265:         $openerform = $env{'form.form'};
                    266:     }
                    267:     my $process_pick = <<"ENDONE";
                    268: <script type="text/javascript">
                    269: function process_pick(dom) {
                    270:     var pickedCourse=opener.document.$openerform.$env{'form.cnumelement'}.value;
                    271:     var pickedDomain=opener.document.$openerform.$env{'form.cdomelement'}.value;
                    272:     var okDomain = 0;
                    273: ENDONE
                    274:     if ($openerform eq 'rolechoice') {
                    275:         $process_pick .= <<"ENDTWO";
                    276:     if (pickedDomain == dom) {
                    277:         if (pickedCourse != '') {
1.88      raeburn   278:             var ccrole = "cc";
                    279:             var pickedType = "$env{'form.type'}";
                    280:             if (pickedType == "Community") {
                    281:                 ccrole = "co";
                    282:             }
                    283:             var courseTarget = ccrole+"./"+pickedDomain+"/"+pickedCourse
1.66      raeburn   284:             opener.document.title='Role selected. Please stand by.';
                    285:             opener.status='Role selected. Please stand by.';
                    286:             opener.document.rolechoice.newrole.value=courseTarget
                    287:             opener.document.rolechoice.submit();
                    288:         }
                    289:     } 
                    290:     else {
                    291:         alert("You may only use this screen to select courses in the current domain: "+dom+"\\nPlease return to the roles page window and click the 'Select Course' link for domain: "+pickedDomain+",\\n if you are a Domain Coordinator in that domain, and wish to become a Course Coordinator in a course in the domain");
                    292:     }
                    293: ENDTWO
                    294:     } else {
                    295:         $process_pick .= <<"ENDTHREE";
                    296:     if (pickedDomain != dom) {
                    297:         alert("You may only use this screen to select courses in the current domain: "+dom+"\\nPlease return to the roles page window and click the 'Select Course' link for domain: "+pickedDomain+",\\n if you are a Domain Coordinator in that domain, and wish to become a Course Coordinator in a course in the domain");
                    298:         return;
                    299:     }
                    300: ENDTHREE
                    301:     }
                    302:     $process_pick .= "
                    303: }
                    304: 
                    305: </script>
                    306: ";
                    307:     return $process_pick;
                    308: }
                    309: 
1.55      raeburn   310: sub create_user_javascript {
                    311:     my ($type) = @_;
                    312:     my $output;
                    313:     #javascript for reporting sections and groups then closing
                    314:     if ($env{'form.pickedcourse'}) {
1.87      raeburn   315:         my %coursedescription = 
                    316:             &Apache::lonnet::coursedescription($env{'form.pickedcourse'},
                    317:                                                {'one_time' => '1'});
                    318:         my $cdom = $coursedescription{'domain'};
                    319:         my $cnum = $coursedescription{'num'};
                    320:         my $crstype = $coursedescription{'type'};
1.106     raeburn   321:         my %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
                    322:         my ($showcredits,$credits);
                    323:         if (($crstype ne 'Community') &&
1.109     raeburn   324:             (($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'} || $domdefs{'textbookcredits'}))) {
1.106     raeburn   325:             $showcredits = 1; 
                    326:             $credits = $coursedescription{'internal.defaultcredits'};
                    327:         }
1.55      raeburn   328:         my $sec_element = 'currsec';
                    329:         my $grplist_element = 'groups';
                    330:         my ($sections,$groups) =
                    331:           &Apache::loncommon::get_secgrprole_info($cdom,$cnum,'',$type);
                    332:         my $num_sections = scalar(@{$sections});
                    333:         my $seclist = join(',',@{$sections});
                    334:         my $num_groups = scalar(@{$groups});
                    335:         my $groupslist = join(',',@{$groups});
                    336:         $output = qq|
                    337: <script type="text/javascript">
1.106     raeburn   338: // <![CDATA[
1.55      raeburn   339: function setSections() {
                    340:     opener.document.$env{"form.form"}.$grplist_element.value='$groupslist';
                    341:     window.opener.setSect('$seclist');
1.87      raeburn   342:     self.close();
                    343: }
                    344: function setRoles() {
                    345:     window.opener.setRole('$crstype');
1.55      raeburn   346: }
1.106     raeburn   347: |;
                    348:         if ($showcredits) {
                    349:             $output .= qq|
                    350: function setDefaultCredits() {
                    351:     window.opener.setCredits('$credits');
                    352: }
                    353: |;
                    354:         }
                    355:         $output .= qq|
                    356: // ]]>
1.55      raeburn   357: </script>
                    358: |;
                    359:     }
                    360:     return $output;
                    361: }
                    362: 
1.54      raeburn   363: sub display_matched_courses {
1.85      raeburn   364:     my ($r,$type,$multiple,$action,$showroles,$cloneruname,$clonerudom,%courses) = @_;
1.55      raeburn   365:     if ($env{'form.form'} eq 'portform') {
                    366:         $action = '/adm/portfolio';
                    367:     }
1.68      raeburn   368:     my $numcourses = keys(%courses);
1.55      raeburn   369:     $r->print('<form name="courselist" method="post" action="'.$action.'">');
1.68      raeburn   370:     if ($env{'form.form'} eq 'modifycourse') {
                    371:         if ($numcourses > 0) {
1.89      raeburn   372:             my $ccrole = 'cc';
                    373:             if ($type eq 'Community') {
                    374:                 $ccrole = 'co';
                    375:             }
                    376:             my $cctitle = &Apache::lonnet::plaintext($ccrole,$type);
1.68      raeburn   377:             my $dctitle = &Apache::lonnet::plaintext('dc');
1.93      raeburn   378:             my $ccrolechk = ' ';
                    379:             my $menuchk = ' checked="checked" ';
1.68      raeburn   380:             $r->print(
1.106     raeburn   381:                 '<div class="LC_left_float">'
                    382:                .'<fieldset>'
                    383:                .'<legend>'.&mt('Pick action').'</legend>'
                    384:                .'<span class="LC_nobreak"><label>'
1.75      bisitz    385:                .'<input type="radio" name="phase" value="ccrole"'.$ccrolechk.'/>'
1.89      raeburn   386:                .'&nbsp;');
                    387:             if ($type eq 'Community') {
                    388:                 $r->print(&mt('Enter the community with the role of [_1].',$cctitle));
                    389:             } else {
                    390:                 $r->print(&mt('Enter the course with the role of [_1].',$cctitle));
                    391:             }
1.106     raeburn   392:             $r->print('</label></span><br />'
                    393:                .'<span class="LC_nobreak"><label>'
1.89      raeburn   394:                .'<input type="radio" name="phase" value="menu"'.$menuchk.'/>&nbsp;');
                    395:             if ($type eq 'Community') {
                    396:                 $r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle));
                    397:             } else {
                    398:                 $r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle));
                    399:             }
1.106     raeburn   400:             $r->print('</label></span>'
                    401:                .'</fieldset></div>'
                    402:                .'<br clear="all" />'
1.75      bisitz    403:             );
1.68      raeburn   404:         }
                    405:     }
1.54      raeburn   406:     my %by_descrip;
                    407:     foreach my $course (keys(%courses)) {
                    408:         my $descr;
1.64      raeburn   409:         if (ref($courses{$course}) eq 'HASH') {
1.65      raeburn   410:             $descr = $courses{$course}{'description'};
1.64      raeburn   411:         } elsif ($courses{$course} =~ m/^([^:]*):/i) {
1.54      raeburn   412:             $descr = &unescape($1);
1.34      albertel  413:         } else {
1.54      raeburn   414:             $descr = &unescape($courses{$course});
                    415:         }
                    416:         my $description = $descr;
                    417:         push (@{$by_descrip{$description}}, $course);
                    418:     }
1.71      bisitz    419:  
1.54      raeburn   420:     if ($numcourses > 1 && $multiple) {
1.104     bisitz    421:         $r->print('<input type="button" value="'.&mt('check all').'"
1.54      raeburn   422:                   onclick="javascript:checkAll(document.courselist.course_id)" />
1.104     bisitz    423:                   &nbsp;&nbsp;<input type="button" value="'.&mt('uncheck all').'"
1.54      raeburn   424:                   onclick="javascript:uncheckAll(document.courselist.course_id)" />
                    425:                   <br /><br />');
                    426:     }
1.71      bisitz    427: 
                    428:     if (%courses) {
                    429:         $r->print(&Apache::loncommon::start_data_table());
                    430:         $r->print(&Apache::loncommon::start_data_table_header_row());
1.89      raeburn   431:         my $titlehdr = &mt('Course Title');
                    432:         if ($type eq 'Community') {
                    433:             $titlehdr = &mt('Community Title');
                    434:         }
1.71      bisitz    435:         $r->print('<th>'.&mt('Select').'</th>'
1.89      raeburn   436:                  .'<th>'.$titlehdr.'</th>'
                    437:                  .'<th>'.&mt('Domain').'</th>');
                    438:         unless ($type eq 'Community') {
                    439:             $r->print('<th>'.&mt('Course Code').'</th>');
                    440:         }
                    441:         $r->print('<th>'.&mt('Owner/Co-owner(s)').'</th>');
1.79      raeburn   442:         if ($showroles) {
                    443:             $r->print('<th>'.&mt("Role(s) for [_1]",
                    444:                 &Apache::loncommon::plainname($env{'form.personfilter'},
                    445:                                               $env{'form.persondomfilter'},'firstname')).'</th>');
                    446:         }
1.71      bisitz    447:         $r->print(&Apache::loncommon::end_data_table_header_row());
                    448:     }
1.92      raeburn   449:     my %cc_cloneable;
                    450:     if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) {
                    451:         my ($coord_cloneable,$warning) =
                    452:             &get_coordinator_cloneable($cloneruname,$clonerudom,$type);
                    453:         if ($coord_cloneable) {
                    454:             map {$cc_cloneable{$_} = 1;} split('&',$coord_cloneable);
                    455:         }
                    456:     }
1.54      raeburn   457:     foreach my $description (sort { lc($a) cmp lc($b) } (keys(%by_descrip))) {
                    458:         foreach my $course (@{$by_descrip{$description}}) {
1.72      raeburn   459:             $r->print(&Apache::loncommon::start_data_table_row());
1.54      raeburn   460:             my $cleandesc=&HTML::Entities::encode($description,'<>&"');
                    461:             $cleandesc=~s/'/\\'/g;
                    462:             my ($cdom,$cnum)=split(/\_/,$course);
1.85      raeburn   463:             my ($descr,$instcode,$ttype,$canclone,@owners);
1.64      raeburn   464:             if (ref($courses{$course}) eq 'HASH') {
                    465:                 $descr = $courses{$course}{'description'};
1.85      raeburn   466:                 $instcode = $courses{$course}{'inst_code'};
                    467:                 $ttype = $courses{$course}{'type'};
                    468:                 if (($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) {
1.98      raeburn   469:                     if ($env{'form.form'} eq 'ccrs') {
                    470:                         if (($env{'request.role.domain'} eq $cdom) &&
                    471:                             (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'}))) {
                    472:                             $canclone = 1;
                    473:                         }
                    474:                     }
                    475:                     unless ($canclone) { 
                    476:                         if ($cc_cloneable{$cnum.':'.$cdom}) {
                    477:                             $canclone = 1;
                    478:                         }
1.92      raeburn   479:                     }
                    480:                     unless ($canclone) {
                    481:                         my $cloners = $courses{$course}{'cloners'};
                    482:                         if ($cloners ne '') { 
                    483:                             my @cloneable = split(',',$cloners);
                    484:                             if (grep(/^\*$/,@cloneable)) {
                    485:                                 $canclone = 1;
                    486:                             }
1.97      raeburn   487:                             if (grep(/^\*:\Q$clonerudom\E$/,@cloneable)) {
1.92      raeburn   488:                                 $canclone = 1;
                    489:                             }
                    490:                             if (grep(/^\Q$cloneruname\E:\Q$clonerudom\E$/,@cloneable)) {
                    491:                                 $canclone = 1;
                    492:                             }
1.85      raeburn   493:                         }
                    494:                     }
                    495:                 }
1.101     raeburn   496:                 push(@owners,$courses{$course}{'owner'});
                    497:                 if ($courses{$course}{'co-owners'} ne '') {
                    498:                     foreach my $item (split(/,/,$courses{$course}{'co-owners'})) {
                    499:                         push(@owners,$item);
1.64      raeburn   500:                     }
                    501:                 }
                    502:             } else {
                    503:                 my $singleowner; 
                    504:                 ($descr,$instcode,$singleowner,$ttype)=split(/:/,$courses{$course});
                    505:                 push(@owners,&unescape($singleowner));
                    506:             }
1.93      raeburn   507:             my $ownerstr = join(', ',map { &Apache::loncommon::plainname(split(':',$_)); } @owners);
1.85      raeburn   508:             $r->print('<td>'.&course_chooser($multiple,$cdom,$cnum,$cleandesc,$canclone).'</td>');
1.71      bisitz    509:             $r->print('<td>'.$description.'</td>');
                    510:             $r->print('<td>');
                    511:             $r->print(&Apache::lonnet::domain($cdom,'description')?
                    512:                       $cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom);
                    513:             $r->print('</td>');
1.89      raeburn   514:             unless ($type eq 'Community') { 
                    515:                 $r->print('<td>');
                    516:                 if ($instcode ne '') {
                    517:                     $r->print(&unescape($instcode));
                    518:                 } else {
                    519:                     $r->print('&nbsp;');
                    520:                 }
                    521:                 $r->print('</td>');
1.54      raeburn   522:             }
1.72      raeburn   523:             $r->print('<td>'.$ownerstr.'</td>');
1.79      raeburn   524:             if ($showroles) {
                    525:                 $r->print('<td>');
                    526:                 my $rolestr;
                    527:                 if (ref($courses{$course}{'roles'}) eq 'ARRAY') {
                    528:                     my @roles = sort(@{$courses{$course}{'roles'}});
                    529:                     foreach my $role (@roles) {
                    530:                         if ($role =~ /^cr/) {
                    531:                             my (undef,$crdom,$crname,$crtitle) = split('/',$role);
                    532:                             $rolestr .= $crtitle.', ';
                    533:                         } else {
1.89      raeburn   534:                             $rolestr .= &Apache::lonnet::plaintext($role,$type).', ';
1.79      raeburn   535:                         }
                    536:                     }
                    537:                     $rolestr =~ s/\, $//;
                    538:                 }
                    539:                 $r->print($rolestr.'</td>');
                    540:             }
1.54      raeburn   541:             if ($multiple) { $r->print("</label>\n"); }
1.72      raeburn   542:             $r->print(&Apache::loncommon::end_data_table_row());
1.71      bisitz    543:             # $r->print("<br />\n");
1.19      raeburn   544:         }
                    545:     }
1.72      raeburn   546:     if (%courses) {
                    547:         $r->print(&Apache::loncommon::end_data_table());
                    548:     }
1.71      bisitz    549: 
1.54      raeburn   550:     if (!%courses) {
1.104     bisitz    551:         $r->print('<p class="LC_info">'.&mt('None found').'</p>');
1.54      raeburn   552:     } elsif ($multiple) {
1.108     bisitz    553:         $r->print('<input type="button" value="'.&mt('Submit').'" onclick="gochoose('."'','','')".'" />');
1.54      raeburn   554:     }
                    555:     $r->print('<input type="hidden" name="form" value="'.$env{'form.form'}.'" />'.
                    556:               "\n".'<input type="hidden" name="pickedcourse" value="" />'."\n".
                    557:               '<input type="hidden" name="type" value="'.$type.'" />'."\n");
                    558:     if ((exists($env{'form.roleelement'})) && ($env{'form.form'} eq 'rolechoice')) {
                    559:         $r->print('<input type="hidden" name="roleelement" value="'.
                    560:                   $env{'form.roleelement'}.'" />'."\n");
                    561:     }
1.55      raeburn   562:     if ($env{'form.form'} eq 'portform') {
                    563:         $r->print('<input type="hidden" name="cnum" value="" />');
                    564:         $r->print('<input type="hidden" name="cdom" value="" />');
                    565:         $r->print('<input type="hidden" name="setroles" value="'.$env{'form.setroles'}.'" />');
                    566:         $r->print('<input type="hidden" name="action" value="rolepicker" />');
1.57      raeburn   567:     } elsif ($env{'form.form'} eq 'modifycourse') {
1.85      raeburn   568:         $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','pickedcourse','type','form','numtitles','state']));
1.57      raeburn   569:     } else {
                    570:         $r->print('<input type="hidden" name="cnumelement" value="'.
                    571:                   $env{'form.cnumelement'}.'" />'."\n".  
                    572:                   '<input type="hidden" name="cdomelement" value="'.
                    573:                   $env{'form.cdomelement'}.'" />'."\n");
1.90      raeburn   574:         if ($env{'form.typeelement'} ne '') {
                    575:             $r->print('<input type="hidden" name="typeelement" value="'.
                    576:                       $env{'form.typeelement'}.'" />'."\n");
                    577: 
                    578:         }
1.55      raeburn   579:     }
1.78      raeburn   580:     if ((exists($env{'form.fixeddom'})) && ($env{'form.form'} eq 'rules')) {
                    581:         $r->print('<input type="hidden" name="fixeddom" value="'.
                    582:                   $env{'form.fixeddom'}.'" />');
                    583:     }
                    584:     if ($env{'form.numtitles'}) {
                    585:         $r->print('<input type="hidden" name="numtitles" value="'.
                    586:                   $env{'form.numtitles'}.'" />');
                    587:     }
1.54      raeburn   588:     $r->print("</form>\n");
                    589:     return;
                    590: }
                    591: 
                    592: sub multiples_tag {
1.55      raeburn   593:     my $jscript = &Apache::loncommon::check_uncheck_jscript();
                    594:     my $multelement = '<input type="hidden" name="multiple" value="1" />';
                    595:     return ($jscript,$multelement);
1.1       www       596: }
1.30      raeburn   597: 
1.92      raeburn   598: sub get_coordinator_cloneable {
                    599:     my ($cloneruname,$clonerudom,$type) = @_;
1.100     www       600:     if (($cloneruname!~/\w/) || ($clonerudom!~/\w/)) {
                    601:         my $warning = '<div class="LC_warning">'.&mt('Intended course owner not specified').
                    602:                    '</div>';
                    603:         return ('',$warning);
                    604:     } elsif (&Apache::lonnet::homeserver($cloneruname,$clonerudom) eq 'no_host') {
1.92      raeburn   605:         my $warning = '<div class="LC_error">'.&mt('Intended course owner does not exist').
                    606:                    '</div>';
                    607:         return ('',$warning);
                    608:     } else {
                    609:         my ($cc_clone,$ccrole);
                    610:         if ($type eq 'Community') {
                    611:             $ccrole = 'co';
                    612:         } elsif ($type eq 'Course') {
                    613:             $ccrole = 'cc';
                    614:         }
                    615:         my %ccroles = &Apache::lonnet::get_my_roles($cloneruname,$clonerudom,
                    616:                                                     'userroles',['active'], [$ccrole]);
                    617:         foreach my $key (sort(keys(%ccroles))) {
                    618:             my ($cnum,$cdom,$role) = split(':',$key);
                    619:             $cc_clone .= $cdom.':'.$cnum.'&';
                    620:         }
                    621:         $cc_clone =~ s/\&$//;
                    622:         return ($cc_clone);
                    623:     }
                    624: }
                    625: 
1.30      raeburn   626: sub course_chooser {
1.85      raeburn   627:     my ($multiple,$cdom,$cnum,$cleandesc,$canclone) = @_;
1.30      raeburn   628:     my $output; 
1.35      raeburn   629:     if ($multiple) {
1.32      albertel  630:         $output = '<label><input type="checkbox" name="course_id" value="'.$cdom.'_'.$cnum.'" />'."\n";
1.85      raeburn   631:     } elsif ((($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) && (!$canclone))  {
                    632:         if ($env{'form.form'} eq 'ccrs') {
                    633:             $output = &mt('No cloning for ').$env{'form.cloner'}."\n";
                    634:         } else {
                    635:             $output = &mt('No rights to clone')."\n";
                    636:         }
1.30      raeburn   637:     } else {
1.108     bisitz    638:         $output = '<input type="button" value="'.&mt('Select').'" onclick="gochoose('.
1.30      raeburn   639:                   "'".$cnum."','".$cdom."','".$cleandesc."')".'" />'."\n";
                    640:     }
                    641:     return $output;
1.49      raeburn   642: }
                    643: 
1.55      raeburn   644: sub gochoose_javascript {
1.57      raeburn   645:     my ($type,$multiple,$autosubmit,$lastaction) = @_;
1.55      raeburn   646:     my %elements = (
                    647:                      'Course' => {
                    648:                                  name  => 'coursepick',
                    649:                                  total => 'coursetotal',
                    650:                                  list  => 'courselist',
                    651:                                  },
1.83      raeburn   652:                      'Community' => {
1.88      raeburn   653:                                  name  => 'coursepick',
                    654:                                  total => 'coursetotal',
                    655:                                  list  => 'courselist',
1.55      raeburn   656:                               },
                    657:                     );
1.107     raeburn   658:     my $output = qq|
1.57      raeburn   659: function gochoose(cname,cdom,cdesc) {
1.55      raeburn   660:     var openerForm = "$env{'form.form'}";
                    661:     courseCount = 0;
                    662:     var courses = '';
1.57      raeburn   663: |;
                    664:     if ($multiple) {
                    665:         $output .= <<"ENDSCRIPT";
                    666:     courseCount = 0;
                    667:     var courses = '';
                    668:     if (typeof(document.courselist.course_id.length) == 'undefined') {
                    669:         // only 1 course checkbox was created
                    670:         if (document.courselist.course_id.checked) {
                    671:             courses = courses + document.courselist.course_id.value + "&&";
                    672:             courseCount ++;
                    673:         }
                    674:     } else {
                    675:         for (var j=0; j<document.courselist.course_id.length; j++) {
                    676:             if (document.courselist.course_id[j].checked) {
                    677:                 courses = courses + document.courselist.course_id[j].value + "&&";
1.55      raeburn   678:                 courseCount ++;
                    679:             }
1.57      raeburn   680:         }
                    681:     }
                    682:     opener.document.$env{'form.form'}.$elements{$type}{'total'}.value = courseCount;
                    683:     if (typeof(opener.document.$env{'form.form'}.$elements{$type}{'name'}.length) ==
                    684:         'undefined') {
                    685:         if (opener.document.$env{'form.form'}.$elements{$type}{'name'}.value == 'specific') {
                    686:             opener.document.$env{'form.form'}.$elements{$type}{'name'}.checked = true;
1.55      raeburn   687:         } else {
1.57      raeburn   688:             opener.document.$env{'form.form'}.$elements{$type}{'name'}.checked = false;
1.55      raeburn   689:         }
1.57      raeburn   690:     } else {
                    691:         for (var j=0; j<opener.document.$env{'form.form'}.$elements{$type}{'name'}.length; j++) {
                    692:             if (opener.document.$env{'form.form'}.$elements{$type}{'name'}\[j].value == 'specific') {
                    693:                 opener.document.$env{'form.form'}.$elements{$type}{'name'}\[j].checked = true;
1.55      raeburn   694:             } else {
1.57      raeburn   695:                 opener.document.$env{'form.form'}.$elements{$type}{'name'}\[j].checked = false;
1.54      raeburn   696:             }
1.55      raeburn   697:         }
1.57      raeburn   698:     }
                    699:     if (courseCount > 0) {
                    700:         courses = courses.substr(0,courses.length-2);
                    701:         opener.document.$env{'form.form'}.$elements{$type}{'list'}.value = courses;
                    702:     }
                    703: ENDSCRIPT
                    704:     } else {
1.90      raeburn   705:         my ($name_code,$type_code);
1.57      raeburn   706:         if ($env{'form.cnameelement'} ne '') {
1.103     raeburn   707:             $name_code = <<ENDNAMECODE;  
                    708: var showcdesc = cdesc;
                    709: if (cdesc.length > 25) {
                    710:     showcdesc = cdesc.substr(0,25)+' ...'; 
                    711: }
                    712: opener.document.$env{'form.form'}.$env{'form.cnameelement'}.value=showcdesc;
                    713: ENDNAMECODE
1.55      raeburn   714:         }
1.90      raeburn   715:         if ($env{'form.typeelement'} ne '') {
                    716:             $type_code = 'opener.document.'.$env{'form.form'}.'.'.
                    717:                           $env{'form.typeelement'}.'.value=document.courselist.type;';
                    718:         }
                    719: 
1.57      raeburn   720:         $output .= qq|
1.55      raeburn   721:         $name_code
1.90      raeburn   722:         $type_code
1.55      raeburn   723:         opener.document.$env{'form.form'}.$env{'form.cnumelement'}.value=cname;
                    724:         var slct=opener.document.$env{'form.form'}.$env{'form.cdomelement'};
                    725:         if (slct.options == undefined) {
                    726:             opener.document.$env{'form.form'}.$env{'form.cdomelement'}.value=cdom;
                    727:         }
                    728:         else {
                    729:             var i;
                    730:             for (i=0;i<slct.length;i++) {
                    731:                 if (slct.options[i].value==cdom) { slct.selectedIndex=i; }
1.54      raeburn   732:             }
                    733:         }
1.57      raeburn   734: |;
1.54      raeburn   735:     }
1.57      raeburn   736:     $output .= qq|
1.55      raeburn   737:     if (openerForm == 'portform') {
                    738:         document.courselist.cnum.value = cname;
                    739:         document.courselist.cdom.value = cdom;
                    740:     }
                    741:     $autosubmit
                    742:     $lastaction
1.54      raeburn   743: }
1.57      raeburn   744: |;
1.105     bisitz    745:     return &Apache::lonhtmlcommon::scripttag($output);
1.54      raeburn   746: }
                    747: 
1.55      raeburn   748: 1;
                    749: __END__
                    750: 
                    751: =pod
                    752: 
                    753: =head1 NAME
                    754: 
                    755: Apache::lonpickcourse - Search for course(s) based on user-specified criteria.   
                    756: 
                    757: =head1 SYNOPSIS
                    758: 
                    759: Invoked by other LON-CAPA modules, when course(s) need to be selected by the user. 
                    760: 
                    761: =head1 OVERVIEW
                    762: 
                    763: Two screens are typically displayed to the user.  The first is a set of criteria which are used to constrain the search for courses.
                    764: 
                    765: =head2 Search Criteria (Screen One)
                    766: 
                    767: =head3 Criteria:
                    768: 
                    769: =over 4
                    770: 
                    771: =item *
                    772: Course Activity - how recently was course last visited by anyone.
                    773: 
                    774: =item *
                    775: Course Domain - the domain of the course
                    776: 
                    777: =item *
1.84      raeburn   778: Type - Course or Community
1.55      raeburn   779: 
                    780: =item *
                    781: Course Institutional Code - the institutional identifier assigned to the course
                    782: 
                    783: =item * 
                    784: Course Owner's Username - the username of the owner of the course (assigned by the Domain Coordinator and/or when the course was created).
                    785: 
                    786: =item *
                    787: Course Owner's Domain - the domain of the owner of the course
                    788: 
                    789: =item * 
1.76      bisitz    790: Course Title - text which appears in the Course Title, as set in the Course Parameters.
1.55      raeburn   791: 
                    792: =item *
                    793: Course ID - the internal course number (course ID part after initial 'domain_') used by LON-CAPA (this criterion is only displayed to Domain Coordinators selecting a course in the same domain as their DC role).
                    794: 
                    795: =back
                    796: 
                    797: The criteria setting screen is not displayed if course picking is done by a user who does not have advanced privileges (as defined by $env{'user.adv'}).
                    798: 
                    799: =head2 Course Display (Screen Two)
                    800: 
                    801: A list of courses matching the search criteria is displayed.  If the user is not an advanced user, screen one will have been skipped and the courses displayed will be all courses in which the user has currently active roles. The information displayed for each course is:
                    802: 
                    803: =over 4
                    804: 
                    805: =item *
                    806: Course description
                    807: 
                    808: =item *
                    809: Domain description of course domain
                    810: 
                    811: =item *
                    812: Course institutional code
                    813: 
                    814: =item * 
                    815: Course owner (username:domain)   
                    816:  
                    817: =back
                    818: 
                    819: Depending on context, the display may include a single select box for each course, allowing selection of only a single course, or may include checkboxes allowing selection of more than one course.
                    820: 
                    821: Following selection, and/or submission, the course description, number and domain are transferred to the browser window from which the course picker window was opened.  In most cases, the child window containing the course picker screens will be closed.  However, in some cases closure will be delayed until a third screen has been displayed (e.g., setting of course-based conditional access controls for portfolio files).  In this case the page is generated via /adm/portfolio and the page features select boxes to allow the user to select roles, access types, sections and groups.
                    822: 
                    823: =head1 SUBROUTINES
                    824: 
                    825: =over 4
                    826: 
                    827: =item *
                    828: X<create_user_javascript()>
                    829: B<create_user_javascript($type)>:
                    830: 
1.83      raeburn   831: Input: 1 - $type  - the course type - Course or Community
1.55      raeburn   832: 
                    833: Output: 1 - $output - javascript wrapped in E<lt>scriptE<gt>E<lt>/scriptE<gt> tags 
                    834: 
                    835: Side Effects: None 
                    836: 
                    837: javascript code for reporting selected sections (as a string of comma separated sections) and groups in the selected course (as a comma separated list) then calling setSect() javscript function in the opener window (to populate section select box) then closing current window.
                    838: 
                    839: 
                    840: =item *
                    841: X<display_matched_courses()>
1.85      raeburn   842: B<display_matched_courses($r,$type,$multiple,$action,$showroles,$cloneruname,$clonerudom,%courses)>:
1.55      raeburn   843: 
1.85      raeburn   844: Input: 7 - request object, course type, multiple (0 or 1), form action, whether to show roles (for course personnel filter), username of new course owner, domain of new course owner, hash of courses.
1.55      raeburn   845: 
                    846: Output: 0
                    847: 
                    848: Side Effects: prints select buttons (multiple = 0) or checkboxes (multiple = 1) and hidden form elements for selection of one or more courses which met search criteria.
                    849: 
                    850: =item *
                    851: X<multiples_tag()>
                    852: B<multiples_tag()>:
                    853: 
                    854: 
                    855: Input: 0
                    856: 
                    857: Output: 2 - $jscript - javascript for check all/uncheck all checkboxes; $multelement - hidden form element with multiple set to 1.
                    858: 
                    859: Side Effects: None
                    860: 
                    861: 
                    862: =item *
                    863: X<course_chooser()>
1.85      raeburn   864: B<course_chooser($multiple,$cdom,$cnum,$cleandesc,$canclone)>:
1.55      raeburn   865: 
1.85      raeburn   866: Input: 5 - single (0) or multiple (1) courses; course domain, course number; course description; can clone course (1 if new course owner has cloning rights). 
1.55      raeburn   867: 
1.85      raeburn   868: Output: 1 - HTML for either checkbox (multiple=1) or select button (multiple=0) for user to indicate course selection.
1.55      raeburn   869: 
                    870: Side Effects: None
                    871: 
                    872: 
                    873: =item *
                    874: X<gochoose_javascript()>
1.57      raeburn   875: B<gochoose_javascript($type,$multiple,$autosubmit,$lastaction)>:
1.55      raeburn   876: 
1.66      raeburn   877: Input: 4 - course type; single (0) or multiple courses (1); in context of DC selecting a CC role in a course: javascript code from &processpick(); final action to take after user chooses course(s):  either close window, or submit form for display of next page etc.
1.55      raeburn   878: 
                    879: Output: 1  $output - javascript wrapped in E<lt>scriptE<gt>E<lt>/scriptE<gt> tags
                    880: 
                    881: Side Effects: None
                    882: 
                    883: javascript functions used when user selects a course(s). Different behavior depending on context:
                    884: 
                    885: =back
                    886: 
                    887: =over 8
                    888: 
                    889: =item
                    890: 
                    891: (a) Domain Coordinator using MAIL to select recipients of broadcast e-mail - && separated list of selected courses written to hidden form element in opener window. Child window closes.
                    892: 
                    893: =item
                    894: 
                    895: (b) Domain Coordinator choosing a course for adoption of a CC role from roles screen - write course identifying information to hidden form elements in opener window and automatically submit role selection form in opener window. Child window closes.
                    896: 
                    897: =item
                    898: 
                    899: (c) Domain Coordinator creating a course, and selecting a course to clone - course number and domain written to visible form elements in opener window. Child window closes.
                    900: 
                    901: =item
1.54      raeburn   902: 
1.55      raeburn   903: (d) User selecting a course for course-based conditional access control for a portfolio file - form is submitted, and new page is displayed for selection of roles, access types, sections and groups to be used in conditional ACL. New page is generated by /adm/portfolio. 
1.54      raeburn   904: 
1.55      raeburn   905: =item
1.54      raeburn   906: 
1.55      raeburn   907: (e) Domain Coordinator assigning a role to a user - form is submitted, and new page does an onload call to a javascript function to (a) write lists of sections and groups to hidden elements in opener window, (b) call function in opener window to dynamically populate select box showing current sections.
1.54      raeburn   908: 
1.55      raeburn   909: =item
1.54      raeburn   910: 
1.55      raeburn   911: (f) Author modifying a rights entry in a .rights file - selected course number and domain are witten to visible form elements in opener window.  Child window closes. 
1.54      raeburn   912: 
1.55      raeburn   913: =item
1.49      raeburn   914: 
1.102     bisitz    915: (g) Bubblesheet Scanning Operator uploading a bubblesheet file to a course - course number is written to visible form element in opener window. Child window closes.
1.30      raeburn   916: 
1.84      raeburn   917: =item
                    918: 
                    919: (h) User requesting creation of a course, and selecting a course to clone - course number and domain written to visible form elements in opener window. Child window closes.
                    920: 
1.55      raeburn   921: =back
                    922:      
                    923: =cut

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>