Diff for /loncom/automation/batchcreatecourse.pm between versions 1.2 and 1.4

version 1.2, 2005/03/02 19:50:52 version 1.4, 2005/04/07 03:58:02
Line 1 Line 1
   #
   # $Id$
   #
   # Copyright Michigan State University Board of Trustees
   #
   # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   #
   # LON-CAPA is free software; you can redistribute it and/or modify
   # it under the terms of the GNU General Public License as published by
   # the Free Software Foundation; either version 2 of the License, or
   # (at your option) any later version.
   #
   # LON-CAPA is distributed in the hope that it will be useful,
   # but WITHOUT ANY WARRANTY; without even the implied warranty of
   # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   # GNU General Public License for more details.
   #
   # You should have received a copy of the GNU General Public License
   # along with LON-CAPA; if not, write to the Free Software
   # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   #
   # /home/httpd/html/adm/gpl.txt
   #
   # http://www.lon-capa.org/
   #
   
 package LONCAPA::batchcreatecourse;  package LONCAPA::batchcreatecourse;
 use LONCAPA::Configuration;  use LONCAPA::Configuration;
 use LONCAPA::Enrollment;  use LONCAPA::Enrollment;
Line 16  use Apache::lonlocal; Line 42  use Apache::lonlocal;
 # of a file containing an XML description of a course request (lonbatchccrs.pm).  # of a file containing an XML description of a course request (lonbatchccrs.pm).
 #   # 
 # XML file(s) describing courses that are to be created in domain $dom are stored in  # XML file(s) describing courses that are to be created in domain $dom are stored in
 # /home/httpd/perl/tmp/addcourse/$dom. Each XML file is deleted after it has been  # /home/httpd/perl/tmp/addcourse/$dom
 # parsed.  
 #  #
 # &create_courses() will create an account for the course owner   # &create_courses() will create an account for the course owner 
 # (if one does not currently exist), will create the course (cloning if necessary),  # (if one does not currently exist), will create the course (cloning if necessary),
Line 137  use Apache::lonlocal; Line 162  use Apache::lonlocal;
 #                    files listed in @$requests are deleted  #                    files listed in @$requests are deleted
 #                    after the files have been parsed.  #                    after the files have been parsed.
 #  #
 #                    Directory searched for files listed in @$requests  #                    Directory for retrieval of files listed in @$requests is: 
 #                    is /home/httpd/perl/tmp/addcourse/$dom/auto if $context is auto  #                    /home/httpd/perl/tmp/addcourse/$dom/auto/pending if $context = auto
 #                    and /home/httpd/perl/tmp/addcourse/$dom/web/$uname if $context is web  #                    /home/httpd/perl/tmp/addcourse/$dom/web/$udom_$uname if $context = web
 #                      #                    
 # inputs (five)  -  requests - ref to array of filename(s) containing course requests   # inputs (five)  -  requests - ref to array of filename(s) containing course requests 
 #                   courseids - ref to hash to store LON-CAPA course ids of new courses   #                   courseids - ref to hash to store LON-CAPA course ids of new courses 
 #                   context - auto if called from command line, web if called from browser  #                   context - auto if called from command line, web if called from browser
 #                   dom - domain for which the course is being created  #                   dom - domain for which the course is being created
 #                   uname - username of DC who is requesting course creation from browser  #                   uname - username of DC who is requesting course creation
   #                   udom - domain of DC who is requesting course creation
 #    #  
 # outputs (three)  -  output - text recording user roles added etc.  # outputs (three)  -  output - text recording user roles added etc.
 #                     logmsg - text to be logged  #                     logmsg - text to be logged
Line 153  use Apache::lonlocal; Line 179  use Apache::lonlocal;
 #############################################################  #############################################################
   
 sub create_courses {  sub create_courses {
     my ($requests,$courseids,$context,$dom,$uname) = @_;      my ($requests,$courseids,$context,$dom,$uname,$udom) = @_;
     my $output;      my $output;
     my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');      my $perlvarref = LONCAPA::Configuration::read_conf('loncapa.conf');
 # Get role names  # Get role names
Line 169  sub create_courses { Line 195  sub create_courses {
     my ($logmsg,$keysmsg,$newusermsg,$addresult);      my ($logmsg,$keysmsg,$newusermsg,$addresult);
     my %enrollcount = ();      my %enrollcount = ();
     my $newcoursedir = $$perlvarref{'lonDaemons'}.'/tmp/addcourse/'.$dom.'/'.$context;      my $newcoursedir = $$perlvarref{'lonDaemons'}.'/tmp/addcourse/'.$dom.'/'.$context;
     if ($uname) {      if ($context eq 'auto') {
         unless ($context eq 'auto') {          $newcoursedir .= '/pending';
             $newcoursedir .= '/'.$uname;      } else {
           if ($uname && $udom) {
               $newcoursedir .= '/'.$udom.'_'.$uname;
           } else {
               $logmsg = "batchcreatecourse::create_courses() called without username and/or domain of requesting Domain Coordinator";
         }          }
     }      }
     if (@{$requests} > 0) {      if (@{$requests} > 0) {
Line 349  sub parse_coursereqs { Line 379  sub parse_coursereqs {
 #########################################################  #########################################################
   
 sub build_course {  sub build_course {
     my ($cdom,$num,$context,$details,$longoles,$logmsg,$newusermsg,$addresult,$enrollcount,$output,$keysmsg) = @_;      my ($cdom,$num,$context,$details,$longoles,$logmsg,$newusermsg,$addresult,$enrollcount,$output,$keysmsg,$udom,$uname) = @_;
     my $owner_uname = $$details{$num}{'owner'};      my $owner_uname = $$details{$num}{'owner'};
     my $owner_domain = $$details{$num}{'domain'};      my $owner_domain = $$details{$num}{'domain'};
     my $owner = $owner_uname.':'.$owner_domain;      my $owner = $owner_uname.':'.$owner_domain;
Line 457  sub build_course { Line 487  sub build_course {
             return;              return;
         }          }
   
         &Apache::loncreatecourse::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum);          &Apache::loncreatecourse::construct_course($courseargs,$logmsg,\$courseid,\$crsudom,\$crsunum,$udom,$uname);
     } else {      } else {
         return;          return;
     }      }

Removed from v.1.2  
changed lines
  Added in v.1.4


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