--- loncom/interface/loncreatecourse.pm 2020/05/22 19:57:57 1.158.2.6 +++ loncom/interface/loncreatecourse.pm 2016/04/04 01:09:48 1.159 @@ -1,7 +1,7 @@ # The LearningOnline Network # Create a course # -# $Id: loncreatecourse.pm,v 1.158.2.6 2020/05/22 19:57:57 raeburn Exp $ +# $Id: loncreatecourse.pm,v 1.159 2016/04/04 01:09:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -82,11 +82,7 @@ use Apache::lonlocal; use Apache::lonuserutils; use Apache::lonclonecourse; use LONCAPA::batchcreatecourse; -use LONCAPA qw(:DEFAULT :match); - -my $registered_flush; -my $registered_instcats; -my $modified_dom; +use LONCAPA; # ===================================================== Phase one: fill-in form @@ -95,6 +91,8 @@ sub print_course_creation_page { my $crstype = 'Community'; if ($env{'form.phase'} eq 'courseone') { $crstype = 'Course'; + } elsif ($env{'form.phase'} eq 'placementone') { + $crstype = 'Placement'; } my $defdom=$env{'request.role.domain'}; my %domdefaults = &Apache::lonnet::get_domain_defaults($defdom); @@ -103,7 +101,7 @@ sub print_course_creation_page { foreach my $server (sort(keys(%host_servers))) { $course_home .= qq{}; } @@ -120,8 +118,6 @@ sub print_course_creation_page { my $endtime = time+(6*30*24*60*60); # 6 months from now, approx my $access_table = &Apache::lonuserutils::date_setting_table($starttime, $endtime,'create_defaultdates'); - my $openallfrom = - &Apache::lonhtmlcommon::date_setter('ccrs','openallfrom',$starttime); if ($crstype eq 'Course') { $enroll_table = &Apache::lonuserutils::date_setting_table($starttime, $endtime,'create_enrolldates'); @@ -136,7 +132,7 @@ sub print_course_creation_page { $krbform = &Apache::loncommon::authform_kerberos(%param); $intform = &Apache::loncommon::authform_internal(%param); $locform = &Apache::loncommon::authform_local(%param); - } else { + } elsif ($crstype eq 'Community') { my $title_alert = &mt('A Community title is required'); my $coord_alert = &mt('The username of the Coordinator is required'); &js_escape(\$title_alert); @@ -153,6 +149,24 @@ function validate(formname) { formname.submit(); } |; + } else { + my $title_alert = &mt('A Placement Test title is required'); + my $coord_alert = &mt('The username of the Course Coordinator is required'); + &js_escape(\$title_alert); + &js_escape(\$coord_alert); + $javascript_validations = qq| +function validate(formname) { + if (formname.title == '') { + alert("$title_alert"); + return; + } + if (formname.ccuname == '') { + alert("$coord_alert"); + } + formname.submit(); +} + |; + } my %lt=&Apache::lonlocal::texthash( 'cinf' => "Course Information", @@ -191,11 +205,9 @@ function validate(formname) { 'shd' => 'Shift date parameters by number of days', 'assp' => "Assessment Parameters", 'oaas' => "Open all assessments", - 'sta' => "starting from:", 'mssg' => "Messaging", 'scpf' => "Set course policy feedback to Course Coordinator", - 'scfc' => "Set resource content feedback to Course Coordinator", - 'scof' => "Set course content feedback to Course Coordinator", + 'scfc' => "Set content feedback to Course Coordinator", 'cmmn' => "Communication", 'dsrd' => "Disable student resource discussion", 'dsuc' => "Disable student use of chat rooms", @@ -241,8 +253,7 @@ function validate(formname) { $lt{'navi'} = &mt('Community Contents'); $lt{'cid'} = &mt('Community ID'); $lt{'scpf'} = &mt('Set community policy feedback to Coordinator'); - $lt{'scfc'} = &mt('Set resource content feedback to Coordinator'); - $lt{'scof'} = &mt('Set community content feedback to Coordinator'); + $lt{'scfc'} = &mt('Set content feedback to Coordinator'); $lt{'dsrd'} = &mt('Disable member resource discussion'); $lt{'dsuc'} = &mt('Disable member use of chat rooms'); $lt{'dads'} = &mt('Default Access Dates for Members'); @@ -253,11 +264,21 @@ function validate(formname) { $lt{'cc'} = &mt('(will be assigned Coordinator role)'); $lt{'cgrs'} = &mt('Community Group Settings'); $lt{'cgrq'} = &mt('Set a quota for the total disk space available for storage of community group portfolio files'); + } elsif ($crstype eq 'Placement') { + $lt{'cinf'} = &mt('Placement Test Information'); + $lt{'ctit'} = &mt('Placement Test Title'); + $lt{'chsr'} = &mt('Placement Test Home Server'); + $lt{'cidn'} = &mt('Placement Test ID/Number'); + $lt{'crco'} = &mt('Placement Test Content'); + $lt{'cncr'} = &mt('Completely new placement test'); + $lt{'cecr'} = &mt('Clone an existing placement test'); + $lt{'sacr'} = &mt('Do NOT generate as standard placement test'); + $lt{'stco'} = &mt('standard placement tests only'); + $lt{'navi'} = &mt('Placement Test Contents'); + $lt{'cid'} = &mt('Placement Test ID'); } my $js = < -// $coursebrowserjs END @@ -285,6 +304,7 @@ END my %titles = &Apache::lonlocal::texthash( courseone => 'Create a New Course', groupone => 'Create a New Community', + placementone=> 'Create a New Placement Test', ); my $start_page = &Apache::loncommon::start_page($titles{$env{'form.phase'}},$js); @@ -296,7 +316,7 @@ END 'Create_Courses'); $r->print($start_page.$crumbs); - $r->print('
' + $r->print('
' .&Apache::lonhtmlcommon::start_pick_box() .&Apache::lonhtmlcommon::row_headline() @@ -363,9 +383,12 @@ END .'' .''.&mt('Yes').(' 'x2) .''.&mt('No') - .' .&Apache::lonhtmlcommon::row_closure() - ); + ); + } + my $blankchk; + if ($crstype eq 'Placement') { + $blankchk = ' checked="checked"'; } # Table: New Course / Clone Course $r->print(&Apache::lonhtmlcommon::row_headline() @@ -391,15 +414,14 @@ END .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title($lt{'fres'}) .'' - .' '); + .''.$lt{'blnk'} + .''); if ($crstype eq 'Community') { - $r->print('
'. &Apache::loncommon::end_page()); - } elsif (($permission->{'create'}) && - ($env{'form.phase'} eq 'requestchange') && ($show_all_choices)) { + } elsif (($env{'form.phase'} eq 'requestchange') && ($show_all_choices)) { if ($env{'form.queue'} eq 'pending') { &Apache::lonhtmlcommon::add_breadcrumb ({href=>"/adm/createcourse?phase=pendingdisplay", @@ -1487,16 +1430,11 @@ sub handler { my $js = &courserequestbrowser_javascript(); my $start_page=&Apache::loncommon::start_page('Display Pending Queue',$js); my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Display Pending Queue','Course_Requests',undef,'Course_Requests'); - my $context = 'pending'; - unless ($permission->{'create'}) { - $context = 'displaypending'; - } $r->print($start_page.$crumbs."\n".'
'. &Apache::loncoursequeueadmin::display_queued_requests( - $context,$env{'request.role.domain'}).'
'. + 'pending',$env{'request.role.domain'}).'
'. &Apache::loncommon::end_page()); - } elsif (($permission->{'create'}) && - ($env{'form.phase'} eq 'requestvalidation') && ($show_all_choices)) { + } elsif (($env{'form.phase'} eq 'requestvalidation') && ($show_all_choices)) { my $js = &courserequestbrowser_javascript(); &Apache::lonhtmlcommon::add_breadcrumb ({href=>"/adm/createcourse?phase=pendingdisplay", @@ -1523,7 +1461,7 @@ sub handler { &print_creation_logs($r); $r->print(''.&Apache::loncommon::end_page()); } else { - &print_intro_page($r,$show_all_choices,\%cancreate,$permission); + &print_intro_page($r,$show_all_choices,\%cancreate); } } else { $env{'user.error.msg'}=