Annotation of loncom/interface/loncreatecourse.pm, revision 1.118

1.65      raeburn     1: # The LearningOnline Network
1.1       www         2: # Create a course
1.5       albertel    3: #
1.118   ! hauer       4: # $Id: loncreatecourse.pm,v 1.117 2009/02/24 18:20:49 hauer Exp $
1.5       albertel    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: #
1.48      www        28: ###
                     29: 
1.111     jms        30: =head1 NAME
                     31: 
                     32: Apache::loncreatecourse.pm
                     33: 
                     34: =head1 SYNOPSIS
                     35: 
                     36: Allows domain coordinators to create new
                     37: courses and assign course coordinators.
                     38: 
                     39: This is part of the LearningOnline Network with CAPA project
                     40: described at http://www.lon-capa.org.
                     41: 
1.112     jms        42: =head1 SUBROUTINES
1.111     jms        43: 
                     44: =over
                     45: 
1.112     jms        46: =item handler()
1.111     jms        47: 
1.112     jms        48: =item print_course_creation_page()
1.111     jms        49: 
1.112     jms        50: =item create_course()
1.111     jms        51: 
1.112     jms        52: =item print_intro_page()
1.111     jms        53: 
1.112     jms        54: =item upload_batchfile()
1.111     jms        55: 
1.112     jms        56: =item process_batchfile()
1.111     jms        57: 
                     58: =back
                     59: 
                     60: =cut
                     61: 
1.1       www        62: package Apache::loncreatecourse;
                     63: 
                     64: use strict;
                     65: use Apache::Constants qw(:common :http);
                     66: use Apache::lonnet;
1.12      www        67: use Apache::loncommon;
1.13      www        68: use Apache::londocs;
1.38      www        69: use Apache::lonlocal;
1.105     raeburn    70: use Apache::lonuserutils;
1.96      albertel   71: use Apache::lonclonecourse;
1.90      raeburn    72: use LONCAPA::batchcreatecourse;
1.89      www        73: use LONCAPA;
1.28      www        74: 
1.2       www        75: # ===================================================== Phase one: fill-in form
                     76: 
1.10      matthew    77: sub print_course_creation_page {
1.2       www        78:     my $r=shift;
1.90      raeburn    79:     my $crstype = 'Group';
                     80:     if ($env{'form.phase'} eq 'courseone') {
                     81:         $crstype = 'Course';
                     82:     }
1.78      albertel   83:     my $defdom=$env{'request.role.domain'};
1.101     albertel   84:     my %host_servers = &Apache::lonnet::get_servers($defdom,'library');
1.10      matthew    85:     my $course_home = '<select name="course_home" size="1">'."\n";
                     86:     foreach my $server (sort(keys(%host_servers))) {
1.14      matthew    87:         $course_home .= qq{<option value="$server"};
                     88:         if ($server eq $Apache::lonnet::perlvar{'lonHostID'}) {
                     89:             $course_home .= " selected ";
                     90:         }
                     91:         $course_home .= qq{>$server $host_servers{$server}</option>};
1.10      matthew    92:     }
                     93:     $course_home .= "\n</select>\n";
1.9       matthew    94:     my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
1.32      www        95:     my $cloneform=&Apache::loncommon::select_dom_form
1.78      albertel   96: 	($env{'request.role.domain'},'clonedomain').
1.32      www        97: 		     &Apache::loncommon::selectcourse_link
1.90      raeburn    98: 	     ('ccrs','clonecourse','clonedomain',undef,undef,undef,$crstype);
1.78      albertel   99:     my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'});
1.90      raeburn   100:     my ($enroll_table,$access_table,$krbdef,$krbdefdom,$krbform,$intform,$locform,
                    101:         $javascript_validations);
                    102:     if ($crstype eq 'Course') {
                    103:         my $starttime = time;
                    104:         my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
1.105     raeburn   105:         $enroll_table = &Apache::lonuserutils::date_setting_table($starttime,
                    106:                                               $endtime,'create_enrolldates');
                    107:         $access_table = &Apache::lonuserutils::date_setting_table($starttime,
                    108:                                              $endtime,'create_defaultdates');
1.90      raeburn   109:         ($krbdef,$krbdefdom) =
                    110:         &Apache::loncommon::get_kerberos_defaults($defdom);
1.105     raeburn   111:         $javascript_validations=&Apache::lonuserutils::javascript_validations(
1.90      raeburn   112:                                                     'createcourse',$krbdefdom);
                    113:         my %param = ( formname      => 'document.ccrs',
                    114:                       kerb_def_dom  => $krbdefdom,
                    115:                       kerb_def_auth => $krbdef
                    116:                     );
                    117:         $krbform = &Apache::loncommon::authform_kerberos(%param);
                    118:         $intform = &Apache::loncommon::authform_internal(%param);
                    119:         $locform = &Apache::loncommon::authform_local(%param);
                    120:     } else {
                    121:         $javascript_validations = qq|
                    122: function validate(formname) {
                    123:     if (formname.title == '') {
                    124:         alert("A group title is required");
                    125:         return;
                    126:     }
                    127:     if (formname.ccuname == '') {
                    128:         alert("The username of the group coordinator is required");
                    129:     }
                    130:     formname.submit();
                    131: }
                    132:         |;
                    133:     }
1.46      sakharuk  134:     my %lt=&Apache::lonlocal::texthash(
                    135: 		    'cinf' => "Course Information",
                    136:                     'ctit' => "Course Title",
                    137:                     'chsr' => "Course Home Server",
                    138:                     'cidn' => "Course ID/Number",
                    139:                     'opt'  => "optional",
                    140:                     'iinf' => "Institutional Information",
                    141:                     'stat' => "The following entries will be used to identify the course according to the naming scheme adopted by your institution. Your choices will be used to map an internal LON-CAPA course ID to the corresponding course section ID(s) used by the office responsible for providing official class lists for courses at your institution. This mapping is required if you choose to employ automatic population of class lists.",
                    142:                     'ccod' => "Course Code",
                    143:                     'toin' => "to interface with institutional data, e.g., fs03glg231 for Fall 2003 Geology 231",
1.90      raeburn   144:                     'snid' => "Section Numbers and corresponding LON-CAPA section IDs",
                    145:                     'csli' => "a comma separated list of institutional section numbers, each separated by a colon from the (optional) corresponding section ID to be used in LON-CAPA e.g., 001:1,002:2",
1.46      sakharuk  146:                     'crcs' => "Crosslisted courses",
1.90      raeburn   147:                     'cscs' => "a comma separated list of course sections crosslisted with the current course, with each entry including the institutional course section name followed by a colon and then the (optional) sectionID to be used in LON-CAPA, e.g., fs03ent231001:ent1,fs03bot231001:bot1,fs03zol231002:zol2",
1.46      sakharuk  148:                     'crco' => "Course Content",
                    149:                     'cncr' => "Completely new course",
                    150:                     'cecr' => "Clone an existing course", 
                    151:                     'map'  => "Map",
                    152:                     'smap' => "Select Map",
                    153:                     'sacr' => "Do NOT generate as standard course",
                    154:                     'ocik' => "only check if you know what you are doing",
                    155:                     'fres' => "First Resource",
                    156:                     'stco' => "standard courses only",
                    157:                     'blnk' => "Blank",
                    158:                     'sllb' => "Syllabus",
1.116     bisitz    159:                     'navi' => "Navigate Contents",
1.46      sakharuk  160:                     'cid'  => "Course ID",
                    161:                     'dmn'  => "Domain",
1.110     bisitz    162:                     'dsh'  => "Date Shift",
1.46      sakharuk  163:                     'asov' => "Additional settings, if specified below, will override cloned settings",
1.106     www       164:                     'ncd'  => "Do not clone date parameters",
                    165:                     'prd'  => 'Clone date parameters as-is',
                    166:                     'shd'  => 'Shift date parameters by number of days',
1.46      sakharuk  167:                     'assp' => "Assessment Parameters",
                    168:                     'oaas' => "Open all assessments",
                    169:                     'mssg' => "Messaging",
                    170:                     'scpf' => "Set course policy feedback to Course Coordinator",
                    171:                     'scfc' => "Set content feedback to Course Coordinator",
                    172:                     'cmmn' => "Communication",
                    173:                     'dsrd' => "Disable student resource discussion",
1.117     hauer     174:                     'dsuc' => "Disable student use of chat rooms",
1.46      sakharuk  175:                     'acco' => "Access Control",
                    176:                     'snak' => "Students need access key to enter course",
1.56      www       177: 		    'kaut' => 
                    178: 		    'Key authority (<tt>id@domain</tt>) if other than course',
1.46      sakharuk  179:                     'cc'   => "Course Coordinator",
                    180:                     'user' => "Username",
                    181:                     'aens' => "Automated enrollment settings",
                    182:                     'aesc' => "The following settings control automatic enrollment of students in this class based on information available for this specific course from your institution's official classlists.",
                    183:                     'aadd' => "Automated adds",
                    184:                     'yes'  => "Yes",
                    185:                     'no'   => "No",
                    186:                     'audr' => "Automated drops",
                    187:                     'dacu' => "Duration of automated classlist updates",
1.60      raeburn   188:                     'dacc' => "Default start and end dates for student access",
1.109     bisitz    189:                     'psam' => "Please select the Authentication mechanism",
1.46      sakharuk  190:                     'pcda' => "Please choose the default authentication method to be used by new users added to this LON-CAPA domain by the automated enrollment process",
                    191:                     'nech' => "Notification of enrollment changes",
                    192:                     'nccl' => "Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?",
1.77      raeburn   193:                     'ndcl' => "Notification to domain coordinator via LON-CAPA message when enrollment changes occur during the automated update?",
1.46      sakharuk  194:                     'irsp' => "Include retrieval of student photographs?",
1.55      www       195: 		    'rshm' => 'Resource Space Home',
1.93      raeburn   196:                     'cgrs' => "Course Group Settings",
                    197:                     'cgrq' => "Set a quota for the total disk space available for storage of course group portfolio files.",
1.90      raeburn   198:                     'opco' => "Open Course",
                    199:                     'ginf' => "Group Information",
                    200:                     'gtit' => "Group Title",
                    201:                     'ghsr' => "Group Home Server",
                    202:                     'gidn' => "Group ID/Number",
                    203:                     'grco' => "Group Content",
                    204:                     'cngr' => "Completely new group",
                    205:                     'cegr' => "Clone an existing group",
                    206:                     'sagr' => "Do NOT generate as standard group",
                    207:                     'stgo' => "standard groups only",
                    208:                     'sgpf' => "Set group policy feedback to Group Coordinator",
                    209:                     'scfg' => "Set content feedback to Group Coordinator",
                    210:                     'dmrd' => "Disable member resource discussion",
1.118   ! hauer     211:                     'dmuc' => "Disable member use of chat rooms",
1.90      raeburn   212:                     'mnak' => "Members need access key to enter group",
                    213:                     'kaug' =>
                    214:                     'Key authority (<tt>id@domain</tt>) if other than group',
                    215:                     'gc'   => "Group Coordinator",
                    216:                     'gid'  => "Group ID",
                    217:                     'crgr' => "Create Group",
1.93      raeburn   218:                     'grts' => "Group Teams Settings",
                    219:                     'grtq' => "Set a quota for the total disk space available for storage of group team portfolio files.",
                    220: 
1.46      sakharuk  221: 				       );
1.86      albertel  222:     my $js = <<END;
                    223: <script type="text/javascript">
1.6       matthew   224: var editbrowser = null;
                    225: function openbrowser(formname,elementname) {
                    226:     var url = '/res/?';
                    227:     if (editbrowser == null) {
                    228:         url += 'launch=1&';
                    229:     }
                    230:     url += 'catalogmode=interactive&';
                    231:     url += 'mode=edit&';
                    232:     url += 'form=' + formname + '&';
1.7       matthew   233:     url += 'element=' + elementname + '&';
                    234:     url += 'only=sequence' + '';
1.6       matthew   235:     var title = 'Browser';
                    236:     var options = 'scrollbars=1,resizable=1,menubar=0';
                    237:     options += ',width=700,height=600';
                    238:     editbrowser = open(url,title,options,'1');
                    239:     editbrowser.focus();
                    240: }
1.41      raeburn   241: $javascript_validations
1.6       matthew   242: </script>
1.32      www       243: $coursebrowserjs
1.86      albertel  244: END
                    245: 
1.90      raeburn   246:     my %titles = &Apache::lonlocal::texthash(
                    247:                   courseone => 'Create a New Course',
                    248:                   groupone => 'Create a New Group',
                    249:     );  
1.86      albertel  250:     my $start_page = 
1.90      raeburn   251:         &Apache::loncommon::start_page($titles{$env{'form.phase'}},$js);
1.86      albertel  252:     my $end_page = 
                    253:         &Apache::loncommon::end_page();
1.91      albertel  254:     my $crumbs = 
                    255: 	&Apache::lonhtmlcommon::breadcrumbs($crstype.' Information',
                    256: 					    'Create_Course',undef,
                    257: 					    'Create_Courses');
1.90      raeburn   258:     $r->print($start_page.$crumbs);
1.110     bisitz    259: 
1.90      raeburn   260:     if ($crstype eq 'Course') {
1.113     raeburn   261:         $r->print('<form action="/adm/createcourse" method="post" name="ccrs"><div class="LC_createcourse">'
1.109     bisitz    262:                  .&Apache::lonhtmlcommon::start_pick_box()
                    263: 
                    264:                  .&Apache::lonhtmlcommon::row_headline()
                    265:                  .'<h3>'.$lt{'cinf'}.'</h3>'
                    266:                  .&Apache::lonhtmlcommon::row_closure()
                    267: 
                    268:                  .&Apache::lonhtmlcommon::row_title($lt{'ctit'})
                    269:                  .'<input type="text" size="50" name="title" />'
                    270:                  .&Apache::lonhtmlcommon::row_closure()
                    271: 
                    272:                  .&Apache::lonhtmlcommon::row_title($lt{'chsr'})
                    273:                  .$course_home
                    274:                  .&Apache::lonhtmlcommon::row_closure()
                    275: 
                    276:                  .&Apache::lonhtmlcommon::row_title($lt{'cidn'}.' ('.$lt{'opt'}.')')
                    277:                  .'<input type="text" size="30" name="crsid" />'
                    278:                  .&Apache::lonhtmlcommon::row_closure()
                    279: 
                    280:                  .&Apache::lonhtmlcommon::row_headline()
                    281:                  .'<h3>'.$lt{'iinf'}.'</h3>'
                    282:                  .$lt{'stat'}
                    283:                  .&Apache::lonhtmlcommon::row_closure()
                    284: 
                    285:                  .&Apache::lonhtmlcommon::row_title($lt{'ccod'})
                    286:                  .'<input type="text" size="30" name="crscode" />'
                    287:                  .'<br />('.$lt{'toin'}.')'
                    288:                  .&Apache::lonhtmlcommon::row_closure()
                    289: 
                    290:                  .&Apache::lonhtmlcommon::row_title($lt{'snid'})
                    291:                  .'<input type="text" size="30" name="crssections" />'
                    292:                  .'<br />('.$lt{'csli'}.')'
                    293:                  .&Apache::lonhtmlcommon::row_closure()
                    294: 
                    295:                  .&Apache::lonhtmlcommon::row_title($lt{'crcs'})
                    296:                  .'<input type="text" size="30" name="crsxlist" />'
                    297:                  .'<br />('.$lt{'cscs'}.')'
                    298:                  .&Apache::lonhtmlcommon::row_closure()
1.110     bisitz    299:         );
1.109     bisitz    300: 
1.110     bisitz    301:         # Table: New Course / Clone Course
                    302:         $r->print(&Apache::lonhtmlcommon::row_headline()
1.109     bisitz    303:                  .'<h3>'.$lt{'crco'}.'</h3>'
1.110     bisitz    304:                  .&Apache::loncommon::start_data_table()
                    305:                  .&Apache::loncommon::start_data_table_header_row()
                    306:                  .'<th>'.$lt{'cncr'}.'</th>'
                    307:                  .'<th>&nbsp;'.&mt('or').'&nbsp;</th>'
                    308:                  .'<th>'.$lt{'cecr'}.'</th>'
                    309:                  .&Apache::loncommon::end_data_table_header_row()
                    310:                  .&Apache::loncommon::start_data_table_row()
                    311: 
                    312:                  # New Course:
                    313:                  .'<td>'
                    314:                  .&Apache::lonhtmlcommon::start_pick_box()
                    315:                  .&Apache::lonhtmlcommon::row_title($lt{'map'})
                    316:                  .'<input type="text" size="50" name="topmap" />'
                    317:                  .'<a href="javascript:openbrowser(\'ccrs\',\'topmap\')">'.$lt{'smap'}.'</a>'
                    318:                  .&Apache::lonhtmlcommon::row_closure()
                    319:                  .&Apache::lonhtmlcommon::row_title('<label for="nonstd">'.$lt{'sacr'}.'</label>')
                    320:                  .'<input id="nonstd" type="checkbox" name="nonstandard" />'
                    321:                  .'<br />('.$lt{'ocik'}.')'
                    322:                  .&Apache::lonhtmlcommon::row_closure()
                    323:                  .&Apache::lonhtmlcommon::row_title($lt{'fres'})
                    324:                  .'<label>'
                    325:                  .'<input type="radio" name="firstres" value="blank" />'.$lt{'blnk'}
                    326:                  .'</label>'
                    327:                  .'&nbsp;'
                    328:                  .'<label>'
                    329:                  .'<input type="radio" name="firstres" value="syl" checked="checked" />'.$lt{'sllb'}
                    330:                  .'</label>'
                    331:                  .'&nbsp;'
                    332:                  .'<label>'
                    333:                  .'<input type="radio" name="firstres" value="nav" />'.$lt{'navi'}
                    334:                  .'</label>'
                    335:                  .'<br />('.$lt{'stco'}.')'
                    336:                  .&Apache::lonhtmlcommon::row_closure(1)
                    337:                  .&Apache::lonhtmlcommon::end_pick_box()
1.109     bisitz    338: 
1.110     bisitz    339:                  .'<td>&nbsp;</td>'
1.109     bisitz    340: 
1.110     bisitz    341:                  # Clone Course:
                    342:                  .'<td>'
                    343:                  .&Apache::lonhtmlcommon::start_pick_box()
                    344:                  .&Apache::lonhtmlcommon::row_title($lt{'cid'})
                    345:                  .'<label>'
                    346:                  .'<input type="text" size="25" name="clonecourse" value="" />'
                    347:                  .'</label>'
                    348:                  .&Apache::lonhtmlcommon::row_closure(1)
                    349:                  .&Apache::lonhtmlcommon::row_title($lt{'dmn'})
                    350:                  .'<label>'
                    351:                  .$cloneform
                    352:                  .'</label>'
                    353:                  .&Apache::lonhtmlcommon::row_closure()
                    354:                  .&Apache::lonhtmlcommon::row_title($lt{'dsh'})
                    355:                  .'<label>'
                    356:                  .'<input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}
                    357:                  .'</label><br />'
                    358:                  .'<label>'
                    359:                  .'<input type="radio" name="datemode" value="preserve" /> '.$lt{'prd'}
                    360:                  .'</label><br />'
                    361:                  .'<label>'
                    362:                  .'<input type="radio" name="datemode" value="shift" checked="checked" /> '.$lt{'shd'}
                    363:                  .'</label>'
                    364:                  .' <input type="text" size="5" name="dateshift" value="365" />'
                    365:                  .&Apache::lonhtmlcommon::row_closure()
                    366:                  .&Apache::lonhtmlcommon::row_headline()
                    367:                  .$lt{'asov'}
                    368:                  .&Apache::lonhtmlcommon::row_closure(1)
                    369:                  .&Apache::lonhtmlcommon::end_pick_box()
                    370:                  .'</td>'
                    371:                  .&Apache::loncommon::end_data_table_row()
                    372:                  .&Apache::loncommon::end_data_table()
1.109     bisitz    373:                  .&Apache::lonhtmlcommon::row_closure()
1.110     bisitz    374:         );
1.109     bisitz    375: 
1.110     bisitz    376:         $r->print(&Apache::lonhtmlcommon::row_headline()
1.109     bisitz    377:                  .'<h3>'.$lt{'assp'}.'</h3>'
                    378:                  .&Apache::lonhtmlcommon::row_closure()
                    379: 
                    380:                  .&Apache::lonhtmlcommon::row_title($lt{'oaas'})
                    381:                  .'<input type="checkbox" name="openall" />'
                    382:                  .&Apache::lonhtmlcommon::row_closure()
                    383: 
                    384:                  .&Apache::lonhtmlcommon::row_headline()
                    385:                  .'<h3>'.$lt{'mssg'}.'</h3>'
                    386:                  .&Apache::lonhtmlcommon::row_closure()
                    387: 
                    388:                  .&Apache::lonhtmlcommon::row_title($lt{'scpf'})
                    389:                  .'<input type="checkbox" name="setpolicy" checked="checked" />'
                    390:                  .&Apache::lonhtmlcommon::row_closure()
                    391: 
                    392:                  .&Apache::lonhtmlcommon::row_title($lt{'scfc'})
                    393:                  .'<input type="checkbox" name="setcontent" checked="checked" />'
                    394:                  .&Apache::lonhtmlcommon::row_closure()
                    395: 
                    396:                  .&Apache::lonhtmlcommon::row_headline()
                    397:                  .'<h3>'.$lt{'cmmn'}.'</h3>'
                    398:                  .&Apache::lonhtmlcommon::row_closure()
                    399: 
                    400:                  .&Apache::lonhtmlcommon::row_title($lt{'dsrd'})
                    401:                  .'<input type="checkbox" name="disresdis" />'
                    402:                  .&Apache::lonhtmlcommon::row_closure()
                    403: 
                    404:                  .&Apache::lonhtmlcommon::row_title($lt{'dsuc'})
                    405:                  .'<input type="checkbox" name="disablechat" /'
                    406:                  .&Apache::lonhtmlcommon::row_closure()
                    407: 
                    408:                  .&Apache::lonhtmlcommon::row_headline()
                    409:                  .'<h3>'.$lt{'acco'}.'</h3>'
                    410:                  .&Apache::lonhtmlcommon::row_closure()
                    411: 
                    412:                  .&Apache::lonhtmlcommon::row_title($lt{'snak'})
                    413:                  .'<input type="checkbox" name="setkeys" />'
                    414:                  .&Apache::lonhtmlcommon::row_closure()
                    415: 
                    416:                  .&Apache::lonhtmlcommon::row_title($lt{'kaut'})
                    417:                  .'<input type="text" size="30" name="keyauth" />'
                    418:                  .&Apache::lonhtmlcommon::row_closure()
                    419: 
                    420:                  .&Apache::lonhtmlcommon::row_headline()
                    421:                  .'<h3>'.$lt{'rshm'}.'</h3>'
                    422:                  .&Apache::lonhtmlcommon::row_closure()
                    423: 
                    424:                  .&Apache::lonhtmlcommon::row_title($lt{'rshm'})
                    425:                  .'<input type="text" name="reshome" size="30" value="/res/'.$defdom.'/" />'
                    426:                  .&Apache::lonhtmlcommon::row_closure()
                    427: 
                    428:                  .&Apache::lonhtmlcommon::row_headline()
                    429:                  .'<h3>'.$lt{'aens'}.'</h3>'
                    430:                  .&Apache::lonhtmlcommon::row_closure()
                    431: 
                    432:                  .&Apache::lonhtmlcommon::row_title($lt{'aadd'})
                    433:                  .'<label><input type="radio" name="autoadds" value="1" />'.$lt{'yes'}.'</label>'
                    434:                  .'<label><input type="radio" name="autoadds" value="0" checked="checked" />'.$lt{'no'}.'</label>'
                    435:                  .&Apache::lonhtmlcommon::row_closure()
                    436: 
                    437:                  .&Apache::lonhtmlcommon::row_title($lt{'audr'})
                    438:                  .'<label><input type="radio" name="autodrops" value="1" />'.$lt{'yes'}.'</label>'
                    439:                  .'<label><input type="radio" name="autodrops" value="0" checked="checked" />'.$lt{'no'}.'</label>'
                    440:                  .&Apache::lonhtmlcommon::row_closure()
                    441: 
                    442:                  .&Apache::lonhtmlcommon::row_title($lt{'dacu'})
                    443:                  .$enroll_table
                    444:                  .&Apache::lonhtmlcommon::row_closure()
                    445: 
                    446:                  .&Apache::lonhtmlcommon::row_title($lt{'dacc'})
                    447:                  .$access_table
                    448:                  .&Apache::lonhtmlcommon::row_closure()
                    449: 
                    450:                  .&Apache::lonhtmlcommon::row_title($lt{'psam'})
                    451:                  .$lt{'pcda'}.'<br />'
                    452:                  .$krbform.'<br />'
                    453:                  .$intform.'<br />'
                    454:                  .$locform
                    455:                  .&Apache::lonhtmlcommon::row_closure()
                    456: 
                    457:                  .&Apache::lonhtmlcommon::row_title($lt{'nech'})
                    458:                  .$lt{'nccl'}.'<br/>'
                    459:                  .'<label><input type="radio" name="notify_owner" value="1" />'.$lt{'yes'}.'</label>'
                    460:                  .'<label><input type="radio" name="notify_owner" value="0" checked="checked" />'.$lt{'no'}.'</label>'
                    461:                  .'<br />'
                    462:                  .$lt{'ndcl'}.'<br/>'
                    463:                  .'<label><input type="radio" name="notify_dc" value="1" />'.$lt{'yes'}.'</label>'
                    464:                  .'<label><input type="radio" name="notify_dc" value="0" checked="checked" />'.$lt{'no'}.'</label>'
                    465:                  .&Apache::lonhtmlcommon::row_closure()
                    466: 
                    467:                  .&Apache::lonhtmlcommon::row_title($lt{'irsp'})
                    468:                  .'<label>'
                    469:                  .'<input type="radio" name="showphotos" value="1" />'.$lt{'yes'}
                    470:                  .'</label> '
                    471:                  .'<label>'
                    472:                  .'<input type="radio" name="showphotos" value="0" checked="checked" />'.$lt{'no'}
                    473:                  .'</label> '
                    474:                  .&Apache::lonhtmlcommon::row_closure()
                    475: 
                    476:                  .&Apache::lonhtmlcommon::row_headline()
                    477:                  .'<h3>'.$lt{'cgrs'}.'</h3>'
                    478:                  .&Apache::lonhtmlcommon::row_closure()
                    479: 
                    480:                  .&Apache::lonhtmlcommon::row_title($lt{'cgrq'})
                    481:                  .'<input type="text" name="crsquota" value="20" size="6" />Mb'
                    482:                  .&Apache::lonhtmlcommon::row_closure()
                    483: 
                    484:                  .&Apache::lonhtmlcommon::row_headline()
                    485:                  .'<h3>'.$lt{'cc'}.'</h3>'
                    486:                  .&Apache::lonhtmlcommon::row_closure()
                    487: 
                    488:                  .&Apache::lonhtmlcommon::row_title($lt{'user'})
                    489:                  .'<input type="text" size="15" name="ccuname" />'
                    490:                  .&Apache::lonhtmlcommon::row_closure()
                    491: 
                    492:                  .&Apache::lonhtmlcommon::row_title($lt{'dmn'},"","LC_odd_row_value")
                    493:                  .$domform
                    494:                  .&Apache::lonhtmlcommon::row_closure(1)
                    495: 
                    496:                  .&Apache::lonhtmlcommon::end_pick_box()
1.110     bisitz    497:         );
1.109     bisitz    498: 
                    499:         $r->print(<<ENDDOCUMENT);
1.113     raeburn   500: </div>
1.55      www       501: <p>
1.90      raeburn   502: <input type="hidden" name="prevphase" value="courseone" />
                    503: <input type="hidden" name="phase" value="coursetwo" />
1.68      matthew   504: <input type="button" onClick="verify_message(this.form)" value="$lt{'opco'}" />
1.10      matthew   505: </p>
1.2       www       506: </form>
                    507: ENDDOCUMENT
1.109     bisitz    508: 
1.90      raeburn   509:     } elsif ($crstype eq 'Group') {
                    510:         $r->print(<<ENDDOCUMENT);
                    511: <form action="/adm/createcourse" method="post" name="ccrs">
                    512: <h2>$lt{'ginf'}</h2>
                    513: <p>
                    514: <label><b>$lt{'gtit'}:</b>
                    515: <input type="text" size="50" name="title" /></label>
                    516: </p><p>
                    517: <label>
                    518:     <b>$lt{'ghsr'}:</b>$course_home
                    519: </label>
                    520: </p><p>
                    521: <label>
                    522:     <b>$lt{'gidn'} ($lt{'opt'})</b>
                    523:     <input type="text" size="30" name="crsid" />
                    524: </label>
                    525: </p>
                    526: <h2>$lt{'grco'}</h2>
                    527: <table border="2">
                    528: <tr><th>$lt{'cngr'}</th><th>$lt{'cegr'}</th></tr>
                    529: <tr><td>
                    530: <p>
                    531: <label>
                    532:     <b>$lt{'map'}:</b>
                    533:     <input type="text" size="50" name="topmap" />
                    534: </label>
                    535: <a href="javascript:openbrowser('ccrs','topmap')">$lt{'smap'}</a>
                    536: </p><p>
                    537: <label for="nonstd"><b>$lt{'sagr'}</b></label>
                    538: <br />
                    539: ($lt{'ocik'}):
                    540: <input id="nonstd" type="checkbox" name="nonstandard" />
                    541: </p><p>
                    542: <b>$lt{'fres'}</b><br />($lt{'stgo'}):
                    543: <label>
                    544:     <input type="radio" name="firstres" value="blank" />$lt{'blnk'}
                    545: </label>
                    546: &nbsp;
                    547: <label>
1.109     bisitz    548:     <input type="radio" name="firstres" value="syl" checked="checked" />$lt{'sllb'}
1.90      raeburn   549: </label>
                    550: &nbsp;
                    551: <label>
                    552:     <input type="radio" name="firstres" value="nav" />$lt{'navi'}
                    553: </label>
                    554: </p>
                    555: </td><td>
                    556: <label>
                    557:     $lt{'gid'}: <input type="text" size="25" name="clonecourse" value="" />
                    558: </label>
                    559: <br />
                    560: <label>
                    561:     $lt{'dmn'}: $cloneform
                    562: </label>
                    563: <br />
1.106     www       564:  <label><input type="radio" name="datemode" value="delete" /> $lt{'ncd'}</label><br />
                    565:  <label><input type="radio" name="datemode" value="preserve" /> $lt{'prd'}</label><br />
                    566:  <label><input type="radio" name="datemode" value="shift" checked="checked" /> $lt{'shd'}</label>
                    567:  <input type="text" size="5" name="dateshift" value="365" /><br />&nbsp;<br />
1.90      raeburn   568: $lt{'asov'}.
                    569: </td></tr>
                    570: </table>
                    571: </p>
                    572: <p>
                    573: <h2>$lt{'mssg'}</h2>
                    574: <p>
                    575: <label>
                    576:     <b>$lt{'sgpf'}: </b>
1.109     bisitz    577:     <input type="checkbox" name="setpolicy" checked="checked" />
1.90      raeburn   578: </label>
                    579: <br />
                    580: <label>
                    581:     <b>$lt{'scfg'}: </b>
1.109     bisitz    582:     <input type="checkbox" name="setcontent" checked="checked" />
1.90      raeburn   583: </label>
                    584: </p>
                    585: <h2>$lt{'cmmn'}</h2>
                    586: <p>
                    587: <label>
                    588:     <b>$lt{'dmrd'}: </b>
                    589:     <input type="checkbox" name="disresdis" />
                    590: </label>
                    591: <br />
                    592: <label>
                    593:     <b>$lt{'dmuc'}: </b>
                    594:     <input type="checkbox" name="disablechat" />
                    595: </label>
                    596: </p>
                    597: <h2>$lt{'acco'}</h2>
                    598: <p>
                    599: <label>
                    600:     <b>$lt{'mnak'}: </b>
                    601:     <input type="checkbox" name="setkeys" />
                    602: </label>
                    603: <br />
                    604: <label>
                    605:     <b>$lt{'kaug'}: </b>
                    606:     <input type="text" size="30" name="keyauth" />
                    607: </label>
                    608: </p>
                    609: <h2>$lt{'rshm'}</h2>
                    610: <p>
                    611: <label>
                    612:     <b>$lt{'rshm'}: </b>
                    613:     <input type="text" name="reshome" size="30" value="/res/$defdom/" />
                    614: </label>
                    615: </p>
1.93      raeburn   616: <p>
                    617: <h2>$lt{'grts'}</h2>
                    618: $lt{'grtq'}
                    619: <input type="text" name="crsquota" value="20" />Mb
                    620: </p>
1.90      raeburn   621: <hr />
                    622: <h2>$lt{'gc'}</h2>
                    623: <p>
                    624: <label>
                    625:     <b>$lt{'user'}:</b> <input type="text" size="15" name="ccuname" />
                    626: </label>
                    627: </p><p>
                    628: <label>
                    629:     <b>$lt{'dmn'}:</b> $domform
                    630: </label>
                    631: </p>
                    632: <p>
                    633: <input type="hidden" name="prevphase" value="groupone" />
                    634: <input type="hidden" name="phase" value="grouptwo" />
                    635: <input type="button" onClick="validate(this.form)" value="$lt{'crgr'}" />
                    636: </p>
                    637: </form>
                    638: ENDDOCUMENT
                    639:     }
                    640:     $r->print($end_page);
1.40      raeburn   641: }
                    642: 
1.2       www       643: # ====================================================== Phase two: make course
                    644: 
1.10      matthew   645: sub create_course {
1.2       www       646:     my $r=shift;
1.99      albertel  647:     my $ccuname =&LONCAPA::clean_username($env{'form.ccuname'});
                    648:     my $ccdomain=&LONCAPA::clean_domain($env{'form.ccdomain'});
1.90      raeburn   649:     my $crstype = 'Group';
                    650:     my ($enrollstart,$enrollend,$startaccess,$endaccess);
1.74      raeburn   651: 
1.90      raeburn   652:     if ($env{'form.phase'} eq 'coursetwo') {
                    653:         $crstype='Course';
                    654:         $enrollstart=&Apache::lonhtmlcommon::get_date_from_form('startenroll');
                    655:         $enrollend=&Apache::lonhtmlcommon::get_date_from_form('endenroll');
                    656:     }
                    657:     $startaccess = &Apache::lonhtmlcommon::get_date_from_form('startaccess');
                    658:     $endaccess   = &Apache::lonhtmlcommon::get_date_from_form('endaccess');
1.74      raeburn   659: 
                    660:     my $autharg;
                    661:     my $authtype;
                    662: 
1.78      albertel  663:     if ($env{'form.login'} eq 'krb') {
1.74      raeburn   664:         $authtype = 'krb';
1.78      albertel  665:         $authtype .=$env{'form.krbver'};
                    666:         $autharg = $env{'form.krbarg'};
                    667:     } elsif ($env{'form.login'} eq 'int') {
1.74      raeburn   668:         $authtype ='internal';
1.78      albertel  669:         if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) {
                    670:             $autharg = $env{'form.intarg'};
1.74      raeburn   671:         }
1.78      albertel  672:     } elsif ($env{'form.login'} eq 'loc') {
1.74      raeburn   673:         $authtype = 'localauth';
1.78      albertel  674:         if ((defined($env{'form.locarg'})) && ($env{'form.locarg'})) {
                    675:             $autharg = $env{'form.locarg'};
1.74      raeburn   676:         }
                    677:     }
1.90      raeburn   678:     my $logmsg;
1.91      albertel  679:     my $start_page=&Apache::loncommon::start_page('Create a New '.$crstype);
1.90      raeburn   680:     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses');
1.74      raeburn   681: 
1.90      raeburn   682:     $r->print($start_page.$crumbs);
1.74      raeburn   683: 
                    684:     my $args = {
1.90      raeburn   685:                crstype => $crstype,
1.74      raeburn   686:                ccuname => $ccuname,
                    687:                ccdomain => $ccdomain,
1.78      albertel  688:                cdescr => $env{'form.title'},
                    689:                curl => $env{'form.topmap'},
                    690:                course_domain => $env{'request.role.domain'},
                    691:                course_home =>  $env{'form.course_home'},
                    692:                nonstandard => $env{'form.nonstandard'},
                    693:                crscode => $env{'form.crscode'},
1.93      raeburn   694:                crsquota => $env{'form.crsquota'},
1.103     raeburn   695:                clonecourse => $env{'form.clonecourse'},
                    696:                clonedomain => $env{'form.clonedomain'},
1.106     www       697:                datemode => $env{'form.datemode'},
                    698:                dateshift => $env{'form.dateshift'},
1.78      albertel  699:                crsid => $env{'form.crsid'},
1.94      raeburn   700:                curruser => $env{'user.name'}.':'.$env{'user.domain'},
1.78      albertel  701:                crssections => $env{'form.crssections'},
                    702:                crsxlist => $env{'form.crsxlist'},
                    703:                autoadds => $env{'form.autoadds'},
                    704:                autodrops => $env{'form.autodrops'},
                    705:                notify_owner => $env{'form.notify_owner'},
                    706:                notify_dc => $env{'form.notify_dc'},
                    707:                no_end_date => $env{'form.no_end_date'},
                    708:                showphotos => $env{'form.showphotos'},
1.74      raeburn   709:                authtype => $authtype,
                    710:                autharg => $autharg,
                    711:                enrollstart => $enrollstart,
                    712:                enrollend => $enrollend,
                    713:                startaccess => $startaccess,
                    714:                endaccess => $endaccess,
1.78      albertel  715:                setpolicy => $env{'form.setpolicy'},
                    716:                setcontent => $env{'form.setcontent'},
                    717:                reshome => $env{'form.reshome'},
                    718:                setkeys => $env{'form.setkeys'},
                    719:                keyauth => $env{'form.keyauth'},
                    720:                disresdis => $env{'form.disresdis'},
                    721:                disablechat => $env{'form.disablechat'},
                    722:                openall => $env{'form.openall'},
                    723:                firstres => $env{'form.firstres'}
1.74      raeburn   724:                };
                    725: 
1.10      matthew   726:     #
                    727:     # Verify data
                    728:     #
                    729:     # Check the veracity of the course coordinator
1.2       www       730:     if (&Apache::lonnet::homeserver($ccuname,$ccdomain) eq 'no_host') {
1.52      albertel  731: 	$r->print('<form action="/adm/createuser" method="post" name="crtuser">');
1.108     bisitz    732:         $r->print('<div class="LC_warning">'
                    733:                   .&mt('No such user [_1] at domain [_2].','<tt>'.$ccuname.'</tt>','<tt>'.$ccdomain.'</tt>')
                    734:                  .'</div>');
                    735: 	$r->print(&mt('Please click Back on your browser and select another user, or [_1]Create User[_2]'
                    736: 	             , '<input type="hidden" name="phase" value="get_user_info" />'
                    737:                       .'<input type="hidden" name="ccuname" value="'.$ccuname.'" />'
                    738:                       .'<input type="hidden" name="ccdomain" value="'.$ccdomain.'" />'
                    739:                       .'<input name="userrole" type="submit" value="'
                    740:                      , '" />'
                    741:                      )
                    742:                  .'</form>'.&Apache::loncommon::end_page()
                    743:                  );
1.2       www       744: 	return;
                    745:     }
1.10      matthew   746:     # Check the proposed home server for the course
1.101     albertel  747:     my %host_servers = 
                    748: 	&Apache::lonnet::get_servers($env{'request.role.domain'},'library');
1.78      albertel  749:     if (! exists($host_servers{$env{'form.course_home'}})) {
1.108     bisitz    750:         $r->print(&mt('Invalid home server for course: [_1]'
                    751:                      ,$env{'form.course_home'}.&Apache::loncommon::end_page()));
1.10      matthew   752:         return;
                    753:     }
1.74      raeburn   754:     my ($courseid,$crsudom,$crsunum);
1.104     albertel  755:     my ($success,$output) = 
                    756: 	&Apache::loncommon::construct_course($args,\$logmsg,\$courseid,
                    757: 					     \$crsudom,\$crsunum,
                    758: 					     $env{'user.domain'},
                    759: 					     $env{'user.name'});
                    760:     $r->print($output);
                    761:     if ($success) {
                    762:         #
                    763: 	# Make the requested user a course coordinator or group coordinator
                    764:         #
                    765: 	if (($ccdomain) && ($ccuname)) {
1.114     bisitz    766: 	    $r->print(&mt('Assigning role of '.$crstype.' Coordinator to [_1]:',
                    767: 			 ,'<i>'.$ccuname.':'.$ccdomain.'</i>')
                    768: 		      .&Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,
1.107     raeburn   769: 						  'cc','','','','','createcourse').'<p>');
1.104     albertel  770: 	}
                    771: 	if ($env{'form.setkeys'}) {
                    772: 	    $r->print(
                    773: 		      '<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>');
                    774: 	}
                    775:         # Flush the course logs so reverse user roles immediately updated
                    776: 	&Apache::lonnet::flushcourselogs();
                    777: 	$r->print('<p>'.&mt('Roles will be active at next login').'.</p>');
                    778:     }
                    779:     $r->print('<p><a href="/adm/createcourse?phase='.lc($crstype).'one">'.
1.114     bisitz    780: 	      &mt("Create Another $crstype").'</a></p>'.
1.86      albertel  781: 	      &Apache::loncommon::end_page());
1.74      raeburn   782: }
                    783: 
1.90      raeburn   784: sub print_intro_page {
                    785:     my $r = shift;
                    786:     my $start_page =
                    787:         &Apache::loncommon::start_page('Create a New Course or Group Space');
                    788:     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Options','Create_Course',undef,'Create_Courses');
                    789:     my $end_page =
                    790:         &Apache::loncommon::end_page();
                    791:     my $helplink=&Apache::loncommon::help_open_topic('Create_Course_GroupSpace',&mt('Help on Creating Courses and Groups'));
                    792: 
                    793:     my @choices = ({ internal_name => 'courseone',
                    794:                      name => &mt('Create a single course'),
                    795:                      short_description =>
                    796:     &mt('Create a new course by completing an online form.'),
                    797:                  },
                    798:                    { internal_name => 'groupone',
1.108     bisitz    799:                      name => &mt('Create a single collaborative group space'),
1.90      raeburn   800:                      short_description =>
1.108     bisitz    801:     &mt('Create a new group space for non-course use by completing an online form.'),
1.90      raeburn   802:                  },
                    803:                    { internal_name => 'batchone',
                    804:                      name => &mt('Create courses/groups by uploading an attributes file'),
                    805:                      short_description =>
1.108     bisitz    806:     &mt('Upload an attributes file containing specifications for one or more courses or groups in XML format.'),
1.97      raeburn   807:                      help => 'Batch_Creation',
1.90      raeburn   808:                  },
                    809:     );
                    810:     my $options;
                    811:     foreach my $choice (@choices) {
                    812:         $options .='    <h3><a href="/adm/createcourse?phase='.
                    813:             $choice->{'internal_name'}.'" >'.
1.97      raeburn   814:             $choice->{'name'}.'</a>';
                    815:         if (exists($choice->{'help'})) {
                    816:             $options .= &Apache::loncommon::help_open_topic($choice->{'help'});
                    817:         }
                    818:         $options .= "</h3>\n".'    '.('&nbsp;'x8).$choice->{'short_description'}.
1.90      raeburn   819:             "\n";
                    820:     }
                    821: 
                    822:     $r->print(<<ENDDOCUMENT);
                    823: $start_page
                    824: $crumbs
                    825: $options
                    826: $end_page
                    827: ENDDOCUMENT
                    828: }
                    829: 
                    830: sub upload_batchfile {
                    831:     my $r = shift;
                    832:     my $start_page =
                    833:         &Apache::loncommon::start_page('Create a New Course or Group Space');
                    834:     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Upload Course/Group Attributes File','Create_Course',undef,'Create_Courses');
                    835:     my $end_page =
                    836:         &Apache::loncommon::end_page();
                    837:     $r->print($start_page.$crumbs);
                    838:     $r->print('<h3>'.&mt('Upload a courses or groups attributes file').'</h3>');
                    839:     $r->print('<form name="batchcreate" method="post" '.
                    840:                 'enctype="multipart/form-data" action="/adm/createcourse">'.
                    841:               '<input type="file" name="coursecreatorxml" />'.
                    842:               '<input type="hidden" name="phase" value="batchtwo"><br /><br />'.
                    843:               '<input type="submit" name="batchsubmit" '.
                    844:               'value="Create Courses/Groups" /></form>');
                    845:     $r->print($end_page);
                    846:     return;
                    847: }
                    848: 
                    849: sub process_batchfile {
                    850:     my $r = shift;
                    851:     my $start_page =
                    852:         &Apache::loncommon::start_page('Create a New Course or Group Space');
                    853:     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses');
                    854:     my $end_page =
                    855:         &Apache::loncommon::end_page();
                    856:     my $defdom=$env{'request.role.domain'};
                    857:     my $batchfilepath=&Apache::lonnet::userfileupload('coursecreatorxml',undef,
                    858:                                                       'batchupload',undef,undef,
                    859:                                                        undef,undef,$defdom);
                    860:     my ($batchdir,$filename) = ($batchfilepath =~ m-^(.+)/pending/([^/]+)$-);
                    861:     my ($result,$logmsg);
                    862:     if (-e "$batchfilepath") {
                    863:         open(FILE,"<$batchfilepath");
                    864:         my @buffer = <FILE>;
                    865:         close(FILE);
                    866:         if ((defined($filename)) && (defined($batchdir))) {
                    867:             my @requests = ($filename);
                    868:             my %courseids = ();
                    869:             ($result,$logmsg) = &LONCAPA::batchcreatecourse::create_courses(
                    870:                                         \@requests,\%courseids,'web',$defdom,
                    871:                                         $env{'user.name'},$env{'user.domain'});
                    872:             if ($result) {
                    873:                 if (!-e "$batchdir/processed") {
                    874:                     mkdir("$batchdir/processed", 0755);
                    875:                     open(FILE,">$batchdir/processed/$filename");
                    876:                     print FILE @buffer;
                    877:                     close(FILE);
                    878:                     if (-e "$batchdir/processed/$filename") {
                    879:                         unlink("$batchdir/pending/$filename");
                    880:                     }
                    881:                 }
                    882:             }
                    883:         }
                    884:     }
1.103     raeburn   885:     $r->print($start_page.$crumbs.$logmsg.$result.'<br /><a href="/adm/createcourse">'.
                    886:               &mt('Creation options menu').'</a>'.$end_page);
1.90      raeburn   887:  
                    888: }
                    889: 
1.2       www       890: # ===================================================================== Handler
1.1       www       891: sub handler {
                    892:     my $r = shift;
                    893: 
                    894:     if ($r->header_only) {
1.38      www       895:        &Apache::loncommon::content_type($r,'text/html');
1.1       www       896:        $r->send_http_header;
                    897:        return OK;
                    898:     }
                    899: 
1.78      albertel  900:     if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
1.38      www       901:        &Apache::loncommon::content_type($r,'text/html');
1.1       www       902:        $r->send_http_header;
                    903: 
1.90      raeburn   904:        &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                    905:                                             ['phase']);
                    906:        &Apache::lonhtmlcommon::clear_breadcrumbs();
                    907:        &Apache::lonhtmlcommon::add_breadcrumb
                    908:           ({href=>"/adm/createcourse",
                    909:             text=>"Creation Options",
                    910:             faq=>79,bug=>'Dom Coord Interface',});
                    911:        if (($env{'form.phase'} eq 'coursetwo') ||
                    912:            ($env{'form.phase'} eq 'grouptwo')) {
                    913:            &Apache::lonhtmlcommon::add_breadcrumb
                    914:                  ({href=>"/adm/createcourse?phase=$env{'form.prevphase'}",
                    915:                    text=>&mt('[_1] Creation Settings',),
                    916:                    faq=>9,bug=>'Dom Coord Interface',});
                    917:           &Apache::lonhtmlcommon::add_breadcrumb
                    918:                  ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
                    919:                    text=>"Creation Outcome",
                    920:                    faq=>9,bug=>'Dom Coord Interface',});
1.10      matthew   921:            &create_course($r);
1.90      raeburn   922:        } elsif (($env{'form.phase'} eq 'courseone') || 
                    923:                 ($env{'form.phase'} eq 'groupone')) {
                    924:            &Apache::lonhtmlcommon::add_breadcrumb
                    925:                  ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
                    926:                    text=>&mt('[_1] Creation Settings',),
                    927:                    faq=>9,bug=>'Dom Coord Interface',});
                    928: 	   &print_course_creation_page($r);
                    929:        } elsif ($env{'form.phase'} eq 'batchone') {
                    930:            &Apache::lonhtmlcommon::add_breadcrumb
                    931:                  ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
                    932:                    text=>"Upload Description File",
                    933:                    faq=>9,bug=>'Dom Coord Interface',});
                    934:            &upload_batchfile($r);
                    935:        } elsif ($env{'form.phase'} eq 'batchtwo') {
                    936:            &Apache::lonhtmlcommon::add_breadcrumb
                    937:                  ({href=>"/adm/createcourse?phase=$env{'form.prevphase'}",
                    938:                    text=>"Upload Description File",
                    939:                    faq=>9,bug=>'Dom Coord Interface',});
                    940:            &Apache::lonhtmlcommon::add_breadcrumb
                    941:                  ({href=>"/adm/createcourse?phase=$env{'form.phase'}",
                    942:                    text=>"Creation Outcome",
                    943:                    faq=>9,bug=>'Dom Coord Interface',});
                    944:            &process_batchfile($r);
1.2       www       945:        } else {
1.90      raeburn   946:            &print_intro_page($r);
1.2       www       947:        }
1.1       www       948:    } else {
1.78      albertel  949:       $env{'user.error.msg'}=
1.90      raeburn   950:         "/adm/createcourse:ccc:0:0:Cannot create courses or groups";
1.1       www       951:       return HTTP_NOT_ACCEPTABLE; 
                    952:    }
                    953:    return OK;
1.90      raeburn   954: }
1.1       www       955: 
                    956: 1;
                    957: __END__

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