Diff for /loncom/interface/loncreatecourse.pm between versions 1.99.2.1 and 1.104.2.2

version 1.99.2.1, 2006/12/11 21:47:39 version 1.104.2.2, 2007/12/23 17:36:56
Line 35  use Apache::lonnet; Line 35  use Apache::lonnet;
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::londocs;  use Apache::londocs;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::londropadd;  use Apache::lonuserutils;
 use Apache::lonclonecourse;  use Apache::lonclonecourse;
 use LONCAPA::batchcreatecourse;  use LONCAPA::batchcreatecourse;
 use LONCAPA;  use LONCAPA;
Line 50  sub print_course_creation_page { Line 50  sub print_course_creation_page {
 #        $crstype = 'Course';  #        $crstype = 'Course';
 #    }  #    }
     my $defdom=$env{'request.role.domain'};      my $defdom=$env{'request.role.domain'};
     my %host_servers = &Apache::loncommon::get_library_servers($defdom);      my %host_servers = &Apache::lonnet::get_servers($defdom,'library');
     my $course_home = '<select name="course_home" size="1">'."\n";      my $course_home = '<select name="course_home" size="1">'."\n";
     foreach my $server (sort(keys(%host_servers))) {      foreach my $server (sort(keys(%host_servers))) {
         $course_home .= qq{<option value="$server"};          $course_home .= qq{<option value="$server"};
Line 71  sub print_course_creation_page { Line 71  sub print_course_creation_page {
     if ($crstype eq 'Course') {      if ($crstype eq 'Course') {
         my $starttime = time;          my $starttime = time;
         my $endtime = time+(6*30*24*60*60); # 6 months from now, approx          my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
         $enroll_table = &Apache::londropadd::date_setting_table($starttime,          $enroll_table = &Apache::lonuserutils::date_setting_table($starttime,
                                                 $endtime,'create_enrolldates');                                                  $endtime,'create_enrolldates');
         $access_table = &Apache::londropadd::date_setting_table($starttime,          $access_table = &Apache::lonuserutils::date_setting_table($starttime,
                                                $endtime,'create_defaultdates');                                                 $endtime,'create_defaultdates');
         ($krbdef,$krbdefdom) =          ($krbdef,$krbdefdom) =
         &Apache::loncommon::get_kerberos_defaults($defdom);          &Apache::loncommon::get_kerberos_defaults($defdom);
         $javascript_validations=&Apache::londropadd::javascript_validations(          $javascript_validations=&Apache::lonuserutils::javascript_validations(
                                                     'createcourse',$krbdefdom);                                                      'createcourse',$krbdefdom);
         my %param = ( formname      => 'document.ccrs',          my %param = ( formname      => 'document.ccrs',
                       kerb_def_dom  => $krbdefdom,                        kerb_def_dom  => $krbdefdom,
Line 576  sub create_course { Line 576  sub create_course {
         $crstype='Course';          $crstype='Course';
         $enrollstart=&Apache::lonhtmlcommon::get_date_from_form('startenroll');          $enrollstart=&Apache::lonhtmlcommon::get_date_from_form('startenroll');
         $enrollend=&Apache::lonhtmlcommon::get_date_from_form('endenroll');          $enrollend=&Apache::lonhtmlcommon::get_date_from_form('endenroll');
   
     }      }
     $startaccess = &Apache::lonhtmlcommon::get_date_from_form('startaccess');      $startaccess = &Apache::lonhtmlcommon::get_date_from_form('startaccess');
     $endaccess   = &Apache::lonhtmlcommon::get_date_from_form('endaccess');      $endaccess   = &Apache::lonhtmlcommon::get_date_from_form('endaccess');
Line 663  sub create_course { Line 662  sub create_course {
  return;   return;
     }      }
     # Check the proposed home server for the course      # Check the proposed home server for the course
     my %host_servers = &Apache::loncommon::get_library_servers      my %host_servers = 
         ($env{'request.role.domain'});   &Apache::lonnet::get_servers($env{'request.role.domain'},'library');
     if (! exists($host_servers{$env{'form.course_home'}})) {      if (! exists($host_servers{$env{'form.course_home'}})) {
         $r->print(&mt('Invalid home server for course').': '.          $r->print(&mt('Invalid home server for course').': '.
                   $env{'form.course_home'}.&Apache::loncommon::end_page());                    $env{'form.course_home'}.&Apache::loncommon::end_page());
         return;          return;
     }      }
     my ($courseid,$crsudom,$crsunum);      my ($courseid,$crsudom,$crsunum);
     $r->print(&Apache::loncommon::construct_course($args,\$logmsg,\$courseid,\$crsudom,\$crsunum,$env{'user.domain'},$env{'user.name'}));      my ($success,$output) = 
    &Apache::loncommon::construct_course($args,\$logmsg,\$courseid,
 #       \$crsudom,\$crsunum,
 # Make the requested user a course coordinator or group coordinator       $env{'user.domain'},
 #       $env{'user.name'});
     if (($ccdomain) && ($ccuname)) {      $r->print($output);
         $r->print(&mt('Assigning role of [_1] Coordinator to [_2] at [_3]:',      if ($success) {
                      $crstype,$ccuname,$ccdomain).          #
                   &Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,   # Make the requested user a course coordinator or group coordinator
                                               'cc').'<p>');          #
     }   if (($ccdomain) && ($ccuname)) {
     if ($env{'form.setkeys'}) {      $r->print(&mt('Assigning role of [_1] Coordinator to [_2] at [_3]: ',
         $r->print(    $crstype,$ccuname,$ccdomain).
  '<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>');        &Apache::lonnet::assignrole($ccdomain,$ccuname,$courseid,
     }    'cc').'<p>');
 # Flush the course logs so reverse user roles immediately updated   }
     &Apache::lonnet::flushcourselogs();   if ($env{'form.setkeys'}) {
     $r->print('<p>'.&mt('Roles will be active at next login').'.</p>'.      $r->print(
       '<p><a href="/adm/createcourse">'.        '<p><a href="/adm/managekeys?cid='.$crsudom.'_'.$crsunum.'">'.&mt('Manage Access Keys').'</a></p>');
    }
           # Flush the course logs so reverse user roles immediately updated
    &Apache::lonnet::flushcourselogs();
    $r->print('<p>'.&mt('Roles will be active at next login').'.</p>');
       }
       $r->print('<p><a href="/adm/createcourse?phase='.lc($crstype).'one">'.
       &mt('Create Another [_1]',$crstype).'</a></p>'.        &mt('Create Another [_1]',$crstype).'</a></p>'.
       &Apache::loncommon::end_page());        &Apache::loncommon::end_page());
 }  }
Line 795  sub process_batchfile { Line 800  sub process_batchfile {
             }              }
         }          }
     }      }
     $r->print($start_page.$crumbs.$result.$end_page);      $r->print($start_page.$crumbs.$logmsg.$result.'<br /><a href="/adm/createcourse">'.
                 &mt('Creation options menu').'</a>'.$end_page);
     
 }  }
   

Removed from v.1.99.2.1  
changed lines
  Added in v.1.104.2.2


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