Diff for /loncom/automation/batchcreatecourse.pm between versions 1.9 and 1.14

version 1.9, 2006/01/13 21:36:33 version 1.14, 2006/05/31 12:57:26
Line 166  use strict; Line 166  use strict;
 #  #
 #                    Directory for retrieval of files listed in @$requests is:   #                    Directory for retrieval of files listed in @$requests is: 
 #                    /home/httpd/perl/tmp/addcourse/$dom/auto/pending if $context = auto  #                    /home/httpd/perl/tmp/addcourse/$dom/auto/pending if $context = auto
 #                    /home/httpd/perl/tmp/addcourse/$dom/web/$udom_$uname if $context = web  #                    /home/httpd/perl/tmp/addcourse/$dom/web/$uname_$udom/pending 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 
Line 201  sub create_courses { Line 201  sub create_courses {
         $newcoursedir .= '/pending';          $newcoursedir .= '/pending';
     } else {      } else {
         if ($uname && $udom) {          if ($uname && $udom) {
             $newcoursedir .= '/'.$udom.'_'.$uname;              $newcoursedir .= '/'.$uname.'_'.$udom.'/pending';
         } else {          } else {
             $logmsg = "batchcreatecourse::create_courses() called without username and/or domain of requesting Domain Coordinator";              $logmsg = "batchcreatecourse::create_courses() called without username and/or domain of requesting Domain Coordinator";
         }          }
Line 629  sub process_date { Line 629  sub process_date {
     if ($timestr !~ /:/) {      if ($timestr !~ /:/) {
         $timestamp = '';          $timestamp = '';
     } else {      } else {
         my @entries = split/:/,$timestr;          my @entries = split(/:/,$timestr);
         for (my $j=0; $j<@entries; $j++) {          for (my $j=0; $j<@entries; $j++) {
             if ( length($entries[$j]) > 1 ) {              if ( length($entries[$j]) > 1 ) {
                 $entries[$j] =~ s/^0//;                  $entries[$j] =~ s/^0//;
             }              }
               $entries[$j] =~ s/\D//g;
               if ($entries[$j] < 0) {
                   $entries[$j] = 0;
               }
         }          }
         if ($entries[1] > 0) {            if ($entries[1] > 0) {  
             $entries[1] = $entries[1] - 1;              $entries[1] = $entries[1] - 1;
         }          }
           if ($entries[5] > 60) {
               $entries[5] = 60;
           }
           if ($entries[4] > 59) {
               $entries[4] = 59;
           }
           if ($entries[3] > 23) {
               $entries[3] = 23;
           }
           if ($entries[2] > 31) {
               $entries[2] = 31;
           }
           if ($entries[1] > 11) {
               $entries[1] = 11;
           }
           if ($entries[2] == 31) {
               if (($entries[1] == 3) || ($entries[1] == 5) ||
                   ($entries[1] == 8) || ($entries[1] == 10)) {
                   $entries[2] = 30;
               }
           }
           if ($entries[1] == 1) {
               if ($entries[2] > 29) {
                   $entries[2] = 29;
               }
               if ($entries[2] == 29) {
                   if ($entries[0]%4 != 0) {
                       $entries[2] = 28;
                   } elsif ( $entries[0]%100 == 0
     && $entries[0]%400 != 0) {
       $entries[2] = 28;
    }
               }
           }     
         $timestamp =  timelocal($entries[5],$entries[4],$entries[3],$entries[2],$entries[1],$entries[0]);          $timestamp =  timelocal($entries[5],$entries[4],$entries[3],$entries[2],$entries[1],$entries[0]);
     }      }
     return $timestamp;      return $timestamp;

Removed from v.1.9  
changed lines
  Added in v.1.14


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