Diff for /loncom/interface/loncreatecourse.pm between versions 1.174 and 1.175

version 1.174, 2020/05/22 19:35:08 version 1.175, 2020/07/01 20:08:54
Line 80  use Apache::loncommon; Line 80  use Apache::loncommon;
 use Apache::londocs;  use Apache::londocs;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonuserutils;  use Apache::lonuserutils;
 use Apache::lonclonecourse;  
 use LONCAPA::batchcreatecourse;  use LONCAPA::batchcreatecourse;
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
   
Line 192  function validate(formname) { Line 191  function validate(formname) {
                     'ncd'  => "Do not clone date parameters",                      'ncd'  => "Do not clone date parameters",
                     'prd'  => 'Clone date parameters as-is',                      'prd'  => 'Clone date parameters as-is',
                     'shd'  => 'Shift date parameters by number of days',                      'shd'  => 'Shift date parameters by number of days',
                       'dpl'  => 'URL shortcuts (for deep linking)',
                       'nsl'  => 'Do not clone URL shortcuts',
                       'tsl'  => 'Transfer URL shortcuts from existing course to new course',
                       'csl'  => 'Create new URL shortcuts in new course',
                     'assp' => "Assessment Parameters",                      'assp' => "Assessment Parameters",
                     'oaas' => "Open all assessments",                      'oaas' => "Open all assessments",
                     'sta'  => "starting from:",                      'sta'  => "starting from:",
Line 257  function validate(formname) { Line 260  function validate(formname) {
         $lt{'cc'}  = &mt('(will be assigned Coordinator role)');          $lt{'cc'}  = &mt('(will be assigned Coordinator role)');
         $lt{'cgrs'} = &mt('Community Group Settings');          $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');          $lt{'cgrq'} = &mt('Set a quota for the total disk space available for storage of community group portfolio files');
           $lt{'tsl'} = &mt('Transfer URL shortcuts from existing community to new community');
           $lt{'csl'} = &mt('Create new URL shortcuts in new community');
     } elsif ($crstype eq 'Placement') {      } elsif ($crstype eq 'Placement') {
         $lt{'cinf'} = &mt('Placement Test Information');          $lt{'cinf'} = &mt('Placement Test Information');
         $lt{'ctit'} = &mt('Placement Test Title');          $lt{'ctit'} = &mt('Placement Test Title');
Line 430  END Line 435  END
                  .'<input type="radio" name="firstres" value="nav" />'.$lt{'navi'}                   .'<input type="radio" name="firstres" value="nav" />'.$lt{'navi'}
                  .'</label>');                   .'</label>');
     }      }
       my $tinyurlhelp=&Apache::loncommon::help_open_topic('Clone_Tiny_URLs');
     $r->print('<br />('.$lt{'stco'}.')'      $r->print('<br />('.$lt{'stco'}.')'
                  .&Apache::lonhtmlcommon::row_closure(1)                   .&Apache::lonhtmlcommon::row_closure(1)
                  .&Apache::lonhtmlcommon::end_pick_box()                   .&Apache::lonhtmlcommon::end_pick_box()
Line 461  END Line 467  END
                  .'</label>'                   .'</label>'
                  .' <input type="text" size="5" name="dateshift" value="365" />'                   .' <input type="text" size="5" name="dateshift" value="365" />'
                  .&Apache::lonhtmlcommon::row_closure()                   .&Apache::lonhtmlcommon::row_closure()
                    .&Apache::lonhtmlcommon::row_title($tinyurlhelp.$lt{'dpl'})
                    .'<label>'
                    .'<input type="radio" name="tinyurls" value="delete" /> '.$lt{'nsl'}
                    .'</label><br />'
                    .'<label>'
                    .'<input type="radio" name="tinyurls" value="transfer" /> '.$lt{'tsl'}
                    .'</label><br />'
                    .'<label>'
                    .'<input type="radio" name="tinyurls" value="create" checked="checked" /> '.$lt{'csl'}
                    .'</label>'
                    .&Apache::lonhtmlcommon::row_closure()
                  .&Apache::lonhtmlcommon::row_headline()                   .&Apache::lonhtmlcommon::row_headline()
                  .'<span class="LC_info">'.$lt{'asov'}.'</span>'                   .'<span class="LC_info">'.$lt{'asov'}.'</span>'
                  .&Apache::lonhtmlcommon::row_closure(1)                   .&Apache::lonhtmlcommon::row_closure(1)
Line 686  sub create_course { Line 703  sub create_course {
                clonedomain => $env{'form.clonedomain'},                 clonedomain => $env{'form.clonedomain'},
                datemode => $env{'form.datemode'},                 datemode => $env{'form.datemode'},
                dateshift => $env{'form.dateshift'},                 dateshift => $env{'form.dateshift'},
                  tinyurls  => $env{'form.tinyurls'},
                crsid => $env{'form.crsid'},                 crsid => $env{'form.crsid'},
                curruser => $env{'user.name'}.':'.$env{'user.domain'},                 curruser => $env{'user.name'}.':'.$env{'user.domain'},
                crssections => $env{'form.crssections'},                 crssections => $env{'form.crssections'},
Line 753  sub create_course { Line 771  sub create_course {
         return;          return;
     }      }
     my ($courseid,$crsudom,$crsunum,$code);      my ($courseid,$crsudom,$crsunum,$code);
     my ($success,$output) =       my ($success,$output,$clonemsgref) = 
  &Apache::loncommon::construct_course($args,\$logmsg,\$courseid,   &Apache::loncommon::construct_course($args,\$logmsg,\$courseid,
      \$crsudom,\$crsunum,       \$crsudom,\$crsunum,
      $env{'user.domain'},       $env{'user.domain'},
      $env{'user.name'},'dc_create',undef,undef,\$code);       $env{'user.name'},'dc_create',undef,undef,\$code);
     $r->print($output);      $r->print($output);
       if (ref($clonemsgref) eq 'ARRAY') {
           my $user_lh = &Apache::loncommon::user_lang($env{'user.name'},$env{'user.domain'});
           foreach my $item (@{$clonemsgref}) {
               if (ref($item) eq 'HASH') {
                   $r->print(&mt($item->{mt},@{$item->{args}}).'<br />'."\n");
               }
           }
       }
     if ($success) {      if ($success) {
         #          #
  # Make the requested user a course coordinator or group coordinator   # Make the requested user a course coordinator or group coordinator
Line 913  sub process_batchfile { Line 939  sub process_batchfile {
     my $uname = $env{'user.name'};      my $uname = $env{'user.name'};
     my $udom = $env{'user.domain'};      my $udom = $env{'user.domain'};
     my $dir = &LONCAPA::tempdir().'addcourse';      my $dir = &LONCAPA::tempdir().'addcourse';
     my ($result,$logmsg,$keysmsg,$codesref,$instcodesref);      my ($result,$logmsg,$clonemsg,$keysmsg,$codesref,$instcodesref);
     if (($defdom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/) && ($udom =~/^$match_domain$/)) {      if (($defdom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/) && ($udom =~/^$match_domain$/)) {
         my $batchfilepath=&Apache::lonnet::userfileupload('coursecreatorxml',undef,          my $batchfilepath=&Apache::lonnet::userfileupload('coursecreatorxml',undef,
                                                           'batchupload',undef,undef,                                                            'batchupload',undef,undef,
Line 927  sub process_batchfile { Line 953  sub process_batchfile {
                     if ((defined($filename)) && (defined($batchdir))) {                      if ((defined($filename)) && (defined($batchdir))) {
                         my @requests = ($filename);                          my @requests = ($filename);
                         my %courseids = ();                          my %courseids = ();
                         ($result,$logmsg,$keysmsg,$codesref,$instcodesref) =                          ($result,$logmsg,$clonemsg,$keysmsg,$codesref,$instcodesref) =
                             &LONCAPA::batchcreatecourse::create_courses(                              &LONCAPA::batchcreatecourse::create_courses(
                                        \@requests,\%courseids,'web',$defdom,                                         \@requests,\%courseids,'web',$defdom,
                                        $uname,$udom);                                         $uname,$udom);
Line 949  sub process_batchfile { Line 975  sub process_batchfile {
                                 &Apache::lonnet::devalidate_cache_new('instcats',$defdom);                                  &Apache::lonnet::devalidate_cache_new('instcats',$defdom);
                                 $updatecats = 1;                                  $updatecats = 1;
                             }                               } 
                             &register_cleanups($r,$defdom,$updatecats);                               &register_cleanups($r,$defdom,$updatecats);
                           }
                           if ($clonemsg) {
                               $clonemsg = '<p class="LC_info">'.$clonemsg.'</p>'."\n";
                         }                          }
                     }                      }
                 } else {                  } else {
Line 967  sub process_batchfile { Line 996  sub process_batchfile {
     }      }
     $r->print(&Apache::loncommon::start_page('Create a New Course, Community or Placement Test').      $r->print(&Apache::loncommon::start_page('Create a New Course, Community or Placement Test').
               &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses').                &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses').
               $logmsg.$result.'<br /><a href="/adm/createcourse">'.                $logmsg.$clonemsg.$result.'<br /><a href="/adm/createcourse">'.
               &mt('Creation options menu').'</a>'.                &mt('Creation options menu').'</a>'.
               &Apache::loncommon::end_page());                &Apache::loncommon::end_page());
     
Line 1556  sub handler { Line 1585  sub handler {
            my $start_page=&Apache::loncommon::start_page('Requests Validation Result',$js);             my $start_page=&Apache::loncommon::start_page('Requests Validation Result',$js);
            my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Validation Attempted','Course_Requests',undef,'Course_Requests');             my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Validation Attempted','Course_Requests',undef,'Course_Requests');
            $r->print($start_page.$crumbs."\n".'<div>'.             $r->print($start_page.$crumbs."\n".'<div>'.
                      &Apache::loncoursequeueadmin::process_official_reqs('domain',$env{'request.role.domain'}).'</div>'.                       &Apache::loncoursequeueadmin::process_official_reqs('domain',$env{'request.role.domain'},
                                                                            $env{'user.name'},$env{'user.domain'}).
                        '</div>'.
                      &Apache::loncommon::end_page());                       &Apache::loncommon::end_page());
        } elsif (($env{'form.phase'} eq 'creationlog') && ($show_all_choices)) {         } elsif (($env{'form.phase'} eq 'creationlog') && ($show_all_choices)) {
            &Apache::lonhtmlcommon::add_breadcrumb             &Apache::lonhtmlcommon::add_breadcrumb

Removed from v.1.174  
changed lines
  Added in v.1.175


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