--- loncom/interface/loncreatecourse.pm 2007/12/14 00:24:11 1.105 +++ loncom/interface/loncreatecourse.pm 2009/02/16 16:19:39 1.115 @@ -1,7 +1,7 @@ # The LearningOnline Network # Create a course # -# $Id: loncreatecourse.pm,v 1.105 2007/12/14 00:24:11 raeburn Exp $ +# $Id: loncreatecourse.pm,v 1.115 2009/02/16 16:19:39 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -27,6 +27,38 @@ # ### +=head1 NAME + +Apache::loncreatecourse.pm + +=head1 SYNOPSIS + +Allows domain coordinators to create new +courses and assign course coordinators. + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + +=head1 SUBROUTINES + +=over + +=item handler() + +=item print_course_creation_page() + +=item create_course() + +=item print_intro_page() + +=item upload_batchfile() + +=item process_batchfile() + +=back + +=cut + package Apache::loncreatecourse; use strict; @@ -124,10 +156,14 @@ function validate(formname) { 'stco' => "standard courses only", 'blnk' => "Blank", 'sllb' => "Syllabus", - 'navi' => "Navigate", + 'navi' => "Navigate Content", 'cid' => "Course ID", 'dmn' => "Domain", + 'dsh' => "Date Shift", 'asov' => "Additional settings, if specified below, will override cloned settings", + 'ncd' => "Do not clone date parameters", + 'prd' => 'Clone date parameters as-is', + 'shd' => 'Shift date parameters by number of days', 'assp' => "Assessment Parameters", 'oaas' => "Open all assessments", 'mssg' => "Messaging", @@ -150,7 +186,7 @@ function validate(formname) { 'audr' => "Automated drops", 'dacu' => "Duration of automated classlist updates", 'dacc' => "Default start and end dates for student access", - 'psam' => "Please select the authentication mechanism", + 'psam' => "Please select the Authentication mechanism", 'pcda' => "Please choose the default authentication method to be used by new users added to this LON-CAPA domain by the automated enrollment process", 'nech' => "Notification of enrollment changes", 'nccl' => "Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?", @@ -220,210 +256,248 @@ END 'Create_Course',undef, 'Create_Courses'); $r->print($start_page.$crumbs); + if ($crstype eq 'Course') { + $r->print('
' + .&Apache::lonhtmlcommon::start_pick_box() + + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'cinf'}.'

' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'ctit'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'chsr'}) + .$course_home + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'cidn'}.' ('.$lt{'opt'}.')') + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'iinf'}.'

' + .$lt{'stat'} + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'ccod'}) + .'' + .'
('.$lt{'toin'}.')' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'snid'}) + .'' + .'
('.$lt{'csli'}.')' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'crcs'}) + .'' + .'
('.$lt{'cscs'}.')' + .&Apache::lonhtmlcommon::row_closure() + ); + + # Table: New Course / Clone Course + $r->print(&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'crco'}.'

' + .&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row() + .''.$lt{'cncr'}.'' + .' '.&mt('or').' ' + .''.$lt{'cecr'}.'' + .&Apache::loncommon::end_data_table_header_row() + .&Apache::loncommon::start_data_table_row() + + # New Course: + .'' + .&Apache::lonhtmlcommon::start_pick_box() + .&Apache::lonhtmlcommon::row_title($lt{'map'}) + .'' + .''.$lt{'smap'}.'' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title('') + .'' + .'
('.$lt{'ocik'}.')' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title($lt{'fres'}) + .'' + .' ' + .'' + .' ' + .'' + .'
('.$lt{'stco'}.')' + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::end_pick_box() + + .' ' + + # Clone Course: + .'' + .&Apache::lonhtmlcommon::start_pick_box() + .&Apache::lonhtmlcommon::row_title($lt{'cid'}) + .'' + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::row_title($lt{'dmn'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_title($lt{'dsh'}) + .'
' + .'
' + .'' + .' ' + .&Apache::lonhtmlcommon::row_closure() + .&Apache::lonhtmlcommon::row_headline() + .$lt{'asov'} + .&Apache::lonhtmlcommon::row_closure(1) + .&Apache::lonhtmlcommon::end_pick_box() + .'' + .&Apache::loncommon::end_data_table_row() + .&Apache::loncommon::end_data_table() + .&Apache::lonhtmlcommon::row_closure() + ); + + $r->print(&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'assp'}.'

' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'oaas'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'mssg'}.'

' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'scpf'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'scfc'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'cmmn'}.'

' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'dsrd'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'dsuc'}) + .''.$lt{'acco'}.'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'snak'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'kaut'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'rshm'}.'

' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'rshm'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'aens'}.'

' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'aadd'}) + .'' + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'audr'}) + .'' + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'dacu'}) + .$enroll_table + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'dacc'}) + .$access_table + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'psam'}) + .$lt{'pcda'}.'
' + .$krbform.'
' + .$intform.'
' + .$locform + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'nech'}) + .$lt{'nccl'}.'
' + .'' + .'' + .'
' + .$lt{'ndcl'}.'
' + .'' + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'irsp'}) + .' ' + .' ' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'cgrs'}.'

' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'cgrq'}) + .'Mb' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_headline() + .'

'.$lt{'cc'}.'

' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'user'}) + .'' + .&Apache::lonhtmlcommon::row_closure() + + .&Apache::lonhtmlcommon::row_title($lt{'dmn'},"","LC_odd_row_value") + .$domform + .&Apache::lonhtmlcommon::row_closure(1) + + .&Apache::lonhtmlcommon::end_pick_box() + ); + $r->print(< -

$lt{'cinf'}

-

- -

- -

- -

-

$lt{'iinf'}

-

-$lt{'stat'} -

- -
-($lt{'toin'}) -

- -
-($lt{'csli'}) -

- -
-($lt{'cscs'}) -

-

$lt{'crco'}

- - - -
$lt{'cncr'}$lt{'cecr'}
-

- -$lt{'smap'} -

- -
-($lt{'ocik'}): - -

-$lt{'fres'}
($lt{'stco'}): - -  - -  - -

-
- -
- -

-$lt{'asov'}. -
-

$lt{'assp'}

-

- -

-

$lt{'mssg'}

-

- -
- -

-

$lt{'cmmn'}

-

- -
- -

-

$lt{'acco'}

-

- -
- -

-

$lt{'rshm'}

-

- -

-

-

$lt{'aens'}

-$lt{'aesc'} -

-

-$lt{'aadd'} - - -

-$lt{'audr'} - - -

-$lt{'dacu'} -$enroll_table -

-$lt{'dacc'} -$access_table -

-$lt{'psam'}.
-$lt{'pcda'}. -

-$krbform -
-$intform -
-$locform -

-$lt{'nech'}
-$lt{'nccl'}
- - -
-$lt{'ndcl'}
- - -

-$lt{'irsp'} - - -

-

-

$lt{'cgrs'}

-$lt{'cgrq'} -Mb -

-
-

$lt{'cc'}

-

- -

- -

+

@@ -431,6 +505,7 @@ $lt{'cgrq'}

ENDDOCUMENT + } elsif ($crstype eq 'Group') { $r->print(< @@ -470,7 +545,7 @@ ENDDOCUMENT    

+
+
+ +
 
$lt{'asov'}. @@ -496,12 +574,12 @@ $lt{'asov'}.


$lt{'cmmn'}

@@ -616,6 +694,8 @@ sub create_course { crsquota => $env{'form.crsquota'}, clonecourse => $env{'form.clonecourse'}, clonedomain => $env{'form.clonedomain'}, + datemode => $env{'form.datemode'}, + dateshift => $env{'form.dateshift'}, crsid => $env{'form.crsid'}, curruser => $env{'user.name'}.':'.$env{'user.domain'}, crssections => $env{'form.crssections'}, @@ -649,23 +729,26 @@ sub create_course { # Check the veracity of the course coordinator if (&Apache::lonnet::homeserver($ccuname,$ccdomain) eq 'no_host') { $r->print('
'); - $r->print(&mt('No such user').' '.$ccuname.' '.&mt('at').' '.$ccdomain.'.
'); - $r->print(&mt("Please click Back on your browser and select another user, or ")); - $r->print(' - - - - -
'.&Apache::loncommon::end_page()); + $r->print('
' + .&mt('No such user [_1] at domain [_2].',''.$ccuname.'',''.$ccdomain.'') + .'
'); + $r->print(&mt('Please click Back on your browser and select another user, or [_1]Create User[_2]' + , '' + .'' + .'' + .'' + ) + .''.&Apache::loncommon::end_page() + ); return; } # Check the proposed home server for the course my %host_servers = &Apache::lonnet::get_servers($env{'request.role.domain'},'library'); if (! exists($host_servers{$env{'form.course_home'}})) { - $r->print(&mt('Invalid home server for course').': '. - $env{'form.course_home'}.&Apache::loncommon::end_page()); + $r->print(&mt('Invalid home server for course: [_1]' + ,$env{'form.course_home'}.&Apache::loncommon::end_page())); return; } my ($courseid,$crsudom,$crsunum); @@ -680,10 +763,10 @@ sub create_course { # Make the requested user a course coordinator or group coordinator # if (($ccdomain) && ($ccuname)) { - $r->print(&mt('Assigning role of [_1] Coordinator to [_2] at [_3]: ', - $crstype,$ccuname,$ccdomain). - &Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid, - 'cc').'

'); + $r->print(&mt('Assigning role of '.$crstype.' Coordinator to [_1]:', + ,''.$ccuname.':'.$ccdomain.'') + .&Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid, + 'cc','','','','','createcourse').'

'); } if ($env{'form.setkeys'}) { $r->print( @@ -694,7 +777,7 @@ sub create_course { $r->print('

'.&mt('Roles will be active at next login').'.

'); } $r->print('

'. - &mt('Create Another [_1]',$crstype).'

'. + &mt("Create Another $crstype").'

'. &Apache::loncommon::end_page()); } @@ -713,14 +796,14 @@ sub print_intro_page { &mt('Create a new course by completing an online form.'), }, { internal_name => 'groupone', - name => &mt('Create a single collaborative group space '), + name => &mt('Create a single collaborative group space'), short_description => - &mt('Create a new group space for non-course use by completing an online form .'), + &mt('Create a new group space for non-course use by completing an online form.'), }, { internal_name => 'batchone', name => &mt('Create courses/groups by uploading an attributes file'), short_description => - &mt('Upload an attributes file containing specifications for one or more courses or groups in XML format'), + &mt('Upload an attributes file containing specifications for one or more courses or groups in XML format.'), help => 'Batch_Creation', }, );